[vlc-commits] [Git][videolan/vlc][master] vlc_tick: add MIN and MAX constants

Romain Vimont (@rom1v) gitlab at videolan.org
Sat Jul 10 14:40:34 UTC 2021



Romain Vimont pushed to branch master at VideoLAN / VLC


Commits:
e5d44f6a by Romain Vimont at 2021-07-10T14:26:56+00:00
vlc_tick: add MIN and MAX constants

Replace INT64_MIN and INT64_MAX used as vlc_tick_t values by
VLC_TICK_MIN and VLC_TICK_MAX.

- - - - -


27 changed files:

- include/vlc_tick.h
- modules/access/live555.cpp
- modules/access/rtp/session.c
- modules/codec/avcodec/video.c
- modules/codec/webvtt/subsvtt.c
- modules/control/dbus/dbus.c
- modules/demux/asf/asfpacket.c
- modules/demux/avformat/demux.c
- modules/demux/avi/avi.c
- modules/demux/mp4/mp4.c
- modules/gui/macosx/playlist/VLCPlayerController.h
- modules/gui/qt/player/player_controller.cpp
- modules/gui/skins2/x11/x11_timer.cpp
- modules/mux/mpeg/ps.c
- modules/stream_out/cycle.c
- modules/video_output/wayland/input.c
- modules/video_output/xcb/window.c
- src/audio_output/dec.c
- src/clock/clock.c
- src/clock/clock.h
- src/input/decoder.c
- src/input/es_out.c
- src/player/player.c
- src/player/timer.c
- src/player/track.c
- src/video_output/video_output.c
- src/video_output/vout_subpictures.c


Changes:

=====================================
include/vlc_tick.h
=====================================
@@ -44,6 +44,8 @@
 typedef int64_t vlc_tick_t;
 typedef vlc_tick_t mtime_t; /* deprecated, use vlc_tick_t */
 
+#define VLC_TICK_MIN INT64_MIN
+#define VLC_TICK_MAX INT64_MAX
 
 /*
  * vlc_tick_t <> seconds (sec) conversions


=====================================
modules/access/live555.cpp
=====================================
@@ -1538,8 +1538,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         case DEMUX_GET_LENGTH:
             if( p_sys->f_npt_length > 0 )
             {
-                if( unlikely(p_sys->f_npt_length >= (double)(INT64_MAX / CLOCK_FREQ)) )
-                    *va_arg( args, vlc_tick_t * ) = INT64_MAX;
+                if( unlikely(p_sys->f_npt_length >= (double)(VLC_TICK_MAX / CLOCK_FREQ)) )
+                    *va_arg( args, vlc_tick_t * ) = VLC_TICK_MAX;
                 else
                     *va_arg( args, vlc_tick_t * ) = vlc_tick_from_sec(p_sys->f_npt_length);
                 return VLC_SUCCESS;


=====================================
modules/access/rtp/session.c
=====================================
@@ -396,7 +396,7 @@ bool rtp_dequeue (demux_t *demux, const rtp_session_t *session,
     vlc_tick_t now = vlc_tick_now ();
     bool pending = false;
 
-    *deadlinep = INT64_MAX;
+    *deadlinep = VLC_TICK_MAX;
 
     for (unsigned i = 0, max = session->srcc; i < max; i++)
     {


=====================================
modules/codec/avcodec/video.c
=====================================
@@ -641,7 +641,7 @@ static block_t * filter_earlydropped_blocks( decoder_t *p_dec, block_t *block )
         p_sys->i_late_frames = 0;
         p_sys->framedrop = FRAMEDROP_NONE;
         p_sys->b_from_preroll = true;
-        p_sys->i_last_late_delay = INT64_MAX;
+        p_sys->i_last_late_delay = VLC_TICK_MAX;
     }
 
     if( p_sys->i_late_frames == 0 )


=====================================
modules/codec/webvtt/subsvtt.c
=====================================
@@ -2065,7 +2065,7 @@ static void LoadExtradata( decoder_t *p_dec )
 static void Flush( decoder_t *p_dec )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
-    ClearCuesByTime( &p_sys->p_root->p_child, INT64_MAX );
+    ClearCuesByTime( &p_sys->p_root->p_child, VLC_TICK_MAX );
 }
 
 /****************************************************************************


=====================================
modules/control/dbus/dbus.c
=====================================
@@ -458,7 +458,7 @@ static void toggle_timeout(DBusTimeout *to, void *data)
 static int next_timeout(intf_thread_t *intf)
 {
     intf_sys_t *sys = intf->p_sys;
-    vlc_tick_t next_timeout = INT64_MAX;
+    vlc_tick_t next_timeout = VLC_TICK_MAX;
     unsigned count = vlc_array_count(&sys->timeouts);
 
     for (unsigned i = 0; i < count; i++)
@@ -474,7 +474,7 @@ static int next_timeout(intf_thread_t *intf)
             next_timeout = *expiry;
     }
 
-    if (next_timeout == INT64_MAX)
+    if (next_timeout == VLC_TICK_MAX)
         return -1;
 
     if (MS_FROM_VLC_TICK(next_timeout) > INT_MAX)


=====================================
modules/demux/asf/asfpacket.c
=====================================
@@ -234,7 +234,7 @@ static int DemuxPayload(asf_packet_sys_t *p_packetsys, asf_packet_t *pkt, int i_
     vlc_tick_t i_pkt_time_delta = 0;
     uint32_t i_payload_data_length = 0;
     uint32_t i_temp_payload_length = 0;
-    *p_packetsys->pi_preroll = __MIN( *p_packetsys->pi_preroll, INT64_MAX );
+    *p_packetsys->pi_preroll = __MIN( *p_packetsys->pi_preroll, VLC_TICK_MAX );
 
     /* First packet, in case we do not have index to guess preroll start time */
     if ( *p_packetsys->pi_preroll_start == ASFPACKET_PREROLL_FROM_CURRENT )


