# OpalMediaFormatList Class Reference

`#include <mediafmt.h>`

## Public Member Functions

Construction
| OpalMediaFormatList ()
| OpalMediaFormatList (const OpalMediaFormat &format)
| OpalMediaFormatList (const OpalMediaFormatList &l)
Operations
OpalMediaFormatList & | operator+= (const char *wildcard)
OpalMediaFormatList & | operator+= (const PString &wildcard)
OpalMediaFormatList & | operator+= (const OpalMediaFormat &format)
OpalMediaFormatList & | operator+= (const OpalMediaFormatList &formats)
OpalMediaFormatList & | operator-= (const OpalMediaFormat &format)
OpalMediaFormatList & | operator-= (const OpalMediaFormatList &formats)
const_iterator | FindFormat (RTP_DataFrame::PayloadTypes rtpPayloadType, const unsigned clockRate=0, const char *rtpEncodingName=NULL, const char *protocol=NULL, const_iterator start=const_iterator()) const
const_iterator | FindFormat (const PString &wildcard, const_iterator start=const_iterator()) const
PBoolean | HasFormat (RTP_DataFrame::PayloadTypes rtpPayloadType) const
PBoolean | HasFormat (const PString &wildcard) const
bool | HasType (const OpalMediaType &type, bool mustBeTransportable=true) const
OpalMediaTypeList | GetMediaTypes () const
void | Reorder (const PStringArray &order)
void | Remove (const PStringArray &mask)
void | RemoveNonTransportable ()

## Detailed Description

This class contains a list of media formats.

## Constructor & Destructor Documentation

OpalMediaFormatList::OpalMediaFormatList | ( |  | ) |

Create an empty media format list.

OpalMediaFormatList::OpalMediaFormatList | ( | const OpalMediaFormat & | format | ) |

Create a media format list with one media format in it.

Parameters:

  format | Format to add

OpalMediaFormatList::OpalMediaFormatList | ( | const OpalMediaFormatList & | l | ) | `[inline]`

Create a copy of a media format list.

## Member Function Documentation

const_iterator OpalMediaFormatList::FindFormat | ( | const PString & | wildcard,
|  | const_iterator | start = `const_iterator()` |
| ) |  |  | const

Get a position in the list of the first entry matching the wildcard. The wildcard string is a string match using several special characters.

The '*' character indicates substrings, for example: "G.711*" would match "G.711-uLaw-64k" and "G.711-ALaw-64k".

The '@' character indicates a type of media format, so say "\@video" would find the first video codec.

The '!' character indicates a negative test. That is the first entry that does NOT match the string is returned. The string after the '!' may contain '*' and '@' characters.

Returns P_MAX_INDEX if not in list.

Parameters:

  wildcard | Wildcard string name.
  start | Starting position iterator for search

const_iterator OpalMediaFormatList::FindFormat | ( | RTP_DataFrame::PayloadTypes | rtpPayloadType,
|  | const unsigned | clockRate = `0`,
|  | const char * | rtpEncodingName = `NULL`,
|  | const char * | protocol = `NULL`,
|  | const_iterator | start = `const_iterator()` |
| ) |  |  | const

Get a format iterator in the list matching the payload type, etc. If the `clockRate` is 0 then it takes no part in the search.

The `rtpEncodingName`, if not NULL or empty string, is searched for first and only if not found is the payload type used. This is because it is possible (though discouraged) for someone to override a standard payload type, e.g. GSM, with another encoding name.

If the `protocol` is NULL or empty string, then it takes no part in the search.

The search begins at the start iterator, if this is end() or simply const_iterator() then the search is started at the begining.

Returns end() if not in list.

Parameters:

  rtpPayloadType | RTP payload type code
  clockRate | clock rate
  rtpEncodingName | RTP payload type name
  protocol | protocol to be valid for (if NULL, then all)
  start | location to start search

OpalMediaTypeList OpalMediaFormatList::GetMediaTypes | ( |  | ) | const

Get list of all media types in format list.

PBoolean OpalMediaFormatList::HasFormat | ( | const PString & | wildcard | ) | const`[inline]`

Determine if a format matching the wildcard is in the list. The wildcard string is a simple substring match using the '*' character. For example: "G.711*" would match "G.711-uLaw-64k" and "G.711-ALaw-64k".

Parameters:

  wildcard | Wildcard string name.

PBoolean OpalMediaFormatList::HasFormat | ( | RTP_DataFrame::PayloadTypes | rtpPayloadType | ) | const`[inline]`

Determine if a format matching the payload type is in the list.

Parameters:

  rtpPayloadType | RTP payload type code

bool OpalMediaFormatList::HasType | ( | const OpalMediaType & | type,
|  | bool | mustBeTransportable = `true` |
| ) |  |  | const

Determine if a list contains a specific media type

OpalMediaFormatList& OpalMediaFormatList::operator+= | ( | const OpalMediaFormatList & | formats | ) |

Add a format to the list. If the format is invalid or already in the list then it is not added.

Parameters:

  formats | Formats to add

OpalMediaFormatList& OpalMediaFormatList::operator+= | ( | const OpalMediaFormat & | format | ) |

Add a format to the list. If the format is invalid or already in the list then it is not added.

Parameters:

  format | Format to add

OpalMediaFormatList& OpalMediaFormatList::operator+= | ( | const PString & | wildcard | ) |

Add a format(s) to the list. If any format is invalid or already in the list then it is not added.

Parameters:

  wildcard | Wildcard for formats to add

OpalMediaFormatList& OpalMediaFormatList::operator+= | ( | const char * | wildcard | ) | `[inline]`

Add a format(s) to the list. If any format is invalid or already in the list then it is not added.

Parameters:

  wildcard | Wildcard for formats to add

OpalMediaFormatList& OpalMediaFormatList::operator-= | ( | const OpalMediaFormatList & | formats | ) |

Remove a format to the list. If the format is invalid or not in the list then this does nothing.

Parameters:

  formats | Formats to remove

OpalMediaFormatList& OpalMediaFormatList::operator-= | ( | const OpalMediaFormat & | format | ) |

Remove a format to the list. If the format is invalid or not in the list then this does nothing.

Parameters:

  format | Format to remove

void OpalMediaFormatList::Remove | ( | const PStringArray & | mask | ) |

Remove all the formats specified. Each string in the array is checked using the wildcard matching algorithm in FindFormat().

The '*' character indicates substrings, for example: "G.711*" would remove "G.711-uLaw-64k" and "G.711-ALaw-64k".

The '@' character indicates a type of media format, so say "\@video" would remove all video codecs.

The '!' character indicates a negative test. That is the entres that do NOT match the string are removed. The string after the '!' may contain '*' and '@' characters.

I should be noted that when the ! operator is used, they are combined differently to the usual application of each entry in turn. Thus, the array {"!A","!B"} will result in keeping both A and B formats.

void OpalMediaFormatList::RemoveNonTransportable | ( |  | ) |

Remove all the non-transportable formats specified.

void OpalMediaFormatList::Reorder | ( | const PStringArray & | order | ) |

Reorder the formats in the list. The order variable is an array of names and the list is reordered according to the order in that array.

Each string in the array is checked using the wildcard matching algorithm similar to FindFormat().

The '*' character indicates substrings, for example: "G.711*" would match "G.711-uLaw-64k" and "G.711-ALaw-64k".

The '@' character indicates a type of media format, so say "\@video" would sort by video codec.

The '!' character is not supported.

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

- mediafmt.h