[FFmpeg-devel] Adding Teletext Tags to mpeg TS demuxer

Reimar Döffinger Reimar.Doeffinger
Fri Sep 18 21:50:32 CEST 2009


On Fri, Sep 18, 2009 at 06:09:50PM +0200, Alwin Esch wrote:
> the attached patch adding codec Id's for mpeg TS streams which including
> Teletext data. The changes to parse the TS stream inside mpegts.c is only a
> extension of the "static const StreamType DESC_types[]" table with the ID's
> taken from ETSI EN 300 468 V1.5.1 (Digital Video Broadcasting (DVB);
> Specification for Service Information (SI) in DVB systems). Due to that
> inside avcodec.h no Data Codec section is present I add the ID's to 0x17500,
> hope this is acceptable.
> 
> It is required for adding Teletext support to XBMC, see Ticket
> http://www.xbmc.org/trac/ticket/7187 on XBMC trac.

This conflicts a bit with a patch I have in my local try. While it can
be considered a bit of a stretch, I think these might better be handled
as subtitle streams (particularly since teletext can also encode
subtitles). In particular, your patch also does not parse the language
from the teletext stream.

Index: libavcodec/avcodec.h
===================================================================
--- libavcodec/avcodec.h        (revision 19911)
+++ libavcodec/avcodec.h        (working copy)
@@ -330,6 +330,7 @@
     CODEC_ID_SSA,
     CODEC_ID_MOV_TEXT,
     CODEC_ID_HDMV_PGS_SUBTITLE,
+    CODEC_ID_DVB_TELETEXT,
 
     /* other specific kind of codecs (generally used for attachments) */
     CODEC_ID_TTF= 0x18000,
Index: libavformat/mpegts.c
===================================================================
--- libavformat/mpegts.c        (revision 19911)
+++ libavformat/mpegts.c        (working copy)
@@ -531,6 +531,7 @@
     { 0x6a, CODEC_TYPE_AUDIO,             CODEC_ID_AC3 }, /* AC-3 descriptor */
     { 0x7a, CODEC_TYPE_AUDIO,            CODEC_ID_EAC3 }, /* E-AC-3 descriptor */
     { 0x7b, CODEC_TYPE_AUDIO,             CODEC_ID_DTS },
+    { 0x56, CODEC_TYPE_SUBTITLE, CODEC_ID_DVB_TELETEXT },
     { 0x59, CODEC_TYPE_SUBTITLE, CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */
     { 0 },
 };
@@ -701,6 +702,13 @@
                 mpegts_find_stream_type(st, desc_tag, DESC_types);
 
             switch(desc_tag) {
+            case 0x56: /* DVB teletext descriptor */
+                language[0] = get8(&p, desc_end);
+                language[1] = get8(&p, desc_end);
+                language[2] = get8(&p, desc_end);
+                language[3] = 0;
+                av_metadata_set(&st->metadata, "language", language);
+                break;
             case 0x59: /* subtitling descriptor */
                 language[0] = get8(&p, desc_end);
                 language[1] = get8(&p, desc_end);



More information about the ffmpeg-devel mailing list