[FFmpeg-devel] [PATCH v2] libavformat/mpegts: demux DVB VBI data

Scott Theisen scott.the.elm at gmail.com
Sat Nov 30 09:53:40 EET 2024


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.
---
 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 bc9163bf98..ed500bf798 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -3634,6 +3634,12 @@ static const AVCodecDescriptor codec_descriptors[] = {
         .long_name = NULL_IF_CONFIG_SMALL("ARIB STD-B24 caption"),
         .profiles  = NULL_IF_CONFIG_SMALL(ff_arib_caption_profiles),
     },
+    {
+        .id        = AV_CODEC_ID_DVB_VBI,
+        .type      = AVMEDIA_TYPE_SUBTITLE,
+        .name      = "dvb_vbi",
+        .long_name = NULL_IF_CONFIG_SMALL("DVB VBI data"),
+    },
 
     /* other kind of codecs and pseudo-codecs */
     {
diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
index 6bfaa02601..0e9e83fddb 100644
--- a/libavcodec/codec_id.h
+++ b/libavcodec/codec_id.h
@@ -579,6 +579,7 @@ enum AVCodecID {
     AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
     AV_CODEC_ID_TTML,
     AV_CODEC_ID_ARIB_CAPTION,
+    AV_CODEC_ID_DVB_VBI,
 
     /* other specific kind of codecs (generally used for attachments) */
     AV_CODEC_ID_FIRST_UNKNOWN = 0x18000,           ///< A dummy ID pointing at the start of various fake codecs.
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 177e610e53..693c8c849d 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -891,6 +891,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          },
+    { VBI_DATA_DESCRIPTOR,     AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_VBI      },
+    { VBI_TELETEXT_DESCRIPTOR, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_VBI      },
     { 0x56, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT },
     { 0x59, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */
     { 0 },
@@ -1888,6 +1890,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 d6dcf20947..bd9d402529 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



More information about the ffmpeg-devel mailing list