[vlc-commits] access: bluray: process stream selection event last

Francois Cartegnie git at videolan.org
Mon Jan 21 18:34:16 CET 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Jan 21 16:02:33 2019 +0100| [4a9dc2a626aa54b339f6cf0b106fd9e3cfc7a29c] | committer: Francois Cartegnie

access: bluray: process stream selection event last

playlist info is not available yet and the stream selection
has no longer access to parent p_sys

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

 modules/access/bluray.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 32b14b1d7f..e8f0b6fde1 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -309,6 +309,9 @@ typedef struct
     unsigned            cur_seekpoint;
     unsigned            updates;
 
+    /* Events */
+    DECL_ARRAY(BD_EVENT) events_delayed;
+
     vlc_mutex_t             pl_info_lock;
     BLURAY_TITLE_INFO      *p_pl_info;
     const BLURAY_CLIP_INFO *p_clip_info;
@@ -857,6 +860,7 @@ static int blurayOpen(vlc_object_t *object)
 
     TAB_INIT(p_sys->i_title, p_sys->pp_title);
     TAB_INIT(p_sys->i_attachments, p_sys->attachments);
+    ARRAY_INIT(p_sys->events_delayed);
 
     vlc_mouse_Init(&p_sys->oldmouse);
 
@@ -1122,6 +1126,8 @@ static void blurayClose(vlc_object_t *object)
       vlc_input_attachment_Delete(p_sys->attachments[i]);
     TAB_CLEAN(p_sys->i_attachments, p_sys->attachments);
 
+    ARRAY_RESET(p_sys->events_delayed);
+
     vlc_mutex_destroy(&p_sys->pl_info_lock);
     vlc_mutex_destroy(&p_sys->bdj.lock);
     vlc_mutex_destroy(&p_sys->read_block_lock);
@@ -2852,7 +2858,7 @@ static void blurayOnClipUpdate(demux_t *p_demux, uint32_t clip)
     blurayResetStillImage(p_demux);
 }
 
-static void blurayHandleEvent(demux_t *p_demux, const BD_EVENT *e)
+static void blurayHandleEvent(demux_t *p_demux, const BD_EVENT *e, bool b_delayed)
 {
     demux_sys_t *p_sys = p_demux->p_sys;
 
@@ -2943,7 +2949,10 @@ static void blurayHandleEvent(demux_t *p_demux, const BD_EVENT *e)
         break;
     case BD_EVENT_AUDIO_STREAM:
     case BD_EVENT_PG_TEXTST_STREAM:
-        blurayOnStreamSelectedEvent(p_demux, e->event, e->param);
+         if(b_delayed)
+             blurayOnStreamSelectedEvent(p_demux, e->event, e->param);
+         else
+             ARRAY_APPEND(p_sys->events_delayed, *e);
         break;
     case BD_EVENT_IG_STREAM:
     case BD_EVENT_SECONDARY_AUDIO:
@@ -3042,15 +3051,20 @@ static int blurayDemux(demux_t *p_demux)
     if (p_sys->b_menu == false) {
         nread = bd_read(p_sys->bluray, p_block->p_buffer, BD_READ_SIZE);
         while (bd_get_event(p_sys->bluray, &e))
-            blurayHandleEvent(p_demux, &e);
+            blurayHandleEvent(p_demux, &e, false);
     } else {
         nread = bd_read_ext(p_sys->bluray, p_block->p_buffer, BD_READ_SIZE, &e);
         while (e.event != BD_EVENT_NONE) {
-            blurayHandleEvent(p_demux, &e);
+            blurayHandleEvent(p_demux, &e, false);
             bd_get_event(p_sys->bluray, &e);
         }
     }
 
+    /* Process delayed selections events */
+    for(int i=0; i<p_sys->events_delayed.i_size; i++)
+        blurayHandleEvent(p_demux, &p_sys->events_delayed.p_elems[i], true);
+    p_sys->events_delayed.i_size = 0;
+
     blurayHandleOverlays(p_demux);
 
     if (nread <= 0) {



More information about the vlc-commits mailing list