Mercurial > mplayer.hg
changeset 26094:2b4e40be7cb0
Support switching to/from nosound in demux_lavf.
Also fixes a bug when pstreams[-1] could be accessed. It happens when
switching audio tracks if mplayer was run with '-nosound'.
author | eugeni |
---|---|
date | Fri, 29 Feb 2008 17:25:57 +0000 |
parents | 835f8ba52075 |
children | 7470a625bbdd |
files | libmpdemux/demux_lavf.c |
diffstat | 1 files changed, 8 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_lavf.c Fri Feb 29 17:25:55 2008 +0000 +++ b/libmpdemux/demux_lavf.c Fri Feb 29 17:25:57 2008 +0000 @@ -665,7 +665,7 @@ { int id = *((int*)arg); int newid = -2; - int i, curridx = -2; + int i, curridx = -1; int nstreams, *pstreams; demux_stream_t *ds; @@ -681,14 +681,6 @@ nstreams = priv->audio_streams; pstreams = priv->astreams; } - if(id == -2) - { - if(ds->id >= 0) - priv->avfc->streams[ds->id]->discard = AVDISCARD_ALL; - ds_free_packs(ds); - *((int*)arg) = ds->id = -2; - return DEMUXER_CTRL_OK; - } for(i = 0; i < nstreams; i++) { if(pstreams[i] == ds->id) //current stream id @@ -698,12 +690,14 @@ } } - if(id < 0) - { - i = (curridx + 1) % nstreams; - newid = pstreams[i]; + if(id == -2) { // no sound + i = -1; + } else if(id == -1) { // next track + i = (curridx + 2) % (nstreams + 1) - 1; + if (i >= 0) + newid = pstreams[i]; } - else + else // select track by id { for(i = 0; i < nstreams; i++) {