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 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 []
 
static const AVFilterPad avfilter_af_aformat_inputs []
 
static const AVFilterPad avfilter_af_aformat_outputs []
 
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, sep; \
int ret; \
if (str && strchr(str, ',')) { \
av_log(ctx, AV_LOG_WARNING, "This syntax is deprecated, use '|' to "\
"separate %s.\n", desc); \
sep = ','; \
} else \
sep = '|'; \
\
while (cur) { \
type fmt; \
next = strchr(cur, sep); \
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 93 of file af_aformat.c.

Referenced by init().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 99 of file af_aformat.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 114 of file af_aformat.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 123 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.

◆ avfilter_af_aformat_inputs

const AVFilterPad avfilter_af_aformat_inputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}

Definition at line 144 of file af_aformat.c.

◆ avfilter_af_aformat_outputs

const AVFilterPad avfilter_af_aformat_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}

Definition at line 152 of file af_aformat.c.

◆ ff_af_aformat

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,
.query_formats = query_formats,
.priv_size = sizeof(AFormatContext),
.priv_class = &aformat_class,
}

Definition at line 160 of file af_aformat.c.

AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:200
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
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_aformat.c:114
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:194
OFFSET
#define OFFSET(x)
Definition: af_aformat.c:48
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
F
#define F
Definition: af_aformat.c:50
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_aformat.c:123
ctx
AVFormatContext * ctx
Definition: movenc.c:48
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:99
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
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
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:117
AFormatContext
Definition: af_aformat.c:36
avfilter_af_aformat_inputs
static const AVFilterPad avfilter_af_aformat_inputs[]
Definition: af_aformat.c:144
ret
ret
Definition: filter_design.txt:187
desc
const char * desc
Definition: libsvtav1.c:79
avfilter_af_aformat_outputs
static const AVFilterPad avfilter_af_aformat_outputs[]
Definition: af_aformat.c:152
convert_header.str
string str
Definition: convert_header.py:20
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
A
#define A
Definition: af_aformat.c:49