Group PJMEDIA_TYPES

group PJMEDIA_TYPES

Basic PJMEDIA types and operations.

Defines

PJMEDIA_DIR_CAPTURE

Direction is capturing audio frames.

PJMEDIA_DIR_PLAYBACK

Direction is playback of audio frames.

PJMEDIA_DIR_CAPTURE_PLAYBACK

Direction is both capture and playback.

PJMEDIA_PORT_SIGNATURE(a, b, c, d)

Create 32bit port signature from ASCII characters.

PJMEDIA_FORMAT_PACK(C1, C2, C3, C4)

Macro for packing format.

Typedefs

typedef struct pjmedia_endpt pjmedia_endpt

Opaque declaration of media endpoint.

typedef struct pjmedia_stream pjmedia_stream

Enums

enum pjmedia_type

Top most media type.

Values:

enumerator PJMEDIA_TYPE_NONE

No type.

enumerator PJMEDIA_TYPE_AUDIO

The media is audio

enumerator PJMEDIA_TYPE_VIDEO

The media is video.

enumerator PJMEDIA_TYPE_UNKNOWN

Unknown media type, in this case the name will be specified in encoding_name.

enumerator PJMEDIA_TYPE_APPLICATION

The media is application.

enum pjmedia_tp_proto

Media transport protocol.

Values:

enumerator PJMEDIA_TP_PROTO_NONE

No transport type

enumerator PJMEDIA_TP_PROTO_RTP_AVP

RTP using A/V profile

enumerator PJMEDIA_TP_PROTO_RTP_SAVP

Secure RTP

enumerator PJMEDIA_TP_PROTO_UNKNOWN

Unknown

enum pjmedia_dir

Media direction.

Values:

enumerator PJMEDIA_DIR_NONE

None

enumerator PJMEDIA_DIR_ENCODING

Encoding (outgoing to network) stream

enumerator PJMEDIA_DIR_DECODING

Decoding (incoming from network) stream.

enumerator PJMEDIA_DIR_ENCODING_DECODING

Incoming and outgoing stream.

enum pjmedia_format_id

This enumeration describes format ID.

Values:

enumerator PJMEDIA_FORMAT_L16

16bit linear

enumerator PJMEDIA_FORMAT_PCM

Alias for PJMEDIA_FORMAT_L16

enumerator PJMEDIA_FORMAT_PCMA

G.711 ALAW

enumerator PJMEDIA_FORMAT_ALAW

Alias for PJMEDIA_FORMAT_PCMA

enumerator PJMEDIA_FORMAT_PCMU

G.711 ULAW

enumerator PJMEDIA_FORMAT_ULAW

Aliaw for PJMEDIA_FORMAT_PCMU

enumerator PJMEDIA_FORMAT_AMR

AMR narrowband

enumerator PJMEDIA_FORMAT_G729

ITU G.729

enumerator PJMEDIA_FORMAT_ILBC

Internet Low Bit-Rate Codec (ILBC)

enum pjmedia_frame_type

Types of media frame.

Values:

enumerator PJMEDIA_FRAME_TYPE_NONE

No frame.

enumerator PJMEDIA_FRAME_TYPE_AUDIO

Normal audio frame.

enumerator PJMEDIA_FRAME_TYPE_EXTENDED

Extended audio frame.

Functions

void pjmedia_zero_samples(pj_int16_t *samples, unsigned count)

This is a general purpose function set PCM samples to zero. Since this function is needed by many parts of the library, by putting this functionality in one place, it enables some. clever people to optimize this function.

Parameters
  • samples – The 16bit PCM samples.

  • count – Number of samples.

void pjmedia_copy_samples(pj_int16_t *dst, const pj_int16_t *src, unsigned count)

This is a general purpose function to copy samples from/to buffers with equal size. Since this function is needed by many parts of the library, by putting this functionality in one place, it enables some. clever people to optimize this function.

void pjmedia_move_samples(pj_int16_t *dst, const pj_int16_t *src, unsigned count)

This is a general purpose function to copy samples from/to buffers with equal size. Since this function is needed by many parts of the library, by putting this functionality in one place, it enables some. clever people to optimize this function.

void pjmedia_frame_ext_append_subframe(pjmedia_frame_ext *frm, const void *src, unsigned bitlen, unsigned samples_cnt)

Append one subframe to pjmedia_frame_ext.

Parameters
  • frm – The pjmedia_frame_ext.

  • src – Subframe data.

  • bitlen – Lenght of subframe, in bits.

  • samples_cnt – Number of audio samples in subframe.

pjmedia_frame_ext_subframe *pjmedia_frame_ext_get_subframe(const pjmedia_frame_ext *frm, unsigned n)

Get a subframe from pjmedia_frame_ext.

Parameters
Returns

The n-th subframe, or NULL if n is out-of-range.

unsigned pjmedia_frame_ext_copy_payload(const pjmedia_frame_ext *frm, void *dst, unsigned maxlen)

Extract all frame payload to the specified buffer.

Parameters
  • frm – The frame.

  • dst – Destination buffer.

  • maxlen – Maximum size to copy (i.e. the size of the destination buffer).

Returns

Total size of payload copied.

pj_status_t pjmedia_frame_ext_pop_subframes(pjmedia_frame_ext *frm, unsigned n)

Pop out first n subframes from pjmedia_frame_ext.

Parameters
Returns

PJ_SUCCESS when successful.

struct pjmedia_sock_info
#include <types.h>

Media socket info is used to describe the underlying sockets to be used as media transport.

struct pjmedia_format
#include <types.h>

Media format information.

struct pjmedia_frame
#include <types.h>

This structure describes a media frame.

struct pjmedia_frame_ext
#include <types.h>

The pjmedia_frame_ext is used to carry a more complex audio frames than the typical PCM audio frames, and it is signaled by setting the “type” field of a pjmedia_frame to PJMEDIA_FRAME_TYPE_EXTENDED. With this set, application may typecast pjmedia_frame to pjmedia_frame_ext.

This structure may contain more than one audio frames, which subsequently will be called subframes in this structure. The subframes section immediately follows the end of this structure, and each subframe is represented by pjmedia_frame_ext_subframe structure. Every next subframe immediately follows the previous subframe, and all subframes are byte-aligned although its payload may not be byte-aligned.

struct pjmedia_frame_ext_subframe
#include <types.h>

This structure represents the individual subframes in the pjmedia_frame_ext structure.