23 #include "libavutil/avassert.h"
24 #include "libavutil/avstring.h"
25 #include "libavutil/channel_layout.h"
26 #include "libavutil/common.h"
27 #include "libavutil/eval.h"
28 #include "libavutil/imgutils.h"
30 #include "libavutil/opt.h"
31 #include "libavutil/pixdesc.h"
32 #include "libavutil/rational.h"
33 #include "libavutil/samplefmt.h"
46 "ref[%p buf:%p data:%p linesize[%d, %d, %d, %d] pts:%"PRId64
" pos:%"PRId64,
52 ff_tlog(ctx,
" a:%d/%d s:%dx%d i:%c iskey:%d type:%c",
61 ff_tlog(ctx,
" cl:%"PRId64
"d n:%d r:%d",
67 ff_tlog(ctx,
"]%s", end ?
"\n" :
"");
83 #define LICENSE_PREFIX "libavfilter license: "
104 idx =
FFMIN(idx, *count);
112 if (!newpads || !newlinks)
115 memmove(*pads + idx + 1, *pads + idx,
sizeof(
AVFilterPad) * (*count - idx));
116 memmove(*links + idx + 1, *links + idx,
sizeof(
AVFilterLink*) * (*count - idx));
118 (*links)[idx] = NULL;
121 for (i = idx + 1; i < *
count; i++)
123 (*(
unsigned *)((
uint8_t *) (*links)[i] + padidx_off))++;
139 "Media type mismatch between the '%s' filter output pad %d (%s) and the '%s' filter input pad %d (%s)\n",
183 unsigned filt_srcpad_idx,
unsigned filt_dstpad_idx)
189 "between the filter '%s' and the filter '%s'\n",
193 if ((ret =
avfilter_link(filt, filt_dstpad_idx, link->
dst, dstpad_idx)) < 0) {
202 filt->
inputs[filt_srcpad_idx] = link;
225 for (i = 0; i < filter->
nb_inputs; i ++) {
237 case AVLINK_STARTINIT:
249 "with more than one input "
250 "must set config_props() "
251 "callbacks on all outputs\n");
254 }
else if ((ret = config_link(link)) < 0) {
256 "Failed to configure output pad on %s\n",
261 switch (link->
type) {
278 }
else if (!link->
w || !link->
h) {
280 "Video source filters must set their output link's "
281 "width and height\n");
297 if ((ret = config_link(link)) < 0) {
299 "Failed to configure input pad on %s\n",
315 "link[%p s:%dx%d fmt:%s %s->%s]%s",
316 link, link->
w, link->
h,
326 "link[%p r:%d cl:%s fmt:%s %s->%s]%s",
368 int i,
min = INT_MAX;
378 min =
FFMIN(min, val);
384 static const char *
const var_names[] = {
"t",
"n",
"pos", NULL };
412 NULL, NULL, NULL, NULL, 0, ctx->
priv);
415 "Error when evaluating the expression '%s' for enable\n",
439 if(!strcmp(cmd,
"ping")){
440 char local_res[256] = {0};
444 res_len =
sizeof(local_res);
447 if (res == local_res)
450 }
else if(!strcmp(cmd,
"enable")) {
468 if (!strcmp(f->
name, name))
485 || (!input->start_frame && !input->end_frame));
501 #if FF_API_OLD_FILTER_REGISTER
507 void avfilter_uninit(
void)
519 for (count = 0; pads->
name; count++)
559 #define OFFSET(x) offsetof(AVFilterContext, x)
560 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM
580 int *
ret,
int nb_jobs)
584 for (i = 0; i < nb_jobs; i++) {
585 int r =
func(ctx, arg, i, nb_jobs);
666 #if FF_API_AVFILTER_OPEN
670 return *filter_ctx ? 0 :
AVERROR(ENOMEM);
706 for (i = 0; i < filter->
nb_inputs; i++) {
746 const char *shorthand = NULL;
758 &parsed_key, &
value);
811 #if FF_API_AVFILTER_INIT_FILTER
864 "options, but options were provided: %s.\n", args);
868 #if FF_API_OLD_FILTER_OPTS
869 if ( !strcmp(filter->
filter->
name,
"format") ||
872 !strcmp(filter->
filter->
name,
"frei0r_src") ||
889 if (!strcmp(filter->
filter->
name,
"frei0r") ||
892 else if (!strcmp(filter->
filter->
name,
"frei0r_src"))
895 while (nb_leading--) {
898 p = copy + strlen(copy);
904 deprecated = strchr(p,
':') != NULL;
906 if (!strcmp(filter->
filter->
name,
"aevalsrc")) {
908 while ((p = strchr(p,
':')) && p[1] !=
':') {
909 const char *epos = strchr(p + 1,
'=');
910 const char *spos = strchr(p + 1,
':');
911 const int next_token_is_opt = epos && (!spos || epos < spos);
912 if (next_token_is_opt) {
920 if (p && *p ==
':') {
922 memmove(p, p + 1, strlen(p));
925 while ((p = strchr(p,
':')))
930 "'|' to separate the list items.\n");
944 if (!strncmp(args,
"filter=", 7))
979 return pads[pad_idx].
name;
984 return pads[pad_idx].
type;
1015 switch (link->
type) {
1022 default:
return AVERROR(EINVAL);
1030 switch (link->
type) {
1041 default:
return AVERROR(EINVAL);
1050 "Processing command time:%f command:%s arg:%s\n",
1078 int insamples = frame->
nb_samples, inpos = 0, nb_samples;
1091 "Samples dropped due to memory allocation failure.\n");
1100 nb_samples =
FFMIN(insamples,
1104 nb_samples, nb_channels, link->
format);
1105 inpos += nb_samples;
1106 insamples -= nb_samples;
int(* poll_frame)(AVFilterLink *link)
Frame poll callback.
const char const char void * val
void * av_calloc(size_t nmemb, size_t size) av_malloc_attrib
Allocate a block of nmemb * size bytes with alignment suitable for all memory accesses (including vec...
void ff_tlog_ref(void *ctx, AVFrame *ref, int end)
#define AVERROR_PATCHWELCOME
void avfilter_link_set_closed(AVFilterLink *link, int closed)
Set the closed field of a link.
AVFilterContext * ff_filter_alloc(const AVFilter *filter, const char *inst_name)
Allocate a new filter context and return it.
This structure describes decoded (raw) audio or video data.
int thread_type
Type of multithreading allowed for filters in this graph.
static int default_filter_frame(AVFilterLink *link, AVFrame *frame)
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
void avfilter_free(AVFilterContext *filter)
Free a filter context.
const char * name
Filter name.
AVFilterGraphInternal * internal
Opaque object for libavfilter internal use.
void * priv
private data for use by the filter
#define AV_LOG_WARNING
Something somehow does not look correct.
int av_escape(char **dst, const char *src, const char *special_chars, enum AVEscapeMode mode, int flags)
Escape string in src, and put the escaped string in an allocated string in *dst, which must be freed ...
#define LIBAVUTIL_VERSION_INT
AVFilterFormats * in_samplerates
Lists of channel layouts and sample rates used for automatic negotiation.
char * av_strdup(const char *s) av_malloc_attrib
Duplicate the string s.
int max_samples
Maximum number of samples to filter at once.
int(* init)(AVFilterContext *ctx)
Filter initialization function.
int h
agreed upon image height
AVDictionaryEntry * av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
Get the type of an AVFilterPad.
uint8_t ** extended_data
pointers to the data planes/channels.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
enum AVMediaType type
AVFilterPad type.
const AVFilter * avfilter_next(const AVFilter *prev)
Iterate over all registered filters.
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
int thread_type
Type of multithreading being allowed/used.
int is_disabled
the enabled state from the last expression evaluation
enum AVFilterLink::@27 init_state
stage of the initialization of the link properties (dimensions, etc)
#define AVFILTER_THREAD_SLICE
Process multiple parts of the frame concurrently.
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
const char * name
Pad name.
int priv_size
size of private data to allocate for the filter
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
Link two filters together.
struct AVFilterChannelLayouts * in_channel_layouts
const AVFilterPad * inputs
List of inputs, terminated by a zeroed element.
int(* request_frame)(AVFilterLink *link)
Frame request callback.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static const uint8_t offset[511][2]
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
static av_cold int end(AVCodecContext *avctx)
unsigned frame_requested
True if a frame is being requested on the link.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
const AVFilterPad * outputs
List of outputs, terminated by a zeroed element.
int flags
A combination of AVFILTER_FLAG_*.
void ff_command_queue_pop(AVFilterContext *filter)
static double av_q2d(AVRational a)
Convert rational to double.
int avfilter_config_links(AVFilterContext *filter)
Negotiate the media format, dimensions, etc of all inputs to a filter.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
#define AV_LOG_VERBOSE
Detailed information.
int interlaced_frame
The content of the picture is interlaced.
void(* uninit)(AVFilterContext *ctx)
Filter uninitialization function.
static void copy(LZOContext *c, int cnt)
Copies bytes from input to output buffer with checking.
static void free_link(AVFilterLink *link)
int(* process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags)
Make the filter instance process a command.
const OptionDef options[]
const AVOption * av_opt_next(void *obj, const AVOption *prev)
Iterate over all AVOptions belonging to obj.
A filter pad used for either input or output.
void ff_update_link_current_pts(AVFilterLink *link, int64_t pts)
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const
Rescale a 64-bit integer by 2 rational numbers.
A link between two filters.
static const AVClass avfilter_class
#define av_err2str(errnum)
#define LIBAVFILTER_VERSION_MICRO
int width
width and height of the video frame
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
int closed
True if the link is closed.
unsigned flags
Link processing flags.
Frame requests may need to loop in order to be fulfilled.
#define avpriv_atomic_ptr_cas
int( avfilter_action_func)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
A function pointer passed to the AVFilterGraph::execute callback to be executed multiple times...
int min_samples
Minimum number of samples to filter at once.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown; if left to 0/0, will be automatically be cop...
int sample_rate
samples per second
static const char * default_filter_name(void *filter_ctx)
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
int avfilter_link_get_channels(AVFilterLink *link)
Get the number of channels of a link.
unsigned nb_outputs
number of output pads
unsigned avfilter_version(void)
Return the LIBAVFILTER_VERSION_INT constant.
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
struct AVFilterGraph * graph
Graph the filter belongs to.
int(* filter_frame)(AVFilterLink *link, AVFrame *frame)
Filtering callback.
void av_dict_free(AVDictionary **m)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
int(* init_dict)(AVFilterContext *ctx, AVDictionary **options)
Should be set instead of init by the filters that want to pass a dictionary of AVOptions to nested co...
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
AVFilterContext * src
source filter
double * var_values
variable values for the enable expression
#define FF_TPRINTF_START(ctx, func)
AVFilterPad * dstpad
input pad on the dest filter
int av_frame_get_channels(const AVFrame *frame)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_samples_copy(uint8_t **dst, uint8_t *const *src, int dst_offset, int src_offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt)
Copy samples from src to dst.
#define av_unused
Disable warnings about deprecated features This is useful for sections of code kept for backward comp...
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
uint64_t channel_layout
Channel layout of the audio data.
int w
agreed upon image width
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
common internal API header
static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
static void * filter_child_next(void *obj, void *prev)
enum AVPictureType pict_type
Picture type of the frame.
char * name
name of this filter instance
unsigned nb_inputs
number of input pads
char * enable_str
enable expression string
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
static AVFilter * first_filter
struct AVFilterCommand * next
static const AVOption avfilter_options[]
const AVFilter * filter
the AVFilter of which this is an instance
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
#define ff_tlog(pctx,...)
struct AVFilter * next
Used by the filter registration system.
const AVClass * av_class
needed for av_log() and filters common options
static int ff_filter_frame_needs_framing(AVFilterLink *link, AVFrame *frame)
void * enable
parsed expression (AVExpr*)
#define LIBAVFILTER_VERSION_INT
int partial_buf_size
Size of the partial buffer to allocate.
int(* init_opaque)(AVFilterContext *ctx, void *opaque)
Filter initialization function, alternative to the init() callback.
Accept to parse a value without a key; the key will then be returned as NULL.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
int age_index
Index in the age array.
int format
agreed upon media format
int avfilter_init_str(AVFilterContext *ctx, const char *args)
Initialize a filter with the supplied parameters.
AVFilterFormats * out_samplerates
Main libavfilter public API header.
struct AVOption * option
a pointer to the first option specified in the class if any or NULL
AVFilterLink ** outputs
array of pointers to output links
int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, unsigned filt_srcpad_idx, unsigned filt_dstpad_idx)
Insert a filter in the middle of an existing link.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
#define AV_LOG_INFO
Standard information.
AVFrame * partial_buf
Buffer partially filled with samples to achieve a fixed/minimum size.
const AVClass * avfilter_get_class(void)
int offset
The offset relative to the context structure where the option value is stored.
void ff_tlog_link(void *ctx, AVFilterLink *link, int end)
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
int av_opt_set_dict(void *obj, struct AVDictionary **options)
Set all the options from a given dictionary on an object.
AVFilterPad * input_pads
array of input pads
const AVOption * av_opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags)
Look for an option in an object.
AVFilterFormats * out_formats
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link)
Update the position of a link in the age heap.
int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags)
Make the filter instance process a command.
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AVERROR_OPTION_NOT_FOUND
Describe the class of an AVClass context structure.
int sample_rate
Sample rate of the audio data.
static const char *const var_names[]
AVFilterLink ** inputs
array of pointers to input links
rational number numerator/denominator
int(* func)(AVBPrint *dst, const char *in, const char *arg)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterContext * dst
dest filter
AVFilter * avfilter_get_by_name(const char *name)
Get a filter definition matching the given name.
const char * avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx)
Get the name of an AVFilterPad.
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
static const int8_t filt[NUMTAPS]
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
static int default_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
enum AVMediaType type
filter media type
int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
Initialize a filter with the supplied dictionary of options.
const char * avfilter_license(void)
Return the libavfilter license.
void av_opt_free(void *obj)
Free all string and binary options in obj.
static int set_enable_expr(AVFilterContext *ctx, const char *expr)
#define FF_DISABLE_DEPRECATION_WARNINGS
#define AVFILTER_FLAG_SUPPORT_TIMELINE
Handy mask to test whether the filter supports or no the timeline feature (internally or generically)...
struct AVFilterGraph * graph
filtergraph this filter belongs to
#define AV_OPT_SEARCH_FAKE_OBJ
The obj passed to av_opt_find() is fake – only a double pointer to AVClass instead of a required poin...
uint64_t channel_layout
channel layout of current buffer (see libavutil/channel_layout.h)
int channels
Number of channels.
avfilter_execute_func * execute
static int filter_frame(AVFilterLink *inlink, AVFrame *insamplesref)
#define FFMPEG_CONFIGURATION
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter)
Remove a filter from a graph;.
AVFilterPad * srcpad
output pad on the source filter
avfilter_execute_func * thread_execute
#define FF_ENABLE_DEPRECATION_WARNINGS
int avfilter_register(AVFilter *filter)
Register a filter.
int top_field_first
If the content is interlaced, is top field displayed first.
const AVClass * priv_class
A class for the private data, used to declare filter private AVOptions.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=av_sample_fmt_is_planar(in_fmt);out_planar=av_sample_fmt_is_planar(out_fmt);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);ff_audio_convert_init_arm(ac);ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_dlog(ac->avr,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out
int av_opt_get_key_value(const char **ropts, const char *key_val_sep, const char *pairs_sep, unsigned flags, char **rkey, char **rval)
Extract a key-value pair from the beginning of a string.
const char * avfilter_configuration(void)
Return the libavfilter build-time configuration.
AVFilterPad * output_pads
array of output pads
static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
int key_frame
1 -> keyframe, 0-> not
struct AVFilterCommand * command_queue
int avfilter_pad_count(const AVFilterPad *pads)
Get the number of elements in a NULL-terminated array of AVFilterPads (e.g.
static int request_frame(AVFilterLink *outlink)
int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, AVFilterPad **pads, AVFilterLink ***links, AVFilterPad *newpad)
Insert a new pad.
struct AVFilterChannelLayouts * out_channel_layouts
int(* config_props)(AVFilterLink *link)
Link configuration callback.
#define AV_DICT_IGNORE_SUFFIX
#define av_assert0(cond)
assert() equivalent, that is always enabled.
double time
time expressed in seconds
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
static const AVClass * filter_child_class_next(const AVClass *prev)
int ff_poll_frame(AVFilterLink *link)
Poll a frame from the filter chain.
void avfilter_link_free(AVFilterLink **link)
Free the link in *link, and set its pointer to NULL.
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
int nb_samples
number of audio samples (per channel) described by this frame
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int64_t av_frame_get_pkt_pos(const AVFrame *frame)
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...) av_printf_format(3
Append output to a string, according to a format.
int64_t current_pts
Current timestamp of the link, as defined by the most recent frame(s), in AV_TIME_BASE units...
int64_t frame_count
Number of past frames sent through the link.
#define AV_NOPTS_VALUE
Undefined timestamp value.
void * av_mallocz(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int process_options(AVFilterContext *ctx, AVDictionary **options, const char *args)
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout)
Return a description of a channel layout.
char * arg
optional argument for the command