=====================================
modules/demux/avformat/demux.c
=====================================
@@ -945,14 +945,14 @@ static int Demux( demux_t *p_demux )
     if( p_frame->i_dts != VLC_TICK_INVALID && p_track->p_es != NULL )
         p_track->i_pcr = p_frame->i_dts;
 
-    vlc_tick_t i_ts_max = INT64_MIN;
+    vlc_tick_t i_ts_max = VLC_TICK_MIN;
     for( unsigned i = 0; i < p_sys->i_tracks; i++ )
     {
         if( p_sys->tracks[i].p_es != NULL )
             i_ts_max = __MAX( i_ts_max, p_sys->tracks[i].i_pcr );
     }
 
-    vlc_tick_t i_ts_min = INT64_MAX;
+    vlc_tick_t i_ts_min = VLC_TICK_MAX;
     for( unsigned i = 0; i < p_sys->i_tracks; i++ )
     {
         if( p_sys->tracks[i].p_es != NULL &&
@@ -960,7 +960,7 @@ static int Demux( demux_t *p_demux )
                 p_sys->tracks[i].i_pcr + VLC_TICK_FROM_SEC(10)>= i_ts_max )
             i_ts_min = __MIN( i_ts_min, p_sys->tracks[i].i_pcr );
     }
-    if( i_ts_min >= p_sys->i_pcr && likely(i_ts_min != INT64_MAX) )
+    if( i_ts_min >= p_sys->i_pcr && likely(i_ts_min != VLC_TICK_MAX) )
     {
         p_sys->i_pcr = i_ts_min;
         es_out_SetPCR( p_demux->out, p_sys->i_pcr );


=====================================
modules/demux/avi/avi.c
=====================================
@@ -1732,8 +1732,8 @@ static int64_t AVI_Rescale( vlc_tick_t i_value, uint32_t i_timescale, uint32_t i
     if( i_timescale == i_newscale )
         return i_value;
 
-    if( (i_value >= 0 && i_value <= INT64_MAX / i_newscale) ||
-        (i_value < 0  && i_value >= INT64_MIN / i_newscale) )
+    if( (i_value >= 0 && i_value <= VLC_TICK_MAX / i_newscale) ||
+        (i_value < 0  && i_value >= VLC_TICK_MIN / i_newscale) )
         return i_value * i_newscale / i_timescale;
 
     /* overflow */


=====================================
modules/demux/mp4/mp4.c
=====================================
@@ -155,7 +155,7 @@ typedef struct
 
 #define INVALID_PRELOAD  UINT_MAX
 #define UNKNOWN_DELTA    UINT32_MAX
-#define INVALID_PTS      INT64_MIN
+#define INVALID_PTS      VLC_TICK_MIN
 
 #define VLC_DEMUXER_EOS (VLC_DEMUXER_EGENERIC - 1)
 #define VLC_DEMUXER_FATAL (VLC_DEMUXER_EGENERIC - 2)
@@ -217,7 +217,7 @@ static int64_t MP4_rescale( int64_t i_value, uint32_t i_timescale, uint32_t i_ne
     if( i_timescale == i_newscale )
         return i_value;
 
-    if( i_value <= INT64_MAX / i_newscale )
+    if( i_value <= VLC_TICK_MAX / i_newscale )
         return i_value * i_newscale / i_timescale;
 
     /* overflow */
@@ -1451,7 +1451,7 @@ static int DemuxTrack( demux_t *p_demux, mp4_track_t *tk, uint64_t i_readpos,
     vlc_tick_t i_current_nzdts = MP4_TrackGetDTSPTS( p_demux, tk, &i_current_nzpts );
     const vlc_tick_t i_demux_max_nzdts =i_max_preload < INVALID_PRELOAD
                                     ? i_current_nzdts + i_max_preload
-                                    : INT64_MAX;
+                                    : VLC_TICK_MAX;
 
     for( ; i_demux_max_nzdts >= i_current_nzdts; )
     {
@@ -1768,7 +1768,7 @@ static int FragPrepareChunk( demux_t *p_demux, MP4_Box_t *p_moof,
 
 static vlc_tick_t FragGetDemuxTimeFromTracksTime( demux_sys_t *p_sys )
 {
-    vlc_tick_t i_time = INT64_MAX;
+    vlc_tick_t i_time = VLC_TICK_MAX;
     for( unsigned int i = 0; i < p_sys->i_tracks; i++ )
     {
         if( p_sys->track[i].context.runs.i_count == 0 )
@@ -1898,7 +1898,7 @@ static void FragTrunSeekToTime( mp4_track_t *p_track, stime_t i_target_time )
     p_track->context.runs.i_current = i_run;
 }
 
-#define INVALID_SEGMENT_TIME  INT64_MAX
+#define INVALID_SEGMENT_TIME  VLC_TICK_MAX
 
 static int FragSeekToTime( demux_t *p_demux, vlc_tick_t i_nztime, bool b_accurate )
 {
@@ -4553,7 +4553,7 @@ static int FragDemuxTrack( demux_t *p_demux, mp4_track_t *p_track,
 
     const stime_t i_demux_max_dts = (i_max_preload < INVALID_PRELOAD) ?
                 p_track->i_time + MP4_rescale_qtime( i_max_preload, p_track->i_timescale ) :
-                INT64_MAX;
+                VLC_TICK_MAX;
 
     for( uint32_t i = p_track->context.i_trun_sample; i < p_trun->i_sample_count; i++ )
     {
@@ -4721,7 +4721,7 @@ static int DemuxMoof( demux_t *p_demux )
     }
     else
     {
-        vlc_tick_t i_segment_end = INT64_MAX;
+        vlc_tick_t i_segment_end = VLC_TICK_MAX;
         for( unsigned i = 0; i < p_sys->i_tracks; i++ )
         {
             mp4_track_t *tk = &p_sys->track[i];
@@ -4732,7 +4732,7 @@ static int DemuxMoof( demux_t *p_demux )
             if( i_track_end < i_segment_end  )
                 i_segment_end = i_track_end;
         }
-        if( i_segment_end != INT64_MAX )
+        if( i_segment_end != VLC_TICK_MAX )
         {
             p_sys->i_nztime = i_segment_end;
             p_sys->i_pcr = VLC_TICK_0 + p_sys->i_nztime;
@@ -5279,7 +5279,7 @@ static int DemuxFrag( demux_t *p_demux )
 end:
     if( i_status == VLC_DEMUXER_EOF )
     {
-        vlc_tick_t i_demux_end = INT64_MIN;
+        vlc_tick_t i_demux_end = VLC_TICK_MIN;
         for( unsigned i = 0; i < p_sys->i_tracks; i++ )
         {
             const mp4_track_t *tk = &p_sys->track[i];
@@ -5287,7 +5287,7 @@ end:
             if( i_track_end > i_demux_end  )
                 i_demux_end = i_track_end;
         }
-        if( i_demux_end != INT64_MIN )
+        if( i_demux_end != VLC_TICK_MIN )
             es_out_SetPCR( p_demux->out, VLC_TICK_0 + i_demux_end );
     }
 


=====================================
modules/gui/macosx/playlist/VLCPlayerController.h
=====================================
@@ -640,14 +640,14 @@ extern const CGFloat VLCVolumeDefault;
 
 /**
  * fetch the delay for a specific track identified through its elementary stream ID
- * @return the delay for the track or INT64_MAX if none is set
+ * @return the delay for the track or VLC_TICK_MAX if none is set
  */
 - (vlc_tick_t)delayForElementaryStreamID:(vlc_es_id_t *)esID;
 
 /**
  * set the delay of a specific track identified through its elementary stream ID
  * @warning Setting the delay of one specific track will override previous and future changes of delay made through generic calls
- * @param delay the delay as a valid time or INT64_MAX to reset to the default for the ES category
+ * @param delay the delay as a valid time or VLC_TICK_MAX to reset to the default for the ES category
  * @param esID the ID for the elementary stream
  * @param relative use an absolute or relative whence to describe the time
  * @return VLC_SUCCESS on success


=====================================
modules/gui/qt/player/player_controller.cpp
=====================================
@@ -907,7 +907,7 @@ static void on_player_timer_update(const struct vlc_player_timer_point *point,
             {
                 q->updatePosition();
 
-                if (that->m_player_time.system_date != INT64_MAX)
+                if (that->m_player_time.system_date != VLC_TICK_MAX)
                 {
                     // Setup the position update interval, depending on media
                     // length and rate.  XXX: VLC_TICK_FROM_MS(1) is an educated
@@ -1575,7 +1575,7 @@ void PlayerController::updateTime(vlc_tick_t system_now, bool forceUpdate)
         d->m_remainingTime = VLC_TICK_INVALID;
     emit remainingTimeChanged(d->m_remainingTime);
 
-    if (d->m_player_time.system_date != INT64_MAX
+    if (d->m_player_time.system_date != VLC_TICK_MAX
      && (forceUpdate || !d->m_time_timer.isActive()))
     {
         // Tell the timer to wait until the next second is reached.


=====================================
modules/gui/skins2/x11/x11_timer.cpp
=====================================
@@ -103,7 +103,7 @@ void X11TimerLoop::removeTimer( X11Timer &rTimer )
 void X11TimerLoop::waitNextTimer()
 {
     vlc_tick_t curDate = vlc_tick_now();
-    vlc_tick_t nextDate = INT64_MAX;
+    vlc_tick_t nextDate = VLC_TICK_MAX;
 
     X11Timer *nextTimer = NULL;
 


=====================================
modules/mux/mpeg/ps.c
=====================================
@@ -461,7 +461,7 @@ static int Mux( sout_mux_t *p_mux )
         /* Write regulary PackHeader */
         if( p_sys->i_pes_count % 30 == 0)
         {
-            vlc_tick_t i_mindts = INT64_MAX;
+            vlc_tick_t i_mindts = VLC_TICK_MAX;
             for( int i=0; i < p_mux->i_nb_inputs; i++ )
             {
                 ps_stream_t *p_s = (ps_stream_t*)p_input->p_sys;
@@ -471,7 +471,7 @@ static int Mux( sout_mux_t *p_mux )
                     i_mindts = p_s->i_dts;
             }
 
-            if( i_mindts != INT64_MAX && i_mindts > p_sys->i_instant_dts )
+            if( i_mindts != VLC_TICK_MAX && i_mindts > p_sys->i_instant_dts )
             {
                 /* Update the instant bitrate every second or so */
                 if( p_sys->i_instant_size &&


=====================================
modules/stream_out/cycle.c
=====================================
@@ -194,24 +194,24 @@ static vlc_tick_t ParseTime(const char *str)
     switch (*end)
     {
         case 'w':
-            if (u < ((unsigned long long)INT64_MAX)/ (60 * 60 * 24 * 7 * CLOCK_FREQ))
+            if (u < ((unsigned long long)VLC_TICK_MAX)/ (60 * 60 * 24 * 7 * CLOCK_FREQ))
                 return vlc_tick_from_sec( 60LU * 60 * 24 * 7 * u );
             break;
         case 'd':
-            if (u < ((unsigned long long)INT64_MAX)/ (60 * 60 * 24 * CLOCK_FREQ))
+            if (u < ((unsigned long long)VLC_TICK_MAX)/ (60 * 60 * 24 * CLOCK_FREQ))
                 return vlc_tick_from_sec( 60LU * 60 * 24 * u );
             break;
         case 'h':
-            if (u < ((unsigned long long)INT64_MAX)/ (60 * 60 * CLOCK_FREQ))
+            if (u < ((unsigned long long)VLC_TICK_MAX)/ (60 * 60 * CLOCK_FREQ))
                 return vlc_tick_from_sec( 60LLU * 60 * u );
             break;
         case 'm':
-            if (u < ((unsigned long long)INT64_MAX)/ (60 * CLOCK_FREQ))
+            if (u < ((unsigned long long)VLC_TICK_MAX)/ (60 * CLOCK_FREQ))
                 return vlc_tick_from_sec( 60LLU * u );
             break;
         case 's':
         case 0:
-            if (u < ((unsigned long long)INT64_MAX)/CLOCK_FREQ)
+            if (u < ((unsigned long long)VLC_TICK_MAX)/CLOCK_FREQ)
                 return vlc_tick_from_sec( u );
             break;
     }


=====================================
modules/video_output/wayland/input.c
=====================================
@@ -218,7 +218,7 @@ static void pointer_create(struct seat_data *sd)
         wl_pointer_add_listener(sd->pointer, &pointer_cbs, sd);
 
     sd->cursor_timeout = VLC_TICK_FROM_MS( var_InheritInteger(sd->owner, "mouse-hide-timeout") );
-    sd->cursor_deadline = INT64_MAX;
+    sd->cursor_deadline = VLC_TICK_MAX;
 }
 
 static void pointer_destroy(struct seat_data *sd)
@@ -454,7 +454,7 @@ int seat_create(vout_window_t *wnd, struct wl_registry *registry,
 
 static vlc_tick_t seat_next_deadline(const struct seat_data *sd)
 {
-    return (sd->pointer != NULL) ? sd->cursor_deadline : INT64_MAX;
+    return (sd->pointer != NULL) ? sd->cursor_deadline : VLC_TICK_MAX;
 }
 
 static void seat_refresh(struct seat_data *sd, vlc_tick_t now)
@@ -462,7 +462,7 @@ static void seat_refresh(struct seat_data *sd, vlc_tick_t now)
     if (sd->pointer != NULL && sd->cursor_deadline <= now)
     {   /* Hide cursor */
         wl_pointer_set_cursor(sd->pointer, sd->cursor_serial, NULL, 0, 0);
-        sd->cursor_deadline = INT64_MAX;
+        sd->cursor_deadline = VLC_TICK_MAX;
     }
 }
 
@@ -511,7 +511,7 @@ void seat_destroy_all(struct wl_list *list)
 int seat_next_timeout(const struct wl_list *list)
 {
     struct seat_data *sd;
-    vlc_tick_t deadline = INT64_MAX;
+    vlc_tick_t deadline = VLC_TICK_MAX;
 
     wl_list_for_each(sd, list, node)
     {
@@ -520,7 +520,7 @@ int seat_next_timeout(const struct wl_list *list)
             deadline = d;
     }
 
-    if (deadline == INT64_MAX)
+    if (deadline == VLC_TICK_MAX)
         return -1;
 
     vlc_tick_t now = vlc_tick_now();


=====================================
modules/video_output/xcb/window.c
=====================================
@@ -331,7 +331,7 @@ static void *Thread (void *data)
     };
     xcb_cursor_t cursor = CursorCreate(conn, p_sys->root); /* blank cursor */
     vlc_tick_t lifetime = VLC_TICK_FROM_MS( var_InheritInteger(wnd, "mouse-hide-timeout") );
-    vlc_tick_t deadline = INT64_MAX;
+    vlc_tick_t deadline = VLC_TICK_MAX;
 
     if (ufd.fd == -1)
         return NULL;
@@ -340,7 +340,7 @@ static void *Thread (void *data)
     {
         int timeout = -1;
 
-        if (deadline != INT64_MAX)
+        if (deadline != VLC_TICK_MAX)
         {
             vlc_tick_t delay = deadline - vlc_tick_now();
             timeout = (delay > 0) ? MS_FROM_VLC_TICK(delay) : 0;
@@ -355,7 +355,7 @@ static void *Thread (void *data)
             xcb_change_window_attributes(conn, wnd->handle.xid,
                                          XCB_CW_CURSOR, &cursor);
             xcb_flush(conn);
-            deadline = INT64_MAX;
+            deadline = VLC_TICK_MAX;
         }
         else
         {


=====================================
src/audio_output/dec.c
=====================================
@@ -328,8 +328,8 @@ void aout_RequestRetiming(audio_output_t *aout, vlc_tick_t system_ts,
     vlc_tick_t drift =
         vlc_clock_Update(owner->sync.clock, system_ts, audio_ts, rate);
 
-    if (unlikely(drift == INT64_MAX) || owner->bitexact)
-        return; /* cf. INT64_MAX comment in aout_DecPlay() */
+    if (unlikely(drift == VLC_TICK_MAX) || owner->bitexact)
+        return; /* cf. VLC_TICK_MAX comment in aout_DecPlay() */
 
     /* Following calculations expect an opposite drift. Indeed,
      * vlc_clock_Update() returns a positive relative time, corresponding to
@@ -493,7 +493,7 @@ int aout_DecPlay(audio_output_t *aout, block_t *block)
     vlc_tick_t play_date =
         vlc_clock_ConvertToSystem(owner->sync.clock, system_now, original_pts,
                                   owner->sync.rate);
-    if (unlikely(play_date == INT64_MAX))
+    if (unlikely(play_date == VLC_TICK_MAX))
     {
         /* The clock is paused but not the output, play the audio anyway since
          * we can't delay audio playback from here. */


=====================================
src/clock/clock.c
=====================================
@@ -127,9 +127,9 @@ static vlc_tick_t vlc_clock_master_update(vlc_clock_t *clock,
 
     vlc_mutex_lock(&main_clock->lock);
 
-    /* If system_now is INT64_MAX, the update is forced, don't modify anything
-     * but only notify the new clock point. */
-    if (system_now != INT64_MAX)
+    /* If system_now is VLC_TICK_MAX, the update is forced, don't modify
+     * anything but only notify the new clock point. */
+    if (system_now != VLC_TICK_MAX)
     {
         if (main_clock->offset != VLC_TICK_INVALID
          && ts != main_clock->last.stream)
@@ -265,7 +265,7 @@ static vlc_tick_t vlc_clock_slave_to_system_locked(vlc_clock_t *clock,
 {
     vlc_clock_main_t *main_clock = clock->owner;
     if (main_clock->pause_date != VLC_TICK_INVALID)
-        return INT64_MAX;
+        return VLC_TICK_MAX;
 
     vlc_tick_t system = main_stream_to_system(main_clock, ts);
     if (system == VLC_TICK_INVALID)
@@ -302,12 +302,13 @@ static vlc_tick_t vlc_clock_slave_update(vlc_clock_t *clock,
 {
     vlc_clock_main_t *main_clock = clock->owner;
 
-    if (system_now == INT64_MAX)
+    if (system_now == VLC_TICK_MAX)
     {
-        /* If system_now is INT64_MAX, the update is forced, don't modify anything
-        * but only notify the new clock point. */
-        vlc_clock_on_update(clock, INT64_MAX, ts, rate, frame_rate, frame_rate_base);
-        return INT64_MAX;
+        /* If system_now is VLC_TICK_MAX, the update is forced, don't modify
+         * anything but only notify the new clock point. */
+        vlc_clock_on_update(clock, VLC_TICK_MAX, ts, rate, frame_rate,
+                            frame_rate_base);
+        return VLC_TICK_MAX;
     }
 
     vlc_mutex_lock(&main_clock->lock);
@@ -351,12 +352,12 @@ void vlc_clock_Wait(vlc_clock_t *clock, vlc_tick_t system_now, vlc_tick_t ts,
     vlc_clock_main_t *main_clock = clock->owner;
     vlc_mutex_lock(&main_clock->lock);
     const vlc_tick_t max_deadline =
-        max_duration > 0 ? system_now + max_duration : INT64_MAX;
+        max_duration > 0 ? system_now + max_duration : VLC_TICK_MAX;
     while (!main_clock->abort)
     {
         vlc_tick_t deadline;
         if (main_clock->pause_date != VLC_TICK_INVALID)
-            deadline = INT64_MAX;
+            deadline = VLC_TICK_MAX;
         else
             deadline = clock->to_system_locked(clock, system_now, ts, rate);
         deadline = __MIN(deadline, max_deadline);


=====================================
src/clock/clock.h
=====================================
@@ -40,8 +40,8 @@ struct vlc_clock_cbs
      * Called when a clock is updated
      *
      * @param system_ts system date when the ts will be rendered,
-     * VLC_TICK_INVALID when the clock is reset or INT64_MAX when the update is
-     * forced (an output was still rendered while paused for example). Note:
+     * VLC_TICK_INVALID when the clock is reset or VLC_TICK_MAX when the update
+     * is forced (an output was still rendered while paused for example). Note:
      * when valid, this date can be in the future, it is not necessarily now.
      * @param ts stream timestamp or VLC_TICK_INVALID when the clock is reset,
      * should be subtracted with VLC_TICK_0 to get the original value
@@ -142,10 +142,10 @@ void vlc_clock_Delete(vlc_clock_t *clock);
 
 /**
  * This function will update the clock drift and returns the drift
- * @param system_now valid system time or INT64_MAX is the updated point is
+ * @param system_now valid system time or VLC_TICK_MAX is the updated point is
  * forced (when paused for example)
  * @return a valid drift relative time, VLC_TICK_INVALID if there is no drift
- * (clock is master) or INT64_MAX if the clock is paused
+ * (clock is master) or VLC_TICK_MAX if the clock is paused
  */
 vlc_tick_t vlc_clock_Update(vlc_clock_t *clock, vlc_tick_t system_now,
                             vlc_tick_t ts, double rate);
@@ -181,7 +181,7 @@ void vlc_clock_Wait(vlc_clock_t *clock, vlc_tick_t system_now, vlc_tick_t ts,
 
 /**
  * This function converts a timestamp from stream to system
- * @return the valid system time or INT64_MAX when the clock is paused
+ * @return the valid system time or VLC_TICK_MAX when the clock is paused
  */
 vlc_tick_t vlc_clock_ConvertToSystem(vlc_clock_t *clock, vlc_tick_t system_now,
                                      vlc_tick_t ts, double rate);


=====================================
src/input/decoder.c
=====================================
@@ -135,8 +135,8 @@ struct vlc_input_decoder_t
     /* Preroll */
     vlc_tick_t i_preroll_end;
 
-#define PREROLL_NONE    INT64_MIN // vlc_tick_t
-#define PREROLL_FORCED  INT64_MAX // vlc_tick_t
+#define PREROLL_NONE   VLC_TICK_MIN
+#define PREROLL_FORCED VLC_TICK_MAX
 
     /* Pause & Rate */
     bool reset_out_state;


=====================================
src/input/es_out.c
=====================================
@@ -1131,7 +1131,7 @@ static void EsOutDecoderChangeDelay( es_out_t *out, es_out_id_t *p_es )
     es_out_sys_t *p_sys = container_of(out, es_out_sys_t, out);
 
     vlc_tick_t i_delay;
-    if( p_es->delay != INT64_MAX )
+    if( p_es->delay != VLC_TICK_MAX )
         i_delay = p_es->delay; /* The track use its own delay, and not a category delay */
     else if( p_es->fmt.i_cat == AUDIO_ES )
         i_delay = p_sys->i_audio_delay;
@@ -2182,7 +2182,7 @@ static es_out_id_t *EsOutAddLocked( es_out_t *out, input_source_t *source,
     es->mouse_event_cb = NULL;
     es->mouse_event_userdata = NULL;
     es->i_pts_level = VLC_TICK_INVALID;
-    es->delay = INT64_MAX;
+    es->delay = VLC_TICK_MAX;
 
     vlc_list_append(&es->node, es->p_master ? &p_sys->es_slaves : &p_sys->es);
 
@@ -3082,7 +3082,7 @@ static vlc_tick_t EsOutGetTracksDelay(es_out_t *out)
     {
         if (es->p_dec)
         {
-            if (es->delay != INT64_MAX)
+            if (es->delay != VLC_TICK_MAX)
                 tracks_delay = __MIN(tracks_delay, es->delay);
             else if (es->fmt.i_cat == AUDIO_ES)
                 has_audio = true;


=====================================
src/player/player.c
=====================================
@@ -1695,7 +1695,7 @@ vlc_player_SetEsIdDelay(vlc_player_t *player, vlc_es_id_t *es_id,
         trackpriv->delay = delay;
     else
     {
-        if (trackpriv->delay == INT64_MAX)
+        if (trackpriv->delay == VLC_TICK_MAX)
             trackpriv->delay = 0;
         trackpriv->delay += delay;
         delay = trackpriv->delay;
@@ -1706,7 +1706,7 @@ vlc_player_SetEsIdDelay(vlc_player_t *player, vlc_es_id_t *es_id,
                                 &param);
     if (ret == VLC_SUCCESS)
     {
-        if (delay != INT64_MAX)
+        if (delay != VLC_TICK_MAX)
             vlc_player_osd_Message(player, _("%s delay: %i ms"),
                                    trackpriv->t.name,
                                    (int)MS_FROM_VLC_TICK(delay));
@@ -1725,7 +1725,7 @@ vlc_player_GetEsIdDelay(vlc_player_t *player, vlc_es_id_t *es_id)
 
     struct vlc_player_track_priv *trackpriv =
         vlc_player_input_FindTrackById(input, es_id, NULL);
-    return trackpriv ? trackpriv->delay : INT64_MAX;
+    return trackpriv ? trackpriv->delay : VLC_TICK_MAX;
 }
 
 static struct {


=====================================
src/player/timer.c
=====================================
@@ -55,11 +55,11 @@ vlc_player_SendTimerSourceUpdates(vlc_player_t *player,
         /* Respect refresh delay of the timer */
         if (force_update || timer->period == VLC_TICK_INVALID
          || timer->last_update_date == VLC_TICK_INVALID
-         || point->system_date == INT64_MAX /* always update when paused */
+         || point->system_date == VLC_TICK_MAX /* always update when paused */
          || point->system_date - timer->last_update_date >= timer->period)
         {
             timer->cbs->on_update(point, timer->data);
-            timer->last_update_date = point->system_date == INT64_MAX ?
+            timer->last_update_date = point->system_date == VLC_TICK_MAX ?
                                       VLC_TICK_INVALID : point->system_date;
         }
     }
@@ -244,7 +244,7 @@ vlc_player_UpdateTimerSource(vlc_player_t *player,
      * interpolation (behave as paused), indeed, we should wait for one more
      * point before starting interpolation (ideally, it should be more) */
     if (source->point.system_date == VLC_TICK_INVALID)
-        source->point.system_date = INT64_MAX;
+        source->point.system_date = VLC_TICK_MAX;
     else
         source->point.system_date = system_date;
 
@@ -302,7 +302,7 @@ vlc_player_UpdateTimer(vlc_player_t *player, vlc_es_id_t *es_source,
 
     vlc_tick_t system_date = point->system_date;
     if (player->timer.state == VLC_PLAYER_TIMER_STATE_PAUSED)
-        system_date = INT64_MAX;
+        system_date = VLC_TICK_MAX;
 
     /* An update after a discontinuity means that the playback is resumed */
     if (player->timer.state == VLC_PLAYER_TIMER_STATE_DISCONTINUITY)
@@ -330,11 +330,12 @@ vlc_player_UpdateTimer(vlc_player_t *player, vlc_es_id_t *es_source,
             force_update = true;
         }
 
-        /* When paused (INT64_MAX), the same ts can be send more than one time
-         * from the video source, only send it if different in that case. */
+        /* When paused (VLC_TICK_MAX), the same ts can be send more than one
+         * time from the video source, only send it if different in that case.
+         */
         if (point->ts != player->timer.last_ts
           || source->point.system_date != system_date
-          || system_date != INT64_MAX)
+          || system_date != VLC_TICK_MAX)
         {
             vlc_player_UpdateTimerSource(player, source, point->rate, point->ts,
                                          system_date);
@@ -479,9 +480,9 @@ vlc_player_timer_point_Interpolate(const struct vlc_player_timer_point *point,
     assert(system_now > 0);
     assert(out_ts || out_pos);
 
-    /* A system_date == INT64_MAX means the clock was paused when it updated
+    /* A system_date == VLC_TICK_MAX means the clock was paused when it updated
      * this point, so there is nothing to interpolate */
-    const vlc_tick_t drift = point->system_date == INT64_MAX ? 0
+    const vlc_tick_t drift = point->system_date == VLC_TICK_MAX ? 0
                            : (system_now - point->system_date) * point->rate;
     vlc_tick_t ts = point->ts;
     float pos = point->position;


=====================================
src/player/track.c
=====================================
@@ -110,7 +110,7 @@ vlc_player_track_priv_New(vlc_es_id_t *id, const char *name, const es_format_t *
         return NULL;
     struct vlc_player_track *track = &trackpriv->t;
 
-    trackpriv->delay = INT64_MAX;
+    trackpriv->delay = VLC_TICK_MAX;
     trackpriv->vout = NULL;
     trackpriv->vout_order = VLC_VOUT_ORDER_NONE;
     trackpriv->selected_by_user = false;


=====================================
src/video_output/video_output.c
=====================================
@@ -1000,7 +1000,7 @@ static picture_t *PreparePicture(vout_thread_sys_t *vout, bool reuse_decoded,
                         vlc_clock_ConvertToSystem(sys->clock, system_now,
                                                   decoded->date, sys->rate);
 
-                    if (system_pts != INT64_MAX &&
+                    if (system_pts != VLC_TICK_MAX &&
                         IsPictureLate(vout, decoded, system_now, system_pts))
                     {
                         picture_Release(decoded);
@@ -1148,7 +1148,7 @@ static int RenderPicture(vout_thread_sys_t *vout, bool render_now)
         /* The clock is paused, it's too late to fallback to the previous
          * picture, display the current picture anyway and force the rendering
          * to now. */
-        if (unlikely(render_subtitle_date == INT64_MAX))
+        if (unlikely(render_subtitle_date == VLC_TICK_MAX))
         {
             render_subtitle_date = system_now;
             render_now = true;
@@ -1288,7 +1288,7 @@ static int RenderPicture(vout_thread_sys_t *vout, bool render_now)
     const vlc_tick_t pts = todisplay->date;
     vlc_tick_t system_pts = render_now ? system_now :
         vlc_clock_ConvertToSystem(sys->clock, system_now, pts, sys->rate);
-    if (unlikely(system_pts == INT64_MAX))
+    if (unlikely(system_pts == VLC_TICK_MAX))
     {
         /* The clock is paused, it's too late to fallback to the previous
          * picture, display the current picture anyway and force the rendering
@@ -1342,7 +1342,7 @@ static int RenderPicture(vout_thread_sys_t *vout, bool render_now)
     {
         sys->displayed.date = system_now;
         /* Tell the clock that the pts was forced */
-        system_pts = INT64_MAX;
+        system_pts = VLC_TICK_MAX;
     }
     vlc_clock_UpdateVideo(sys->clock, system_pts, pts, sys->rate,
                           frame_rate, frame_rate_base);
@@ -1436,7 +1436,7 @@ static int DisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
         const vlc_tick_t next_system_pts =
             vlc_clock_ConvertToSystem(sys->clock, system_now,
                                       sys->displayed.current->date, sys->rate);
-        if (likely(next_system_pts != INT64_MAX))
+        if (likely(next_system_pts != VLC_TICK_MAX))
         {
             vlc_tick_t date_next = next_system_pts - render_delay;
             if (date_next <= system_now)
@@ -1452,7 +1452,7 @@ static int DisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
         const vlc_tick_t swap_next_pts =
             vlc_clock_ConvertToSystem(sys->clock, vlc_tick_now(),
                                         next->date, sys->rate);
-        if (likely(swap_next_pts != INT64_MAX))
+        if (likely(swap_next_pts != VLC_TICK_MAX))
             date_refresh = swap_next_pts - render_delay;
 
         // next frame will still need some waiting before display
@@ -1822,7 +1822,7 @@ static void vout_ReleaseDisplay(vout_thread_sys_t *vout)
 
     /* Destroy the rendering display */
     if (sys->private.display_pool != NULL)
-        vout_FlushUnlocked(vout, true, INT64_MAX);
+        vout_FlushUnlocked(vout, true, VLC_TICK_MAX);
 
     vlc_mutex_lock(&sys->display_lock);
     vout_CloseWrapper(&vout->obj, &sys->private, sys->display);


=====================================
src/video_output/vout_subpictures.c
=====================================
@@ -619,7 +619,7 @@ static size_t spu_channel_UpdateDates(struct spu_channel *channel,
     for (size_t index = 0; index < channel->entries.size; index++)
     {
         spu_render_entry_t *render_entry = &channel->entries.data[index];
-        if(date_array[index * 2] != INT64_MAX) /* pause triggered before or during spu render */
+        if(date_array[index * 2] != VLC_TICK_MAX) /* pause triggered before or during spu render */
         {
             render_entry->start = date_array[index * 2];
             render_entry->stop = date_array[index * 2 + 1];
@@ -731,7 +731,7 @@ spu_SelectSubpictures(spu_t *spu, vlc_tick_t system_now,
         if (start_date < sys->last_sort_date)
             start_date = sys->last_sort_date;
         if (start_date <= 0)
-            start_date = INT64_MAX;
+            start_date = VLC_TICK_MAX;
 
         /* Select pictures to be displayed */
         for (size_t index = 0; index < channel->entries.size; ) {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e5d44f6af015c74b820e160e95838d2ea971d6b7

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e5d44f6af015c74b820e160e95838d2ea971d6b7
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list