Commit 7cc4c9f3 authored by Anton Khirnov's avatar Anton Khirnov

lavfi/formats: avoid using AV_{PIX,SAMPLE}_FMT_NB

Thatt hardcodes the number of formats into lavfi and will break when a
shared lavu is updated, adding new formats.
parent b03b2d86
...@@ -209,15 +209,19 @@ int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout) ...@@ -209,15 +209,19 @@ int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout)
AVFilterFormats *ff_all_formats(enum AVMediaType type) AVFilterFormats *ff_all_formats(enum AVMediaType type)
{ {
AVFilterFormats *ret = NULL; AVFilterFormats *ret = NULL;
int fmt;
int num_formats = type == AVMEDIA_TYPE_VIDEO ? AV_PIX_FMT_NB :
type == AVMEDIA_TYPE_AUDIO ? AV_SAMPLE_FMT_NB : 0;
for (fmt = 0; fmt < num_formats; fmt++) { if (type == AVMEDIA_TYPE_VIDEO) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt); const AVPixFmtDescriptor *desc = NULL;
if ((type != AVMEDIA_TYPE_VIDEO) || while ((desc = av_pix_fmt_desc_next(desc))) {
(type == AVMEDIA_TYPE_VIDEO && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))) if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
ff_add_format(&ret, av_pix_fmt_desc_get_id(desc));
}
} else if (type == AVMEDIA_TYPE_AUDIO) {
enum AVSampleFormat fmt = 0;
while (av_get_sample_fmt_name(fmt)) {
ff_add_format(&ret, fmt); ff_add_format(&ret, fmt);
fmt++;
}
} }
return ret; return ret;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment