[vlc-commits] [Git][videolan/vlc][master] 5 commits: es_out: add support for video delay

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Nov 4 08:44:31 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
450296f9 by Thomas Guillem at 2023-11-04T08:23:22+00:00
es_out: add support for video delay

- - - - -
37277f9b by Thomas Guillem at 2023-11-04T08:23:22+00:00
input: add support for video delay

- - - - -
5a48b306 by Thomas Guillem at 2023-11-04T08:23:22+00:00
player: add support for video delay

- - - - -
cf961e63 by Thomas Guillem at 2023-11-04T08:23:22+00:00
player: add helpers to set the video category delay

- - - - -
34ad4f2c by Thomas Guillem at 2023-11-04T08:23:22+00:00
qt: remove assert() if video delay changed

- - - - -


5 changed files:

- include/vlc_player.h
- modules/gui/qt/player/player_controller.cpp
- src/input/es_out.c
- src/input/input.c
- src/player/player.c


Changes:

=====================================
include/vlc_player.h
=====================================
@@ -1987,6 +1987,26 @@ vlc_player_SetAudioDelay(vlc_player_t *player, vlc_tick_t delay,
     vlc_player_SetCategoryDelay(player, AUDIO_ES, delay, whence);
 }
 
+/**
+ * Helper to get the audio delay
+ */
+static inline vlc_tick_t
+vlc_player_GetVideoDelay(vlc_player_t *player)
+{
+    return vlc_player_GetCategoryDelay(player, VIDEO_ES);
+}
+
+/**
+ * Helper to set the audio delay
+ */
+static inline void
+vlc_player_SetVideoDelay(vlc_player_t *player, vlc_tick_t delay,
+                         enum vlc_player_whence whence)
+
+{
+    vlc_player_SetCategoryDelay(player, VIDEO_ES, delay, whence);
+}
+
 /**
  * Helper to get the subtitle delay
  */


=====================================
modules/gui/qt/player/player_controller.cpp
=====================================
@@ -652,7 +652,8 @@ static void on_player_category_delay_changed(vlc_player_t *,
                 that->m_subtitleDelay = new_delay;
                 emit that->q_func()->subtitleDelayChanged( new_delay );
                 break;
-            default: vlc_assert_unreachable();
+            default:
+                break;
         }
     });
 }


=====================================
src/input/es_out.c
=====================================
@@ -201,6 +201,7 @@ typedef struct
     /* delay */
     vlc_tick_t i_audio_delay;
     vlc_tick_t i_spu_delay;
+    vlc_tick_t i_video_delay;
 
     /* Clock configuration */
     vlc_tick_t  i_pts_delay;
@@ -688,7 +689,7 @@ static void EsOutUpdateDelayJitter(es_out_t *out)
 
 static void EsOutSetEsDelay(es_out_t *out, es_out_id_t *es, vlc_tick_t delay)
 {
-    assert(es->fmt.i_cat == AUDIO_ES || es->fmt.i_cat == SPU_ES);
+    assert(es->fmt.i_cat == AUDIO_ES || es->fmt.i_cat == SPU_ES || es->fmt.i_cat == VIDEO_ES);
 
     es->delay = delay;
 
@@ -706,6 +707,8 @@ static void EsOutSetDelay( es_out_t *out, int i_cat, vlc_tick_t i_delay )
         p_sys->i_audio_delay = i_delay;
     else if( i_cat == SPU_ES )
         p_sys->i_spu_delay = i_delay;
+    else if( i_cat == VIDEO_ES )
+        p_sys->i_video_delay = i_delay;
 
     foreach_es_then_es_slaves(es)
         EsOutDecoderChangeDelay(out, es);
@@ -1118,6 +1121,8 @@ static void EsOutDecoderChangeDelay( es_out_t *out, es_out_id_t *p_es )
         i_delay = p_sys->i_audio_delay;
     else if( p_es->fmt.i_cat == SPU_ES )
         i_delay = p_sys->i_spu_delay;
+    else if( p_es->fmt.i_cat == VIDEO_ES )
+        i_delay = p_sys->i_video_delay;
     else
         return;
 
@@ -3075,6 +3080,7 @@ static vlc_tick_t EsOutGetTracksDelay(es_out_t *out)
     es_out_sys_t *p_sys = container_of(out, es_out_sys_t, out);
 
     vlc_tick_t tracks_delay = 0;
+    bool has_video = false;
     bool has_audio = false;
     bool has_spu = false;
 
@@ -3088,11 +3094,15 @@ static vlc_tick_t EsOutGetTracksDelay(es_out_t *out)
 
         if (es->delay != VLC_TICK_MAX)
             tracks_delay = __MIN(tracks_delay, es->delay);
+        else if (es->fmt.i_cat == VIDEO_ES)
+            has_video = true;
         else if (es->fmt.i_cat == AUDIO_ES)
             has_audio = true;
         else if (es->fmt.i_cat == SPU_ES)
             has_spu = true;
     }
+    if (has_video)
+        tracks_delay = __MIN(tracks_delay, p_sys->i_video_delay);
     if (has_audio)
         tracks_delay = __MIN(tracks_delay, p_sys->i_audio_delay);
     if (has_spu)


=====================================
src/input/input.c
=====================================
@@ -2225,7 +2225,8 @@ static bool Control( input_thread_t *p_input,
 
         case INPUT_CONTROL_SET_CATEGORY_DELAY:
             assert(param.cat_delay.cat == AUDIO_ES
-                || param.cat_delay.cat == SPU_ES);
+                || param.cat_delay.cat == SPU_ES
+                || param.cat_delay.cat == VIDEO_ES);
             es_out_SetDelay(priv->p_es_out_display,
                             param.cat_delay.cat, param.cat_delay.delay);
             break;


=====================================
src/player/player.c
=====================================
@@ -1656,7 +1656,7 @@ vlc_player_SetCategoryDelay(vlc_player_t *player, enum es_format_category_e cat,
     if (!input)
         return VLC_EGENERIC;
 
-    if (cat != AUDIO_ES && cat != SPU_ES)
+    if (cat != AUDIO_ES && cat != SPU_ES && cat != VIDEO_ES)
         return VLC_EGENERIC;
     vlc_tick_t *cat_delay = &input->cat_delays[cat];
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/43258706e3ec925bd90e6c958a196e1a28bc9a8a...34ad4f2c777f56428963d99047ed7ecf45bdc590

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/43258706e3ec925bd90e6c958a196e1a28bc9a8a...34ad4f2c777f56428963d99047ed7ecf45bdc590
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