[FFmpeg-cvslog] fftools/ffmpeg_enc: return errors from enc_flush() instead of aborting

Anton Khirnov git at videolan.org
Thu Jul 20 21:56:40 EEST 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Jul 13 13:34:32 2023 +0200| [43bcf631d0e4240c5eb138d97b8685290903c3ed] | committer: Anton Khirnov

fftools/ffmpeg_enc: return errors from enc_flush() instead of aborting

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=43bcf631d0e4240c5eb138d97b8685290903c3ed
---

 fftools/ffmpeg.c     | 2 +-
 fftools/ffmpeg.h     | 2 +-
 fftools/ffmpeg_enc.c | 6 ++++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 27c4e7ef26..926fdea23a 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1250,7 +1250,7 @@ static int transcode(int *err_rate_exceeded)
         } else if (err_rate)
             av_log(ist, AV_LOG_VERBOSE, "Decode error rate %g\n", err_rate);
     }
-    enc_flush();
+    ret = err_merge(ret, enc_flush());
 
     term_exit();
 
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 89c87cf1c4..506deaa0f3 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -815,7 +815,7 @@ void enc_free(Encoder **penc);
 int enc_open(OutputStream *ost, AVFrame *frame);
 int enc_subtitle(OutputFile *of, OutputStream *ost, const AVSubtitle *sub);
 int enc_frame(OutputStream *ost, AVFrame *frame);
-void enc_flush(void);
+int enc_flush(void);
 
 /*
  * Initialize muxing state for the given stream, should be called
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index 384c6c0a88..90ec20ee6b 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -1147,7 +1147,7 @@ int enc_frame(OutputStream *ost, AVFrame *frame)
            do_video_out(of, ost, frame) : do_audio_out(of, ost, frame);
 }
 
-void enc_flush(void)
+int enc_flush(void)
 {
     int ret;
 
@@ -1168,6 +1168,8 @@ void enc_flush(void)
 
         ret = submit_encode_frame(of, ost, NULL);
         if (ret != AVERROR_EOF)
-            exit_program(1);
+            return ret;
     }
+
+    return 0;
 }



More information about the ffmpeg-cvslog mailing list