[vlc-devel] [PATCH 6/6] bluray: Filter video tracks to display the main one.

Hugo Beauzée-Luyssen beauze.h at gmail.com
Thu Mar 8 16:08:35 CET 2012


This fixes playback for wall-e bluray (and maybe others)
---
 modules/access/bluray.c |   25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 426320d..d189a55 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -118,6 +118,7 @@ struct  demux_sys_t
     es_out_t            *p_out;
     vlc_array_t         es;
     int                 i_audio_stream; /* Selected audio stream. -1 if default */
+    int                 i_video_stream;
     stream_t            *p_parser;
 };
 
@@ -171,6 +172,7 @@ static int blurayOpen( vlc_object_t *object )
     }
     p_sys->current_overlay = -1;
     p_sys->i_audio_stream = -1;
+    p_sys->i_video_stream = -1;
 
     /* init demux info fields */
     p_demux->info.i_update    = 0;
@@ -390,6 +392,8 @@ static es_out_id_t *esOutAdd( es_out_t *p_out, const es_format_t *p_fmt )
     switch (fmt.i_cat)
     {
     case VIDEO_ES:
+        if ( p_sys->i_video_stream != -1 && p_sys->i_video_stream != p_fmt->i_id )
+            fmt.i_priority = -2;
         break ;
     case AUDIO_ES:
         if ( p_sys->i_audio_stream != -1 && p_sys->i_audio_stream != p_fmt->i_id )
@@ -1078,6 +1082,25 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
     return VLC_SUCCESS;
 }
 
+static void     blurayUpdateCurrentClip( demux_t *p_demux, uint32_t clip )
+{
+    if (clip == 0xFF)
+        return ;
+    demux_sys_t *p_sys = p_demux->p_sys;
+
+    p_sys->i_current_clip = clip;
+    BLURAY_TITLE_INFO   *info = bd_get_title_info(p_sys->bluray,
+                                        bd_get_current_title(p_sys->bluray), 0);
+    if ( info == NULL )
+        return ;
+    /* Let's assume a single video track for now.
+     * This may brake later, but it's enough for now.
+     */
+    assert(info->clips[p_sys->i_current_clip].video_stream_count >= 1);
+    p_sys->i_video_stream = info->clips[p_sys->i_current_clip].video_streams[0].pid;
+    bd_free_title_info(info);
+}
+
 static void blurayHandleEvent( demux_t *p_demux, const BD_EVENT *e )
 {
     demux_sys_t     *p_sys = p_demux->p_sys;
@@ -1088,7 +1111,7 @@ static void blurayHandleEvent( demux_t *p_demux, const BD_EVENT *e )
             blurayUpdateTitle(p_demux, e->param);
             break;
         case BD_EVENT_PLAYITEM:
-            p_sys->i_current_clip = e->param;
+            blurayUpdateCurrentClip(p_demux, e->param);
             break;
         case BD_EVENT_AUDIO_STREAM:
         {
-- 
1.7.9.3




More information about the vlc-devel mailing list