[vlc-commits] [Git][videolan/vlc][master] 6 commits: mmal: replace deprecated mtime_t with vlc_tick_t

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Aug 17 04:41:01 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
be1baa8b by Steve Lhomme at 2022-08-17T04:26:22+00:00
mmal: replace deprecated mtime_t with vlc_tick_t

- - - - -
13d744b8 by Steve Lhomme at 2022-08-17T04:26:22+00:00
libplacebo: replace deprecated mtime_t with vlc_tick_t

- - - - -
bd8c5cb9 by Steve Lhomme at 2022-08-17T04:26:22+00:00
vlc_tick: remove deprecated and unused mtime_t

- - - - -
ebfd515a by Steve Lhomme at 2022-08-17T04:26:22+00:00
vlc_tick: remove outdated comment

- - - - -
aa70adf4 by Steve Lhomme at 2022-08-17T04:26:22+00:00
libvlc: rename outdated mtime functions to vlc_tick ones

- - - - -
b20b9596 by Steve Lhomme at 2022-08-17T04:26:22+00:00
libvlc_internal: do the half up millisecond rounding with vlc_tick macros

Don't assume any CLOCK_FREQ value.

- - - - -


7 changed files:

- include/vlc_tick.h
- lib/libvlc_internal.h
- lib/media.c
- lib/media_player.c
- lib/picture.c
- modules/hw/mmal/converter.c
- modules/video_output/libplacebo/display.c


Changes:

=====================================
include/vlc_tick.h
=====================================
@@ -6,8 +6,6 @@
  * functions like gettimeofday() and ftime() are not always supported.
  * Most functions are declared as inline or as macros since they are only
  * interfaces to system calls and have to be called frequently.
- * 'm' stands for 'micro', since maximum resolution is the microsecond.
- * Functions prototyped are implemented in interface/mtime.c.
  *****************************************************************************
  * Copyright (C) 1996, 1997, 1998, 1999, 2000 VLC authors and VideoLAN
  *
@@ -44,7 +42,6 @@ struct timespec;
  * arithmetic operators, and that no special functions are required.
  */
 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


=====================================
lib/libvlc_internal.h
=====================================
@@ -98,12 +98,12 @@ void libvlc_event_send(
         libvlc_event_manager_t * p_em,
         libvlc_event_t * p_event );
 
-static inline libvlc_time_t from_mtime(vlc_tick_t time)
+static inline libvlc_time_t libvlc_time_from_vlc_tick(vlc_tick_t time)
 {
-    return (time + 500ULL)/ 1000ULL;
+    return MS_FROM_VLC_TICK(time + VLC_TICK_FROM_US(500));
 }
 
-static inline vlc_tick_t to_mtime(libvlc_time_t time)
+static inline vlc_tick_t vlc_tick_from_libvlc_time(libvlc_time_t time)
 {
     return VLC_TICK_FROM_MS(time);
 }


=====================================
lib/media.c
=====================================
@@ -327,7 +327,7 @@ static void input_item_duration_changed( const vlc_event_t *p_event,
     /* Construct the event */
     event.type = libvlc_MediaDurationChanged;
     event.u.media_duration_changed.new_duration =
-        from_mtime(p_event->u.input_item_duration_changed.new_duration);
+        libvlc_time_from_vlc_tick(p_event->u.input_item_duration_changed.new_duration);
 
     /* Send the event */
     libvlc_event_send( &p_md->event_manager, &event );
@@ -776,7 +776,7 @@ libvlc_media_get_duration( libvlc_media_t * p_md )
     if (!input_item_IsPreparsed( p_md->p_input_item ))
         return -1;
 
-    return from_mtime(input_item_GetDuration( p_md->p_input_item ));
+    return libvlc_time_from_vlc_tick(input_item_GetDuration( p_md->p_input_item ));
 }
 
 int
