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

Git pushed a commit to branch master
in repository ffmpeg.

commit 684b84e36d5c14457ab10ad19da666af10d63a66
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sun Sep 20 21:01:47 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Sat Sep 26 11:36:30 2026 +0000

    ffplay: seek to a chapter list entry by clicking it
    
    Assisted-by: Claude
---
 doc/ffplay.texi  |  3 +++
 fftools/ffplay.c | 22 ++++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/doc/ffplay.texi b/doc/ffplay.texi
index a1a3089813..95a0e54b82 100644
--- a/doc/ffplay.texi
+++ b/doc/ffplay.texi
@@ -280,6 +280,9 @@ Seek to the chapter selected in the chapter list while it 
is shown.
 @item mouse wheel
 Move the chapter list selection while it is shown.
 
+@item left mouse click
+Seek to the clicked chapter list entry.
+
 @item right mouse click
 Seek to percentage in file corresponding to fraction of width.
 
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index e54d0595c4..783ccf6888 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -1248,6 +1248,24 @@ static int chapter_list_visible(VideoState *is)
     return chapter_list_alpha(is, av_gettime_relative()) > 0;
 }
 
+static void seek_chapter(VideoState *is, int i);
+
+/* seeks to the entry under a click, returns whether the click hit the list at 
all */
+static int chapter_list_click(VideoState *is, int x, int y)
+{
+    ChapterListLayout l = chapter_list_layout(is);
+    int row;
+
+    x -= is->chapter_rect.x;
+    y -= is->chapter_rect.y;
+    if (x < 0 || y < 0 || x >= is->chapter_rect.w || y >= is->chapter_rect.h)
+        return 0;
+    row = (y - l.font / 2) / l.line;
+    if (row < l.nb_rows)
+        seek_chapter(is, l.first + row);
+    return 1;
+}
+
 static void chapter_list_draw(VideoState *is)
 {
     double alpha = chapter_list_alpha(is, av_gettime_relative());
@@ -4118,6 +4136,9 @@ static void event_loop(VideoState *cur_stream)
                 do_exit(cur_stream);
                 break;
             }
+            if (event.button.button == SDL_BUTTON_LEFT && 
chapter_list_visible(cur_stream) &&
+                chapter_list_click(cur_stream, event.button.x, event.button.y))
+                break;
             if (event.button.button == SDL_BUTTON_LEFT) {
                 static int64_t last_mouse_left_click = 0;
                 if (av_gettime_relative() - last_mouse_left_click <= 500000) {
@@ -4398,6 +4419,7 @@ void show_help_default(const char *opt, const char *arg)
            "l                   keep the chapter list on screen, down/up then 
move its selection\n"
            "enter               seek to the chapter selected in the chapter 
list while it is shown\n"
            "mouse wheel         move the chapter list selection while it is 
shown\n"
+           "left click          seek to the clicked chapter list entry\n"
            "right mouse click   seek to percentage in file corresponding to 
fraction of width\n"
            "left double-click   toggle full screen\n"
            );

-- 
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