mirror of
https://github.com/mpv-player/mpv
synced 2025-01-20 06:11:10 +00:00
Implement stream switching for AVI demuxer.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21419 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
e6981cadec
commit
d441d65f34
@ -762,6 +762,31 @@ static int demux_avi_control(demuxer_t *demuxer,int cmd, void *arg){
|
||||
if (sh_video->video.dwLength<=1) return DEMUXER_CTRL_GUESS;
|
||||
return DEMUXER_CTRL_OK;
|
||||
|
||||
case DEMUXER_CTRL_SWITCH_AUDIO:
|
||||
case DEMUXER_CTRL_SWITCH_VIDEO: {
|
||||
int audio = (cmd == DEMUXER_CTRL_SWITCH_AUDIO);
|
||||
demux_stream_t *ds = audio ? demuxer->audio : demuxer->video;
|
||||
void **streams = audio ? demuxer->a_streams : demuxer->v_streams;
|
||||
int maxid = FFMAX(99, audio ? MAX_A_STREAMS : MAX_V_STREAMS);
|
||||
int chunkid;
|
||||
if (ds->id < -1)
|
||||
return DEMUXER_CTRL_NOTIMPL;
|
||||
|
||||
if (*(int *)arg >= 0)
|
||||
ds->id = *(int *)arg;
|
||||
else {
|
||||
do {
|
||||
if (++ds->id >= maxid) ds->id = 0;
|
||||
} while (!streams[ds->id]);
|
||||
}
|
||||
|
||||
chunkid = (ds->id / 10 + '0') | (ds->id % 10 + '0') << 8;
|
||||
ds->sh = NULL;
|
||||
demux_avi_select_stream(demuxer, chunkid);
|
||||
*(int *)arg = ds->id;
|
||||
return DEMUXER_CTRL_OK;
|
||||
}
|
||||
|
||||
default:
|
||||
return DEMUXER_CTRL_NOTIMPL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user