[FFmpeg-devel] How to satisfy two codecs with one decoder?
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- ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] How to satisfy two codecs with one decoder?
On 4/17/2020 7:40 PM, Roger Pack wrote: > 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? Usually, you set up two decoders that both reference the same functions (or most of them). In the case of shared function, they would then execute a different codepath depending on codec_id as required. See mpeg12dec.c and how both the mpeg1 and mpeg2 AVCodec entries are essentially the same for an example. Or the nvenc encoders. > > Thanks. > > -Roger- > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] How to satisfy two codecs with one decoder?
On 18.04.2020 00:53, James Almer wrote: See mpeg12dec.c and how both the mpeg1 and mpeg2 AVCodec entries are essentially the same for an example. Or the nvenc encoders. The old cuviddec is probably an even better example. The same decoder handles half a dozen codecs. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] How to satisfy two codecs with one decoder?
Am Sa., 18. Apr. 2020 um 00:46 Uhr schrieb Roger Pack : > > 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? I don't know how relevant this is but the mjpeg decoder also decodes ljpeg. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] How to satisfy two codecs with one decoder?
On Fri, Apr 17, 2020 at 4:53 PM James Almer wrote: > > On 4/17/2020 7:40 PM, Roger Pack wrote: > > 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? > > Usually, you set up two decoders that both reference the same functions > (or most of them). In the case of shared function, they would then > execute a different codepath depending on codec_id as required. > > See mpeg12dec.c and how both the mpeg1 and mpeg2 AVCodec entries are > essentially the same for an example. Or the nvenc encoders. Thanks that did it, those are good examples. One thing I did notice is if two decoders use the same ".priv_class" then it causes an infinite loop trying to find the next decoder to search for parameters. But one past that, all is well... Thanks! -roger- ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".