reSIProcate/stack  9694
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes | Friends
resip::SdpContents::Session::Codec Class Reference

parameters for a specific codec are stored in this class. More...

#include <SdpContents.hxx>

Collaboration diagram for resip::SdpContents::Session::Codec:
Collaboration graph
[legend]

List of all members.

Public Types

typedef HashMap< int, CodecCodecMap

Public Member Functions

 Codec ()
 Codec (const Data &name, unsigned long rate, const Data &parameters=Data::Empty, const Data &encodingParameters=Data::Empty)
 full constructor for a Codec.
 Codec (const Data &name, int payloadType, int rate=8000)
 constructor for a Codec
 Codec (const Codec &rhs)
Codecoperator= (const Codec &codec)
void parse (ParseBuffer &pb, const SdpContents::Session::Medium &medium, int payLoadType)
void assignFormatParameters (const SdpContents::Session::Medium &medium)
const DatagetName () const
 returns the name of the codec.
int getRate () const
 returns the name of the codec.
int payloadType () const
 returns the RTP payload type associated with this codec.
int & payloadType ()
 returns the RTP payload type associated with this codec.
const Dataparameters () const
 returns the parameters associated with this codec
Dataparameters ()
 returns the parameters associated with this codec
const DataencodingParameters () const
 returns the encoding parameters associated with this codec
DataencodingParameters ()
 returns the encoding parameters associated with this codec

Static Public Member Functions

static CodecMapgetStaticCodecs ()

Static Public Attributes

static const Codec ULaw_8000
static const Codec ALaw_8000
static const Codec G729_8000
static const Codec G723_8000
static const Codec GSM_8000
static const Codec TelephoneEvent
static const Codec FrfDialedDigit
static const Codec CN

Private Attributes

Data mName
unsigned long mRate
int mPayloadType
Data mParameters
Data mEncodingParameters

Static Private Attributes

static std::auto_ptr< CodecMapsStaticCodecs
static bool sStaticCodecsCreated = false

Friends

bool operator== (const Codec &, const Codec &)
EncodeStreamoperator<< (EncodeStream &, const Codec &)

Detailed Description

parameters for a specific codec are stored in this class.

Definition at line 69 of file SdpContents.hxx.


Member Typedef Documentation

Definition at line 149 of file SdpContents.hxx.


Constructor & Destructor Documentation

resip::SdpContents::Session::Codec::Codec ( ) [inline]

Definition at line 72 of file SdpContents.hxx.

Referenced by getStaticCodecs().

: mName(), mRate(0), mPayloadType(-1) {}
Codec::Codec ( const Data name,
unsigned long  rate,
const Data parameters = Data::Empty,
const Data encodingParameters = Data::Empty 
)

full constructor for a Codec.

This constructor allows a rate and optional parameters to be specified.

Parameters:
namea string identifying the codec
ratenumber of samples/sec
parametersoptional list of parameters for the codec
encodingParametersoptional encoding parameters for the codec

Definition at line 1725 of file SdpContents.cxx.

   : mName(name),
     mRate(rate),
     mPayloadType(-1),
     mParameters(parameters),
     mEncodingParameters(encodingParameters)
{
}
Codec::Codec ( const Data name,
int  payloadType,
int  rate = 8000 
)

constructor for a Codec

This constructor allows for payload type and rate parameters to be specified.

Parameters:
namea string identifying the codec
payloadTypeRTP payload type to associate with this codec
ratesample rate of this codec

Definition at line 1746 of file SdpContents.cxx.

   : mName(name),
     mRate(rate),
     mPayloadType(payloadType)
{
}
Codec::Codec ( const Codec rhs)

Member Function Documentation

void Codec::assignFormatParameters ( const SdpContents::Session::Medium medium)

Definition at line 1793 of file SdpContents.cxx.

References resip::Data::data(), resip::SdpContents::Session::Medium::exists(), fmtp, resip::SdpContents::Session::Medium::getValues(), InfoLog, resip::ParseBuffer::integer(), mParameters, and mPayloadType.