@@ -1013,11 +1013,11 @@ libvlc_media_thumbnail_request_by_time( libvlc_instance_t *inst,
     req->crop = crop;
     libvlc_media_retain( md );
     req->req = vlc_thumbnailer_RequestByTime( p_priv->p_thumbnailer,
-        to_mtime( time ),
+        vlc_tick_from_libvlc_time( time ),
         speed == libvlc_media_thumbnail_seek_fast ?
             VLC_THUMBNAILER_SEEK_FAST : VLC_THUMBNAILER_SEEK_PRECISE,
         md->p_input_item,
-        timeout > 0 ? to_mtime( timeout ) : VLC_TICK_INVALID,
+        timeout > 0 ? vlc_tick_from_libvlc_time( timeout ) : VLC_TICK_INVALID,
         media_on_thumbnail_ready, req );
     if ( req->req == NULL )
     {
@@ -1059,7 +1059,7 @@ libvlc_media_thumbnail_request_by_pos( libvlc_instance_t *inst,
         speed == libvlc_media_thumbnail_seek_fast ?
             VLC_THUMBNAILER_SEEK_FAST : VLC_THUMBNAILER_SEEK_PRECISE,
         md->p_input_item,
-        timeout > 0 ? to_mtime( timeout ) : VLC_TICK_INVALID,
+        timeout > 0 ? vlc_tick_from_libvlc_time( timeout ) : VLC_TICK_INVALID,
         media_on_thumbnail_ready, req );
     if ( req->req == NULL )
     {


=====================================
lib/media_player.c
=====================================
@@ -1282,7 +1282,7 @@ libvlc_time_t libvlc_media_player_get_length(
     vlc_player_Lock(player);
 
     vlc_tick_t length = vlc_player_GetLength(player);
-    libvlc_time_t i_time = from_mtime(length);
+    libvlc_time_t i_time = libvlc_time_from_vlc_tick(length);
 
     vlc_player_Unlock(player);
     return i_time;
@@ -1294,7 +1294,7 @@ libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi )
     vlc_player_Lock(player);
 
     vlc_tick_t tick = vlc_player_GetTime(player);
-    libvlc_time_t i_time = from_mtime(tick);
+    libvlc_time_t i_time = libvlc_time_from_vlc_tick(tick);
 
     vlc_player_Unlock(player);
     return i_time;
@@ -1303,7 +1303,7 @@ libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi )
 int libvlc_media_player_set_time( libvlc_media_player_t *p_mi,
                                    libvlc_time_t i_time, bool b_fast )
 {
-    vlc_tick_t tick = to_mtime(i_time);
+    vlc_tick_t tick = vlc_tick_from_libvlc_time(i_time);
 
     vlc_player_t *player = p_mi->player;
     vlc_player_Lock(player);
@@ -1898,7 +1898,7 @@ libvlc_media_player_select_track(libvlc_media_player_t *p_mi,
 
     const libvlc_media_trackpriv_t *trackpriv =
         libvlc_media_track_to_priv(track);
-    
+
     // It must be a player track
     assert(trackpriv->es_id);
 


=====================================
lib/picture.c
=====================================
@@ -63,7 +63,7 @@ libvlc_picture_t* libvlc_picture_new( vlc_object_t* p_obj, picture_t* input,
         return NULL;
     vlc_atomic_rc_init( &pic->rc );
     pic->type = type;
-    pic->time = from_mtime( input->date );
+    pic->time = libvlc_time_from_vlc_tick( input->date );
     pic->attachment = NULL;
     vlc_fourcc_t format;
     switch ( type )


=====================================
modules/hw/mmal/converter.c
=====================================
@@ -141,7 +141,7 @@ static void pic_fifo_put(vlc_picture_chain_t * const pf, picture_t * pic)
 
 typedef struct conv_frame_stash_s
 {
-    mtime_t pts;
+    vlc_tick_t pts;
     MMAL_BUFFER_HEADER_T * sub_bufs[SUBS_MAX];
 } conv_frame_stash_t;
 


=====================================
modules/video_output/libplacebo/display.c
=====================================
@@ -80,7 +80,7 @@ typedef struct vout_display_sys_t
 } vout_display_sys_t;
 
 // Display callbacks
-static void PictureRender(vout_display_t *, picture_t *, subpicture_t *, mtime_t);
+static void PictureRender(vout_display_t *, picture_t *, subpicture_t *, vlc_tick_t);
 static void PictureDisplay(vout_display_t *, picture_t *);
 static int Control(vout_display_t *, int);
 static void Close(vout_display_t *);
@@ -209,7 +209,7 @@ static void Close(vout_display_t *vd)
 }
 
 static void PictureRender(vout_display_t *vd, picture_t *pic,
-                          subpicture_t *subpicture, mtime_t date)
+                          subpicture_t *subpicture, vlc_tick_t date)
 {
     VLC_UNUSED(date);
     vout_display_sys_t *sys = vd->sys;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a36e0faa55ec0a936e44d725ca9705dfd3467185...b20b95965807f18fe6625921aadbf089c1573210

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


VideoLAN code repository instance


More information about the vlc-commits mailing list