Commit eb2a565071 for ffmpeg
commit eb2a565071fbae1481a76e5d462f85c47702446c
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Thu Oct 15 02:03:01 2026 +0200
ffplay: count the loops of each input
-loop was counted down in the global option, so a later input played
only the loops the first one left.
Assisted-by: Claude
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 1985685e0e..a8d329f3ff 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -314,6 +314,7 @@ typedef struct VideoState {
char *title;
int seek_by_bytes;
int infinite_buffer;
+ int loop;
int width, height, xleft, ytop;
int step;
@@ -3462,7 +3463,7 @@ static int read_thread(void *arg)
if (!is->paused &&
(!is->audio_st || (is->auddec.finished == is->audioq.serial && frame_queue_nb_remaining(&is->sampq) == 0)) &&
(!is->video_st || (is->viddec.finished == is->videoq.serial && frame_queue_nb_remaining(&is->pictq) == 0))) {
- if (loop != 1 && (!loop || --loop)) {
+ if (is->loop != 1 && (!is->loop || --is->loop)) {
stream_seek(is, start_time != AV_NOPTS_VALUE ? start_time : 0, 0, 0);
} else if (autoexit) {
ret = AVERROR_EOF;
@@ -3590,6 +3591,7 @@ static VideoState *stream_open(const char *filename,
is->iformat = iformat;
is->seek_by_bytes = seek_by_bytes;
is->infinite_buffer = infinite_buffer;
+ is->loop = loop;
is->ytop = 0;
is->xleft = 0;