Group PJMEDIA_RESAMPLE

group PJMEDIA_RESAMPLE

Sample rate conversion algorithm.

This section describes the base resampling functions. In addition to this, application can use the Resample Port which provides media port abstraction for the base resampling algorithm.

Typedefs

typedefPJ_BEGIN_DECL struct pjmedia_resample pjmedia_resample

Opaque resample session.

Functions

pj_status_t pjmedia_resample_create(pj_pool_t *pool, pj_bool_t high_quality, pj_bool_t large_filter, unsigned channel_count, unsigned rate_in, unsigned rate_out, unsigned samples_per_frame, pjmedia_resample **p_resample)

Create a frame based resample session.

Parameters
  • pool – Pool to allocate the structure and buffers.

  • high_quality – If true, then high quality conversion will be used, at the expense of more CPU and memory, because temporary buffer needs to be created.

  • large_filter – If true, large filter size will be used.

  • channel_count – Number of channels.

  • rate_in – Clock rate of the input samples.

  • rate_out – Clock rate of the output samples.

  • samples_per_frame – Number of samples per frame in the input.

  • p_resample – Pointer to receive the resample session.

Returns

PJ_SUCCESS on success.

void pjmedia_resample_run(pjmedia_resample *resample, const pj_int16_t *input, pj_int16_t *output)

Use the resample session to resample a frame. The frame must have the same size and settings as the resample session, or otherwise the behavior is undefined.

Parameters
  • resample – The resample session.

  • input – Buffer containing the input samples.

  • output – Buffer to store the output samples.

unsigned pjmedia_resample_get_input_size(pjmedia_resample *resample)

Get the input frame size of a resample session.

Parameters

resample – The resample session.

Returns

The frame size, in number of samples.

void pjmedia_resample_destroy(pjmedia_resample *resample)

Destroy the resample.

Parameters

resample – The resample session.