Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OpalMediaFormat Class Reference

#include <mediafmt.h>

Inheritance diagram for OpalMediaFormat:

OpalAudioFormat OpalVideoFormat List of all members.

Public Types

enum  { DefaultAudioSessionID = 1, DefaultVideoSessionID = 2, DefaultDataSessionID = 3, DefaultH224SessionID = 4 }
enum  StandardClockRate { AudioClockRate = 8000, VideoClockRate = 90000 }

Public Methods

 OpalMediaFormat ()
 OpalMediaFormat (const char *fullName, unsigned defaultSessionID, RTP_DataFrame::PayloadTypes rtpPayloadType, const char *encodingName, BOOL needsJitter, unsigned bandwidth, PINDEX frameSize, unsigned frameTime, unsigned clockRate)
 OpalMediaFormat (RTP_DataFrame::PayloadTypes rtpPayloadType, unsigned clockRate, const char *rtpEncodingName=NULL)
 OpalMediaFormat (const char *wildcard)
 OpalMediaFormat (const PString &wildcard)
OpalMediaFormat & operator= (const OpalMediaFormat &format)
OpalMediaFormat & operator= (RTP_DataFrame::PayloadTypes rtpPayloadType)
OpalMediaFormat & operator= (const char *wildcard)
OpalMediaFormat & operator= (const PString &wildcard)
virtual PObject * Clone () const
virtual bool Merge (const OpalMediaFormat &mediaFormat)
RTP_DataFrame::PayloadTypes GetPayloadType () const
const char * GetEncodingName () const
unsigned GetDefaultSessionID () const
bool NeedsJitterBuffer () const
unsigned GetBandwidth () const
PINDEX GetFrameSize () const
unsigned GetFrameTime () const
unsigned GetTimeUnits () const
unsigned GetClockRate () const
PINDEX GetOptionCount () const
const OpalMediaOptionGetOption (PINDEX index)
bool GetOptionValue (const PString &name, PString &value) const
bool SetOptionValue (const PString &name, const PString &value)
bool GetOptionBoolean (const PString &name, bool dflt=FALSE) const
bool SetOptionBoolean (const PString &name, bool value)
int GetOptionInteger (const PString &name, int dflt=0) const
bool SetOptionInteger (const PString &name, int value)
double GetOptionReal (const PString &name, double dflt=0) const
bool SetOptionReal (const PString &name, double value)
PINDEX GetOptionEnum (const PString &name, PINDEX dflt=0) const
bool SetOptionEnum (const PString &name, PINDEX value)
PString GetOptionString (const PString &name, const PString &dflt=PString::Empty()) const
bool SetOptionString (const PString &name, const PString &value)

Static Public Methods

OpalMediaFormatList GetAllRegisteredMediaFormats ()
void GetAllRegisteredMediaFormats (OpalMediaFormatList &copy)
bool SetRegisteredMediaFormat (const OpalMediaFormat &mediaFormat)

Static Public Attributes

const char *const NeedsJitterOption
const char *const MaxBitRateOption
const char *const MaxFrameSizeOption
const char *const FrameTimeOption
const char *const ClockRateOption

Protected Methods

bool AddOption (OpalMediaOption *option)
OpalMediaOptionFindOption (const PString &name) const

Protected Attributes

RTP_DataFrame::PayloadTypes rtpPayloadType
const char * rtpEncodingName
unsigned defaultSessionID
PMutex media_format_mutex
PSortedList< OpalMediaOptionoptions

Friends

class OpalMediaFormatList

Detailed Description

This class describes a media format as used in the OPAL system. A media format is the type of any media data that is trasferred between OPAL entities. For example an audio codec such as G.723.1 is a media format, a video codec such as H.261 is also a media format.

There


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
DefaultAudioSessionID 
DefaultVideoSessionID 
DefaultDataSessionID 
DefaultH224SessionID 

enum OpalMediaFormat::StandardClockRate
 

Enumeration values:
AudioClockRate  8kHz sample rate
VideoClockRate  90kHz sample rate


Constructor & Destructor Documentation

OpalMediaFormat::OpalMediaFormat  
 

Default constructor creates a PCM-16 media format.

OpalMediaFormat::OpalMediaFormat const char *    fullName,
unsigned    defaultSessionID,
RTP_DataFrame::PayloadTypes    rtpPayloadType,
const char *    encodingName,
BOOL    needsJitter,
unsigned    bandwidth,
PINDEX    frameSize,
unsigned    frameTime,
unsigned    clockRate
 

This form of the constructor will register the full details of the media format into an internal database. This would typically be used as a static global. In fact it would be very dangerous for an instance to use this constructor in any other way, especially local variables.

If the rtpPayloadType is RTP_DataFrame::DynamicBase, then the RTP payload type is actually set to teh first unused dynamic RTP payload type that is in the registers set of media formats.

The frameSize parameter indicates that the media format has a maximum size for each data frame, eg G.723.1 frames are no more than 24 bytes long. If zero then there is no intrinsic maximum, eg G.711.

