libswresample/swresample.h File Reference

libswresample public header More...

#include <inttypes.h>
#include "libavutil/samplefmt.h"

Go to the source code of this file.

Defines

#define LIBSWRESAMPLE_VERSION_MAJOR   0
#define LIBSWRESAMPLE_VERSION_MINOR   5
#define LIBSWRESAMPLE_VERSION_MICRO   0
#define SWR_CH_MAX   16
 Maximum number of channels.
#define SWR_FLAG_RESAMPLE   1
 Force resampling even if equal sample rate.

Functions

struct SwrContextswr_alloc (void)
 Allocate SwrContext.
int swr_init (struct SwrContext *s)
 Initialize context after user parameters have been set.
struct SwrContextswr_alloc_set_opts (struct SwrContext *s, int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, int log_offset, void *log_ctx)
 Allocate SwrContext if needed and set/reset common parameters.
void swr_free (struct SwrContext **s)
 Free the given SwrContext and set the pointer to NULL.
int swr_convert (struct SwrContext *s, uint8_t *out[SWR_CH_MAX], int out_count, const uint8_t *in[SWR_CH_MAX], int in_count)
 Convert audio.
void swr_compensate (struct SwrContext *s, int sample_delta, int compensation_distance)
 Activate resampling compensation.
int swr_set_channel_mapping (struct SwrContext *s, const int *channel_map)
 Set a customized input channel mapping.


Detailed Description

libswresample public header

Definition in file swresample.h.


Define Documentation

#define LIBSWRESAMPLE_VERSION_MAJOR   0

Definition at line 32 of file swresample.h.

#define LIBSWRESAMPLE_VERSION_MICRO   0

Definition at line 34 of file swresample.h.

#define LIBSWRESAMPLE_VERSION_MINOR   5

Definition at line 33 of file swresample.h.

#define SWR_CH_MAX   16

Maximum number of channels.

Definition at line 36 of file swresample.h.

Referenced by main(), sane_layout(), and swri_rematrix_init().

#define SWR_FLAG_RESAMPLE   1

Force resampling even if equal sample rate.

Definition at line 38 of file swresample.h.

Referenced by do_audio_out(), and swr_init().


Function Documentation

struct SwrContext* swr_alloc ( void   )  [read]

Allocate SwrContext.

If you use this function you will need to set the parameters (manually or with swr_alloc_set_opts()) before calling swr_init().

See also:
swr_alloc_set_opts(), swr_init(), swr_free()
Returns:
NULL on error, allocated context otherwise

Definition at line 80 of file swresample.c.

Referenced by swr_alloc_set_opts().

struct SwrContext* swr_alloc_set_opts ( struct SwrContext s,
int64_t  out_ch_layout,
enum AVSampleFormat  out_sample_fmt,
int  out_sample_rate,
int64_t  in_ch_layout,
enum AVSampleFormat  in_sample_fmt,
int  in_sample_rate,
int  log_offset,
void *  log_ctx 
) [read]

Allocate SwrContext if needed and set/reset common parameters.

This function does not require s to be allocated with swr_alloc(). On the other hand, swr_alloc() can use swr_alloc_set_opts() to set the parameters on the allocated context.

Parameters:
s Swr context, can be NULL
out_ch_layout output channel layout (AV_CH_LAYOUT_*)
out_sample_fmt output sample format (AV_SAMPLE_FMT_*).
out_sample_rate output sample rate (frequency in Hz)
in_ch_layout input channel layout (AV_CH_LAYOUT_*)
in_sample_fmt input sample format (AV_SAMPLE_FMT_*).
in_sample_rate input sample rate (frequency in Hz)
log_offset logging level offset
log_ctx parent logging context, can be NULL
See also:
swr_init(), swr_free()
Returns:
NULL on error, allocated context otherwise

Definition at line 89 of file swresample.c.

Referenced by audio_decode_frame(), do_audio_out(), and main().

void swr_compensate ( struct SwrContext s,
int  sample_delta,
int  compensation_distance 
)

Activate resampling compensation.

Definition at line 248 of file resample.c.

Referenced by do_audio_out().

int swr_convert ( struct SwrContext s,
uint8_t *  out[SWR_CH_MAX],
int  out_count,
const uint8_t *  in[SWR_CH_MAX],
int  in_count 
)

Convert audio.

in and in_count can be set to 0 to flush the last few samples out at the end.

Parameters:
s allocated Swr context, with parameters set
out output buffers, only the first one need be set in case of packed audio
out_count amount of space available for output in samples per channel
in input buffers, only the first one need to be set in case of packed audio
in_count number of input samples available in one channel
Returns:
number of samples output per channel

Definition at line 399 of file swresample.c.

Referenced by audio_decode_frame(), do_audio_out(), and main().

void swr_free ( struct SwrContext **  s  ) 

Free the given SwrContext and set the pointer to NULL.

Definition at line 118 of file swresample.c.

Referenced by audio_decode_frame(), do_audio_out(), stream_component_close(), and transcode().

int swr_init ( struct SwrContext s  ) 

Initialize context after user parameters have been set.

Returns:
AVERROR error code in case of failure.

Definition at line 134 of file swresample.c.

Referenced by audio_decode_frame(), do_audio_out(), and main().

int swr_set_channel_mapping ( struct SwrContext s,
const int *  channel_map 
)

Set a customized input channel mapping.

Parameters:
s allocated Swr context, not yet initialized
channel_map customized input channel mapping (array of channel indexes, -1 for a muted channel)
Returns:
AVERROR error code in case of failure.

Definition at line 73 of file swresample.c.

Referenced by do_audio_out().


Generated on Fri Oct 26 02:43:53 2012 for FFmpeg by  doxygen 1.5.8