Referenced by resip::SdpContents::Session::Medium::codecs(), and parse().

{
   // get parameters if they exist
   if (medium.exists(fmtp))
   {
      for (list<Data>::const_iterator i = medium.getValues(fmtp).begin();
           i != medium.getValues(fmtp).end(); ++i)
      {
         try
         {
            ParseBuffer pb(i->data(), i->size());
            int payload = pb.integer();
            if (payload == mPayloadType)
            {
               const char* anchor = pb.skipWhitespace();
               pb.skipToEnd();
               mParameters = pb.data(anchor);
               break;
            }
         }
         catch (ParseException &pe)
         {
            InfoLog(<<"Caught exception when parsing a=fmtp: "<< pe);
         }
      }
   }
}

Here is the call graph for this function:

const Data& resip::SdpContents::Session::Codec::encodingParameters ( ) const [inline]

returns the encoding parameters associated with this codec

Returns:
encoding parameters

Definition at line 134 of file SdpContents.hxx.

References mEncodingParameters.

Data& resip::SdpContents::Session::Codec::encodingParameters ( ) [inline]

returns the encoding parameters associated with this codec

Returns:
encoding parameters

Definition at line 138 of file SdpContents.hxx.

References mEncodingParameters.

const Data & Codec::getName ( ) const

returns the name of the codec.

Returns:
name of the codec

Definition at line 1822 of file SdpContents.cxx.

References mName.

Referenced by resip::SdpContents::Session::Medium::findTelephoneEventPayloadType().

{
   return mName;
}
int Codec::getRate ( ) const

returns the name of the codec.

Returns:
name of the codec

Definition at line 1828 of file SdpContents.cxx.

References mRate.

{
   return mRate;
}
Codec::CodecMap & Codec::getStaticCodecs ( ) [static]

Definition at line 1833 of file SdpContents.cxx.

References Codec(), sStaticCodecs, and sStaticCodecsCreated.

Referenced by resip::SdpContents::Session::Medium::codecs().

{
   if (! sStaticCodecsCreated)
   {
      //
      // Build map of static codecs as defined in RFC 3551
      //
      sStaticCodecs = std::auto_ptr<CodecMap>(new CodecMap);

      // Audio codecs
      sStaticCodecs->insert(make_pair(0,Codec("PCMU",0,8000)));
      sStaticCodecs->insert(make_pair(3,Codec("GSM",3,8000)));
      sStaticCodecs->insert(make_pair(4,Codec("G723",4,8000)));
      sStaticCodecs->insert(make_pair(5,Codec("DVI4",5,8000)));
      sStaticCodecs->insert(make_pair(6,Codec("DVI4",6,16000)));
      sStaticCodecs->insert(make_pair(7,Codec("LPC",7,8000)));
      sStaticCodecs->insert(make_pair(8,Codec("PCMA",8,8000)));
      sStaticCodecs->insert(make_pair(9,Codec("G722",9,8000)));
      sStaticCodecs->insert(make_pair(10,Codec("L16-2",10,44100)));
      sStaticCodecs->insert(make_pair(11,Codec("L16-1",11,44100)));
      sStaticCodecs->insert(make_pair(12,Codec("QCELP",12,8000)));
      sStaticCodecs->insert(make_pair(13,Codec("CN",13,8000)));
      sStaticCodecs->insert(make_pair(14,Codec("MPA",14,90000)));
      sStaticCodecs->insert(make_pair(15,Codec("G728",15,8000)));
      sStaticCodecs->insert(make_pair(16,Codec("DVI4",16,11025)));
      sStaticCodecs->insert(make_pair(17,Codec("DVI4",17,22050)));
      sStaticCodecs->insert(make_pair(18,Codec("G729",18,8000)));

      // Video or audio/video codecs
      sStaticCodecs->insert(make_pair(25,Codec("CelB",25,90000)));
      sStaticCodecs->insert(make_pair(26,Codec("JPEG",26,90000)));
      sStaticCodecs->insert(make_pair(28,Codec("nv",28,90000)));
      sStaticCodecs->insert(make_pair(31,Codec("H261",31,90000)));
      sStaticCodecs->insert(make_pair(32,Codec("MPV",32,90000)));
      sStaticCodecs->insert(make_pair(33,Codec("MP2T",33,90000)));
      sStaticCodecs->insert(make_pair(34,Codec("H263",34,90000)));

      sStaticCodecsCreated = true;
   }
   return *(sStaticCodecs.get());
}