Parameters:
fullName  Full name of media format
defaultSessionID  Default session for codec type
rtpPayloadType  RTP payload type code
encodingName  RTP encoding name
needsJitter  Indicate format requires a jitter buffer
bandwidth  Bandwidth in bits/second
frameSize  Size of frame in bytes (if applicable)
frameTime  Time for frame in RTP units (if applicable)
clockRate  Clock rate for data (if applicable)

OpalMediaFormat::OpalMediaFormat RTP_DataFrame::PayloadTypes    rtpPayloadType,
unsigned    clockRate,
const char *    rtpEncodingName = NULL
 

Construct a media format, searching database for information. This constructor will search through the RegisteredMediaFormats list for the match of the payload type, if found the other information fields are set from the database. If not found then the ancestor string is set to the empty string.

Note it is impossible to determine the order of registration so this should not be relied on.

Parameters:
rtpPayloadType  RTP payload type code
clockRate  clock rate
rtpEncodingName  RTP payload type name

OpalMediaFormat::OpalMediaFormat const char *    wildcard
 

Construct a media format, searching database for information. This constructor will search through the RegisteredMediaFormats list for the wildcard match of the parameter string, if found the other information fields are set from the database. If not found then the ancestor string is set to the empty string.

The wildcard string is a simple substring match using the '*' character. For example: "G.711*" would match the first of "G.711-uLaw-64k" and "G.711-ALaw-64k" to have been registered.

Note it is impossible to determine the order of registration so this should not be relied on.

Parameters:
wildcard  Wildcard name to search for

OpalMediaFormat::OpalMediaFormat const PString &    wildcard
 

Construct a media format, searching database for information. This constructor will search through the RegisteredMediaFormats list for the wildcard match of the parameter string, if found the other information fields are set from the database. If not found then the ancestor string is set to the empty string.

The wildcard string is a simple substring match using the '*' character. For example: "G.711*" would match the first of "G.711-uLaw-64k" and "G.711-ALaw-64k" to have been registered.

Note it is impossible to determine the order of registration so this should not be relied on.

Parameters:
wildcard  Wildcard name to search for


Member Function Documentation

bool OpalMediaFormat::AddOption OpalMediaOption   option [protected]
 

virtual PObject* OpalMediaFormat::Clone   [virtual]
 

Create a copy of the media format.

Reimplemented in OpalVideoFormat.

OpalMediaOption* OpalMediaFormat::FindOption const PString &    name const [protected]
 

void OpalMediaFormat::GetAllRegisteredMediaFormats OpalMediaFormatList   copy [static]
 

Parameters:
copy  List to receive the copy of the master list

OpalMediaFormatList OpalMediaFormat::GetAllRegisteredMediaFormats   [static]
 

Get a copy of the list of media formats that have been registered.

unsigned OpalMediaFormat::GetBandwidth   const [inline]
 

Get the average bandwidth used in bits/second.

unsigned OpalMediaFormat::GetClockRate   const [inline]
 

Get the clock rate in Hz for this format.

unsigned OpalMediaFormat::GetDefaultSessionID   const [inline]
 

Get the default session ID for media format.

const char* OpalMediaFormat::GetEncodingName   const [inline]
 

Get the RTP encoding name that is to be used for this media format.

PINDEX OpalMediaFormat::GetFrameSize   const [inline]
 

Get the maximum frame size in bytes. If this returns zero then the media format has no intrinsic maximum frame size, eg G.711 would return zero but G.723.1 whoud return 24.

unsigned OpalMediaFormat::GetFrameTime   const [inline]
 

Get the frame time in RTP timestamp units. If this returns zero then the media format is not real time and has no intrinsic timing eg T.120

const OpalMediaOption& OpalMediaFormat::GetOption PINDEX    index [inline]
 

Get the option instance at the specified index. This contains the description and value for the option.

Parameters:
index  Index of option in list to get

bool OpalMediaFormat::GetOptionBoolean const PString &    name,
bool    dflt = FALSE
const
 

Get the option value of the specified name as a boolean. The default value is returned if the option is not present.

Parameters:
name  Option name
dflt  Default value if option not present

PINDEX OpalMediaFormat::GetOptionCount   const [inline]
 

Get the number of options this media format has.

PINDEX OpalMediaFormat::GetOptionEnum const PString &    name,
PINDEX    dflt = 0
const
 

Get the option value of the specified name as an index into an enumeration list. The default value is returned if the option is not present.

Parameters:
name  Option name
dflt  Default value if option not present

int OpalMediaFormat::GetOptionInteger const PString &    name,
int    dflt = 0
const
 

Get the option value of the specified name as an integer. The default value is returned if the option is not present.

Parameters:
name  Option name
dflt  Default value if option not present

double OpalMediaFormat::GetOptionReal const PString &    name,
double    dflt = 0
const
 

Get the option value of the specified name as a real. The default value is returned if the option is not present.

Parameters:
name  Option name
dflt  Default value if option not present

PString OpalMediaFormat::GetOptionString const PString &    name,
const PString &    dflt = PString::Empty()
const
 

Get the option value of the specified name as a string. The default value is returned if the option is not present.

Parameters:
name  Option name
dflt  Default value if option not present

bool OpalMediaFormat::GetOptionValue const PString &    name,
PString &    value
const
 

