diff mpcommon.c @ 36682:68794f2fbf1e

Add support for default of multiple video tracks. Some container formats like matroska support multiple video tracks, one of which may be flagged the 'default' one which thus should be played by default. Works with the lavf demuxer.
author ib
date Sun, 02 Feb 2014 19:18:31 +0000
parents 8587ae275646
children
line wrap: on
line diff
--- a/mpcommon.c	Sun Feb 02 10:54:37 2014 +0000
+++ b/mpcommon.c	Sun Feb 02 19:18:31 2014 +0000
@@ -416,6 +416,16 @@
     return demuxer->audio->id;
 }
 
+int select_video(demuxer_t* demuxer, int video_id)
+{
+    if (video_id == -1)
+        video_id = demuxer_default_video_track(demuxer);
+    if (video_id != -1) // -1 (automatic) is the default behaviour of demuxers
+        demuxer_switch_video(demuxer, video_id);
+
+    return demuxer->video->id;
+}
+
 /* Parse -noconfig common to both programs */
 int disable_system_conf=0;
 int disable_user_conf=0;