MediaClient: Add remaining wiring for input/output functionality

* BufferReceived is renamed HandleBuffer.
* Update doc.
* Implement buffer production private methods.
This commit is contained in:
Dario Casalinuovo
2017-03-10 01:02:15 +01:00
parent 58be34781b
commit 5854fc4a7a
8 changed files with 91 additions and 46 deletions
@@ -61,7 +61,7 @@ public:
// When those functions return, the BMediaConnection is added to the
// list and is visible to other nodes as not connected. Any input/output
// should be registered to a BMediaClient to become something useful.
// should be registered to a BMediaClient to become visible in the system.
virtual status_t RegisterInput(BMediaInput* input);
virtual status_t RegisterOutput(BMediaOutput* output);
@@ -81,7 +81,7 @@ public:
// BMediaClient::Format() will be used, in case both aren't specified
// an error is returned. The first parameter should always belong to
// this node, the second will be a connection obtained from another
// BMediaClient.
// BMediaClient. Unregistered connections will be registered automatically.
virtual status_t Connect(BMediaConnection* ourConnection,
BMediaConnection* theirConnection);
@@ -25,6 +25,7 @@ class BMediaClientNode;
// the BufferReceived function will be called so that you can process the BBuffer,
// and once the function returns the output will be automatically forwarded
// to the connection B SendBuffer method.
// It's not possible to mix a BMediaInput with a BMediaOutput in the same class.
class BMediaConnection {
public:
const media_connection& Connection() const;
@@ -39,7 +40,7 @@ public:
bool IsConnected() const;
// This allow to specify a format that will be used while
// connecting to another node. See BMediaClient::SetFormat.
// connecting to another node.
void SetAcceptedFormat(
const media_format& format);
const media_format& AcceptedFormat() const;
@@ -48,10 +49,6 @@ public:
// for this connection.
size_t BufferSize() const;
// Represents the duration of one buffer depends on the format set or
// negotiated for this connection.
bigtime_t BufferDuration() const;
// Disconnect this connection. When a connection is disconnected,
// it can be reused as brand new.
status_t Disconnect();
@@ -99,9 +96,6 @@ private:
// see BMediaClient::Bind.
BMediaConnection* fBind;
size_t fBufferSize;
bigtime_t fBufferDuration;
BBufferGroup* fBufferGroup;
bool fConnected;
@@ -140,7 +134,7 @@ protected:
// Callbacks
virtual status_t FormatChanged(const media_format& format);
virtual void BufferReceived(BBuffer* buffer);
virtual void HandleBuffer(BBuffer* buffer);
private:
media_input _MediaInput() const;
@@ -135,7 +135,7 @@ protected:
virtual void Connected(const media_format& format);
virtual void Disconnected();
virtual void BufferReceived(BBuffer* buffer);
virtual void HandleBuffer(BBuffer* buffer);
};