[FFmpeg-devel] [PATCH] ffplay: Dont autoexeit by default on single images
Michael Niedermayer
michaelni at gmx.at
Sun Sep 7 02:16:23 CEST 2014
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
ffplay.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/ffplay.c b/ffplay.c
index 06bccce..64ec058 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -185,6 +185,7 @@ typedef struct VideoState {
int realtime;
int audio_finished;
int video_finished;
+ int video_frames;
Clock audclk;
Clock vidclk;
@@ -311,7 +312,7 @@ static int fast = 0;
static int genpts = 0;
static int lowres = 0;
static int decoder_reorder_pts = -1;
-static int autoexit = 1;
+static int autoexit = -1;
static int exit_on_keydown;
static int exit_on_mousedown;
static int loop = 1;
@@ -1701,6 +1702,8 @@ static int get_video_frame(VideoState *is, AVFrame *frame, AVPacket *pkt, int *s
int ret = 1;
double dpts = NAN;
+ is->video_frames ++;
+
if (decoder_reorder_pts == -1) {
frame->pts = av_frame_get_best_effort_timestamp(frame);
} else if (decoder_reorder_pts) {
@@ -2995,7 +2998,7 @@ static int read_thread(void *arg)
(!is->video_st || (is->video_finished == is->videoq.serial && pictq_nb_remaining(is) == 0))) {
if (loop != 1 && (!loop || --loop)) {
stream_seek(is, start_time != AV_NOPTS_VALUE ? start_time : 0, 0, 0);
- } else if (autoexit) {
+ } else if (autoexit == 1 || (autoexit == -1 && is->video_frames != 1)) {
ret = AVERROR_EOF;
goto fail;
}
--
1.7.9.5
More information about the ffmpeg-devel
mailing list