Get the option value of the specified name as a string.

Returns false of the option is not present.

Parameters:
name  Option name
value  String to receive option value

RTP_DataFrame::PayloadTypes OpalMediaFormat::GetPayloadType   const [inline]
 

Get the RTP payload type that is to be used for this media format. This will either be an intrinsic one for the media format eg GSM or it will be automatically calculated as a dynamic media format that will be uniqueue amongst the registered media formats.

unsigned OpalMediaFormat::GetTimeUnits   const [inline]
 

Get the number of RTP timestamp units per millisecond.

virtual bool OpalMediaFormat::Merge const OpalMediaFormat &    mediaFormat [virtual]
 

Merge with another media format. This will alter and validate the options for this media format according to the merge rule for each option. The parameter is typically a "capability" while the current object isthe proposed channel format. This if the current object has a tx number of frames of 3, but the parameter has a value of 1, then the current object will be set to 1.

Returns FALSE if the media formats are incompatible and cannot be merged.

Reimplemented in OpalVideoFormat.

bool OpalMediaFormat::NeedsJitterBuffer   const [inline]
 

Determine if the media format requires a jitter buffer. As a rule an audio codec needs a jitter buffer and all others do not.

OpalMediaFormat& OpalMediaFormat::operator= const PString &    wildcard
 

Search for the specified format name. This is equivalent to going fmt = OpalMediaFormat(search);

Parameters:
wildcard  Wildcard name to search for

OpalMediaFormat& OpalMediaFormat::operator= const char *    wildcard
 

Search for the specified format name. This is equivalent to going fmt = OpalMediaFormat(search);

Parameters:
wildcard  Wildcard name to search for

OpalMediaFormat& OpalMediaFormat::operator= RTP_DataFrame::PayloadTypes    rtpPayloadType
 

Search for the specified format type. This is equivalent to going fmt = OpalMediaFormat(rtpPayloadType);

Parameters:
rtpPayloadType  RTP payload type code

OpalMediaFormat& OpalMediaFormat::operator= const OpalMediaFormat &    format
 

bool OpalMediaFormat::SetOptionBoolean const PString &    name,
bool    value
 

Set the option value of the specified name as a boolean. Note the option will not be added if it does not exist, the option must be explicitly added using AddOption().

Returns false of the option is not present or is not of the same type.

Parameters:
name  Option name
value  New value for option

bool OpalMediaFormat::SetOptionEnum const PString &    name,
PINDEX    value
 

Set the option value of the specified name as an index into an enumeration. Note the option will not be added if it does not exist, the option must be explicitly added using AddOption().

Returns false of the option is not present or is not of the same type.

Parameters:
name  Option name
value  New value for option

bool OpalMediaFormat::SetOptionInteger const PString &    name,
int    value
 

Set the option value of the specified name as an integer. Note the option will not be added if it does not exist, the option must be explicitly added using AddOption().

Returns false of the option is not present, not of the same type or is putside the allowable range.

Parameters:
name  Option name
value  New value for option

bool OpalMediaFormat::SetOptionReal const PString &    name,
double    value
 

Set the option value of the specified name as a real. Note the option will not be added if it does not exist, the option must be explicitly added using AddOption().

Returns false of the option is not present or is not of the same type.

Parameters:
name  Option name
value  New value for option

bool OpalMediaFormat::SetOptionString const PString &    name,
const PString &    value
 

Set the option value of the specified name as a string. Note the option will not be added if it does not exist, the option must be explicitly added using AddOption().

Returns false of the option is not present or is not of the same type.

Parameters:
name  Option name
value  New value for option

bool OpalMediaFormat::SetOptionValue const PString &    name,
const PString &    value
 

Set the option value of the specified name as a string. Note the option will not be added if it does not exist, the option must be explicitly added using AddOption().

Returns false of the option is not present.

Parameters:
name  Option name
value  New option value as string

bool OpalMediaFormat::SetRegisteredMediaFormat const OpalMediaFormat &    mediaFormat [static]
 

Set the options on the master format list entry. The media format must already be registered. Returns false if not.

Parameters:
mediaFormat  Media format to copy to master list


Friends And Related Function Documentation

friend class OpalMediaFormatList [friend]
 


Member Data Documentation

const char* const OpalMediaFormat::ClockRateOption [static]
 

unsigned OpalMediaFormat::defaultSessionID [protected]
 

const char* const OpalMediaFormat::FrameTimeOption [static]
 

const char* const OpalMediaFormat::MaxBitRateOption [static]
 

const char* const OpalMediaFormat::MaxFrameSizeOption [static]
 

PMutex OpalMediaFormat::media_format_mutex [protected]
 

const char* const OpalMediaFormat::NeedsJitterOption [static]
 

PSortedList<OpalMediaOption> OpalMediaFormat::options [protected]
 

const char* OpalMediaFormat::rtpEncodingName [protected]
 

RTP_DataFrame::PayloadTypes OpalMediaFormat::rtpPayloadType [protected]
 


The documentation for this class was generated from the following file:
Generated on Sun Jul 23 09:40:34 2006 for OPAL by doxygen1.2.18