# HG changeset patch # User nicodvb # Date 1163712186 0 # Node ID 7c91b80cabc1afed3e158ea2c03febde3f270fe5 # Parent 6baefa24946f3150b60f4140190885afd67982a5 added code to switch video stream diff -r 6baefa24946f -r 7c91b80cabc1 libmpdemux/demuxer.c --- a/libmpdemux/demuxer.c Thu Nov 16 21:22:07 2006 +0000 +++ b/libmpdemux/demuxer.c Thu Nov 16 21:23:06 2006 +0000 @@ -1079,6 +1079,13 @@ return index; } +int demuxer_switch_video(demuxer_t *demuxer, int index){ + int res = demux_control(demuxer, DEMUXER_CTRL_SWITCH_VIDEO, &index); + if (res == DEMUXER_CTRL_NOTIMPL) + index = demuxer->video->id; + return index; +} + int demuxer_add_chapter(demuxer_t* demuxer, const char* name, uint64_t start, uint64_t end){ if (demuxer->chapters == NULL) demuxer->chapters = malloc (32*sizeof(*demuxer->chapters)); diff -r 6baefa24946f -r 7c91b80cabc1 libmpdemux/demuxer.h --- a/libmpdemux/demuxer.h Thu Nov 16 21:22:07 2006 +0000 +++ b/libmpdemux/demuxer.h Thu Nov 16 21:23:06 2006 +0000 @@ -78,6 +78,7 @@ #define DEMUXER_CTRL_GET_PERCENT_POS 11 #define DEMUXER_CTRL_SWITCH_AUDIO 12 #define DEMUXER_CTRL_RESYNC 13 +#define DEMUXER_CTRL_SWITCH_VIDEO 14 // Holds one packet/frame/whatever typedef struct demux_packet_st { @@ -365,6 +366,7 @@ extern double demuxer_get_time_length(demuxer_t *demuxer); extern int demuxer_get_percent_pos(demuxer_t *demuxer); extern int demuxer_switch_audio(demuxer_t *demuxer, int index); +extern int demuxer_switch_video(demuxer_t *demuxer, int index); extern int demuxer_type_by_filename(char* filename);