Home --> Documentations --> PJMEDIA Reference

Sample rate conversion algorithm. More...


typedef typedefPJ_BEGIN_DECL struct pjmedia_resample pjmedia_resample


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)
void pjmedia_resample_run (pjmedia_resample *resample, const pj_int16_t *input, pj_int16_t *output)
unsigned pjmedia_resample_get_input_size (pjmedia_resample *resample)
void pjmedia_resample_destroy (pjmedia_resample *resample)

Detailed Description

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.

Typedef Documentation

◆ pjmedia_resample

typedef typedefPJ_BEGIN_DECL struct pjmedia_resample pjmedia_resample

Opaque resample session.

Function Documentation

◆ pjmedia_resample_create()

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.

poolPool to allocate the structure and buffers.
high_qualityIf true, then high quality conversion will be used, at the expense of more CPU and memory, because temporary buffer needs to be created.
large_filterIf true, large filter size will be used.
channel_countNumber of channels.
rate_inClock rate of the input samples.
rate_outClock rate of the output samples.
samples_per_frameNumber of samples per frame in the input.
p_resamplePointer to receive the resample session.
PJ_SUCCESS on success.

◆ pjmedia_resample_run()

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.

resampleThe resample session.
inputBuffer containing the input samples.
outputBuffer to store the output samples.

◆ pjmedia_resample_get_input_size()

unsigned pjmedia_resample_get_input_size ( pjmedia_resample resample)

Get the input frame size of a resample session.

resampleThe resample session.
The frame size, in number of samples.

◆ pjmedia_resample_destroy()

void pjmedia_resample_destroy ( pjmedia_resample resample)

Destroy the resample.

resampleThe resample session.


PJMEDIA small footprint Open Source media stack
Copyright (C) 2006-2008 Teluu Inc.