payload types in OpalMediaFormat instances and transcoders.
* Contributor(s): ______________________________________.
*
* $Log$
+ * Revision 2.17 2007/09/10 03:15:04 rjongbloed
+ * Fixed issues in creating and subsequently using correctly unique
+ * payload types in OpalMediaFormat instances and transcoders.
+ *
* Revision 2.16 2007/09/07 17:49:47 ykiryanov
* File was missing transcoders.h include. This had an effect while building code with no video.
*
@@ -434,12 +438,12 @@ class OpalPluginTranscoderFactory : public OpalTranscoderFactory
class Worker : public OpalTranscoderFactory::WorkerBase
{
public:
- Worker(const OpalMediaFormatPair & key, PluginCodec_Definition * _codecDefn, BOOL _isEncoder)
+ Worker(const OpalTranscoderKey & key, PluginCodec_Definition * _codecDefn, BOOL _isEncoder)
: OpalTranscoderFactory::WorkerBase(), codecDefn(_codecDefn), isEncoder(_isEncoder)
{ OpalTranscoderFactory::Register(key, this); }
protected:
- virtual OpalTranscoder * Create(const OpalMediaFormatPair &) const
+ virtual OpalTranscoder * Create(const OpalTranscoderKey &) const
{ return new TranscoderClass(codecDefn, isEncoder); }
PluginCodec_Definition * codecDefn;
* Contributor(s): ______________________________________.
*
* $Log$
+ * Revision 1.10 2007/09/10 03:15:04 rjongbloed
+ * Fixed issues in creating and subsequently using correctly unique
+ * payload types in OpalMediaFormat instances and transcoders.
+ *
* Revision 1.9 2007/06/25 05:09:09 rjongbloed
* Fixed compile after change to anonymous structure in header (for GCC).
*
@@ -723,8 +727,8 @@ void OpalCodecInfo::Main()
OpalTranscoderList keys = OpalTranscoderFactory::GetKeyList();
OpalTranscoderList::const_iterator transcoder;
for (transcoder = keys.begin(); transcoder != keys.end(); ++transcoder) {
- cout << " " << *transcoder << flush;
- OpalTranscoder * xcoder = OpalTranscoder::Create(transcoder->GetInputFormat(), transcoder->GetOutputFormat());
+ cout << " " << transcoder->first << "->" << transcoder->second << flush;
+ OpalTranscoder * xcoder = OpalTranscoder::Create(transcoder->first, transcoder->second);
if (xcoder == NULL)
cout << " CANNOT BE INSTANTIATED";
else
* Contributor(s): ______________________________________.
*
* $Log$
+ * Revision 2.52 2007/09/10 03:15:04 rjongbloed
+ * Fixed issues in creating and subsequently using correctly unique
+ * payload types in OpalMediaFormat instances and transcoders.
+ *
* Revision 2.51 2007/08/22 05:18:09 rjongbloed
* Changed size of RTP packet to be slightlysmaller, the true MTU for ethernet.
* Also some code clean ups.
@@ -1965,20 +1969,18 @@ void OpalPluginCodecManager::RegisterPluginPair(
case PluginCodec_MediaTypeVideo:
handler->CreateVideoTranscoder(OpalYUV420P, encoderCodec->destFormat, encoderCodec, TRUE);
handler->CreateVideoTranscoder(encoderCodec->destFormat, OpalYUV420P, decoderCodec, FALSE);
- //new OpalPluginTranscoderFactory<OpalPluginVideoTranscoder>::Worker(OpalMediaFormatPair(OpalYUV420P, encoderCodec->destFormat), encoderCodec, TRUE);
- //new OpalPluginTranscoderFactory<OpalPluginVideoTranscoder>::Worker(OpalMediaFormatPair(encoderCodec->destFormat, OpalYUV420P), decoderCodec, FALSE);
break;
#endif
#if OPAL_AUDIO
case PluginCodec_MediaTypeAudio:
if (encoderCodec->sampleRate == 8000) {
- new OpalPluginTranscoderFactory<OpalPluginFramedAudioTranscoder>::Worker(OpalMediaFormatPair(OpalPCM16, encoderCodec->destFormat), encoderCodec, TRUE);
- new OpalPluginTranscoderFactory<OpalPluginFramedAudioTranscoder>::Worker(OpalMediaFormatPair(encoderCodec->destFormat, OpalPCM16), decoderCodec, FALSE);
+ new OpalPluginTranscoderFactory<OpalPluginFramedAudioTranscoder>::Worker(OpalTranscoderKey(OpalPCM16, encoderCodec->destFormat), encoderCodec, TRUE);
+ new OpalPluginTranscoderFactory<OpalPluginFramedAudioTranscoder>::Worker(OpalTranscoderKey(encoderCodec->destFormat, OpalPCM16), decoderCodec, FALSE);
}
else if (encoderCodec->sampleRate == 16000)
{
- new OpalPluginTranscoderFactory<OpalPluginFramedAudioTranscoder>::Worker(OpalMediaFormatPair(OpalPCM16_16KHZ, encoderCodec->destFormat), encoderCodec, TRUE);
- new OpalPluginTranscoderFactory<OpalPluginFramedAudioTranscoder>::Worker(OpalMediaFormatPair(encoderCodec->destFormat, OpalPCM16_16KHZ), decoderCodec, FALSE);
+ new OpalPluginTranscoderFactory<OpalPluginFramedAudioTranscoder>::Worker(OpalTranscoderKey(OpalPCM16_16KHZ, encoderCodec->destFormat), encoderCodec, TRUE);
+ new OpalPluginTranscoderFactory<OpalPluginFramedAudioTranscoder>::Worker(OpalTranscoderKey(encoderCodec->destFormat, OpalPCM16_16KHZ), decoderCodec, FALSE);
}
else
{
@@ -1987,13 +1989,13 @@ void OpalPluginCodecManager::RegisterPluginPair(
break;
case PluginCodec_MediaTypeAudioStreamed:
if (encoderCodec->sampleRate == 8000) {
- new OpalPluginTranscoderFactory<OpalPluginStreamedAudioEncoder>::Worker(OpalMediaFormatPair(OpalPCM16, encoderCodec->destFormat), encoderCodec, TRUE);
- new OpalPluginTranscoderFactory<OpalPluginStreamedAudioDecoder>::Worker(OpalMediaFormatPair(encoderCodec->destFormat, OpalPCM16), decoderCodec, FALSE);
+ new OpalPluginTranscoderFactory<OpalPluginStreamedAudioEncoder>::Worker(OpalTranscoderKey(OpalPCM16, encoderCodec->destFormat), encoderCodec, TRUE);
+ new OpalPluginTranscoderFactory<OpalPluginStreamedAudioDecoder>::Worker(OpalTranscoderKey(encoderCodec->destFormat, OpalPCM16), decoderCodec, FALSE);
}
else if (encoderCodec->sampleRate == 16000)
{
- new OpalPluginTranscoderFactory<OpalPluginStreamedAudioEncoder>::Worker(OpalMediaFormatPair(OpalPCM16_16KHZ, encoderCodec->destFormat), encoderCodec, TRUE);
- new OpalPluginTranscoderFactory<OpalPluginStreamedAudioDecoder>::Worker(OpalMediaFormatPair(encoderCodec->destFormat, OpalPCM16_16KHZ), decoderCodec, FALSE);
+ new OpalPluginTranscoderFactory<OpalPluginStreamedAudioEncoder>::Worker(OpalTranscoderKey(OpalPCM16_16KHZ, encoderCodec->destFormat), encoderCodec, TRUE);
+ new OpalPluginTranscoderFactory<OpalPluginStreamedAudioDecoder>::Worker(OpalTranscoderKey(encoderCodec->destFormat, OpalPCM16_16KHZ), decoderCodec, FALSE);
}
else
{
@@ -2003,8 +2005,8 @@ void OpalPluginCodecManager::RegisterPluginPair(
#endif
#if OPAL_T38FAX
case PluginCodec_MediaTypeFax:
- new OpalPluginTranscoderFactory<OpalFaxAudioTranscoder>::Worker(OpalMediaFormatPair(GetOpalPCM16Fax(), encoderCodec->destFormat), encoderCodec, TRUE);
- new OpalPluginTranscoderFactory<OpalFaxAudioTranscoder>::Worker(OpalMediaFormatPair(encoderCodec->destFormat, GetOpalPCM16Fax()), decoderCodec, FALSE);
+ new OpalPluginTranscoderFactory<OpalFaxAudioTranscoder>::Worker(OpalTranscoderKey(GetOpalPCM16Fax(), encoderCodec->destFormat), encoderCodec, TRUE);
+ new OpalPluginTranscoderFactory<OpalFaxAudioTranscoder>::Worker(OpalTranscoderKey(encoderCodec->destFormat, GetOpalPCM16Fax()), decoderCodec, FALSE);
break;
#endif
default:
@@ -2130,7 +2132,7 @@ OpalMediaFormat * OpalPluginCodecHandler::OnCreateVideoFormat(OpalPluginCodecMan
void OpalPluginCodecHandler::CreateVideoTranscoder(const OpalMediaFormat & src, const OpalMediaFormat & dst, PluginCodec_Definition * codec, BOOL v)
{
- new OpalPluginTranscoderFactory<OpalPluginVideoTranscoder>::Worker(OpalMediaFormatPair(src, dst), codec, v);
+ new OpalPluginTranscoderFactory<OpalPluginVideoTranscoder>::Worker(OpalTranscoderKey(src, dst), codec, v);
}
#endif
* Contributor(s): ______________________________________.
*
* $Log$
+ * Revision 2.74 2007/09/10 03:15:04 rjongbloed
+ * Fixed issues in creating and subsequently using correctly unique
+ * payload types in OpalMediaFormat instances and transcoders.
+ *
* Revision 2.73 2007/09/10 00:16:16 rjongbloed
* Fixed allocating dynamic payload types to media formats maked as internal via
* having an IllegalPayloadType
@@ -941,8 +945,6 @@ OpalMediaFormat::OpalMediaFormat(const char * fullName,
// then move the old format to the next unused format
if (match != NULL)
match->rtpPayloadType = nextUnused;
- else
- rtpPayloadType = nextUnused;
registeredFormats.OpalMediaFormatBaseList::Append(this);
}
* Contributor(s): ______________________________________.
*
* $Log$
+ * Revision 2.37 2007/09/10 03:15:04 rjongbloed
+ * Fixed issues in creating and subsequently using correctly unique
+ * payload types in OpalMediaFormat instances and transcoders.
+ *
* Revision 2.36 2007/09/05 14:19:27 csoutheren
* Remove warning on Windows
*
@@ -310,7 +314,7 @@ OpalTranscoder * OpalTranscoder::Create(const OpalMediaFormat & srcFormat,
const BYTE * instance,
unsigned instanceLen)
{
- OpalTranscoder * transcoder = OpalTranscoderFactory::CreateInstance(OpalMediaFormatPair(srcFormat, destFormat));
+ OpalTranscoder * transcoder = OpalTranscoderFactory::CreateInstance(OpalTranscoderKey(srcFormat, destFormat));
if (transcoder != NULL) {
transcoder->UpdateOutputMediaFormat(destFormat);
if (instance != NULL && instanceLen != 0 && transcoder->HasCodecControl("set_instance_id")) {
@@ -349,13 +353,12 @@ BOOL OpalTranscoder::SelectFormats(unsigned sessionID,
for (s = 0; s < srcFormats.GetSize(); s++) {
srcFormat = srcFormats[s];
if (srcFormat.GetDefaultSessionID() == sessionID) {
- OpalMediaFormatPair search(srcFormat, dstFormat);
+ OpalTranscoderKey search(srcFormat, dstFormat);
OpalTranscoderList availableTranscoders = OpalTranscoderFactory::GetKeyList();
for (OpalTranscoderIterator i = availableTranscoders.begin(); i != availableTranscoders.end(); ++i) {
- OpalMediaFormatPair & target = *i;
- if (search == target)
- return srcFormat.Merge(target.GetInputFormat()) &&
- dstFormat.Merge(target.GetOutputFormat()) &&
+ if (search == *i)
+ return srcFormat.Merge(i->first) &&
+ dstFormat.Merge(i->second) &&
srcFormat.Merge(dstFormat);
}
}
@@ -390,13 +393,13 @@ BOOL OpalTranscoder::FindIntermediateFormat(OpalMediaFormat & srcFormat,
OpalTranscoderList availableTranscoders = OpalTranscoderFactory::GetKeyList();
for (OpalTranscoderIterator find1 = availableTranscoders.begin(); find1 != availableTranscoders.end(); ++find1) {
- if (find1->GetInputFormat() == srcFormat) {
+ if (find1->first == srcFormat) {
for (OpalTranscoderIterator find2 = availableTranscoders.begin(); find2 != availableTranscoders.end(); ++find2) {
- if (find2->GetInputFormat() == find1->GetOutputFormat() && find2->GetOutputFormat() == dstFormat) {
- intermediateFormat = find1->GetOutputFormat();
- intermediateFormat.Merge(find2->GetInputFormat());
- return srcFormat.Merge(find1->GetInputFormat()) &&
- dstFormat.Merge(find2->GetOutputFormat()) &&
+ if (find2->first == find1->second && find2->second == dstFormat) {
+ intermediateFormat = find1->second;
+ intermediateFormat.Merge(find2->first);
+ return srcFormat.Merge(find1->first) &&
+ dstFormat.Merge(find2->second) &&
srcFormat.Merge(dstFormat);
}
}
@@ -413,8 +416,8 @@ OpalMediaFormatList OpalTranscoder::GetDestinationFormats(const OpalMediaFormat
OpalTranscoderList availableTranscoders = OpalTranscoderFactory::GetKeyList();
for (OpalTranscoderIterator find = availableTranscoders.begin(); find != availableTranscoders.end(); ++find) {
- if (find->GetInputFormat() == srcFormat)
- list += find->GetOutputFormat();
+ if (find->first == srcFormat)
+ list += find->second;
}
return list;
@@ -427,10 +430,8 @@ OpalMediaFormatList OpalTranscoder::GetSourceFormats(const OpalMediaFormat & dst
OpalTranscoderList availableTranscoders = OpalTranscoderFactory::GetKeyList();
for (OpalTranscoderIterator find = availableTranscoders.begin(); find != availableTranscoders.end(); ++find) {
- PString s = find->GetInputFormat();
- PString d = find->GetOutputFormat();
- if (find->GetOutputFormat() == dstFormat)
- list += find->GetInputFormat();
+ if (find->second == dstFormat)
+ list += find->first;
}
return list;
* Contributor(s): ______________________________________.
*
* $Log$
+ * Revision 2.184 2007/09/10 03:15:05 rjongbloed
+ * Fixed issues in creating and subsequently using correctly unique
+ * payload types in OpalMediaFormat instances and transcoders.
+ *
* Revision 2.183 2007/09/04 05:40:15 rjongbloed
* Added OnRegistrationStatus() call back function so can distinguish
* between initial registration and refreshes.
@@ -729,6 +733,11 @@ SIPEndPoint::SIPEndPoint(OpalManager & mgr)
natMethod = None;
+ // Make sure these have been contructed now to avoid
+ // payload type disambiguation problems.
+ GetOpalRFC2833();
+ GetOpalCiscoNSE();
+
PTRACE(4, "SIP\tCreated endpoint.");
}