This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit ef8c89863d9afb4ee65cc5f9601c682764b49dc0
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sun Sep 20 18:08:33 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Sat Sep 26 11:36:30 2026 +0000

    ffplay: factor the current chapter lookup out of seek_chapter
    
    Assisted-by: Claude
---
 fftools/ffplay.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 8fb129a0be..108aa05ce4 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -3702,23 +3702,28 @@ static void refresh_loop_wait_event(VideoState *is, 
SDL_Event *event) {
     }
 }
 
-static void seek_chapter(VideoState *is, int incr)
+/* index of the chapter containing the current playback position, -1 before 
the first one */
+static int current_chapter(VideoState *is)
 {
     int64_t pos = get_master_clock(is) * AV_TIME_BASE;
     int i;
 
-    if (!is->ic->nb_chapters)
-        return;
-
-    /* find the current chapter */
     for (i = 0; i < is->ic->nb_chapters; i++) {
         AVChapter *ch = is->ic->chapters[i];
         if (av_compare_ts(pos, AV_TIME_BASE_Q, ch->start, ch->time_base) < 0)
             break;
     }
+    return i - 1;
+}
+
+static void seek_chapter(VideoState *is, int incr)
+{
+    int i;
+
+    if (!is->ic->nb_chapters)
+        return;
 
-    i += incr - 1;
-    i = FFMAX(i, 0);
+    i = FFMAX(current_chapter(is) + incr, 0);
     if (i >= is->ic->nb_chapters)
         return;
 

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to