[vlc-commits] [Git][videolan/vlc][master] mock: update seekpoints while playing

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Dec 2 07:10:29 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
17f6b1e4 by Thomas Guillem at 2023-12-02T06:45:43+00:00
mock: update seekpoints while playing

- - - - -


1 changed file:

- modules/demux/mock.c


Changes:

=====================================
modules/demux/mock.c
=====================================
@@ -300,6 +300,7 @@ struct demux_sys
 
     int current_title;
     vlc_tick_t chapter_gap;
+    int current_chapter;
 
     uint8_t bar_colors[PICTURE_PLANE_MAX][PICTURE_PLANE_MAX];
     bool b_colors;
@@ -403,6 +404,7 @@ Control(demux_t *demux, int query, va_list args)
                 {
                     sys->pts = sys->audio_pts = sys->video_pts =
                         (seekpoint_idx * sys->chapter_gap) + VLC_TICK_0;
+                    sys->current_chapter = seekpoint_idx;
                     return VLC_SUCCESS;
                 }
             }
@@ -424,7 +426,7 @@ Control(demux_t *demux, int query, va_list args)
         case DEMUX_GET_SEEKPOINT:
             if (sys->chapter_gap != VLC_TICK_INVALID)
             {
-                *va_arg(args, int *) = sys->pts / sys->chapter_gap;
+                *va_arg(args, int *) = sys->current_chapter;
                 return VLC_SUCCESS;
             }
             return VLC_EGENERIC;
@@ -1085,6 +1087,16 @@ Demux(demux_t *demux)
     if (sys->pts > sys->length)
         sys->pts = sys->length;
 
+    if (sys->chapter_gap > 0)
+    {
+        int chapter_index = sys->pts / sys->chapter_gap;
+        if (chapter_index != sys->current_chapter)
+        {
+            sys->updates |= INPUT_UPDATE_SEEKPOINT;
+            sys->current_chapter = chapter_index;
+        }
+    }
+
     if (!sys->can_control_pace)
     {
         /* Simulate a live input */
@@ -1459,6 +1471,7 @@ Open(vlc_object_t *obj)
     sys->current_title = 0;
     sys->chapter_gap = sys->chapter_count > 0 ?
                        (sys->length / sys->chapter_count) : VLC_TICK_INVALID;
+    sys->current_chapter = 0;
     sys->updates = 0;
 
     demux->pf_control = Control;



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

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/17f6b1e4c8ee124155fa5e4ea91a6d0917a44936
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