[FFmpeg-devel] [PATCH] cmdutils: fix finding next codec for id
Josh de Kock
josh at itanimul.li
Wed Feb 7 14:14:44 EET 2018
---
fftools/cmdutils.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 0b06ccc71a..8bb9952016 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1424,11 +1424,14 @@ static char get_media_type_char(enum AVMediaType type)
static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec *prev,
int encoder)
{
+ const AVCodec *next = NULL;
void *i = 0;
- while ((prev = av_codec_iterate(&i))) {
- if (prev->id == id &&
- (encoder ? av_codec_is_encoder(prev) : av_codec_is_decoder(prev)))
- return prev;
+
+ while ((next = av_codec_iterate(&i))) {
+ if (next->id == id &&
+ (!prev || (strcmp(next->name, prev->name) > 0)) &&
+ (encoder ? av_codec_is_encoder(next) : av_codec_is_decoder(next)))
+ return next;
}
return NULL;
}
--
2.14.3 (Apple Git-98)
More information about the ffmpeg-devel
mailing list