[haiku-commits] haiku: hrev51818 - headers/private/media/experimental src/kits/media/experimental

  • From: b.vitruvio@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 26 Feb 2018 20:50:42 -0500 (EST)

hrev51818 adds 2 changesets to branch 'master'
old head: ff56eda570eb9bdbd482ab9cca02ed19cea4d59e
new head: 9ab4c384203171292da63e5837eb24ede64bbe75
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=9ab4c3842031+%5Eff56eda570eb

----------------------------------------------------------------------------

444d8ec0e220: MediaConnection: Hide connection callbacks
  
  * At this point we want to avoid the user calling the callbacks
  in the form of BMediaConnection. Instead we force to use the
  BMediaInput and BMediaOutput versions.

9ab4c3842031: MediaConnection: Add more plans about buffer management

                                        [ Barrett17 <b.vitruvio@xxxxxxxxx> ]

----------------------------------------------------------------------------

4 files changed, 39 insertions(+), 7 deletions(-)
.../private/media/experimental/MediaConnection.h | 19 +++++++++++++++----
.../media/experimental/SimpleMediaClient.h       |  1 +
src/kits/media/experimental/MediaConnection.cpp  | 20 ++++++++++++++++++++
.../media/experimental/SimpleMediaClient.cpp     |  6 +++---

############################################################################

Commit:      444d8ec0e220f7693b79662c506d699a84f1acc5
URL:         http://cgit.haiku-os.org/haiku/commit/?id=444d8ec0e220
Author:      Barrett17 <b.vitruvio@xxxxxxxxx>
Date:        Tue Feb 27 01:43:34 2018 UTC

MediaConnection: Hide connection callbacks

* At this point we want to avoid the user calling the callbacks
in the form of BMediaConnection. Instead we force to use the
BMediaInput and BMediaOutput versions.

----------------------------------------------------------------------------

diff --git a/headers/private/media/experimental/MediaConnection.h 
b/headers/private/media/experimental/MediaConnection.h
index 9498e1eaf2..b4e8465775 100644
--- a/headers/private/media/experimental/MediaConnection.h
+++ b/headers/private/media/experimental/MediaConnection.h
@@ -68,12 +68,11 @@ protected:
                                                                                
media_connection_kinds kinds);
        virtual                                                 
~BMediaConnection();
 
+private:
        // Those callbacks are shared between BMediaInput and BMediaOutput
        virtual void                                    Connected(const 
media_format& format);
        virtual void                                    Disconnected();
 
-private:
-
                        void                                    
_ConnectionRegistered(BMediaClient* owner,
                                                                                
media_connection_id id);
 
@@ -122,6 +121,9 @@ protected:
 
        virtual void                                    HandleBuffer(BBuffer* 
buffer);
 
+       virtual void                                    Connected(const 
media_format& format);
+       virtual void                                    Disconnected();
+
 private:
        media_input                                             _MediaInput() 
const;
 
@@ -162,6 +164,7 @@ protected:
        // you are doing.
        virtual status_t                                SendBuffer(BBuffer* 
buffer);
 
+       virtual void                                    Connected(const 
media_format& format);
        virtual void                                    Disconnected();
 
 private:
diff --git a/headers/private/media/experimental/SimpleMediaClient.h 
b/headers/private/media/experimental/SimpleMediaClient.h
index eb0f187273..2621f60bab 100755
--- a/headers/private/media/experimental/SimpleMediaClient.h
+++ b/headers/private/media/experimental/SimpleMediaClient.h
@@ -122,6 +122,7 @@ protected:
                                                                                
media_connection_kinds kinds);
        virtual                                                 
~BSimpleMediaConnection();
 
+                       // TODO: move those to private and introduce protected 
methods
                        process_hook                    fProcessHook;
                        notify_hook                             fNotifyHook;
                        void*                                   fBufferCookie;
