[FFmpeg-devel] [PATCH]Report "unknown codec" instead of "unspecifed size" if the codec is unknown
Carl Eugen Hoyos
cehoyos at ag.or.at
Sun Jun 1 19:28:31 CEST 2014
On Sunday 01 June 2014 07:21:10 pm Michael Niedermayer wrote:
> On Sun, Jun 01, 2014 at 02:20:17PM +0200, Carl Eugen Hoyos wrote:
> > Currently, has_codec_parameters() fails with "unspecified size" if
> > nothing is known about a video stream, I believe it makes more
> > sense to report "unknown codec" with highest priority.
> > + if (avctx->codec_id == AV_CODEC_ID_NONE)
> > + FAIL("unknown codec");
>
> ID_NONE is allowed in the AVMEDIA_TYPE_DATA case prior to this patch
New patch attached.
Thank you, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1f72241..6df426b 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2644,6 +2644,9 @@ static int has_codec_parameters(AVStream *st, const char **errmsg_ptr)
return 0; \
} while (0)
+ if ( avctx->codec_id == AV_CODEC_ID_NONE
+ && avctx->codec_type != AVMEDIA_TYPE_DATA)
+ FAIL("unknown codec");
switch (avctx->codec_type) {
case AVMEDIA_TYPE_AUDIO:
if (!avctx->frame_size && determinable_frame_size(avctx))
@@ -2675,8 +2678,6 @@ static int has_codec_parameters(AVStream *st, const char **errmsg_ptr)
if (avctx->codec_id == AV_CODEC_ID_NONE) return 1;
}
- if (avctx->codec_id == AV_CODEC_ID_NONE)
- FAIL("unknown codec");
return 1;
}
More information about the ffmpeg-devel
mailing list