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
187{187{
188 int i, j, ret;188 int i, j, ret;
189 char filt_args[128];189 char filt_args[128];
190 AVFilterFormats *formats, *chlayouts, *packing;
190 191
191 /* ask all the sub-filters for their supported media formats */192 /* ask all the sub-filters for their supported media formats */
192 for (i = 0; i < graph->filter_count; i++) {193 for (i = 0; i < graph->filter_count; i++) {
@@ -221,9 +222,13 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 28 unmodified lines
221 !link->in_packing || !link->out_packing)222 !link->in_packing || !link->out_packing)
222 return AVERROR(EINVAL);223 return AVERROR(EINVAL);
223 224
224 if (!avfilter_merge_formats(link->in_formats, link->out_formats) ||225 /* Merge all three list before checking: that way, in all
225 !avfilter_merge_formats(link->in_chlayouts, link->out_chlayouts) ||226 * three categories, aconvert will use a common format
226 !avfilter_merge_formats(link->in_packing, link->out_packing))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)
227 if (ret = insert_conv_filter(graph, link, "aconvert", NULL))232 if (ret = insert_conv_filter(graph, link, "aconvert", NULL))
228 return ret;233 return ret;
229 }234 }

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