diff --git a/src/kits/media/experimental/MediaConnection.cpp 
b/src/kits/media/experimental/MediaConnection.cpp
index 5a3423fda3..c9bb372057 100644
--- a/src/kits/media/experimental/MediaConnection.cpp
+++ b/src/kits/media/experimental/MediaConnection.cpp
@@ -204,7 +204,20 @@ void
 BMediaInput::HandleBuffer(BBuffer* buffer)
 {
        CALLED();
+}
+
 
+void
+BMediaInput::Connected(const media_format& format)
+{
+       BMediaConnection::Connected(format);
+}
+
+
+void
+BMediaInput::Disconnected()
+{
+       BMediaConnection::Disconnected();
 }
 
 
@@ -297,6 +310,13 @@ BMediaOutput::SendBuffer(BBuffer* buffer)
 }
 
 
+void
+BMediaOutput::Connected(const media_format& format)
+{
+       BMediaConnection::Connected(format);
+}
+
+
 void
 BMediaOutput::Disconnected()
 {
diff --git a/src/kits/media/experimental/SimpleMediaClient.cpp 
b/src/kits/media/experimental/SimpleMediaClient.cpp
index 9dfa094318..5334ca3fce 100644
--- a/src/kits/media/experimental/SimpleMediaClient.cpp
+++ b/src/kits/media/experimental/SimpleMediaClient.cpp
@@ -195,7 +195,7 @@ BSimpleMediaInput::Disconnected()
        if (fNotifyHook != NULL)
                (*fNotifyHook)(this, 
BSimpleMediaConnection::B_INPUT_DISCONNECTED);
 
-       BMediaConnection::Disconnected();
+       BMediaInput::Disconnected();
 }
 
 
@@ -242,7 +242,7 @@ BSimpleMediaOutput::Connected(const media_format& format)
        if (fNotifyHook != NULL)
                (*fNotifyHook)(this, 
BSimpleMediaConnection::B_OUTPUT_CONNECTED);
 
-       BSimpleMediaConnection::Connected(format);
+       BMediaOutput::Connected(format);
 }
 
 
@@ -252,5 +252,5 @@ BSimpleMediaOutput::Disconnected()
        if (fNotifyHook != NULL)
                (*fNotifyHook)(this, 
BSimpleMediaConnection::B_OUTPUT_DISCONNECTED);
 
-       BSimpleMediaConnection::Disconnected();
+       BMediaOutput::Disconnected();
 }

############################################################################

Revision:    hrev51818
Commit:      9ab4c384203171292da63e5837eb24ede64bbe75
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9ab4c3842031
Author:      Barrett17 <b.vitruvio@xxxxxxxxx>
Date:        Tue Feb 27 01:49:50 2018 UTC

MediaConnection: Add more plans about buffer management

----------------------------------------------------------------------------

diff --git a/headers/private/media/experimental/MediaConnection.h 
b/headers/private/media/experimental/MediaConnection.h
index b4e8465775..408f2e6d37 100644
--- a/headers/private/media/experimental/MediaConnection.h
+++ b/headers/private/media/experimental/MediaConnection.h
@@ -49,9 +49,17 @@ public:
                                                                                
const media_format& format);
        const media_format&                             AcceptedFormat() const;
 
-       // Represents the buffer size, depends on the format set or negotiated
-       // for this connection.
+       // Represents the buffer size, implement it to return the buffer size
+       // you decided for this connection.
+       // TODO: Do we want this (and ChainSize) moved on the output side?
+       // Or perhaps provide an implementation based on the buffer group
+       // for the consumer?
+       // Problem is: the consumer has not easy access to the buffer group,
+       // so we way want to add a special messaging between clients after
+       // connection, so that inputs know the buffer size and chain size.
        virtual size_t                                  BufferSize() const = 0;
+       // Implement it to specify the size of your chain of buffers.
+       //virtual int32                                 ChainSize() const = 0;
 
        // Disconnect this connection. When a connection is disconnected,
        // it can be reused as brand new.


Other related posts:

  • » [haiku-commits] haiku: hrev51818 - headers/private/media/experimental src/kits/media/experimental - b . vitruvio