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

Scott Theisen scott.the.elm at gmail.com
Fri Nov 15 07:48:23 EET 2024


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.
---
 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



More information about the ffmpeg-devel mailing list