[FFmpeg-devel] [PATCH 2/2] libavformat/mpegts: demux DVB VBI data
Marton Balint
cus at passwd.hu
Fri Nov 22 23:12:03 EET 2024
On Fri, 15 Nov 2024, Scott Theisen wrote:
> From: ulmus-scott <scott.the.elm at gmail.com>
>
> DVB VBI data is defined in ETSI EN 301 775 and can include EBU teletext data
> as defined in ETSI EN 300 472.
>
> ETSI EN 300 468 defines teletext_descriptor, VBI_data_descriptor, and
> VBI_teletext_descriptor, which has the same definition as, but different use
> from, teletext_descriptor.
Hmm, adding a new codec for VBI data might be OK, but I am not sure if
there is a better way to automagically let the framework know if there are
teletext compatible VBI packets, so the teletext decoder can be used. Or
maybe we should simply set the codec id to DVB_TELETEXT if there is a
VBI_TELETEXT_DESCRIPTOR, and make the teletext decoder parse all data
units in search for a comptaible data unit id?
Because if we set the codec to VBI for VBI_TELETEXT cases, won't this
break the automatic probing of unknown codecs? (which otherwise might
recognize the stream as teletext)? So maybe for VBI_TELETEXT_DESCRIPTOR
case we should keep the coded id NONE and rely entirely on probing?
Thanks,
Marton
> ---
> libavcodec/codec_desc.c | 6 ++++++
> libavcodec/codec_id.h | 1 +
> libavformat/mpegts.c | 3 +++
> libavformat/mpegts.h | 2 ++
> 4 files changed, 12 insertions(+)
>
> diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
> index aeac75a6c5..63dbc3f155 100644
> --- a/libavcodec/codec_desc.c
> +++ b/libavcodec/codec_desc.c
> @@ -3720,6 +3720,12 @@ static const AVCodecDescriptor codec_descriptors[] = {
> .name = "lcevc",
> .long_name = NULL_IF_CONFIG_SMALL("LCEVC (Low Complexity Enhancement Video Coding) / MPEG-5 LCEVC / MPEG-5 part 2"),
> },
> + {
> + .id = AV_CODEC_ID_DVB_VBI,
> + .type = AVMEDIA_TYPE_DATA,
> + .name = "dvb_vbi",
> + .long_name = NULL_IF_CONFIG_SMALL("DVB VBI data"),
> + },
> {
> .id = AV_CODEC_ID_MPEG2TS,
> .type = AVMEDIA_TYPE_DATA,
> diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
> index 6bfaa02601..e7e984379c 100644
> --- a/libavcodec/codec_id.h
> +++ b/libavcodec/codec_id.h
> @@ -596,6 +596,7 @@ enum AVCodecID {
> AV_CODEC_ID_BIN_DATA,
> AV_CODEC_ID_SMPTE_2038,
> AV_CODEC_ID_LCEVC,
> + AV_CODEC_ID_DVB_VBI,
>
>
> AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> index 78ab7f7efe..07b5ba996d 100644
> --- a/libavformat/mpegts.c
> +++ b/libavformat/mpegts.c
> @@ -890,6 +890,8 @@ static const StreamType DESC_types[] = {
> { 0x6a, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AC3 }, /* AC-3 descriptor */
> { 0x7a, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_EAC3 }, /* E-AC-3 descriptor */
> { 0x7b, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS },
> + { 0x45, AVMEDIA_TYPE_DATA, AV_CODEC_ID_DVB_VBI }, /* VBI_DATA_DESCRIPTOR */
> + { 0x46, AVMEDIA_TYPE_DATA, AV_CODEC_ID_DVB_VBI }, /* VBI_TELETEXT_DESCRIPTOR */
> { 0x56, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT },
> { 0x59, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */
> { 0 },
> @@ -1887,6 +1889,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
> }
> }
> break;
> + case VBI_TELETEXT_DESCRIPTOR:
> case 0x56: /* DVB teletext descriptor */
> {
> uint8_t *extradata = NULL;
> diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
> index 729c8b07b9..d1fc4210ae 100644
> --- a/libavformat/mpegts.h
> +++ b/libavformat/mpegts.h
> @@ -167,6 +167,8 @@
>
> /* DVB descriptor tag values [0x40, 0x7F] from
> ETSI EN 300 468 Table 12: Possible locations of descriptors */
> +#define VBI_DATA_DESCRIPTOR 0x45
> +#define VBI_TELETEXT_DESCRIPTOR 0x46
> #define SERVICE_DESCRIPTOR 0x48
> #define STREAM_IDENTIFIER_DESCRIPTOR 0x52
> #define TELETEXT_DESCRIPTOR 0x56
> --
> 2.43.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>
More information about the ffmpeg-devel
mailing list