[vlc-commits] bluray: notify libbluray when stream selection changes

Petri Hintukainen git at videolan.org
Tue Nov 10 14:03:39 CET 2015


vlc | branch: master | Petri Hintukainen <phintuka at gmail.com> | Tue Nov 10 13:41:54 2015 +0200| [fea9d0b70a70b588eda1f46b159d7ffac68bb767] | committer: Jean-Baptiste Kempf

bluray: notify libbluray when stream selection changes

Fixes currently selected stream in disc pop-up menus.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fea9d0b70a70b588eda1f46b159d7ffac68bb767
---

 modules/access/bluray.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index c7a6b59..f9863b7 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -1493,6 +1493,39 @@ static int bluraySetTitle(demux_t *p_demux, int i_title)
     return VLC_SUCCESS;
 }
 
+#if BLURAY_VERSION < BLURAY_VERSION_CODE(0,9,2)
+#  define BLURAY_AUDIO_STREAM 0
+#endif
+
+static void blurayStreamSelected(demux_sys_t *p_sys, int i_pid)
+{
+    vlc_mutex_lock(&p_sys->pl_info_lock);
+
+    if (p_sys->p_clip_info) {
+        if ((i_pid & 0xff00) == 0x1100) {
+            // audio
+            for (int i_id = 0; i_id < p_sys->p_clip_info->audio_stream_count; i_id++) {
+                if (i_pid == p_sys->p_clip_info->audio_streams[i_id].pid) {
+                    p_sys->i_audio_stream_idx = i_id;
+                    bd_select_stream(p_sys->bluray, BLURAY_AUDIO_STREAM, i_id + 1, 1);
+                    break;
+                }
+            }
+        } else if ((i_pid & 0xff00) == 0x1400 || i_pid == 0x1800) {
+            // subtitle
+            for (int i_id = 0; i_id < p_sys->p_clip_info->pg_stream_count; i_id++) {
+                if (i_pid == p_sys->p_clip_info->pg_streams[i_id].pid) {
+                    p_sys->i_spu_stream_idx = i_id;
+                    bd_select_stream(p_sys->bluray, BLURAY_PG_TEXTST_STREAM, i_id + 1, 1);
+                    break;
+                }
+            }
+        }
+    }
+
+    vlc_mutex_unlock(&p_sys->pl_info_lock);
+}
+
 /*****************************************************************************
  * blurayControl: handle the controls
  *****************************************************************************/
@@ -1518,6 +1551,12 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
     case DEMUX_SET_PAUSE_STATE:
         /* Nothing to do */
         break;
+    case DEMUX_SET_ES:
+    {
+        int i_id = (int)va_arg(args, int);
+        blurayStreamSelected(p_sys, i_id);
+        break;
+    }
     case DEMUX_SET_TITLE:
     {
         int i_title = (int)va_arg(args, int);



More information about the vlc-commits mailing list