23 #include "libavfilter/avfilter.h"
24 #include "libavfilter/buffersink.h"
26 #include "libavresample/avresample.h"
28 #include "libavutil/avassert.h"
29 #include "libavutil/avstring.h"
30 #include "libavutil/bprint.h"
31 #include "libavutil/channel_layout.h"
32 #include "libavutil/opt.h"
33 #include "libavutil/pixdesc.h"
34 #include "libavutil/pixfmt.h"
35 #include "libavutil/imgutils.h"
36 #include "libavutil/samplefmt.h"
61 "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
75 for (; *p != -1; p++) {
84 "Incompatible sample format '%s' for codec '%s', auto-selecting format '%s'\n",
142 #define DEF_CHOOSE_FORMAT(type, var, supported_list, none, get_name) \
143 static char *choose_ ## var ## s(OutputStream *ost) \
145 if (ost->st->codec->var != none) { \
146 get_name(ost->st->codec->var); \
147 return av_strdup(name); \
148 } else if (ost->enc && ost->enc->supported_list) { \
150 AVIOContext *s = NULL; \
154 if (avio_open_dyn_buf(&s) < 0) \
157 for (p = ost->enc->supported_list; *p != none; p++) { \
159 avio_printf(s, "%s|", name); \
161 len = avio_close_dyn_buf(s, &ret); \
203 ist->filters[ist->nb_filters - 1] = fg->
inputs[0];
228 int file_idx = strtol(in->
name, &p, 0);
239 if (stream_type != type &&
261 if (i == nb_input_streams) {
263 "unlabeled input pad %d on filter %s\n", in->
pad_idx,
286 const char *filter_name)
301 "recording time.\n", name);
309 if (duration != INT64_MAX) {
349 name, NULL, NULL, fg->
graph);
358 snprintf(args,
sizeof(args),
"%d:%d:0x%X",
362 snprintf(name,
sizeof(name),
"scaler for output stream %d:%d",
365 name, args, NULL, fg->
graph)) < 0)
367 if ((ret =
avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
376 snprintf(name,
sizeof(name),
"pixel format for output stream %d:%d",
380 "format", pix_fmts, NULL,
385 if ((ret =
avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
398 snprintf(name,
sizeof(name),
"fps for output stream %d:%d",
401 name, args, NULL, fg->
graph);
412 snprintf(name,
sizeof(name),
"trim for output stream %d:%d",
415 &last_filter, &pad_idx, name);
440 name, NULL, NULL, fg->
graph);
446 #define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \
447 AVFilterContext *filt_ctx; \
449 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
450 "similarly to -af " filter_name "=%s.\n", arg); \
452 ret = avfilter_graph_create_filter(&filt_ctx, \
453 avfilter_get_by_name(filter_name), \
454 filter_name, arg, NULL, fg->graph); \
458 ret = avfilter_link(last_filter, pad_idx, filt_ctx, 0); \
462 last_filter = filt_ctx; \
482 sample_fmts = choose_sample_fmts(ost);
483 sample_rates = choose_sample_rates(ost);
484 channel_layouts = choose_channel_layouts(ost);
485 if (sample_fmts || sample_rates || channel_layouts) {
494 av_strlcatf(args,
sizeof(args),
"sample_rates=%s:",
497 av_strlcatf(args,
sizeof(args),
"channel_layouts=%s:",
504 snprintf(name,
sizeof(name),
"audio format for output stream %d:%d",
508 name, args, NULL, fg->
graph);
516 last_filter = format;
535 if (i<of->ctx->nb_streams) {
541 snprintf(name,
sizeof(name),
"trim for output stream %d:%d",
544 &last_filter, &pad_idx, name);
554 #define DESCRIBE_FILTER_LINK(f, inout, in) \
556 AVFilterContext *ctx = inout->filter_ctx; \
557 AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads; \
558 int nb_pads = in ? ctx->nb_inputs : ctx->nb_outputs; \
561 if (avio_open_dyn_buf(&pb) < 0) \
564 avio_printf(pb, "%s", ctx->filter->name); \
566 avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));\
568 avio_close_dyn_buf(pb, &f->name); \
632 int ret, pad_idx = 0;
655 "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:"
662 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
666 args.str, NULL, fg->
graph)) < 0)
668 last_filter = ifilter->
filter;
673 snprintf(name,
sizeof(name),
"force CFR for input from stream %d:%d",
684 last_filter = setpts;
690 snprintf(name,
sizeof(name),
"deinterlace input from stream %d:%d",
704 snprintf(name,
sizeof(name),
"trim for input stream %d:%d",
725 int ret, pad_idx = 0;
733 av_bprintf(&args,
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s",
738 av_bprintf(&args,
":channel_layout=0x%"PRIx64,
742 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
746 name, args.str, NULL,
749 last_filter = ifilter->
filter;
751 #define AUTO_INSERT_FILTER_INPUT(opt_name, filter_name, arg) do { \
752 AVFilterContext *filt_ctx; \
754 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
755 "similarly to -af " filter_name "=%s.\n", arg); \
757 snprintf(name, sizeof(name), "graph %d %s for input stream %d:%d", \
758 fg->index, filter_name, ist->file_index, ist->st->index); \
759 ret = avfilter_graph_create_filter(&filt_ctx, \
760 avfilter_get_by_name(filter_name), \
761 name, arg, NULL, fg->graph); \
765 ret = avfilter_link(last_filter, 0, filt_ctx, 0); \
769 last_filter = filt_ctx; \
773 char args[256] = {0};
800 "audio filter instead.\n");
806 snprintf(name,
sizeof(name),
"trim for input stream %d:%d",
857 args[strlen(args)-1] = 0;
866 args[strlen(args) - 1] =
'\0';
877 if (simple && (!inputs || inputs->
next || !outputs || outputs->
next)) {
879 "exactly one input and output.\n", graph_desc);
883 for (cur = inputs; !simple && init && cur; cur = cur->
next)
886 for (cur = inputs, i = 0; cur; cur = cur->
next, i++)
891 if (!init || simple) {
894 for (cur = outputs, i = 0; cur; cur = cur->
next, i++)
902 for (cur = outputs; cur;) {
void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags)
Enable or disable automatic format conversion inside the graph.
int64_t recording_time
desired length of the resulting file in microseconds == AV_TIME_BASE units
all automatic conversions disabled
static int configure_input_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in)
char * scale_sws_opts
sws options to use for the auto-inserted scale filters
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.
enum AVSampleFormat * sample_fmts
array of supported sample formats, or NULL if unknown, array is terminated by -1
#define AV_LOG_WARNING
Something somehow does not look correct.
static const AVFilterPad outputs[]
#define AVERROR_FILTER_NOT_FOUND
char * av_strdup(const char *s) av_malloc_attrib
Duplicate the string s.
static av_cold int init(AVCodecContext *avctx)
void choose_sample_fmt(AVStream *st, AVCodec *codec)
int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
void avfilter_inout_free(AVFilterInOut **inout)
Free the supplied list of AVFilterInOut and set *inout to NULL.
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the given stream matches a stream specifier.
AVDictionaryEntry * av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
AVCodecContext * codec
Codec context associated with this stream.
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
Get the type of an AVFilterPad.
#define CODEC_CAP_LOSSLESS
Codec is lossless.
static int insert_trim(int64_t start_time, int64_t duration, AVFilterContext **last_filter, int *pad_idx, const char *filter_name)
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
FilterGraph * init_simple_filtergraph(InputStream *ist, OutputStream *ost)
static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
int index
stream index in AVFormatContext
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.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
void avfilter_graph_free(AVFilterGraph **graph)
Free a graph, destroy its links, and set *graph to NULL.
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...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define DEF_CHOOSE_FORMAT(type, var, supported_list, none, get_name)
char * resample_lavr_opts
libavresample options to use for the auto-inserted resample filters
AVFilterContext * filter_ctx
filter context associated to this input/output
int64_t start_time
start time in microseconds == AV_TIME_BASE units
AVFilterContext * avfilter_graph_alloc_filter(AVFilterGraph *graph, const AVFilter *filter, const char *name)
Create a new filter instance in a filter graph.
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
AVRational av_guess_frame_rate(AVFormatContext *ctx, AVStream *stream, AVFrame *frame)
Guess the frame rate, based on both the container and codec information.
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
Link two filters together.
static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in)
static int64_t start_time
enum AVSampleFormat sample_fmt
audio sample format
static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
const char * name
Name of the codec implementation.
int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx)
Create and add a filter instance into an existing graph.
AVDictionary * resample_opts
#define CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs)
Add a graph described by a string to a graph.
int ist_in_filtergraph(FilterGraph *fg, InputStream *ist)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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-> in
#define GET_CH_LAYOUT_NAME(ch_layout)
FilterGraph ** filtergraphs
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_...
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
int capabilities
Codec capabilities.
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
AVPixelFormat
Pixel format.
static const int sample_rates[]
static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
uint64_t channel_layout
Audio channel layout.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Init a print buffer.
static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
unsigned int nb_streams
A list of all streams in the file.
uint8_t nb_components
The number of components each pixel has, (1-4)
Buffer to print data progressively.
char * name
name of this filter instance
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
struct OutputStream * ost
int width
picture width / height.
#define AV_BPRINT_SIZE_AUTOMATIC
AVFilterGraph * avfilter_graph_alloc(void)
Allocate a filter graph.
int audio_channels_mapped
char * name
unique name for this input/output in the list
#define GET_SAMPLE_FMT_NAME(sample_fmt)
void exit_program(int ret)
Wraps exit with a program-specific cleanup routine.
int avfilter_init_str(AVFilterContext *ctx, const char *args)
Initialize a filter with the supplied parameters.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
A linked-list of the inputs/outputs of the filter chain.
enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
Find the best pixel format to convert to given a certain source pixel format and a selection of two d...
#define GET_SAMPLE_RATE_NAME(rate)
AVSampleFormat
Audio Sample Formats.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define AV_LOG_INFO
Standard information.
static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in)
enum AVMediaType codec_type
int sample_rate
samples per second
static char * choose_pix_fmts(OutputStream *ost)
AVFilterPad * input_pads
array of input pads
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum AVPixelFormat target)
main external API structure.
static int sub2video_prepare(InputStream *ist)
int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
#define AUTO_INSERT_FILTER(opt_name, filter_name, arg)
int audio_channels_map[SWR_CH_MAX]
int configure_filtergraph(FilterGraph *fg)
#define FF_COMPLIANCE_UNOFFICIAL
Allow unofficial extensions.
static const AVFilterPad inputs[]
int pad_idx
index of the filt_ctx pad to use for linking
rational number numerator/denominator
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
AVFilter * avfilter_get_by_name(const char *name)
Get a filter definition matching the given name.
float audio_drift_threshold
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
struct FilterGraph * graph
#define DESCRIBE_FILTER_LINK(f, inout, in)
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
enum AVPixelFormat * pix_fmts
array of supported pixel formats, or NULL if unknown, array is terminated by -1
void av_bprintf(AVBPrint *buf, const char *fmt,...) av_printf_format(2
Append a formatted string to a print buffer.
struct AVFilterInOut * next
next input/input in the list, NULL if this is the last
#define GROW_ARRAY(array, nb_elems)
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 channels
number of audio channels
AVFilterPad * output_pads
array of output pads
static enum AVSampleFormat sample_fmts[]
#define AV_DICT_IGNORE_SUFFIX
OutputFile ** output_files
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_...
#define AUTO_INSERT_FILTER_INPUT(opt_name, filter_name, arg)
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
int strict_std_compliance
strictly follow the standard (MPEG4, ...).
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.
#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 ...
InputStream ** input_streams
int64_t av_get_default_channel_layout(int nb_channels)
Return default channel layout for a given number of channels.