[FFmpeg-devel] [PATCH] lavu: make av_get_media_type_string() never return NULL

Scott Theisen scott.the.elm at gmail.com
Mon Feb 28 23:06:08 EET 2022


On 2/23/22 02:52, Anton Khirnov wrote:
> Quoting Andreas Rheinhardt (2022-02-02 03:13:12)
>> Who sets invalid media types?
>> (In case of fftools/*: If they don't set it themselves, they (and all
>> our users) should be able to rely on our libraries to not set invalid
>> values. The same goes for all demuxers (as they set this value
>> themselves). Checks are only necessary where the media type comes from
>> the user; this means muxers (where the check should be done generically)
>> and possibly avfiltergraph.c (I am pretty sure that the type has already
>> been checked earlier for filters).)
> Some demuxer code in lavf looks like it might result in a TYPE_UNKNOWN
> AVStream. E.g. argo_brp, avi, both asfdecs, gxf.

Also, in libavcodec/codec_desc.c, avcodec_get_type(AV_CODEC_ID_NONE) 
will return AVMEDIA_TYPE_UNKNOWN.  The mpegts demuxer, for example, will 
set (or more likely leave) AV_CODEC_ID_NONE as the AVCodecID of a stream 
if it can't identify the codec.  This is probably true of all demuxers.

-Scott Theisen


More information about the ffmpeg-devel mailing list