55 for (; (*graph)->filter_count > 0; (*graph)->filter_count--)
76 const char *
name,
const char *args,
void *opaque,
115 "Input pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any source\n",
124 "Output pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any destination\n",
170 int scaler_count = 0, resampler_count = 0;
184 for (j = 0; j < filter->
nb_inputs; j++) {
186 int convert_needed = 0;
206 if (convert_needed) {
210 char scale_args[256];
214 switch (link->
type) {
218 "not present, cannot convert pixel formats.\n");
222 snprintf(inst_name,
sizeof(inst_name),
"auto-inserted scaler %d",
224 av_strlcpy(scale_args,
"0:0",
sizeof(scale_args));
226 av_strlcat(scale_args,
":",
sizeof(scale_args));
230 inst_name, scale_args,
NULL,
237 "not present, cannot convert audio formats.\n");
241 snprintf(inst_name,
sizeof(inst_name),
"auto-inserted resampler %d",
255 inlink = convert->
inputs[0];
275 "Impossible to convert between the formats supported by the filter "
297 " the link between filters %s and %s.\n", link->
src->
name,
306 "the link between filters %s and %s.\n", link->
src->
name,
324 #define REDUCE_FORMATS(fmt_type, list_type, list, var, nb, add_format) \
326 for (i = 0; i < filter->nb_inputs; i++) { \
327 AVFilterLink *link = filter->inputs[i]; \
330 if (!link->out_ ## list || link->out_ ## list->nb != 1) \
332 fmt = link->out_ ## list->var[0]; \
334 for (j = 0; j < filter->nb_outputs; j++) { \
335 AVFilterLink *out_link = filter->outputs[j]; \
338 if (link->type != out_link->type || \
339 out_link->in_ ## list->nb == 1) \
341 fmts = out_link->in_ ## list; \
343 if (!out_link->in_ ## list->nb) { \
344 add_format(&out_link->in_ ##list, fmt); \
348 for (k = 0; k < out_link->in_ ## list->nb; k++) \
349 if (fmts->var[k] == fmt) { \
350 fmts->var[0] = fmt; \
361 int i, j, k, ret = 0;
391 for (i = 0; i < filter->
nb_inputs; i++) {
405 int best_idx, best_diff = INT_MAX;
414 if (diff < best_diff) {
432 #define CH_CENTER_PAIR (AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER)
433 #define CH_FRONT_PAIR (AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT)
434 #define CH_STEREO_PAIR (AV_CH_STEREO_LEFT | AV_CH_STEREO_RIGHT)
435 #define CH_WIDE_PAIR (AV_CH_WIDE_LEFT | AV_CH_WIDE_RIGHT)
436 #define CH_SIDE_PAIR (AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT)
437 #define CH_DIRECT_PAIR (AV_CH_SURROUND_DIRECT_LEFT | AV_CH_SURROUND_DIRECT_RIGHT)
438 #define CH_BACK_PAIR (AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT)
471 for (i = 0; i < filter->
nb_inputs; i++) {
483 int best_idx = -1, best_score = INT_MIN, best_count_diff = INT_MAX;
494 int count_diff = out_channels - in_channels;
495 int matched_channels, extra_channels;
502 if (( in_chlayout & cmp0) && (!(out_chlayout & cmp0)) &&
503 (out_chlayout & cmp1) && (!( in_chlayout & cmp1))) {
504 in_chlayout &= ~cmp0;
505 out_chlayout &= ~cmp1;
514 (out_chlayout & AV_CH_LOW_FREQUENCY))
516 in_chlayout &= ~AV_CH_LOW_FREQUENCY;
517 out_chlayout &= ~AV_CH_LOW_FREQUENCY;
523 score += 10 * matched_channels - 5 * extra_channels;
525 if (score > best_score ||
526 (count_diff < best_count_diff && score == best_score)) {
529 best_count_diff = count_diff;
553 for (i = 0; i < filter->
nb_inputs; i++) {
568 int best_idx = -1, best_score = INT_MIN;
586 if (bps == 4 && out_bps == 8) {
592 score = -abs(out_bps - bps);
596 if (score > best_score) {
683 snprintf(name,
sizeof(name),
"auto-inserted fifo %d", fifo_count++);