summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_avi.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-12-01 17:57:29 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-12-01 17:57:29 +0000
commitd441d65f3411402a367e24cd70b606c579ef356e (patch)
treed910366c7810fa8e84278d4fa267075b5dc6effb /libmpdemux/demux_avi.c
parente6981cadec1204be8d22f739bdbba6302e027ec3 (diff)
downloadmpv-d441d65f3411402a367e24cd70b606c579ef356e.tar.bz2
mpv-d441d65f3411402a367e24cd70b606c579ef356e.tar.xz
Implement stream switching for AVI demuxer.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21419 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/demux_avi.c')
-rw-r--r--libmpdemux/demux_avi.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libmpdemux/demux_avi.c b/libmpdemux/demux_avi.c
index b2e9556dc7..d6053e878b 100644
--- a/libmpdemux/demux_avi.c
+++ b/libmpdemux/demux_avi.c
@@ -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;
}