History

lavfi/formats: describe conversion in negotiation structure.

Nicolas George committed 5 years ago

Commit 85a64041 parent 86d3dd53 files · +18 −33Browse files

Showing the changes to libavfilter/avfiltergraph.c (1 of 3 files). Show all

Unified · Split

libavfilter/avfiltergraph.c+12−33
@@ -430,7 +430,7 @@ static int formats_declared(AVFilterContext *f) · 429 unmodified lines
430static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)430static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
431{431{
432 int i, j, ret;432 int i, j, ret;
433 int scaler_count = 0, resampler_count = 0;433 int converter_count = 0;
434 int count_queried = 0; /* successful calls to query_formats() */434 int count_queried = 0; /* successful calls to query_formats() */
435 int count_merged = 0; /* successful merge of formats lists */435 int count_merged = 0; /* successful merge of formats lists */
436 int count_already_merged = 0; /* lists already merged */436 int count_already_merged = 0; /* lists already merged */
@@ -497,6 +497,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 60 unmodified lines
497 const AVFilter *filter;497 const AVFilter *filter;
498 AVFilterLink *inlink, *outlink;498 AVFilterLink *inlink, *outlink;
499 char inst_name[30];499 char inst_name[30];
500 const char *opts;
500 501
501 if (graph->disable_auto_convert) {502 if (graph->disable_auto_convert) {
502 av_log(log_ctx, AV_LOG_ERROR,503 av_log(log_ctx, AV_LOG_ERROR,
@@ -507,40 +508,18 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 4 unmodified lines
507 }508 }
508 509
509 /* couldn't merge format lists. auto-insert conversion filter */510 /* couldn't merge format lists. auto-insert conversion filter */
510 switch (link->type) {511 if (!(filter = avfilter_get_by_name(neg->conversion_filter))) {
511 case AVMEDIA_TYPE_VIDEO:512 av_log(log_ctx, AV_LOG_ERROR,
512 if (!(filter = avfilter_get_by_name("scale"))) {513 "'%s' filter not present, cannot convert formats.\n",
513 av_log(log_ctx, AV_LOG_ERROR, "'scale' filter "514 neg->conversion_filter);
514 "not present, cannot convert pixel formats.\n");
515 return AVERROR(EINVAL);
516 }
517
518 snprintf(inst_name, sizeof(inst_name), "auto_scaler_%d",
519 scaler_count++);
520
521 if ((ret = avfilter_graph_create_filter(&convert, filter,
522 inst_name, graph->scale_sws_opts, NULL,
523 graph)) < 0)
524 return ret;
525 break;
526 case AVMEDIA_TYPE_AUDIO:
527 if (!(filter = avfilter_get_by_name("aresample"))) {
528 av_log(log_ctx, AV_LOG_ERROR, "'aresample' filter "
529 "not present, cannot convert audio formats.\n");
530 return AVERROR(EINVAL);
531 }
532
533 snprintf(inst_name, sizeof(inst_name), "auto_resampler_%d",
534 resampler_count++);
535 if ((ret = avfilter_graph_create_filter(&convert, filter,
536 inst_name, graph->aresample_swr_opts,
537 NULL, graph)) < 0)
538 return ret;
539 break;
540 default:
541 return AVERROR(EINVAL);515 return AVERROR(EINVAL);
542 }516 }
543 517 snprintf(inst_name, sizeof(inst_name), "auto_%s_%d",
518 neg->conversion_filter, converter_count++);
519 opts = FF_FIELD_AT(char *, neg->conversion_opts_offset, *graph);
520 ret = avfilter_graph_create_filter(&convert, filter, inst_name, opts, NULL, graph);
521 if (ret < 0)
522 return ret;
544 if ((ret = avfilter_insert_filter(link, convert, 0, 0)) < 0)523 if ((ret = avfilter_insert_filter(link, convert, 0, 0)) < 0)
545 return ret;524 return ret;
546 525

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t