[MPlayer-dev-eng] [PATCH] add teletext demuxing support for ts demuxer

Reimar Döffinger Reimar.Doeffinger at gmx.de
Fri Aug 21 12:34:33 CEST 2009


Hello,
this is a bit pointless since there is nothing to do with it, but with
attached patch teletext es streams at least get recognized.

-------------- next part --------------
Index: libmpdemux/demux_ts.c
===================================================================
--- libmpdemux/demux_ts.c	(revision 29540)
+++ libmpdemux/demux_ts.c	(working copy)
@@ -80,6 +80,7 @@
 	AUDIO_TRUEHD	= mmioFOURCC('T', 'R', 'H', 'D'),
 	SPU_DVD		= 0x3000000,
 	SPU_DVB		= 0x3000001,
+	SPU_TELETEXT	= 0x3000002,
 	PES_PRIVATE1	= 0xBD00000,
 	SL_PES_STREAM	= 0xD000000,
 	SL_SECTION	= 0xD100000,
@@ -247,6 +248,7 @@
 
 #define IS_AUDIO(x) (((x) == AUDIO_MP2) || ((x) == AUDIO_A52) || ((x) == AUDIO_LPCM_BE) || ((x) == AUDIO_AAC) || ((x) == AUDIO_DTS) || ((x) == AUDIO_TRUEHD))
 #define IS_VIDEO(x) (((x) == VIDEO_MPEG1) || ((x) == VIDEO_MPEG2) || ((x) == VIDEO_MPEG4) || ((x) == VIDEO_H264) || ((x) == VIDEO_AVC)  || ((x) == VIDEO_VC1))
+#define IS_SUB(x) (((x) == SPU_DVD) || ((x) == SPU_DVB) || ((x) == SPU_TELETEXT))
 
 static int ts_parse(demuxer_t *demuxer, ES_stream_t *es, unsigned char *packet, int probe);
 
@@ -695,7 +697,7 @@
 
 			is_audio = IS_AUDIO(es.type) || ((es.type==SL_PES_STREAM) && IS_AUDIO(es.subtype));
 			is_video = IS_VIDEO(es.type) || ((es.type==SL_PES_STREAM) && IS_VIDEO(es.subtype));
-			is_sub   = ((es.type == SPU_DVD) || (es.type == SPU_DVB));
+			is_sub   = IS_SUB(es.type);
 
 
 			if((! is_audio) && (! is_video) && (! is_sub))
@@ -882,8 +884,8 @@
 		mp_msg(MSGT_DEMUXER, MSGL_INFO, "NO AUDIO! ");
 	}
 
-	if(param->stype == SPU_DVD || param->stype == SPU_DVB)
-		mp_msg(MSGT_DEMUXER, MSGL_INFO, " SUB %s(pid=%d) ", (param->stype==SPU_DVD ? "DVD" : "DVB"), param->spid);
+	if(IS_SUB(param->stype))
+		mp_msg(MSGT_DEMUXER, MSGL_INFO, " SUB %s(pid=%d) ", (param->stype==SPU_DVD ? "DVD" : param->stype==SPU_DVB ? "DVB" : "Teletext"), param->spid);
 	else
 	{
 		param->stype = UNKNOWN;
@@ -2250,6 +2252,14 @@
 				mp_msg(MSGT_DEMUX, MSGL_DBG2, "DVB DTS Descriptor\n");
 			}
 		}
+		else if(ptr[j] == 0x56) // Teletext
+		{
+			if(descr_len >= 5) {
+				memcpy(es->lang, ptr+2, 3);
+				es->lang[3] = 0;
+			}
+			es->type = SPU_TELETEXT;
+		}
 		else if(ptr[j] == 0x59)	//Subtitling Descriptor
 		{
 			uint8_t subtype;
@@ -2880,7 +2890,7 @@
 
 		is_video = IS_VIDEO(tss->type) || (tss->type==SL_PES_STREAM && IS_VIDEO(tss->subtype));
 		is_audio = IS_AUDIO(tss->type) || (tss->type==SL_PES_STREAM && IS_AUDIO(tss->subtype)) || (tss->type == PES_PRIVATE1);
-		is_sub	= ((tss->type == SPU_DVD) || (tss->type == SPU_DVB));
+		is_sub	= IS_SUB(tss->type);
 		pid_type = pid_type_from_pmt(priv, pid);
 
 			// PES CONTENT STARTS HERE
@@ -2913,7 +2923,7 @@
 				si = &priv->astr;
 			}
 			else if(is_sub
-				|| (pid_type == SPU_DVD) || (pid_type == SPU_DVB))
+				|| IS_SUB(pid_type))
 			{
 				//SUBS are infrequent, so the initial detection may fail
 				// and we may need to add them at play-time
@@ -3062,7 +3072,7 @@
 			tss->is_synced |= es->is_synced || rap_flag;
 			tss->payload_size = es->payload_size;
 
-			if(is_audio && (lang = pid_lang_from_pmt(priv, es->pid)))
+			if((is_sub || is_audio) && (lang = pid_lang_from_pmt(priv, es->pid)))
 			{
 				memcpy(es->lang, lang, 3);
 				es->lang[3] = 0;


More information about the MPlayer-dev-eng mailing list