changeset 20948:7c91b80cabc1

added code to switch video stream
author nicodvb
date Thu, 16 Nov 2006 21:23:06 +0000
parents 6baefa24946f
children fdc42ef57a58
files libmpdemux/demuxer.c libmpdemux/demuxer.h
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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));
--- 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);