[vlc-commits] bluray: split blurayDemux()

Petri Hintukainen git at videolan.org
Fri Oct 16 19:40:01 CEST 2015


vlc | branch: master | Petri Hintukainen <phintuka at gmail.com> | Fri Oct 16 19:01:58 2015 +0300| [6d7c3ff0731db167df23b652cf93807d801dd71b] | committer: Jean-Baptiste Kempf

bluray: split blurayDemux()

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

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

 modules/access/bluray.c |   59 ++++++++++++++++++++++++++---------------------
 1 file changed, 33 insertions(+), 26 deletions(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 611b08e..f2b9d3a 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -1836,34 +1836,9 @@ static bool blurayIsBdjTitle(demux_t *p_demux)
     return false;
 }
 
-#define BD_TS_PACKET_SIZE (192)
-#define NB_TS_PACKETS (200)
-
-static int blurayDemux(demux_t *p_demux)
+static void blurayHandleOverlays(demux_t *p_demux, int nread)
 {
     demux_sys_t *p_sys = p_demux->p_sys;
-    BD_EVENT e;
-
-    block_t *p_block = block_Alloc(NB_TS_PACKETS * (int64_t)BD_TS_PACKET_SIZE);
-    if (!p_block)
-        return VLC_DEMUXER_EGENERIC;
-
-    int nread;
-
-    if (p_sys->b_menu == false) {
-        while (bd_get_event(p_sys->bluray, &e))
-            blurayHandleEvent(p_demux, &e);
-
-        nread = bd_read(p_sys->bluray, p_block->p_buffer,
-                        NB_TS_PACKETS * BD_TS_PACKET_SIZE);
-    } else {
-        nread = bd_read_ext(p_sys->bluray, p_block->p_buffer,
-                            NB_TS_PACKETS * BD_TS_PACKET_SIZE, &e);
-        while (e.event != BD_EVENT_NONE) {
-            blurayHandleEvent(p_demux, &e);
-            bd_get_event(p_sys->bluray, &e);
-        }
-    }
 
     vlc_mutex_lock(&p_sys->bdj_overlay_lock);
 
@@ -1913,6 +1888,38 @@ static int blurayDemux(demux_t *p_demux)
     }
 
     vlc_mutex_unlock(&p_sys->bdj_overlay_lock);
+}
+
+#define BD_TS_PACKET_SIZE (192)
+#define NB_TS_PACKETS (200)
+
+static int blurayDemux(demux_t *p_demux)
+{
+    demux_sys_t *p_sys = p_demux->p_sys;
+    BD_EVENT e;
+
+    block_t *p_block = block_Alloc(NB_TS_PACKETS * (int64_t)BD_TS_PACKET_SIZE);
+    if (!p_block)
+        return VLC_DEMUXER_EGENERIC;
+
+    int nread;
+
+    if (p_sys->b_menu == false) {
+        while (bd_get_event(p_sys->bluray, &e))
+            blurayHandleEvent(p_demux, &e);
+
+        nread = bd_read(p_sys->bluray, p_block->p_buffer,
+                        NB_TS_PACKETS * BD_TS_PACKET_SIZE);
+    } else {
+        nread = bd_read_ext(p_sys->bluray, p_block->p_buffer,
+                            NB_TS_PACKETS * BD_TS_PACKET_SIZE, &e);
+        while (e.event != BD_EVENT_NONE) {
+            blurayHandleEvent(p_demux, &e);
+            bd_get_event(p_sys->bluray, &e);
+        }
+    }
+
+    blurayHandleOverlays(p_demux, nread);
 
     if (nread <= 0) {
         block_Release(p_block);



More information about the vlc-commits mailing list