[MPlayer-dev-eng] [PATCH] Add support for default of multiple video tracks

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Jan 28 19:12:14 CET 2014


On Tue, Jan 28, 2014 at 03:36:50PM +0100, Ingo Brückl wrote:
> Reimar Döffinger wrote on Tue, 28 Jan 2014 08:44:04 +0100:
> 
> > On 28 January 2014 00:09:40 CET, "Ingo Brückl" <ib at wupperonline.de>
> > wrote:
> >>Reimar Döffinger wrote on Mon, 27 Jan 2014 23:55:42 +0100:
> >>
> >>> On 27.01.2014, at 21:55, Ingo Brückl <ib at wupperonline.de> wrote:
> >>>> I wrote on Mon, 27 Jan 2014 19:20:07 +0100:
> >>>>
> >>>> The mplayer.c part of the patch attached to this posting doesn't change
> >>>> video_id which is preferable.
> >>
> >>> This doesn't seem right/make sense to me.
> >>> The stream selection code if I remember right is in the code that adds a
> >>> new stream.
> 
> > The issue is, that when we get a new stream we must immediately decide
> > to play it or not, otherwise we might lose data.
> > But that means when a default stream comes later, you actually have to
> > _switch_ streams, discarding data, reinitializing decoders, ...
> > And this might not be desirable anyway.
> 
> I admit that I don't know much about demuxing, so maybe I've got something
> wrong with this idea of selecting the default video stream. On the other
> hand, we are doing it already for audio and subtitles. (And very similar
> if I don't get it wrong.)
> 
> > One way to solve this is to forget about doing it correctly but instead
> > only fix the simple cases while making sure not to make the complex ones
> > worse.
> 
> Well, I'd be glad if at least the default video stream after demux open would
> get selected. This will be done by the patch I've proposed. It may not handle
> the case that streams change during playback, but it is at least far much
> better than what we have currently.
> 
> And, default audio gets handled very similar at the very same position in
> mplayer.c. Is audio different from video in this regard?

I guess I just shouldn't be answering without reading code first.
What I was thinking of is this:
        if (vid == video_id) {
            demuxer->video->id = id;
            demuxer->video->sh = demuxer->v_streams[id];
        }
But that one's actually the code that handles streams that appear
only later, everything else is handled earlier.
One thing that makes video slightly more problematic than audio is
that losing just one packet can corrupt 30 seconds or more, but admittedly
it's better to have a consistent solution.
However I feel like this whole thing (both for audio and video) is misdesigned.
E.g. demux_lavf has this code:
            // select the first video stream if auto-selection is requested
            if(demuxer->video->id == -1) {
                demuxer->video->id = i;
                demuxer->video->sh= demuxer->v_streams[i];
            }

But this seems like it will be a larger project to clean up.
My suggestions would be
1) Test it with MPEG-TS/DVB/DVD streams if you can, just to be sure.
2) Make it a select_video function just to be consistent and so that
3) You can easily add it right next to select_audio in mencoder.c, too.


More information about the MPlayer-dev-eng mailing list