[FFmpeg-devel] [PATCH] avcodec/avformat: Added codec_name to AVCodecContext and AVCodecParameters

Anton Khirnov anton at khirnov.net
Wed Jul 3 12:10:41 EEST 2024


Quoting Bernardo Pilarz via ffmpeg-devel (2024-07-03 10:10:15)
> >> +    char *codec_name;
> >>        const struct AVCodec  *codec;
> >>        enum AVCodecID     codec_id; /* see AV_CODEC_ID_xxx */
> >>
> > Adding a new field here is an ABI break, it would need to go at the
> > end of the struct.
> >
> > In general, I feel like this might be better served to go into
> > metadata though, especially as very few containers have a string codec
> > identifier to begin with.
>
> I would be very glad to do it the right way, but I need some guidance 
> since this is the first time I try to contribute to FFmpeg.
> 
> The problem that I am trying to solve is receiving metadata from an RTSP 
> stream (in example, ONVIF metadata identified by the codec name 
> 'vcd.onvif.metadata').
> This is data that the application will want to handle on its own (and 
> not through FFmpeg).
> 
> Can you guide me on how to do this properly?

First of all, this should definitely NOT go into AVCodecContext, since
the entire premise is that we have no codec ID and hence no decoders or
encoders, so a codec context makes no sense.

Next, the idea that you can define a generic container-independent
"codec name" sounds dubious to me, as they are not universally
standardized. You'd either have to define precisely what can the API
caller expect in there, or make this a private AV_OPT_FLAG_EXPORT option
of your demuxer. I'd suggest the second, as it's much simpler, though
IIRC we do not yet support per-stream private options.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list