History

avfiltergraph: fix format selection.

The old code had two bugs: For audio filters, the format was not set. For video filters, if several links reference the same format list, the same format must be selected in the end. This is done by setting formats->format_count to 1: the other links sharing the reference will therefore have only one choice. If the heuristic does not pick the first format, the selected format must also be moved to the first position.

Nicolas George committed 14 years ago

Commit fd2cd641 parent 62b745a1 file · +3 −3Browse files

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

Unified · Split

libavfilter/avfiltergraph.c+3−3
@@ -269,12 +269,12 @@ static void pick_format(AVFilterLink *link, AVFilterLink *ref) · 268 unmodified lines
269 enum PixelFormat p = link->in_formats->formats[i];269 enum PixelFormat p = link->in_formats->formats[i];
270 best= avcodec_find_best_pix_fmt2(best, p, ref->format, has_alpha, NULL);270 best= avcodec_find_best_pix_fmt2(best, p, ref->format, has_alpha, NULL);
271 }271 }
272 link->format = best;272 link->in_formats->formats[0] = best;
273 }else273 }
274 link->format = link->in_formats->formats[0];
275 }274 }
276 275
277 link->in_formats->format_count = 1;276 link->in_formats->format_count = 1;
277 link->format = link->in_formats->formats[0];
278 avfilter_formats_unref(&link->in_formats);278 avfilter_formats_unref(&link->in_formats);
279 avfilter_formats_unref(&link->out_formats);279 avfilter_formats_unref(&link->out_formats);
280 280

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