32 #ifndef OPAL_OPAL_MEDIAFMT_H 33 #define OPAL_OPAL_MEDIAFMT_H 41 #pragma warning(disable:4663) 51 #include <ptlib/videoio.h> 100 ) { PConstString s(wildcard);
return operator+=(s); }
106 const PString & wildcard
144 const unsigned clockRate,
145 const char * rtpEncodingName = NULL,
146 const char * protocol = NULL,
147 const_iterator start = const_iterator()
167 const PString & wildcard,
168 const_iterator start = const_iterator()
175 )
const {
return FindFormat(rtpPayloadType) != end(); }
183 const PString & wildcard
184 )
const {
return FindFormat(wildcard) != end(); }
205 const PStringArray & mask
224 const PStringArray & order
231 bool mustBeTransportable =
true 236 virtual PINDEX Append(PObject *) {
return P_MAX_INDEX; }
237 virtual PINDEX Insert(
const PObject &, PObject *) {
return P_MAX_INDEX; }
238 virtual PINDEX InsertAt(PINDEX, PObject *) {
return P_MAX_INDEX; }
239 virtual PBoolean SetAt(PINDEX, PObject *) {
return false; }
278 virtual Comparison Compare(
const PObject & obj)
const;
284 virtual bool ValidateMerge(
288 virtual Comparison CompareValue(
295 PString AsString()
const;
296 bool FromString(
const PString & value);
298 const PString &
GetName()
const {
return m_name; }
319 , integerType(UnsignedInt)
322 , excludeReqMode(false)
367 template <
typename T>
400 if (m_merge != IntersectionMerge)
404 if (otherOption == NULL)
407 m_value &= otherOption->
m_value;
414 if (otherOption == NULL)
416 if (m_value < otherOption->m_value)
418 if (m_value > otherOption->
m_value)
426 if (otherOption != NULL)
427 m_value = otherOption->
m_value;
445 template <
typename T>
456 T minimum = std::numeric_limits<T>::min(),
457 T maximum = std::numeric_limits<T>::max()
459 : BaseClass(name, readOnly, merge, value)
476 if (temp >= m_minimum && temp <= m_maximum)
477 this->m_value = temp;
479 strm.setstate(ios::badbit);
484 if (value < m_minimum)
485 this->m_value = m_minimum;
486 else if (value > m_maximum)
487 this->m_value = m_maximum;
489 this->m_value = value;
518 operator double()
const {
return m_value; }
519 void operator&=(
double other) {
if (m_value > other) m_value = other; }
538 const char *
const * enumerations,
544 virtual PObject * Clone()
const;
545 virtual void PrintOn(ostream & strm)
const;
546 virtual void ReadFrom(istream & strm);
552 void SetValue(PINDEX value);
577 const PString & value
580 virtual PObject * Clone()
const;
581 virtual void PrintOn(ostream & strm)
const;
582 virtual void ReadFrom(istream & strm);
588 const PString &
GetValue()
const {
return m_value; }
589 void SetValue(
const PString & value);
609 const PBYTEArray & value
619 virtual PObject * Clone()
const;
620 virtual void PrintOn(ostream & strm)
const;
621 virtual void ReadFrom(istream & strm);
626 const PBYTEArray &
GetValue()
const {
return m_value; }
627 void SetValue(
const PBYTEArray & value);
628 void SetValue(
const BYTE * data, PINDEX length);
648 const char * fullName,
651 const char * encodingName,
652 PBoolean needsJitter,
660 const PCaselessString &
GetName()
const {
return formatName; }
662 virtual PObject * Clone()
const;
663 virtual void PrintOn(ostream & strm)
const;
665 virtual bool IsValid()
const;
666 virtual bool IsTransportable()
const;
668 virtual PStringToString GetOptions()
const;
669 virtual bool GetOptionValue(
const PString & name, PString & value)
const;
670 virtual bool SetOptionValue(
const PString & name,
const PString & value);
671 virtual bool GetOptionBoolean(
const PString & name,
bool dflt)
const;
672 virtual bool SetOptionBoolean(
const PString & name,
bool value);
673 virtual int GetOptionInteger(
const PString & name,
int dflt)
const;
674 virtual bool SetOptionInteger(
const PString & name,
int value);
675 virtual double GetOptionReal(
const PString & name,
double dflt)
const;
676 virtual bool SetOptionReal(
const PString & name,
double value);
677 virtual PINDEX GetOptionEnum(
const PString & name, PINDEX dflt)
const;
678 virtual bool SetOptionEnum(
const PString & name, PINDEX value);
679 virtual PString GetOptionString(
const PString & name,
const PString & dflt)
const;
680 virtual bool SetOptionString(
const PString & name,
const PString & value);
681 virtual bool GetOptionOctets(
const PString & name, PBYTEArray & octets)
const;
682 virtual bool SetOptionOctets(
const PString & name,
const PBYTEArray & octets);
683 virtual bool SetOptionOctets(
const PString & name,
const BYTE * data, PINDEX length);
684 virtual bool AddOption(
OpalMediaOption * option, PBoolean overwrite =
false);
687 virtual bool ToNormalisedOptions();
688 virtual bool ToCustomisedOptions();
693 virtual bool IsValidForProtocol(
const PString & protocol)
const;
706 friend bool operator==(
const char * other,
const OpalMediaFormat & fmt);
707 friend bool operator!=(
const char * other,
const OpalMediaFormat & fmt);
708 friend bool operator==(
const PString & other,
const OpalMediaFormat & fmt);
709 friend bool operator!=(
const PString & other,
const OpalMediaFormat & fmt);
731 virtual PBoolean MakeUnique();
733 virtual void DestroyContents();
734 virtual void AssignContents(
const PContainer & c);
757 const char * fullName,
760 const char * encodingName,
761 PBoolean needsJitter,
781 const char * rtpEncodingName = NULL,
782 const char * protocol = NULL
799 const char * wildcard
816 const PString & wildcard
830 const char * wildcard
837 const PString & wildcard
842 virtual PObject * Clone()
const;
846 virtual Comparison Compare(
const PObject & obj)
const;
852 virtual void PrintOn(ostream & strm)
const;
856 virtual void ReadFrom(istream & strm);
862 bool ToNormalisedOptions();
867 bool ToCustomisedOptions();
896 PString
GetName()
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ?
"" : m_info->formatName; }
902 PBoolean
IsValid()
const { PWaitAndSignal m(m_mutex);
return m_info != NULL && m_info->IsValid(); }
907 PBoolean
IsTransportable()
const { PWaitAndSignal m(m_mutex);
return m_info != NULL && m_info->IsTransportable(); }
919 const char *
GetEncodingName()
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ?
"" : m_info->rtpEncodingName.GetPointer(); }
928 bool NeedsJitterBuffer()
const { PWaitAndSignal m(m_mutex);
return m_info != NULL && m_info->GetOptionBoolean(NeedsJitterOption(),
false); }
929 static const PString & NeedsJitterOption();
933 unsigned GetBandwidth()
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ? 0 : m_info->GetOptionInteger(MaxBitRateOption(), 0); }
934 static const PString & MaxBitRateOption();
935 static const PString & TargetBitRateOption();
941 PINDEX
GetFrameSize()
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ? 0 : m_info->GetOptionInteger(MaxFrameSizeOption(), 0); }
942 static const PString & MaxFrameSizeOption();
947 unsigned GetFrameTime()
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ? 0 : m_info->GetOptionInteger(FrameTimeOption(), 0); }
948 static const PString & FrameTimeOption();
955 AudioClockRate = 8000,
956 VideoClockRate = 90000
961 unsigned GetClockRate()
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ? 0 : m_info->GetOptionInteger(ClockRateOption(), 1000); }
962 static const PString & ClockRateOption();
966 static const PString & ProtocolOption();
974 static const PString & MaxTxPacketSizeOption();
979 PStringToString
GetOptions()
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ? PStringToString() : m_info->GetOptions(); }
983 PINDEX
GetOptionCount()
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ? 0 : m_info->options.GetSize(); }
990 )
const { PWaitAndSignal m(m_mutex);
return m_info->options[index]; }
997 const PString & name,
999 )
const { PWaitAndSignal m(m_mutex);
return m_info != NULL && m_info->GetOptionValue(name, value); }
1008 const PString & name,
1009 const PString & value
1010 ) { PWaitAndSignal m(m_mutex); MakeUnique();
return m_info != NULL && m_info->SetOptionValue(name, value); }
1016 const PString & name,
1018 )
const { PWaitAndSignal m(m_mutex);
return m_info != NULL && m_info->GetOptionBoolean(name, dflt); }
1027 const PString & name,
1029 ) { PWaitAndSignal m(m_mutex); MakeUnique();
return m_info != NULL && m_info->SetOptionBoolean(name, value); }
1035 const PString & name,
1037 )
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ? dflt : m_info->GetOptionInteger(name, dflt); }
1047 const PString & name,
1049 ) { PWaitAndSignal m(m_mutex); MakeUnique();
return m_info != NULL && m_info->SetOptionInteger(name, value); }
1055 const PString & name,
1057 )
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ? dflt : m_info->GetOptionReal(name, dflt); }
1066 const PString & name,
1068 ) { PWaitAndSignal m(m_mutex); MakeUnique();
return m_info != NULL && m_info->SetOptionReal(name, value); }
1075 const PString & name,
1077 )
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ? dflt : m_info->GetOptionEnum(name, dflt); }
1086 const PString & name,
1088 ) { PWaitAndSignal m(m_mutex); MakeUnique();
return m_info != NULL && m_info->SetOptionEnum(name, value); }
1094 const PString & name,
1095 const PString & dflt = PString::Empty()
1096 )
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ? dflt : m_info->GetOptionString(name, dflt); }
1105 const PString & name,
1106 const PString & value
1107 ) { PWaitAndSignal m(m_mutex); MakeUnique();
return m_info != NULL && m_info->SetOptionString(name, value); }
1113 const PString & name,
1115 )
const { PWaitAndSignal m(m_mutex);
return m_info != NULL && m_info->GetOptionOctets(name, octets); }
1124 const PString & name,
1125 const PBYTEArray & octets
1126 ) { PWaitAndSignal m(m_mutex); MakeUnique();
return m_info != NULL && m_info->SetOptionOctets(name, octets); }
1128 const PString & name,
1131 ) { PWaitAndSignal m(m_mutex); MakeUnique();
return m_info != NULL && m_info->SetOptionOctets(name, data, length); }
1136 static void GetAllRegisteredMediaFormats(
1143 static bool SetRegisteredMediaFormat(
1150 static bool RemoveRegisteredMediaFormat(
1159 PBoolean overwrite =
false 1160 ) { PWaitAndSignal m(m_mutex); MakeUnique();
return m_info != NULL && m_info->AddOption(option, overwrite); }
1165 bool HasOption(
const PString & name)
const { PWaitAndSignal m(m_mutex);
return m_info != NULL && m_info->FindOption(name) != NULL; }
1171 const PString & name
1172 )
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ? NULL : m_info->FindOption(name); }
1178 const PString & name
1179 )
const {
return dynamic_cast<T *
>(FindOption(name)); }
1186 bool IsValidForProtocol(
const PString & protocol)
const { PWaitAndSignal m(m_mutex);
return m_info != NULL && m_info->IsValidForProtocol(protocol); }
1188 time_t
GetCodecVersionTime()
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ? 0 : m_info->codecVersionTime; }
1192 PWaitAndSignal m(m_mutex);
1194 strm << setw(-1) << *m_info;
1201 void AdjustVideoArgs(
1202 PVideoDevice::OpenArgs & args
1207 virtual PBoolean
IsEmpty()
const { PWaitAndSignal m(m_mutex);
return m_info == NULL || !m_info->IsValid(); }
1208 operator PString()
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ?
"" : m_info->formatName; }
1209 operator const char *()
const { PWaitAndSignal m(m_mutex);
return m_info == NULL ?
"" : m_info->formatName; }
1210 bool operator==(
const char * other)
const { PWaitAndSignal m(m_mutex);
return m_info != NULL && m_info->formatName == other; }
1211 bool operator!=(
const char * other)
const { PWaitAndSignal m(m_mutex);
return m_info == NULL || m_info->formatName != other; }
1212 bool operator==(
const PString & other)
const { PWaitAndSignal m(m_mutex);
return m_info != NULL && m_info->formatName == other; }
1213 bool operator!=(
const PString & other)
const { PWaitAndSignal m(m_mutex);
return m_info == NULL || m_info->formatName != other; }
1222 static const PString & MediaPacketizationOption();
1223 static const PString & MediaPacketizationsOption();
1224 PStringSet GetMediaPacketizations()
const;
1225 void SetMediaPacketizations(
const PStringSet & packetizations);
1229 PBoolean SetSize(PINDEX) {
return true; }
1246 const char * fullName,
1248 const char * encodingName,
1257 virtual PObject * Clone()
const;
1269 const char * fullName,
1271 const char * encodingName,
1276 unsigned maxFrames = 256,
1277 unsigned clockRate = 8000,
1278 time_t timeStamp = 0
1281 static const PString & RxFramesPerPacketOption();
1282 static const PString & TxFramesPerPacketOption();
1283 static const PString & MaxFramesPerPacketOption();
1284 static const PString & ChannelsOption();
1292 const char * fullName,
1294 const char * encodingName,
1295 unsigned maxFrameWidth,
1296 unsigned maxFrameHeight,
1297 unsigned maxFrameRate,
1298 unsigned maxBitRate,
1301 virtual PObject * Clone()
const;
1314 const char * fullName,
1316 const char * encodingName,
1317 unsigned maxFrameWidth,
1318 unsigned maxFrameHeight,
1319 unsigned maxFrameRate,
1320 unsigned maxBitRate,
1321 time_t timeStamp = 0
1324 static const PString & FrameWidthOption();
1325 static const PString & FrameHeightOption();
1326 static const PString & MinRxFrameWidthOption();
1327 static const PString & MinRxFrameHeightOption();
1328 static const PString & MaxRxFrameWidthOption();
1329 static const PString & MaxRxFrameHeightOption();
1330 static const PString & TemporalSpatialTradeOffOption();
1331 static const PString & TxKeyFramePeriodOption();
1332 static const PString & RateControlPeriodOption();
1333 static const PString & RateControllerOption();
1353 enum { ContentRoleMask = 15 };
1355 static const PString & ContentRoleOption();
1356 static const PString & ContentRoleMaskOption();
1362 #define OPAL_PCM16 "PCM-16" 1363 #define OPAL_PCM16S "PCM-16S" 1364 #define OPAL_PCM16_16KHZ "PCM-16-16kHz" 1365 #define OPAL_PCM16S_16KHZ "PCM-16S-16kHz" 1366 #define OPAL_PCM16_32KHZ "PCM-16-32kHz" 1367 #define OPAL_PCM16S_32KHZ "PCM-16S-32kHz" 1368 #define OPAL_PCM16_48KHZ "PCM-16-48kHz" 1369 #define OPAL_PCM16S_48KHZ "PCM-16S-48kHz" 1370 #define OPAL_L16_MONO_8KHZ "Linear-16-Mono-8kHz" 1371 #define OPAL_L16_STEREO_8KHZ "Linear-16-Stereo-8kHz" 1372 #define OPAL_L16_MONO_16KHZ "Linear-16-Mono-16kHz" 1373 #define OPAL_L16_STEREO_16KHZ "Linear-16-Stereo-16kHz" 1374 #define OPAL_L16_MONO_32KHZ "Linear-16-Mono-32kHz" 1375 #define OPAL_L16_STEREO_32KHZ "Linear-16-Stereo-32kHz" 1376 #define OPAL_L16_MONO_48KHZ "Linear-16-Mono-48kHz" 1377 #define OPAL_L16_STEREO_48KHZ "Linear-16-Stereo-48kHz" 1378 #define OPAL_G711_ULAW_64K "G.711-uLaw-64k" 1379 #define OPAL_G711_ALAW_64K "G.711-ALaw-64k" 1380 #define OPAL_G722 "G.722" 1381 #define OPAL_G7221 "G.722.1" 1382 #define OPAL_G7222 "G.722.2" 1383 #define OPAL_G726_40K "G.726-40K" 1384 #define OPAL_G726_32K "G.726-32K" 1385 #define OPAL_G726_24K "G.726-24K" 1386 #define OPAL_G726_16K "G.726-16K" 1387 #define OPAL_G728 "G.728" 1388 #define OPAL_G729 "G.729" 1389 #define OPAL_G729A "G.729A" 1390 #define OPAL_G729B "G.729B" 1391 #define OPAL_G729AB "G.729A/B" 1392 #define OPAL_G7231 "G.723.1" 1393 #define OPAL_G7231_6k3 OPAL_G7231 1394 #define OPAL_G7231_5k3 "G.723.1(5.3k)" 1395 #define OPAL_G7231A_6k3 "G.723.1A(6.3k)" 1396 #define OPAL_G7231A_5k3 "G.723.1A(5.3k)" 1397 #define OPAL_GSM0610 "GSM-06.10" 1398 #define OPAL_GSMAMR "GSM-AMR" 1399 #define OPAL_iLBC "iLBC" 1400 #define OPAL_H261 "H.261" 1401 #define OPAL_H263 "H.263" 1402 #define OPAL_H264 "H.264" 1403 #define OPAL_H264_MODE0 "H.264-0" 1404 #define OPAL_H264_MODE1 "H.264-1" 1405 #define OPAL_MPEG4 "MPEG4" 1406 #define OPAL_RFC2833 "UserInput/RFC2833" 1407 #define OPAL_CISCONSE "NamedSignalEvent" 1408 #define OPAL_T38 "T.38" 1450 #if OPAL_T38_CAPABILITY 1456 #define OpalPCM16 GetOpalPCM16() 1457 #define OpalPCM16S GetOpalPCM16S() 1458 #define OpalPCM16_16KHZ GetOpalPCM16_16KHZ() 1459 #define OpalPCM16S_16KHZ GetOpalPCM16S_16KHZ() 1460 #define OpalPCM16_32KHZ GetOpalPCM16_32KHZ() 1461 #define OpalPCM16S_32KHZ GetOpalPCM16S_32KHZ() 1462 #define OpalPCM16_48KHZ GetOpalPCM16_48KHZ() 1463 #define OpalPCM16S_48KHZ GetOpalPCM16S_48KHZ() 1464 #define OpalL16_MONO_8KHZ GetOpalL16_MONO_8KHZ() 1465 #define OpalL16_STEREO_8KHZ GetOpalL16_STEREO_8KHZ() 1466 #define OpalL16_MONO_16KHZ GetOpalL16_MONO_16KHZ() 1467 #define OpalL16_STEREO_16KHZ GetOpalL16_STEREO_16KHZ() 1468 #define OpalL16_MONO_32KHZ GetOpalL16_MONO_32KHZ() 1469 #define OpalL16_STEREO_32KHZ GetOpalL16_STEREO_32KHZ() 1470 #define OpalL16_MONO_48KHZ GetOpalL16_MONO_48KHZ() 1471 #define OpalL16_STEREO_48KHZ GetOpalL16_STEREO_48KHZ() 1472 #define OpalG711_ULAW_64K GetOpalG711_ULAW_64K() 1473 #define OpalG711_ALAW_64K GetOpalG711_ALAW_64K() 1474 #define OpalG722 GetOpalG722() 1475 #define OpalG7221 GetOpalG7221() 1476 #define OpalG7222 GetOpalG7222() 1477 #define OpalG726_40K GetOpalG726_40K() 1478 #define OpalG726_32K GetOpalG726_32K() 1479 #define OpalG726_24K GetOpalG726_24K() 1480 #define OpalG726_16K GetOpalG726_16K() 1481 #define OpalG728 GetOpalG728() 1482 #define OpalG729 GetOpalG729() 1483 #define OpalG729A GetOpalG729A() 1484 #define OpalG729B GetOpalG729B() 1485 #define OpalG729AB GetOpalG729AB() 1486 #define OpalG7231_6k3 GetOpalG7231_6k3() 1487 #define OpalG7231_5k3 GetOpalG7231_5k3() 1488 #define OpalG7231A_6k3 GetOpalG7231A_6k3() 1489 #define OpalG7231A_5k3 GetOpalG7231A_5k3() 1490 #define OpalGSM0610 GetOpalGSM0610() 1491 #define OpalGSMAMR GetOpalGSMAMR() 1492 #define OpaliLBC GetOpaliLBC() 1493 #define OpalRFC2833 GetOpalRFC2833() 1494 #define OpalCiscoNSE GetOpalCiscoNSE() 1495 #define OpalT38 GetOpalT38() 1497 #define OpalL16Mono8kHz OpalL16_MONO_8KHZ 1498 #define OpalL16Mono16kHz OpalL16_MONO_16KHZ 1499 #define OpalG711uLaw OpalG711_ULAW_64K 1500 #define OpalG711ALaw OpalG711_ALAW_64K 1502 #define OPAL_T140 "T.140" 1503 #define OpalT140 GetOpalT140() 1507 #define OPAL_MSRP "MSRP" 1508 #define OpalMSRP GetOpalMSRP() 1513 #define OPAL_SIPIM "SIP-IM" 1514 #define OpalSIPIM GetOpalSIPIM() 1520 #pragma warning(default:4663) 1524 #endif // OPAL_OPAL_MEDIAFMT_H
PayloadTypes
Definition: rtp.h:86