34 #define DEF_CHOOSE_FORMAT(type, var, supported_list, none, get_name, separator)\
35 static char *choose_ ## var ## s(OutputStream *ost) \
37 if (ost->st->codec->var != none) { \
38 get_name(ost->st->codec->var); \
39 return av_strdup(name); \
40 } else if (ost->enc->supported_list) { \
42 AVIOContext *s = NULL; \
46 if (avio_open_dyn_buf(&s) < 0) \
49 for (p = ost->enc->supported_list; *p != none; p++) { \
51 avio_printf(s, "%s" separator, name); \
53 len = avio_close_dyn_buf(s, &ret); \
95 ist->filters[ist->nb_filters - 1] = fg->
inputs[0];
120 int file_idx = strtol(in->
name, &p, 0);
150 if (i == nb_input_streams) {
152 "unlabeled input pad %d on filter %s", in->
pad_idx,
183 snprintf(name,
sizeof(name),
"output stream %d:%d", ost->
file_index, ost->
index);
194 snprintf(args,
sizeof(args),
"%d:%d:flags=0x%X",
198 snprintf(name,
sizeof(name),
"scaler for output stream %d:%d",
203 if ((ret =
avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
210 if ((pix_fmts = choose_pix_fmts(ost))) {
212 snprintf(name,
sizeof(name),
"pixel format for output stream %d:%d",
216 "format", pix_fmts,
NULL,
219 if ((ret =
avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
231 snprintf(args,
sizeof(args),
"fps=%d/%d", ost->
frame_rate.
num,
233 snprintf(name,
sizeof(name),
"fps for output stream %d:%d",
259 char *
sample_fmts, *sample_rates, *channel_layouts;
264 snprintf(name,
sizeof(name),
"output stream %d:%d", ost->
file_index, ost->
index);
274 sample_fmts = choose_sample_fmts(ost);
275 sample_rates = choose_sample_rates(ost);
276 channel_layouts = choose_channel_layouts(ost);
277 if (sample_fmts || sample_rates || channel_layouts) {
283 len += snprintf(args + len,
sizeof(args) - len,
"sample_fmts=%s:",
286 len += snprintf(args + len,
sizeof(args) - len,
"sample_rates=%s:",
289 len += snprintf(args + len,
sizeof(args) - len,
"channel_layouts=%s:",
297 snprintf(name,
sizeof(name),
"audio format for output stream %d:%d",
309 last_filter = format;
319 #define DESCRIBE_FILTER_LINK(f, inout, in) \
321 AVFilterContext *ctx = inout->filter_ctx; \
322 AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads; \
323 int nb_pads = in ? ctx->input_count : ctx->output_count; \
326 if (avio_open_dyn_buf(&pb) < 0) \
329 avio_printf(pb, "%s", ctx->filter->name); \
331 avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));\
333 avio_close_dyn_buf(pb, &f->name); \
357 char args[255],
name[255];
364 snprintf(args,
sizeof(args),
"%d:%d:%d:%d:%d:%d:%d", ist->
st->
codec->
width,
367 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
377 snprintf(name,
sizeof(name),
"force CFR for input from stream %d:%d",
385 if ((ret =
avfilter_link(setpts, 0, first_filter, pad_idx)) < 0)
388 first_filter = setpts;
404 char args[255],
name[255];
407 snprintf(args,
sizeof(args),
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s"
408 ":channel_layout=0x%"PRIx64,
413 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
426 "asyncts audio filter instead.\n");
429 len += snprintf(args + len,
sizeof(args) - len,
"compensate=1:"
431 snprintf(args + len,
sizeof(args) - len,
"min_delta=%f",
434 snprintf(name,
sizeof(name),
"graph %d audio sync for input stream %d:%d",
446 first_filter = async;
453 "audio filter instead.\n");
455 snprintf(args,
sizeof(args),
"volume=%f",
audio_volume / 256.0);
457 snprintf(name,
sizeof(name),
"graph %d volume for input stream %d:%d",
469 first_filter = volume;
505 snprintf(args,
sizeof(args),
"flags=0x%X", (
unsigned)ost->
sws_flags);
512 if (simple && (!inputs || inputs->
next || !outputs || outputs->
next)) {
514 "exactly one input and output.\n", graph_desc);
518 for (cur = inputs; !simple && init && cur; cur = cur->
next)
521 for (cur = inputs, i = 0; cur; cur = cur->
next, i++)
526 if (!init || simple) {
529 for (cur = outputs, i = 0; cur; cur = cur->
next, i++)
537 for (cur = outputs; cur;) {