[vlc-commits] access: bluray: force low delay with timed slideshow clips

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


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Oct 23 17:26:14 2018 +0200| [d6e8d9e5d20fc262e14118e1b793f15a057ceafd] | committer: Francois Cartegnie

access: bluray: force low delay with timed slideshow clips

(cherry picked from commit f7a730db7d8ca25361d45b93db5edb0f59fbf9ef)

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

 modules/access/bluray.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 4970c6da51..a4d149bd89 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -63,6 +63,7 @@
 #include <libbluray/keys.h>
 #include <libbluray/meta_data.h>
 #include <libbluray/overlay.h>
+#include <libbluray/clpi_data.h>
 
 /*****************************************************************************
  * Module descriptor
@@ -163,6 +164,16 @@ struct  demux_sys_t
     vlc_mutex_t             pl_info_lock;
     BLURAY_TITLE_INFO      *p_pl_info;
     const BLURAY_CLIP_INFO *p_clip_info;
+    enum
+    {
+        BD_CLIP_APP_TYPE_TS_MAIN_PATH_MOVIE = 1,
+        BD_CLIP_APP_TYPE_TS_MAIN_PATH_TIMED_SLIDESHOW = 2,
+        BD_CLIP_APP_TYPE_TS_MAIN_PATH_BROWSABLE_SLIDESHOW = 3,
+        BD_CLIP_APP_TYPE_TS_SUB_PATH_BROWSABLE_SLIDESHOW = 4,
+        BD_CLIP_APP_TYPE_TS_SUB_PATH_INTERACTIVE_MENU = 5,
+        BD_CLIP_APP_TYPE_TS_SUB_PATH_TEXT_SUBTITLE = 6,
+        BD_CLIP_APP_TYPE_TS_SUB_PATH_ELEMENTARY_STREAM_PATH = 7,
+    } clip_application_type;
 
     /* Attachments */
     int                 i_attachments;
@@ -1089,6 +1100,7 @@ typedef struct
     void *priv;
     bool b_discontinuity;
     bool b_disable_output;
+    bool b_lowdelay;
     vlc_mutex_t lock;
     struct
     {
@@ -1105,6 +1117,8 @@ enum
     BLURAY_ES_OUT_CONTROL_FLAG_DISCONTINUITY,
     BLURAY_ES_OUT_CONTROL_ENABLE_OUTPUT,
     BLURAY_ES_OUT_CONTROL_DISABLE_OUTPUT,
+    BLURAY_ES_OUT_CONTROL_ENABLE_LOW_DELAY,
+    BLURAY_ES_OUT_CONTROL_DISABLE_LOW_DELAY,
 };
 
 static es_out_id_t *bluray_esOutAdd(es_out_t *p_out, const es_format_t *p_fmt)
@@ -1121,6 +1135,11 @@ static es_out_id_t *bluray_esOutAdd(es_out_t *p_out, const es_format_t *p_fmt)
 
     switch (fmt.i_cat) {
     case VIDEO_ES:
+        if(esout_sys->b_lowdelay)
+        {
+            fmt.video.i_frame_rate = 1; fmt.video.i_frame_rate_base = 1;
+            fmt.b_packetized = true;
+        }
         if (esout_sys->selected.i_video_pid != -1 && esout_sys->selected.i_video_pid != p_fmt->i_id)
             fmt.i_priority = ES_PRIORITY_NOT_SELECTABLE;
         break ;
@@ -1274,6 +1293,13 @@ static int bluray_esOutControl(es_out_t *p_out, int i_query, va_list args)
             i_ret = VLC_SUCCESS;
         } break;
 
+        case BLURAY_ES_OUT_CONTROL_ENABLE_LOW_DELAY:
+        case BLURAY_ES_OUT_CONTROL_DISABLE_LOW_DELAY:
+        {
+            esout_sys->b_lowdelay = (i_query == BLURAY_ES_OUT_CONTROL_ENABLE_LOW_DELAY);
+            i_ret = VLC_SUCCESS;
+        } break;
+
         case ES_OUT_SET_ES_DEFAULT:
         case ES_OUT_SET_ES:
         case ES_OUT_SET_ES_STATE:
@@ -1331,6 +1357,7 @@ static es_out_t *esOutNew(vlc_object_t *p_obj, es_out_t *p_dst_out, void *priv)
     esout_sys->priv = priv;
     esout_sys->b_discontinuity = false;
     esout_sys->b_disable_output = false;
+    esout_sys->b_lowdelay = false;
     esout_sys->selected.i_audio_pid = -1;
     esout_sys->selected.i_video_pid = -1;
     esout_sys->selected.i_spu_pid = -1;
@@ -2483,7 +2510,7 @@ static void blurayUpdatePlaylist(demux_t *p_demux, unsigned i_playlist)
     blurayResetStillImage(p_demux);
 }
 
-static void blurayUpdateCurrentClip(demux_t *p_demux, uint32_t clip)
+static void blurayOnClipUpdate(demux_t *p_demux, uint32_t clip)
 {
     demux_sys_t *p_sys = p_demux->p_sys;
 
@@ -2501,6 +2528,20 @@ static void blurayUpdateCurrentClip(demux_t *p_demux, uint32_t clip)
         assert(p_sys->p_clip_info->video_stream_count >= 1);
     }
 
+    CLPI_CL *clpi = bd_get_clpi(p_sys->bluray, clip);
+    if(clpi && clpi->clip.application_type != p_sys->clip_application_type)
+    {
+        if(p_sys->clip_application_type == BD_CLIP_APP_TYPE_TS_MAIN_PATH_TIMED_SLIDESHOW ||
+           clpi->clip.application_type == BD_CLIP_APP_TYPE_TS_MAIN_PATH_TIMED_SLIDESHOW)
+            blurayRestartParser(p_demux, false);
+
+        if(clpi->clip.application_type == BD_CLIP_APP_TYPE_TS_MAIN_PATH_TIMED_SLIDESHOW)
+            es_out_Control(p_sys->p_out, BLURAY_ES_OUT_CONTROL_ENABLE_LOW_DELAY);
+        else
+            es_out_Control(p_sys->p_out, BLURAY_ES_OUT_CONTROL_DISABLE_LOW_DELAY);
+        bd_free_clpi(clpi);
+    }
+
     vlc_mutex_unlock(&p_sys->pl_info_lock);
 
     blurayResetStillImage(p_demux);
@@ -2534,7 +2575,7 @@ static void blurayHandleEvent(demux_t *p_demux, const BD_EVENT *e)
         break;
     case BD_EVENT_PLAYITEM:
         notifyDiscontinuityToParser(p_sys);
-        blurayUpdateCurrentClip(p_demux, e->param);
+        blurayOnClipUpdate(p_demux, e->param);
         break;
     case BD_EVENT_CHAPTER:
         if (e->param && e->param < 0xffff)



More information about the vlc-commits mailing list