[MPlayer-dev-eng] [PATCH] Return actual current stream id in slave mode

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Dec 15 23:38:43 CET 2009


On Tue, Dec 15, 2009 at 11:05:45PM +0100, Adrian Stutz wrote:
> Hello,
> 
> Currently, get_property switch_audio / switch_video return -1 if no stream
> has been explicitly selected by either using -aid/-vid or switching streams
> while playing.
> 
> I don't think that's very useful and on the other hand it's very practical
> to know which stream mplayer selected exactly if none has been specified.
> This patch changes the return value of the switch_audio and switch_video
> properties to return the current stream id instead of -1.

Seems wrong in the details.
First, I think you have to check that mpctx->d_video (same for audio) is not NULL,
I expect that can happen.
Secondly, I think that it would be more useful to still return values < 0, since
I think that allows to distinguish
- a file without any video in principle (e.g. mp3 file)
- a file with audio disabled (== -2)
- a file for which no suitable stream has been found yet, e.g. a MPEG file
  where audio only starts quite far in (== -1)

MPlayer may not handle all these cases in a way that makes sense yet,
but we should not just ignore them if it's easy to take them into account.



More information about the MPlayer-dev-eng mailing list