31 #ifndef OPAL_OPAL_MEDIATYPE_H
32 #define OPAL_OPAL_MEDIATYPE_H
36 #include <ptlib/pfactory.h>
37 #include <ptlib/bitwise_enum.h>
78 : std::string(str) { }
81 : std::string(str) { }
84 : std::string((const char *)str) { }
90 #if OPAL_T38_CAPABILITY
105 (OfferInactive, Receive, Transmit, DontOffer),
106 ReceiveTransmit = Receive|Transmit,
107 TransmitReceive = Receive|Transmit);
111 class AutoStartMap :
public std::map<OpalMediaType, OpalMediaType::AutoStartMode>
116 bool Add(
const PString & stringOption);
117 bool Add(
const PCaselessString & mediaTypeName,
const PCaselessString & modeName);
131 return strm << mediaType.c_str();
134 ostream &
operator<<(ostream & strm, OpalMediaType::AutoStartMode mode);
142 class SDPMediaDescription;
154 const char * mediaType,
155 const char * mediaSession,
156 unsigned defaultSessionId = 0,
157 OpalMediaType::AutoStartMode autoStart = OpalMediaType::DontOffer
174 void SetAutoStart(OpalMediaType::AutoStartMode v,
bool on);
185 virtual PString GetSDPMediaType()
const;
186 virtual PString GetSDPTransportType()
const;
189 virtual bool MatchesSDP(
190 const PCaselessString & sdpMediaType,
191 const PCaselessString & sdpTransport,
192 const PStringArray & sdpLines,
197 virtual SDPMediaDescription * CreateSDPMediaDescription(
218 #define OPAL_INSTANTIATE_MEDIATYPE2(cls, name) \
219 PFACTORY_CREATE(OpalMediaTypesFactory, cls, name, true)
221 #define OPAL_INSTANTIATE_MEDIATYPE(cls) \
222 OPAL_INSTANTIATE_MEDIATYPE2(cls, cls::Name())
224 #define OPAL_MEDIATYPE(clsBase) \
225 OPAL_INSTANTIATE_MEDIATYPE2(clsBase##Definition, clsBase##Definition::Name()); \
226 const OpalMediaType & clsBase##Type() { static OpalMediaType t(clsBase##Definition::Name()); return t; }
229 template <const
char * Type,
unsigned SessionId = 0>
233 static const char *
Name() {
return Type; }
240 #define OPAL_INSTANTIATE_SIMPLE_MEDIATYPE(cls, name, ...) \
241 namespace OpalMediaTypeSpace { extern const char cls[] = name; }; \
242 typedef SimpleMediaType<OpalMediaTypeSpace::cls, ##__VA_ARGS__> cls; \
243 OPAL_INSTANTIATE_MEDIATYPE(cls) \
255 const char * mediaType,
256 unsigned defaultSessionId = 0,
257 OpalMediaType::AutoStartMode autoStart = OpalMediaType::DontOffer
261 virtual bool MatchesSDP(
const PCaselessString &,
const PCaselessString &,
const PStringArray &, PINDEX);
269 static const char *
Name();
284 static const char *
Name();
299 static const char *
Name();
306 #if OPAL_T38_CAPABILITY
311 static const char * Name();
312 static const PCaselessString & UDPTL();
314 OpalFaxMediaDefinition();
317 virtual PString GetSDPMediaType()
const;
318 virtual PString GetSDPTransportType()
const;
320 SDPMediaDescription * CreateSDPMediaDescription(
326 #endif // OPAL_T38_CAPABILITY
332 #endif // OPAL_OPAL_MEDIATYPE_H