[MPlayer-dev-eng] [PATCH] stream switching for AVI demuxer
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Nov 30 19:01:15 CET 2006
Hello,
please test and comment on attached patch.
Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpdemux/demux_avi.c
===================================================================
--- libmpdemux/demux_avi.c (revision 21403)
+++ libmpdemux/demux_avi.c (working copy)
@@ -762,6 +762,32 @@
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;
}
More information about the MPlayer-dev-eng
mailing list