[MPlayer-users] switch_audio on *.ts files

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Jun 21 14:24:23 CEST 2009


On Sun, Jun 21, 2009 at 02:23:14PM +0200, Reimar Döffinger wrote:
> On Thu, Jun 18, 2009 at 11:31:13AM +0200, Nico Sabbi wrote:
> > On Thursday 18 June 2009 03:59:08 RVM wrote:
> > > Full log attached (and compressed, it's huge). BTW, is it necessary
> > > that those ID_VIDEO_ID and ID_AUDIO_ID lines appear so many times?
> > 
> > it's annoying, but adding even more code to handle such cases is even 
> > more so. Anyway, patch welcome.
> 
> Applied the other one, this patch makes sure ID_AID_???_LANG is printed
> only once and directly after the corresponding ID_AUDIO_ID.
> Subtitle messages are still duplicated though, which is due to the fact
> that new_sh_sub is never called? Could it be subtitles are not really
> supported for TS or am I missing something??

I know, I know... here's the patch...
-------------- next part --------------
Index: libmpdemux/demux_ts.c
===================================================================
--- libmpdemux/demux_ts.c	(revision 29378)
+++ libmpdemux/demux_ts.c	(working copy)
@@ -286,6 +286,7 @@
 }
 
 static int parse_avc_sps(uint8_t *buf, int len, int *w, int *h);
+static inline uint8_t *pid_lang_from_pmt(ts_priv_t *priv, int pid);
 
 static void ts_add_stream(demuxer_t * demuxer, ES_stream_t *es)
 {
@@ -300,6 +301,7 @@
 		sh_audio_t *sh = new_sh_audio_aid(demuxer, priv->last_aid, es->pid);
 		if(sh)
 		{
+			const char *lang;
 			sh->format = IS_AUDIO(es->type) ? es->type : es->subtype;
 			sh->ds = demuxer->audio;
 
@@ -307,6 +309,9 @@
 			priv->ts.streams[es->pid].sh = sh;
 			priv->ts.streams[es->pid].type = TYPE_AUDIO;
 			mp_msg(MSGT_DEMUX, MSGL_V, "\r\nADDED AUDIO PID %d, type: %x stream n. %d\r\n", es->pid, sh->format, priv->last_aid);
+			lang = pid_lang_from_pmt(priv, es->pid);
+			if (lang && lang[0])
+				mp_msg(MSGT_IDENTIFY, MSGL_V, "ID_AID_%d_LANG=%s\n", es->pid, lang);
 			priv->last_aid++;
 		}
 
@@ -706,8 +711,6 @@
 			}
 			else if(is_audio)
 			{
-				if (es.lang[0] > 0)
-					mp_msg(MSGT_IDENTIFY, MSGL_V, "ID_AID_%d_LANG=%s\n", es.pid, es.lang);
 				if(req_apid > 0)
 				{
 					chosen_pid = (req_apid == es.pid);


More information about the MPlayer-users mailing list