[FFmpeg-devel] How to satisfy two codecs with one decoder?

Roger Pack rogerdpack2 at gmail.com
Sat Apr 18 01:40:25 EEST 2020


I want to add to the closed caption libavcodec/ccaption_dec.c decoder
to be able to handle both 608 "over CEA 708" (which it already does)
and also "raw EIA 608 byte pairs" which it doesn't.

My idea was to introduce a new codec id for the raw 608 pairs.
AV_CODEC_ID_EIA_RAW_608 or the like.

The decoding shares a lot of functionality.

Currently the decoder code is set up like this:

AVCodec ff_ccaption_decoder = {
.name = "cc_dec",
.long_name = NULL_IF_CONFIG_SMALL("Closed Caption (EIA-608 / CEA-708)"),
.type = AVMEDIA_TYPE_SUBTITLE,
.id = AV_CODEC_ID_EIA_608,
...

I was hoping to "add" another codec like AV_CODEC_ID_EIA_RAW_608 and
having this decoder be able to decode both types.

I was anticipating being able to define some kind of "query" method so
it would check if the requested codec id was "either
AV_CODEC_ID_EIA_608 or AV_CODEC_ID_EIA_RAW_608" and accept decoding
either codec.

Is there a way for a codec to decode two id's like this?
If not any recommendations on how to best handle this?

Thanks.

-Roger-


More information about the ffmpeg-devel mailing list