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.
This commit is contained in:
Barrett17 2018-02-27 02:43:34 +01:00
parent ff56eda570
commit 444d8ec0e2
4 changed files with 29 additions and 5 deletions

View File

@ -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:

View File

@ -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;

View File

@ -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()
{

View File

@ -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();
}