History

avfiltergraph: avoid harmful auto audio conversions.

With the current code, an automatically inserted aconvert necessary for format change would usually convert to mono for no good reason. The new code will not avoid all conversions, but at least will keep them among the layouts common to both filters.

Nicolas George committed 14 years ago

Commit 42655b21 parent 69a653c1 file · +8 −3Browse files

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

Unified · Split

libavfilter/avfiltergraph.c+8−3
@@ -187,6 +187,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 186 unmodified lines
187187 {
188188 int i, j, ret;
189189 char filt_args[128];
190+ AVFilterFormats *formats, *chlayouts, *packing;
190191
191192 /* ask all the sub-filters for their supported media formats */
192193 for (i = 0; i < graph->filter_count; i++) {
@@ -221,9 +222,13 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 28 unmodified lines
221222 !link->in_packing || !link->out_packing)
222223 return AVERROR(EINVAL);
223224
224− if (!avfilter_merge_formats(link->in_formats, link->out_formats) ||
225− !avfilter_merge_formats(link->in_chlayouts, link->out_chlayouts) ||
226− !avfilter_merge_formats(link->in_packing, link->out_packing))
225+ /* Merge all three list before checking: that way, in all
226+ * three categories, aconvert will use a common format
227+ * whenever possible. */
228+ formats = avfilter_merge_formats(link->in_formats, link->out_formats);
229+ chlayouts = avfilter_merge_formats(link->in_chlayouts, link->out_chlayouts);
230+ packing = avfilter_merge_formats(link->in_packing, link->out_packing);
231+ if (!formats || !chlayouts || !packing)
227232 if (ret = insert_conv_filter(graph, link, "aconvert", NULL))
228233 return ret;
229234 }

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