[vlc-commits] bluray: use defines for still image boundaries

Steve Lhomme git at videolan.org
Wed Sep 19 11:58:00 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon May  7 13:52:54 2018 +0200| [24d43feca0c291f4073fd128ce67a78cf0b04ec4] | committer: Steve Lhomme

bluray: use defines for still image boundaries

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

 modules/access/bluray.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index dc032e2479..5016f3d538 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -287,6 +287,9 @@ static void  onMouseEvent(const vlc_mouse_t *mouse, void *user_data);
 static void  blurayResetParser(demux_t *p_demux);
 static void  notifyDiscontinuity( demux_sys_t *p_sys );
 
+#define STILL_IMAGE_NOT_SET    0
+#define STILL_IMAGE_INFINITE  -1
+
 #define CURRENT_TITLE p_sys->pp_title[p_sys->cur_title]
 #define CUR_LENGTH    CURRENT_TITLE->i_length
 
@@ -677,7 +680,7 @@ static int blurayOpen(vlc_object_t *object)
     p_sys->i_audio_stream_idx = -1;
     p_sys->i_spu_stream_idx = -1;
     p_sys->i_video_stream = -1;
-    p_sys->i_still_end_time = 0;
+    p_sys->i_still_end_time = STILL_IMAGE_NOT_SET;
 
     /* init demux info fields */
     p_sys->updates = 0;
@@ -2194,8 +2197,8 @@ static void blurayResetStillImage( demux_t *p_demux )
 {
     demux_sys_t *p_sys = p_demux->p_sys;
 
-    if (p_sys->i_still_end_time) {
-        p_sys->i_still_end_time = 0;
+    if (p_sys->i_still_end_time != STILL_IMAGE_NOT_SET) {
+        p_sys->i_still_end_time = STILL_IMAGE_NOT_SET;
 
         blurayResetParser(p_demux);
         es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
@@ -2207,7 +2210,9 @@ static void blurayStillImage( demux_t *p_demux, unsigned i_timeout )
     demux_sys_t *p_sys = p_demux->p_sys;
 
     /* time period elapsed ? */
-    if (p_sys->i_still_end_time > 0 && p_sys->i_still_end_time <= vlc_tick_now()) {
+    if (p_sys->i_still_end_time != STILL_IMAGE_NOT_SET &&
+        p_sys->i_still_end_time != STILL_IMAGE_INFINITE &&
+        p_sys->i_still_end_time <= vlc_tick_now()) {
         msg_Dbg(p_demux, "Still image end");
         bd_read_skip_still(p_sys->bluray);
 
@@ -2216,13 +2221,13 @@ static void blurayStillImage( demux_t *p_demux, unsigned i_timeout )
     }
 
     /* show last frame as still image */
-    if (!p_sys->i_still_end_time) {
+    if (p_sys->i_still_end_time == STILL_IMAGE_NOT_SET) {
         if (i_timeout) {
             msg_Dbg(p_demux, "Still image (%d seconds)", i_timeout);
             p_sys->i_still_end_time = vlc_tick_now() + vlc_tick_from_sec( i_timeout );
         } else {
             msg_Dbg(p_demux, "Still image (infinite)");
-            p_sys->i_still_end_time = -1;
+            p_sys->i_still_end_time = STILL_IMAGE_INFINITE;
         }
 
         /* flush demuxer and decoder (there won't be next video packet starting with ts PUSI) */



More information about the vlc-commits mailing list