diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index 2448bf7ab2..e5dd39c25b 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -1079,6 +1079,13 @@ int demuxer_switch_audio(demuxer_t *demuxer, int index){ 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 --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h index 49f3625e01..6d2c5d6eb0 100644 --- a/libmpdemux/demuxer.h +++ b/libmpdemux/demuxer.h @@ -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 int demuxer_get_current_time(demuxer_t *demuxer); 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);