#include <patch.h>
Public Member Functions | |
Construction | |
OpalMediaPatch (OpalMediaStream &source) | |
~OpalMediaPatch () | |
Overrides from PObject | |
void | PrintOn (ostream &strm) const |
Operations | |
virtual void | Main () |
void | Close () |
BOOL | AddSink (OpalMediaStream *stream, const RTP_DataFrame::PayloadMapType &rtpMap) |
void | RemoveSink (OpalMediaStream *stream) |
OpalMediaStream & | GetSource () const |
void | AddFilter (const PNotifier &filter, const OpalMediaFormat &stage=OpalMediaFormat()) |
BOOL | RemoveFilter (const PNotifier &filter, const OpalMediaFormat &stage=OpalMediaFormat()) |
virtual void | FilterFrame (RTP_DataFrame &frame, const OpalMediaFormat &mediaFormat) |
virtual BOOL | UpdateMediaFormat (const OpalMediaFormat &mediaFormat, BOOL fromSink) |
virtual BOOL | ExecuteCommand (const OpalMediaCommand &command, BOOL fromSink) |
virtual void | SetCommandNotifier (const PNotifier ¬ifier, BOOL fromSink) |
Protected Attributes | |
OpalMediaStream & | source |
PList< Sink > | sinks |
PList< Filter > | filters |
PTimedMutex | inUse |
Classes | |
class | Filter |
class | Sink |
Note the thread is not actually started straight away. It is expected that the Resume() function is called on the patch when the creator code is ready for it to begin. For example all sink streams have been added.
OpalMediaPatch::OpalMediaPatch | ( | OpalMediaStream & | source | ) |
Create a new patch. Note the thread is not started here.
source | Source media stream |
OpalMediaPatch::~OpalMediaPatch | ( | ) |
Destroy patch.
void OpalMediaPatch::AddFilter | ( | const PNotifier & | filter, | |
const OpalMediaFormat & | stage = OpalMediaFormat() | |||
) |
Add a filter to the media pipeline. Use PDECLARE_NOTIFIER(RTP_DataFrame, YourClass, YourFunction) for the filter function notifier.
BOOL OpalMediaPatch::AddSink | ( | OpalMediaStream * | stream, | |
const RTP_DataFrame::PayloadMapType & | rtpMap | |||
) |
Add another "sink" OpalMediaStream to patch. The stream must not be a ReadOnly media stream for the patch to be able to write to it.
stream | Media stream to add. |
rtpMap | Outgoing RTP type map |
void OpalMediaPatch::Close | ( | ) |
Close the patch. This is an internal function that closes all of the sink streams and waits for the the thread to terminate. It is called when the source stream is called.
virtual BOOL OpalMediaPatch::ExecuteCommand | ( | const OpalMediaCommand & | command, | |
BOOL | fromSink | |||
) | [virtual] |
Execute the command specified to the transcoder. The commands are highly context sensitive, for example VideoFastUpdate would only apply to a video transcoder.
The default behaviour passes the command on to the source or sinks and the sinks transcoders.
command | Command to execute. |
fromSink | Flag for source or sink |
virtual void OpalMediaPatch::FilterFrame | ( | RTP_DataFrame & | frame, | |
const OpalMediaFormat & | mediaFormat | |||
) | [virtual] |
Filter a frame. Calls all filter functions.
OpalMediaStream& OpalMediaPatch::GetSource | ( | ) | const [inline] |
Get the current source stream for patch.
virtual void OpalMediaPatch::Main | ( | ) | [virtual] |
Thread entry point.
void OpalMediaPatch::PrintOn | ( | ostream & | strm | ) | const |
Standard stream print function. The PObject class has a << operator defined that calls this function polymorphically.
strm | Stream to output text representation |
BOOL OpalMediaPatch::RemoveFilter | ( | const PNotifier & | filter, | |
const OpalMediaFormat & | stage = OpalMediaFormat() | |||
) |
Remove a filter from the media pipeline.
void OpalMediaPatch::RemoveSink | ( | OpalMediaStream * | stream | ) |
Add existing "sink" OpalMediaStream to patch. If the stream is not a sink of this patch then this function does nothing.
stream | Medai stream to remove |
virtual void OpalMediaPatch::SetCommandNotifier | ( | const PNotifier & | notifier, | |
BOOL | fromSink | |||
) | [virtual] |
Set a notifier to receive commands generated by the transcoder. The commands are highly context sensitive, for example VideoFastUpdate would only apply to a video transcoder.
The default behaviour passes the command on to the source or sinks and the sinks transcoders.
notifier | Command to execute. |
fromSink | Flag for source or sink |
virtual BOOL OpalMediaPatch::UpdateMediaFormat | ( | const OpalMediaFormat & | mediaFormat, | |
BOOL | fromSink | |||
) | [virtual] |
Update the source/sink media format. This can be used to adjust the parameters of a codec at run time. Note you cannot change the basic media format, eg change GSM0610 to G.711, only options for that format, eg 6k3 mode to 5k3 mode in G.723.1.
The default behaviour updates the source/sink media stream and the output side of any relevant transcoders.
mediaFormat | New media format |
fromSink | Flag for source or sink |
PList<Filter> OpalMediaPatch::filters [protected] |
PTimedMutex OpalMediaPatch::inUse [mutable, protected] |
PList<Sink> OpalMediaPatch::sinks [protected] |
OpalMediaStream& OpalMediaPatch::source [protected] |