Here is the call graph for this function:

Codec & Codec::operator= ( const Codec codec)

Definition at line 1754 of file SdpContents.cxx.

References mEncodingParameters, mName, mParameters, mPayloadType, and mRate.

{
   if (this != &rhs)
   {
      mName = rhs.mName;
      mRate = rhs.mRate;
      mPayloadType = rhs.mPayloadType;
      mParameters = rhs.mParameters;
      mEncodingParameters = rhs.mEncodingParameters;
   }
   return *this;
}
const Data& resip::SdpContents::Session::Codec::parameters ( ) const [inline]

returns the parameters associated with this codec

Returns:
codec parameters

Definition at line 125 of file SdpContents.hxx.

References mParameters.

{return mParameters;}
Data& resip::SdpContents::Session::Codec::parameters ( ) [inline]

returns the parameters associated with this codec

Returns:
codec parameters

Definition at line 129 of file SdpContents.hxx.

References mParameters.

{return mParameters;}
void Codec::parse ( ParseBuffer pb,
const SdpContents::Session::Medium medium,
int  payLoadType 
)
int resip::SdpContents::Session::Codec::payloadType ( ) const [inline]

returns the RTP payload type associated with this codec.

Returns:
RTP payload type

Definition at line 116 of file SdpContents.hxx.

References mPayloadType.

Referenced by parse().

{return mPayloadType;}
int& resip::SdpContents::Session::Codec::payloadType ( ) [inline]

returns the RTP payload type associated with this codec.

Returns:
RTP payload type

Definition at line 120 of file SdpContents.hxx.

References mPayloadType.

{return mPayloadType;}

Friends And Related Function Documentation

EncodeStream& operator<< ( EncodeStream ,
const Codec  
) [friend]
bool operator== ( const Codec ,
const Codec  
) [friend]

Member Data Documentation

const Codec Codec::ALaw_8000 [static]

Definition at line 141 of file SdpContents.hxx.

const Codec Codec::CN [static]

Definition at line 147 of file SdpContents.hxx.

const Codec Codec::FrfDialedDigit [static]

Definition at line 146 of file SdpContents.hxx.

const Codec Codec::G723_8000 [static]

Definition at line 143 of file SdpContents.hxx.

const Codec Codec::G729_8000 [static]

Definition at line 142 of file SdpContents.hxx.

const Codec Codec::GSM_8000 [static]

Definition at line 144 of file SdpContents.hxx.

Definition at line 161 of file SdpContents.hxx.

Referenced by encodingParameters(), operator=(), and parse().

Definition at line 157 of file SdpContents.hxx.

Referenced by getName(), operator=(), and parse().

Definition at line 160 of file SdpContents.hxx.

Referenced by assignFormatParameters(), operator=(), and parameters().

Definition at line 159 of file SdpContents.hxx.

Referenced by assignFormatParameters(), operator=(), parse(), and payloadType().

Definition at line 158 of file SdpContents.hxx.

Referenced by getRate(), operator=(), and parse().

std::auto_ptr< Codec::CodecMap > Codec::sStaticCodecs [static, private]

Definition at line 163 of file SdpContents.hxx.

Referenced by getStaticCodecs().

bool Codec::sStaticCodecsCreated = false [static, private]

Definition at line 164 of file SdpContents.hxx.

Referenced by getStaticCodecs().

const Codec Codec::TelephoneEvent [static]
const Codec Codec::ULaw_8000 [static]

Definition at line 140 of file SdpContents.hxx.


The documentation for this class was generated from the following files: