From 96e829fc9c37f01952f3ccb8785ea0a8e9046937 Mon Sep 17 00:00:00 2001 From: nicodvb Date: Thu, 16 Nov 2006 21:23:06 +0000 Subject: [PATCH] added code to switch video stream git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20964 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demuxer.c | 7 +++++++ libmpdemux/demuxer.h | 2 ++ 2 files changed, 9 insertions(+) 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);