summaryrefslogtreecommitdiff
path: root/libavfilter/formats.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-27 03:22:45 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-27 03:23:23 +0200
commita1cb4efd2ff05421822362b294d4638a2976d81f (patch)
tree63dc9c7de3dc91544ed8feee263f93787181b8b8 /libavfilter/formats.c
parent50ffd8439c9306a761a279d470564ad9688e3689 (diff)
parent7cc4c9f32f446feaec5447e3d097e8147e35f156 (diff)
Merge commit '7cc4c9f32f446feaec5447e3d097e8147e35f156'
* commit '7cc4c9f32f446feaec5447e3d097e8147e35f156': lavfi/formats: avoid using AV_{PIX,SAMPLE}_FMT_NB Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/formats.c')
-rw-r--r--libavfilter/formats.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 5816032746..dbd8bd9803 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -343,15 +343,19 @@ int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout)
AVFilterFormats *ff_all_formats(enum AVMediaType type)
{
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++) {
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
- if ((type != AVMEDIA_TYPE_VIDEO) ||
- (type == AVMEDIA_TYPE_VIDEO && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)))
+ if (type == AVMEDIA_TYPE_VIDEO) {
+ const AVPixFmtDescriptor *desc = NULL;
+ while ((desc = av_pix_fmt_desc_next(desc))) {
+ 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);
+ fmt++;
+ }
}
return ret;