Group PJSIP_MSG_MEDIA

group PJSIP_MSG_MEDIA

Media/MIME type declaration and manipulations.

Functions

void pjsip_media_type_init(pjsip_media_type *mt, pj_str_t *type, pj_str_t *subtype)

Initialize the media type with the specified type and subtype string.

Parameters
  • mt – The media type.

  • type – Optionally specify the media type.

  • subtype – Optionally specify the media subtype.

void pjsip_media_type_init2(pjsip_media_type *mt, char *type, char *subtype)

Initialize the media type with the specified type and subtype string.

Parameters
  • mt – The media type.

  • type – Optionally specify the media type.

  • subtype – Optionally specify the media subtype.

int pjsip_media_type_cmp(const pjsip_media_type *mt1, const pjsip_media_type *mt2, int cmp_param)

Compare two media types.

Parameters
  • mt1 – The first media type.

  • mt2 – The second media type.

  • cmp_param – Specify how to compare the media type parameters:

    • 0: do not compare parameters

    • 1: compare parameters but ignore parameters that only appear in one of the media type.

    • 2: compare the parameters.

Returns

Zero if both media types are equal, -1 if mt1 < mt2, 1 if mt1 > mt2.

void pjsip_media_type_cp(pj_pool_t *pool, pjsip_media_type *dst, const pjsip_media_type *src)

Copy SIP media type to another.

Parameters
  • pool – Pool to duplicate strings.

  • dst – Destination structure.

  • src – Source structure.

int pjsip_media_type_print(char *buf, unsigned len, const pjsip_media_type *mt)

Print media type to the specified buffer.

Parameters
  • buf – Destination buffer.

  • len – Length of the buffer.

  • mt – The media type to be printed.

Returns

The number of characters printed to the buffer, or -1 if there’s not enough space in the buffer.

struct pjsip_media_type
#include <sip_msg.h>

This structure describes SIP media type, as used for example in Accept and Content-Type header..