diff mbox

[FFmpeg-devel] ffplay: terminate program on EOF.

Message ID 1500639963-9838-1-git-send-email-jorge.ramirez-ortiz@linaro.org
State Withdrawn
Headers show

Commit Message

Jorge Ramirez-Ortiz July 21, 2017, 12:26 p.m. UTC
ffplay always requires user intervention via the GUI to close the
video at the end of the file.

This commit, stops playing and terminates the program when EOF is
received.
---
 ffplay.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Gyan July 21, 2017, 12:38 p.m. UTC | #1
On Fri, Jul 21, 2017 at 5:56 PM, Jorge Ramirez-Ortiz <
jorge.ramirez-ortiz@linaro.org> wrote:

> ffplay always requires user intervention via the GUI to close the
> video at the end of the file.
>

You wish to make -autoexit the default?
Clément Bœsch July 21, 2017, 12:41 p.m. UTC | #2
On Fri, Jul 21, 2017 at 02:26:03PM +0200, Jorge Ramirez-Ortiz wrote:
> ffplay always requires user intervention via the GUI to close the
> video at the end of the file.
> 
> This commit, stops playing and terminates the program when EOF is
> received.

-autoexit?
Jorge Ramirez-Ortiz July 21, 2017, 12:49 p.m. UTC | #3
On 07/21/2017 02:41 PM, Clément Bœsch wrote:
> On Fri, Jul 21, 2017 at 02:26:03PM +0200, Jorge Ramirez-Ortiz wrote:
>> ffplay always requires user intervention via the GUI to close the
>> video at the end of the file.
>>
>> This commit, stops playing and terminates the program when EOF is
>> received.
> -autoexit?

ah, too many options....sorry, I didnt know it existed, my bad.
please forget this patch


>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
diff mbox

Patch

diff --git a/ffplay.c b/ffplay.c
index c0b326c..12de7ba 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -593,7 +593,7 @@  static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) {
                 if (ret == AVERROR_EOF) {
                     d->finished = d->pkt_serial;
                     avcodec_flush_buffers(d->avctx);
-                    return 0;
+                    return -1;
                 }
                 if (ret >= 0)
                     return 1;
@@ -2088,8 +2088,13 @@  static int video_thread(void *arg)
 
     for (;;) {
         ret = get_video_frame(is, frame);
-        if (ret < 0)
-            goto the_end;
+        if (ret < 0) {
+                SDL_Event event;
+                event.type = FF_QUIT_EVENT;
+                event.user.data1 = is;
+                SDL_PushEvent(&event);
+                goto the_end;
+        }
         if (!ret)
             continue;