changeset 29502:9fa45a007afe

Add suport for detecting and demuxing DVB teletext streams (nothing beyond that though).
author reimar
date Fri, 21 Aug 2009 16:54:57 +0000
parents a0ba51e33912
children a3e1ef1c76d0
files libmpdemux/demux_ts.c
diffstat 1 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_ts.c	Thu Aug 20 01:55:45 2009 +0000
+++ b/libmpdemux/demux_ts.c	Fri Aug 21 16:54:57 2009 +0000
@@ -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;