[vlc-commits] access: bluray: drain on end of title

Francois Cartegnie git at videolan.org
Tue Oct 30 18:12:48 CET 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Oct 24 17:59:13 2018 +0200| [6bac4fb9c6aa603fe25533b2f9a5827161206b05] | committer: Francois Cartegnie

access: bluray: drain on end of title

(cherry picked from commit 580c9409713dc4abc2e4f349e51f8c1aaa44610e)

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

 modules/access/bluray.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index a4d149bd89..426ad097c8 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -155,6 +155,7 @@ typedef struct bluray_overlay_t
 struct  demux_sys_t
 {
     BLURAY              *bluray;
+    bool                b_draining;
 
     /* Titles */
     unsigned int        i_title;
@@ -2112,6 +2113,7 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
         }
         blurayRestartParser(p_demux, true);
         notifyDiscontinuityToParser(p_sys);
+        p_sys->b_draining = false;
         es_out_Control(p_demux->out, ES_OUT_RESET_PCR);
         es_out_Control(p_sys->p_out, BLURAY_ES_OUT_CONTROL_FLAG_DISCONTINUITY);
         break;
@@ -2122,6 +2124,7 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
         bd_seek_chapter(p_sys->bluray, i_chapter);
         blurayRestartParser(p_demux, true);
         notifyDiscontinuityToParser(p_sys);
+        p_sys->b_draining = false;
         es_out_Control(p_demux->out, ES_OUT_RESET_PCR);
         p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT;
         break;
@@ -2168,6 +2171,7 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
         bd_seek_time(p_sys->bluray, TO_TICKS(i_time));
         blurayRestartParser(p_demux, true);
         notifyDiscontinuityToParser(p_sys);
+        p_sys->b_draining = false;
         es_out_Control(p_sys->p_out, BLURAY_ES_OUT_CONTROL_FLAG_DISCONTINUITY);
         return VLC_SUCCESS;
     }
@@ -2197,6 +2201,7 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
         bd_seek_time(p_sys->bluray, TO_TICKS(f_position*CUR_LENGTH));
         blurayRestartParser(p_demux, true);
         notifyDiscontinuityToParser(p_sys);
+        p_sys->b_draining = false;
         es_out_Control(p_sys->p_out, BLURAY_ES_OUT_CONTROL_FLAG_DISCONTINUITY);
         return VLC_SUCCESS;
     }
@@ -2652,7 +2657,7 @@ static void blurayHandleEvent(demux_t *p_demux, const BD_EVENT *e)
         {
             notifyDiscontinuityToParser(p_sys);
             blurayRestartParser(p_demux, false);
-            es_out_Control(p_demux->out, ES_OUT_RESET_PCR);
+            p_sys->b_draining = true;
             p_sys->b_pl_playing = false;
         }
         break;
@@ -2757,6 +2762,22 @@ static int blurayDemux(demux_t *p_demux)
     demux_sys_t *p_sys = p_demux->p_sys;
     BD_EVENT e;
 
+    if(p_sys->b_draining)
+    {
+        bool b_empty = false;
+        if(es_out_Control(p_sys->p_out, ES_OUT_GET_EMPTY, &b_empty) != VLC_SUCCESS || b_empty)
+        {
+            es_out_Control(p_sys->p_out, ES_OUT_RESET_PCR);
+            p_sys->b_draining = false;
+        }
+        else
+        {
+            msg_Dbg(p_demux, "Draining...");
+            msleep( 40000 );
+            return VLC_DEMUXER_SUCCESS;
+        }
+    }
+
     block_t *p_block = block_Alloc(BD_READ_SIZE);
     if (!p_block)
         return VLC_DEMUXER_EGENERIC;



More information about the vlc-commits mailing list