42#include "libavfilter/avfilter.h"
43#include "libavfilter/buffersink.h"
44#include "libavfilter/buffersrc.h"
46#include "libavutil/avassert.h"
47#include "libavutil/avstring.h"
48#include "libavutil/bprint.h"
49#include "libavutil/channel_layout.h"
50#include "libavutil/display.h"
51#include "libavutil/opt.h"
52#include "libavutil/pixdesc.h"
53#include "libavutil/pixfmt.h"
54#include "libavutil/imgutils.h"
55#include "libavutil/samplefmt.h"
61 static const enum AVPixelFormat mjpeg_formats[] =
62 { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P,
65 if (!strcmp(codec->name,
"mjpeg")) {
68 return default_formats;
73 const AVCodec *codec,
enum AVPixelFormat target)
75 if (codec && codec->pix_fmts) {
76 const enum AVPixelFormat *p = codec->pix_fmts;
77 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(target);
79 int has_alpha = desc ? desc->nb_components % 2 == 0 : 0;
80 enum AVPixelFormat best= AV_PIX_FMT_NONE;
82 if (enc_ctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
85 for (; *p != AV_PIX_FMT_NONE; p++) {
86 best = av_find_best_pix_fmt_of_2(best, *p, target, has_alpha, NULL);
90 if (*p == AV_PIX_FMT_NONE) {
91 if (target != AV_PIX_FMT_NONE)
92 av_log(NULL, AV_LOG_WARNING,
93 "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
94 av_get_pix_fmt_name(target),
96 av_get_pix_fmt_name(best));
109 const AVDictionaryEntry *strict_dict = av_dict_get(ost->
encoder_opts,
"strict", NULL, 0);
112 av_opt_set(ost->
enc_ctx,
"strict", strict_dict->value, 0);
115 avfilter_graph_set_auto_convert(ofilter->
graph->
graph,
116 AVFILTER_AUTO_CONVERT_NONE);
117 if (ost->
enc_ctx->pix_fmt == AV_PIX_FMT_NONE)
119 return av_get_pix_fmt_name(ost->
enc_ctx->pix_fmt);
121 if (ost->
enc_ctx->pix_fmt != AV_PIX_FMT_NONE) {
123 }
else if (ost->
enc && ost->
enc->pix_fmts) {
124 const enum AVPixelFormat *p;
126 p = ost->
enc->pix_fmts;
127 if (ost->
enc_ctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
131 for (; *p != AV_PIX_FMT_NONE; p++) {
132 const char *name = av_get_pix_fmt_name(*p);
133 av_bprintf(bprint,
"%s%c", name, p[1] == AV_PIX_FMT_NONE ?
'\0' :
'|');
135 if (!av_bprint_is_complete(bprint))
144#define DEF_CHOOSE_FORMAT(name, type, var, supported_list, none, printf_format, get_name) \
145static void choose_ ## name (OutputFilter *ofilter, AVBPrint *bprint) \
147 if (ofilter->var == none && !ofilter->supported_list) \
149 av_bprintf(bprint, #name "="); \
150 if (ofilter->var != none) { \
151 av_bprintf(bprint, printf_format, get_name(ofilter->var)); \
155 for (p = ofilter->supported_list; *p != none; p++) { \
156 av_bprintf(bprint, printf_format "|", get_name(*p)); \
158 if (bprint->len > 0) \
159 bprint->str[--bprint->len] = '\0'; \
161 av_bprint_chars(bprint, ':', 1); \
168 AV_SAMPLE_FMT_NONE,
"%s", av_get_sample_fmt_name)
175 if (av_channel_layout_check(&ofilter->ch_layout)) {
176 av_bprintf(bprint,
"channel_layouts=");
177 av_channel_layout_describe_bprint(&ofilter->ch_layout, bprint);
178 }
else if (ofilter->ch_layouts) {
179 const AVChannelLayout *p;
181 av_bprintf(bprint,
"channel_layouts=");
182 for (p = ofilter->ch_layouts; p->nb_channels; p++) {
183 av_channel_layout_describe_bprint(p, bprint);
184 av_bprintf(bprint,
"|");
187 bprint->str[--bprint->len] =
'\0';
190 av_bprint_chars(bprint,
':', 1);
215 ifilter->
frame_queue = av_fifo_alloc2(8,
sizeof(AVFrame*), AV_FIFO_FLAG_AUTO_GROW);
230 AVFilterContext *ctx = inout->filter_ctx;
231 AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads;
232 int nb_pads = in ? ctx->nb_inputs : ctx->nb_outputs;
236 res = av_strdup(ctx->filter->name);
238 res = av_asprintf(
"%s:%s", ctx->filter->name,
239 avfilter_pad_get_name(pads, inout->pad_idx));
248 enum AVMediaType type = avfilter_pad_get_type(in->filter_ctx->input_pads, in->pad_idx);
253 if (type != AVMEDIA_TYPE_VIDEO && type != AVMEDIA_TYPE_AUDIO) {
254 av_log(NULL, AV_LOG_FATAL,
"Only video and audio filters supported "
263 int file_idx = strtol(in->name, &p, 0);
266 av_log(NULL, AV_LOG_FATAL,
"Invalid file index %d in filtergraph description %s.\n",
272 for (i = 0; i < s->nb_streams; i++) {
273 enum AVMediaType stream_type = s->streams[i]->codecpar->codec_type;
274 if (stream_type != type &&
275 !(stream_type == AVMEDIA_TYPE_SUBTITLE &&
276 type == AVMEDIA_TYPE_VIDEO ))
284 av_log(NULL, AV_LOG_FATAL,
"Stream specifier '%s' in filtergraph description %s "
290 av_log(NULL, AV_LOG_FATAL,
"Stream specifier '%s' in filtergraph description %s "
291 "matches a disabled input stream.\n", p, fg->
graph_desc);
304 av_log(NULL, AV_LOG_FATAL,
"Cannot find a matching stream for "
305 "unlabeled input pad %d on filter %s\n", in->pad_idx,
306 in->filter_ctx->name);
315 ist->
st->discard = AVDISCARD_NONE;
321 ifilter->
type = ist->
st->codecpar->codec_type;
324 ifilter->
frame_queue = av_fifo_alloc2(8,
sizeof(AVFrame*), AV_FIFO_FLAG_AUTO_GROW);
334 AVFilterInOut *inputs, *outputs, *cur;
335 AVFilterGraph *graph;
340 graph = avfilter_graph_alloc();
342 return AVERROR(ENOMEM);
343 graph->nb_threads = 1;
345 ret = avfilter_graph_parse2(graph, fg->
graph_desc, &inputs, &outputs);
349 for (cur = inputs; cur; cur = cur->next)
352 for (cur = outputs; cur;) {
357 ofilter->
type = avfilter_pad_get_type(cur->filter_ctx->output_pads,
365 avfilter_inout_free(&inputs);
366 avfilter_graph_free(&graph);
371 AVFilterContext **last_filter,
int *pad_idx,
372 const char *filter_name)
374 AVFilterGraph *graph = (*last_filter)->graph;
375 AVFilterContext *ctx;
376 const AVFilter *trim;
377 enum AVMediaType type = avfilter_pad_get_type((*last_filter)->output_pads, *pad_idx);
378 const char *name = (type == AVMEDIA_TYPE_VIDEO) ?
"trim" :
"atrim";
381 if (duration == INT64_MAX && start_time == AV_NOPTS_VALUE)
384 trim = avfilter_get_by_name(name);
386 av_log(NULL, AV_LOG_ERROR,
"%s filter not present, cannot limit "
387 "recording time.\n", name);
388 return AVERROR_FILTER_NOT_FOUND;
391 ctx = avfilter_graph_alloc_filter(graph, trim, filter_name);
393 return AVERROR(ENOMEM);
395 if (duration != INT64_MAX) {
396 ret = av_opt_set_int(ctx,
"durationi", duration,
397 AV_OPT_SEARCH_CHILDREN);
399 if (ret >= 0 && start_time != AV_NOPTS_VALUE) {
400 ret = av_opt_set_int(ctx,
"starti", start_time,
401 AV_OPT_SEARCH_CHILDREN);
404 av_log(ctx, AV_LOG_ERROR,
"Error configuring the %s filter", name);
408 ret = avfilter_init_str(ctx, NULL);
412 ret = avfilter_link(*last_filter, *pad_idx, ctx, 0);
422 const char *filter_name,
const char *args)
424 AVFilterGraph *graph = (*last_filter)->graph;
425 AVFilterContext *ctx;
428 ret = avfilter_graph_create_filter(&ctx,
429 avfilter_get_by_name(filter_name),
430 filter_name, args, NULL, graph);
434 ret = avfilter_link(*last_filter, *pad_idx, ctx, 0);
447 AVFilterContext *last_filter = out->filter_ctx;
449 int pad_idx = out->pad_idx;
451 const char *pix_fmts;
454 snprintf(name,
sizeof(name),
"out_%d_%d", ost->
file_index, ost->
index);
455 ret = avfilter_graph_create_filter(&ofilter->
filter,
456 avfilter_get_by_name(
"buffersink"),
457 name, NULL, NULL, fg->
graph);
464 AVFilterContext *filter;
465 const AVDictionaryEntry *e = NULL;
467 snprintf(args,
sizeof(args),
"%d:%d",
470 while ((e = av_dict_get(ost->
sws_dict,
"", e,
471 AV_DICT_IGNORE_SUFFIX))) {
472 av_strlcatf(args,
sizeof(args),
":%s=%s", e->key, e->value);
475 snprintf(name,
sizeof(name),
"scaler_out_%d_%d",
477 if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name(
"scale"),
478 name, args, NULL, fg->
graph)) < 0)
480 if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
483 last_filter = filter;
487 av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED);
489 AVFilterContext *filter;
491 ret = avfilter_graph_create_filter(&filter,
492 avfilter_get_by_name(
"format"),
493 "format", pix_fmts, NULL, fg->
graph);
494 av_bprint_finalize(&bprint, NULL);
497 if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
500 last_filter = filter;
505 AVFilterContext *fps;
508 snprintf(args,
sizeof(args),
"fps=%d/%d", ost->
frame_rate.num,
510 snprintf(name,
sizeof(name),
"fps_out_%d_%d",
512 ret = avfilter_graph_create_filter(&fps, avfilter_get_by_name(
"fps"),
513 name, args, NULL, fg->
graph);
517 ret = avfilter_link(last_filter, pad_idx, fps, 0);
524 snprintf(name,
sizeof(name),
"trim_out_%d_%d",
527 &last_filter, &pad_idx, name);
532 if ((ret = avfilter_link(last_filter, pad_idx, ofilter->
filter, 0)) < 0)
542 AVCodecContext *codec = ost->
enc_ctx;
543 AVFilterContext *last_filter = out->filter_ctx;
544 int pad_idx = out->pad_idx;
549 snprintf(name,
sizeof(name),
"out_%d_%d", ost->
file_index, ost->
index);
550 ret = avfilter_graph_create_filter(&ofilter->
filter,
551 avfilter_get_by_name(
"abuffersink"),
552 name, NULL, NULL, fg->
graph);
555 if ((ret = av_opt_set_int(ofilter->
filter,
"all_channel_counts", 1, AV_OPT_SEARCH_CHILDREN)) < 0)
558#define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \
559 AVFilterContext *filt_ctx; \
561 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
562 "similarly to -af " filter_name "=%s.\n", arg); \
564 ret = avfilter_graph_create_filter(&filt_ctx, \
565 avfilter_get_by_name(filter_name), \
566 filter_name, arg, NULL, fg->graph); \
570 ret = avfilter_link(last_filter, pad_idx, filt_ctx, 0); \
574 last_filter = filt_ctx; \
577 av_bprint_init(&args, 0, AV_BPRINT_SIZE_UNLIMITED);
579 AVChannelLayout mapped_layout = { 0 };
582 av_channel_layout_describe_bprint(&mapped_layout, &args);
588 av_bprint_clear(&args);
591 if (codec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
592 av_channel_layout_default(&codec->ch_layout, codec->ch_layout.nb_channels);
594 choose_sample_fmts(ofilter, &args);
595 choose_sample_rates(ofilter, &args);
597 if (!av_bprint_is_complete(&args)) {
598 ret = AVERROR(ENOMEM);
602 AVFilterContext *format;
604 snprintf(name,
sizeof(name),
"format_out_%d_%d",
606 ret = avfilter_graph_create_filter(&format,
607 avfilter_get_by_name(
"aformat"),
608 name, args.str, NULL, fg->
graph);
612 ret = avfilter_link(last_filter, pad_idx, format, 0);
616 last_filter = format;
623 for (i=0; i<of->
ctx->nb_streams; i++)
624 if (of->
ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
627 if (i<of->ctx->nb_streams) {
632 snprintf(name,
sizeof(name),
"trim for output stream %d:%d",
635 &last_filter, &pad_idx, name);
639 if ((ret = avfilter_link(last_filter, pad_idx, ofilter->
filter, 0)) < 0)
642 av_bprint_finalize(&args, NULL);
651 av_log(NULL, AV_LOG_FATAL,
"Filter %s has an unconnected output\n", ofilter->
name);
655 switch (avfilter_pad_get_type(out->filter_ctx->output_pads, out->pad_idx)) {
658 default: av_assert0(0);
return 0;
670 av_log(NULL, AV_LOG_FATAL,
"Filter %s has an unconnected output\n", output->
name);
688 for (i = 0; i < avf->nb_streams; i++) {
689 if (avf->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
690 w = FFMAX(w, avf->streams[i]->codecpar->width);
691 h = FFMAX(h, avf->streams[i]->codecpar->height);
698 av_log(avf, AV_LOG_INFO,
"sub2video: using %dx%d canvas\n", w, h);
708 ifilter->
format = AV_PIX_FMT_RGB32;
712 return AVERROR(ENOMEM);
727 AVFilterContext *last_filter;
728 const AVFilter *buffer_filt = avfilter_get_by_name(
"buffer");
729 const AVPixFmtDescriptor *desc;
738 int ret, pad_idx = 0;
739 int64_t tsoffset = 0;
740 AVBufferSrcParameters *par = av_buffersrc_parameters_alloc();
743 return AVERROR(ENOMEM);
744 memset(par, 0,
sizeof(*par));
745 par->format = AV_PIX_FMT_NONE;
747 if (ist->
dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
748 av_log(NULL, AV_LOG_ERROR,
"Cannot connect video filter to audio input\n");
749 ret = AVERROR(EINVAL);
756 if (ist->
dec_ctx->codec_type == AVMEDIA_TYPE_SUBTITLE) {
764 sar = (AVRational){0,1};
765 av_bprint_init(&args, 0, AV_BPRINT_SIZE_AUTOMATIC);
767 "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:"
768 "pixel_aspect=%d/%d",
770 tb.num, tb.den, sar.num, sar.den);
771 if (fr.num && fr.den)
772 av_bprintf(&args,
":frame_rate=%d/%d", fr.num, fr.den);
773 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
777 if ((ret = avfilter_graph_create_filter(&ifilter->
filter, buffer_filt, name,
778 args.str, NULL, fg->
graph)) < 0)
781 ret = av_buffersrc_parameters_set(ifilter->
filter, par);
785 last_filter = ifilter->
filter;
787 desc = av_pix_fmt_desc_get(ifilter->
format);
791 if (ist->
autorotate && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
796 displaymatrix = (int32_t *)av_stream_get_side_data(ist->
st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
799 if (fabs(theta - 90) < 1.0) {
801 displaymatrix[3] > 0 ?
"cclock_flip" :
"clock");
802 }
else if (fabs(theta - 180) < 1.0) {
803 if (displaymatrix[0] < 0) {
808 if (displaymatrix[4] < 0) {
811 }
else if (fabs(theta - 270) < 1.0) {
813 displaymatrix[3] < 0 ?
"clock_flip" :
"cclock");
814 }
else if (fabs(theta) > 1.0) {
816 snprintf(rotate_buf,
sizeof(rotate_buf),
"%f*PI/180", theta);
817 ret =
insert_filter(&last_filter, &pad_idx,
"rotate", rotate_buf);
818 }
else if (fabs(theta) < 1.0) {
819 if (displaymatrix && displaymatrix[4] < 0) {
827 snprintf(name,
sizeof(name),
"trim_in_%d_%d",
832 tsoffset += f->
ctx->start_time;
836 &last_filter, &pad_idx, name);
840 if ((ret = avfilter_link(last_filter, 0, in->filter_ctx, in->pad_idx)) < 0)
852 AVFilterContext *last_filter;
853 const AVFilter *abuffer_filt = avfilter_get_by_name(
"abuffer");
858 int ret, pad_idx = 0;
859 int64_t tsoffset = 0;
861 if (ist->
dec_ctx->codec_type != AVMEDIA_TYPE_AUDIO) {
862 av_log(NULL, AV_LOG_ERROR,
"Cannot connect audio filter to non audio input\n");
863 return AVERROR(EINVAL);
866 av_bprint_init(&args, 0, AV_BPRINT_SIZE_AUTOMATIC);
867 av_bprintf(&args,
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s",
870 av_get_sample_fmt_name(ifilter->
format));
871 if (av_channel_layout_check(&ifilter->
ch_layout) &&
872 ifilter->
ch_layout.order != AV_CHANNEL_ORDER_UNSPEC) {
873 av_bprintf(&args,
":channel_layout=");
874 av_channel_layout_describe_bprint(&ifilter->
ch_layout, &args);
876 av_bprintf(&args,
":channels=%d", ifilter->
ch_layout.nb_channels);
877 snprintf(name,
sizeof(name),
"graph_%d_in_%d_%d", fg->
index,
880 if ((ret = avfilter_graph_create_filter(&ifilter->
filter, abuffer_filt,
881 name, args.str, NULL,
884 last_filter = ifilter->
filter;
886#define AUTO_INSERT_FILTER_INPUT(opt_name, filter_name, arg) do { \
887 AVFilterContext *filt_ctx; \
889 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
890 "similarly to -af " filter_name "=%s.\n", arg); \
892 snprintf(name, sizeof(name), "graph_%d_%s_in_%d_%d", \
893 fg->index, filter_name, ist->file_index, ist->st->index); \
894 ret = avfilter_graph_create_filter(&filt_ctx, \
895 avfilter_get_by_name(filter_name), \
896 name, arg, NULL, fg->graph); \
900 ret = avfilter_link(last_filter, 0, filt_ctx, 0); \
904 last_filter = filt_ctx; \
908 char args[256] = {0};
914 av_strlcatf(args,
sizeof(args),
":first_pts=0");
934 av_log(NULL, AV_LOG_WARNING,
"-vol has been deprecated. Use the volume "
935 "audio filter instead.\n");
937 snprintf(args,
sizeof(args),
"%f",
audio_volume / 256.);
941 snprintf(name,
sizeof(name),
"trim for input stream %d:%d",
946 tsoffset += f->
ctx->start_time;
950 &last_filter, &pad_idx, name);
954 if ((ret = avfilter_link(last_filter, 0, in->filter_ctx, in->pad_idx)) < 0)
964 av_log(NULL, AV_LOG_ERROR,
965 "No decoder for stream #%d:%d, filtering impossible\n",
967 return AVERROR_DECODER_NOT_FOUND;
969 switch (avfilter_pad_get_type(in->filter_ctx->input_pads, in->pad_idx)) {
972 default: av_assert0(0);
return 0;
983 avfilter_graph_free(&fg->
graph);
988 return f->nb_inputs == 0 &&
989 (!strcmp(f->filter->name,
"buffer") ||
990 !strcmp(f->filter->name,
"abuffer"));
995 for (
unsigned i = 0; i < graph->nb_filters; i++) {
996 const AVFilterContext *f = graph->filters[i];
1002 if (!((f->filter->flags & AVFILTER_FLAG_METADATA_ONLY) ||
1003 f->nb_outputs == 0 ||
1012 AVFilterInOut *inputs, *outputs, *cur;
1018 if (!(fg->
graph = avfilter_graph_alloc()))
1019 return AVERROR(ENOMEM);
1024 const AVDictionaryEntry *e = NULL;
1031 e = av_dict_get(ost->
encoder_opts,
"threads", NULL, 0);
1033 av_opt_set(fg->
graph,
"threads", e->value, 0);
1038 while ((e = av_dict_get(ost->
sws_dict,
"", e,
1039 AV_DICT_IGNORE_SUFFIX))) {
1040 av_strlcatf(args,
sizeof(args),
"%s=%s:", e->key, e->value);
1043 args[strlen(args)-1] = 0;
1044 fg->
graph->scale_sws_opts = av_strdup(args);
1049 while ((e = av_dict_get(ost->
swr_opts,
"", e,
1050 AV_DICT_IGNORE_SUFFIX))) {
1051 av_strlcatf(args,
sizeof(args),
"%s=%s:", e->key, e->value);
1054 args[strlen(args)-1] = 0;
1055 av_opt_set(fg->
graph,
"aresample_swr_opts", args, 0);
1060 if ((ret = avfilter_graph_parse2(fg->
graph, graph_desc, &inputs, &outputs)) < 0)
1067 if (simple && (!inputs || inputs->next || !outputs || outputs->next)) {
1068 const char *num_inputs;
1069 const char *num_outputs;
1072 }
else if (outputs->next) {
1079 }
else if (inputs->next) {
1084 av_log(NULL, AV_LOG_ERROR,
"Simple filtergraph '%s' was expected "
1085 "to have exactly 1 input and 1 output."
1086 " However, it had %s input(s) and %s output(s)."
1087 " Please adjust, or use a complex filtergraph (-filter_complex) instead.\n",
1088 graph_desc, num_inputs, num_outputs);
1089 ret = AVERROR(EINVAL);
1093 for (cur = inputs, i = 0; cur; cur = cur->next, i++)
1095 avfilter_inout_free(&inputs);
1096 avfilter_inout_free(&outputs);
1099 avfilter_inout_free(&inputs);
1101 for (cur = outputs, i = 0; cur; cur = cur->next, i++)
1103 avfilter_inout_free(&outputs);
1106 avfilter_graph_set_auto_convert(fg->
graph, AVFILTER_AUTO_CONVERT_NONE);
1107 if ((ret = avfilter_graph_config(fg->
graph, NULL)) < 0)
1116 AVFilterContext *sink = ofilter->
filter;
1118 ofilter->
format = av_buffersink_get_format(sink);
1120 ofilter->
width = av_buffersink_get_w(sink);
1121 ofilter->
height = av_buffersink_get_h(sink);
1123 ofilter->
sample_rate = av_buffersink_get_sample_rate(sink);
1124 av_channel_layout_uninit(&ofilter->
ch_layout);
1125 ret = av_buffersink_get_ch_layout(sink, &ofilter->
ch_layout);
1137 av_log(NULL, AV_LOG_ERROR,
"Encoder (codec %s) not found for output stream #%d:%d\n",
1139 ret = AVERROR(EINVAL);
1142 if (ost->
enc->type == AVMEDIA_TYPE_AUDIO &&
1143 !(ost->
enc->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE))
1151 ret = av_buffersrc_add_frame(fg->
inputs[i]->
filter, tmp);
1152 av_frame_free(&tmp);
1161 ret = av_buffersrc_add_frame(fg->
inputs[i]->
filter, NULL);
1174 avsubtitle_free(&tmp);
1188 AVFrameSideData *sd;
1193 ifilter->
format = frame->format;
1195 ifilter->
width = frame->width;
1196 ifilter->
height = frame->height;
1200 ret = av_channel_layout_copy(&ifilter->
ch_layout, &frame->ch_layout);
1205 sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX);
1207 ifilter->
displaymatrix = av_memdup(sd->data,
sizeof(int32_t) * 9);
1209 if (frame->hw_frames_ctx) {
1210 ifilter->
hw_frames_ctx = av_buffer_ref(frame->hw_frames_ctx);
1212 return AVERROR(ENOMEM);
int64_t start_time
start time in microseconds == AV_TIME_BASE units
int64_t recording_time
desired length of the resulting file in microseconds == AV_TIME_BASE units
struct OutputStream * ost
struct FilterGraph * graph
AVChannelLayout ch_layout
int audio_channels_mapped
AVDictionary * encoder_opts