Group PJMEDIA_FRAME

group PJMEDIA_FRAME

Frame.

Enums

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.

enumerator PJMEDIA_FRAME_TYPE_VIDEO

Video frame.

Functions

void pjmedia_frame_copy(pjmedia_frame *dst, const pjmedia_frame *src)

Copy one frame to another. If the destination frame’s size is smaller than the source frame’s, the destination buffer will be truncated.

Parameters:
  • src – Source frame.

  • dst – Destination frame.

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 – Length 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.

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.

struct pjmedia_frame
#include <frame.h>

This structure describes a media frame.

Public Members

pjmedia_frame_type type

Frame type.

void *buf

Pointer to buffer.

pj_size_t size

Frame size in bytes.

pj_timestamp timestamp

Frame timestamp.

pj_uint32_t bit_info

Bit info of the frame, sample case: a frame may not exactly start and end at the octet boundary, so this field may be used for specifying start & end bit offset.

struct pjmedia_frame_ext
#include <frame.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.

Public Members

pjmedia_frame base

Base frame info

pj_uint16_t samples_cnt

Number of samples in this frame

pj_uint16_t subframe_cnt

Number of (sub)frames in this frame

struct pjmedia_frame_ext_subframe
#include <frame.h>

This structure represents the individual subframes in the pjmedia_frame_ext structure.

Public Members

pj_uint16_t bitlen

Number of bits in the data

pj_uint8_t data[1]

Start of encoded data