FFmpeg
Data Structures | Macros | Functions | Variables
af_aformat.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/opt.h"
#include "audio.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  AFormatContext
 

Macros

#define OFFSET(x)   offsetof(AFormatContext, x)
 
#define A   AV_OPT_FLAG_AUDIO_PARAM
 
#define F   AV_OPT_FLAG_FILTERING_PARAM
 
#define PARSE_FORMATS(str, type, list, add_to_list, get_fmt, none, desc)
 

Functions

 AVFILTER_DEFINE_CLASS (aformat)
 
static int get_sample_rate (const char *samplerate)
 
static int parse_channel_layouts (AVFilterContext *ctx)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 

Variables

static const AVOption aformat_options []
 
const AVFilter ff_af_aformat
 

Detailed Description

format audio filter

Definition in file af_aformat.c.

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)    offsetof(AFormatContext, x)

Definition at line 48 of file af_aformat.c.

◆ A

#define A   AV_OPT_FLAG_AUDIO_PARAM

Definition at line 49 of file af_aformat.c.

◆ F

Definition at line 50 of file af_aformat.c.

◆ PARSE_FORMATS

#define PARSE_FORMATS (   str,
  type,
  list,
  add_to_list,
  get_fmt,
  none,
  desc 
)
Value:
do { \
char *next, *cur = str; \
int ret; \
\
while (cur) { \
type fmt; \
next = strchr(cur, '|'); \
if (next) \
*next++ = 0; \
if ((fmt = get_fmt(cur)) == none) { \
av_log(ctx, AV_LOG_ERROR, "Error parsing " desc ": %s.\n", cur);\
return AVERROR(EINVAL); \
} \
if ((ret = add_to_list(&list, fmt)) < 0) { \
return ret; \
} \
\
cur = next; \
} \
} while (0)

Definition at line 63 of file af_aformat.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( aformat  )

◆ get_sample_rate()

static int get_sample_rate ( const char *  samplerate)
static

Definition at line 86 of file af_aformat.c.

Referenced by init().

◆ parse_channel_layouts()

static int parse_channel_layouts ( AVFilterContext ctx)
static

Definition at line 92 of file af_aformat.c.

Referenced by init().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 120 of file af_aformat.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 136 of file af_aformat.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 145 of file af_aformat.c.

Variable Documentation

◆ aformat_options

const AVOption aformat_options[]
static
Initial value:
= {
{ "sample_fmts", "A '|'-separated list of sample formats.", OFFSET(formats_str), AV_OPT_TYPE_STRING, .flags = A|F },
{ "f", "A '|'-separated list of sample formats.", OFFSET(formats_str), AV_OPT_TYPE_STRING, .flags = A|F },
{ "sample_rates", "A '|'-separated list of sample rates.", OFFSET(sample_rates_str), AV_OPT_TYPE_STRING, .flags = A|F },
{ "r", "A '|'-separated list of sample rates.", OFFSET(sample_rates_str), AV_OPT_TYPE_STRING, .flags = A|F },
{ "channel_layouts", "A '|'-separated list of channel layouts.", OFFSET(channel_layouts_str), AV_OPT_TYPE_STRING, .flags = A|F },
{ "cl", "A '|'-separated list of channel layouts.", OFFSET(channel_layouts_str), AV_OPT_TYPE_STRING, .flags = A|F },
{ NULL }
}

Definition at line 51 of file af_aformat.c.

◆ ff_af_aformat

const AVFilter ff_af_aformat
Initial value:
= {
.name = "aformat",
.description = NULL_IF_CONFIG_SMALL("Convert the input audio to one of the specified formats."),
.init = init,
.uninit = uninit,
.priv_size = sizeof(AFormatContext),
.priv_class = &aformat_class,
}

Definition at line 166 of file af_aformat.c.

AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_aformat.c:136
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
OFFSET
#define OFFSET(x)
Definition: af_aformat.c:48
F
#define F
Definition: af_aformat.c:50
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_aformat.c:145
ctx
AVFormatContext * ctx
Definition: movenc.c:49
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
if
if(ret)
Definition: filter_design.txt:179
NULL
#define NULL
Definition: coverity.c:32
init
static av_cold int init(AVFilterContext *ctx)
Definition: af_aformat.c:120
list
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining list
Definition: filter_design.txt:25
ff_audio_default_filterpad
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
Definition: audio.c:33
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
AFormatContext
Definition: af_aformat.c:36
ret
ret
Definition: filter_design.txt:187
AVFILTER_FLAG_METADATA_ONLY
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Definition: avfilter.h:133
desc
const char * desc
Definition: libsvtav1.c:75
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:239
A
#define A
Definition: af_aformat.c:49