Proper fix for last demux_avi commit, stream switching now really should

not hang anymore


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21421 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2006-12-01 19:24:42 +00:00
parent f32179337e
commit 0af2daec29
1 changed files with 9 additions and 8 deletions

View File

@ -775,18 +775,19 @@ static int demux_avi_control(demuxer_t *demuxer,int cmd, void *arg){
if (*(int *)arg >= 0)
ds->id = *(int *)arg;
else {
int id = ds->id;
do {
if (++id >= maxid) id = 0;
if (id == ds->id) // no streams available
return DEMUXER_CTRL_NOTIMPL;
} while (!streams[id]);
ds->id = id;
int i;
for (i = 0; i < maxid; i++) {
if (++ds->id >= maxid) ds->id = 0;
if (streams[ds->id]) break;
}
}
chunkid = (ds->id / 10 + '0') | (ds->id % 10 + '0') << 8;
ds->sh = NULL;
demux_avi_select_stream(demuxer, chunkid);
if (!streams[ds->id]) // stream not available
ds->id = -1;
else
demux_avi_select_stream(demuxer, chunkid);
*(int *)arg = ds->id;
return DEMUXER_CTRL_OK;
}