[MPlayer-users] switch_audio on *.ts files

Reimar Döffinger Reimar.Doeffinger at gmx.de
Fri Jun 19 14:56:52 CEST 2009


On Fri, Jun 19, 2009 at 01:37:41PM +0200, rvm wrote:
> 2009/6/19 Reimar Döffinger <Reimar.Doeffinger at gmx.de>:
> 
> > Probably, there are two kinds on stream IDs in MPlayer and -vid
> > originally selected one that made no sense.
> > They are still confused in some places and this is probably one.
> > See if this patch fixes it for you:
> > Index: command.c
> > ===================================================================
> > --- command.c   (revision 29371)
> > +++ command.c   (working copy)
> > @@ -2029,7 +2029,7 @@
> >     { "channels", mp_property_channels, CONF_TYPE_INT,
> >      0, 0, 0, NULL },
> >     { "switch_audio", mp_property_audio, CONF_TYPE_INT,
> > -     CONF_RANGE, -2, MAX_A_STREAMS - 1, NULL },
> > +     CONF_RANGE, -2, 65535, NULL },
> >     { "balance", mp_property_balance, CONF_TYPE_FLOAT,
> >      M_OPT_RANGE, -1, 1, NULL },
> >
> > @@ -2075,7 +2075,7 @@
> >     { "aspect", mp_property_aspect, CONF_TYPE_FLOAT,
> >      0, 0, 0, NULL },
> >     { "switch_video", mp_property_video, CONF_TYPE_INT,
> > -     CONF_RANGE, -2, MAX_V_STREAMS - 1, NULL },
> > +     CONF_RANGE, -2, 65535, NULL },
> >     { "switch_program", mp_property_program, CONF_TYPE_INT,
> >      CONF_RANGE, -1, 65535, NULL },
> 
> No, I'm afraid it doesn't fix it.
> The only difference it that now mplayer doesn't print the error "The
> switch_video option must be <= 255", but still it doesn't change to
> the specified video track. switch_audio doesn't work either if passing
> the ID printed with -identify.

Ah, sorry, I looked at the MPEG-PS code, your case is TS.
I think this might work, Nico do you think it is correct?
(Compilation still in progress so I haven't tested yet).
Index: libmpdemux/demux_ts.c
===================================================================
--- libmpdemux/demux_ts.c       (revision 29371)
+++ libmpdemux/demux_ts.c       (working copy)
@@ -3378,14 +3378,9 @@
                        }
                        else    //audio track <n>
                        {
-                               for(i = 0; i < 8192; i++)
-                               {
-                                       if(priv->ts.streams[i].id == n && priv->ts.streams[i].type == reftype)
-                                       {
+                               if (n >= 8192 || priv->ts.streams[n].type != reftype) return DEMUXER_CTRL_NOTIMPL;
+                               i = n;
                                                sh = priv->ts.streams[i].sh;
-                                               break;
-                                       }
-                               }
                        }
 
                        if(sh)


More information about the MPlayer-users mailing list