[FFmpeg-cvslog] ffmpeg: allow pass 3

Michael Niedermayer git at videolan.org
Sun Oct 30 02:47:12 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Oct 30 02:26:48 2011 +0100| [4dbce51b9e5a994634c6c26f7f2e78f5d75ee342] | committer: Michael Niedermayer

ffmpeg: allow pass 3

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 ffmpeg.c |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 3d7c623..e9ac81a 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2247,15 +2247,7 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
                 snprintf(logfilename, sizeof(logfilename), "%s-%d.log",
                          pass_logfilename_prefix ? pass_logfilename_prefix : DEFAULT_PASS_LOGFILENAME_PREFIX,
                          i);
-                if (codec->flags & CODEC_FLAG_PASS1) {
-                    f = fopen(logfilename, "wb");
-                    if (!f) {
-                        av_log(NULL, AV_LOG_FATAL, "Cannot write log file '%s' for pass-1 encoding: %s\n",
-                               logfilename, strerror(errno));
-                        exit_program(1);
-                    }
-                    ost->logfile = f;
-                } else {
+                if (codec->flags & CODEC_FLAG_PASS2) {
                     char  *logbuffer;
                     size_t logbuffer_size;
                     if (read_file(logfilename, &logbuffer, &logbuffer_size) < 0) {
@@ -2265,6 +2257,15 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
                     }
                     codec->stats_in = logbuffer;
                 }
+                if (codec->flags & CODEC_FLAG_PASS1) {
+                    f = fopen(logfilename, "wb");
+                    if (!f) {
+                        av_log(NULL, AV_LOG_FATAL, "Cannot write log file '%s' for pass-1 encoding: %s\n",
+                               logfilename, strerror(errno));
+                        exit_program(1);
+                    }
+                    ost->logfile = f;
+                }
             }
         }
         if(codec->codec_type == AVMEDIA_TYPE_VIDEO){
@@ -3466,9 +3467,10 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
 
         /* two pass mode */
         if (do_pass) {
-            if (do_pass == 1) {
+            if (do_pass & 1) {
                 video_enc->flags |= CODEC_FLAG_PASS1;
-            } else {
+            }
+            if (do_pass & 2) {
                 video_enc->flags |= CODEC_FLAG_PASS2;
             }
         }
@@ -3969,7 +3971,7 @@ static void opt_output_file(void *optctx, const char *filename)
 /* same option as mencoder */
 static int opt_pass(const char *opt, const char *arg)
 {
-    do_pass = parse_number_or_die(opt, arg, OPT_INT, 1, 2);
+    do_pass = parse_number_or_die(opt, arg, OPT_INT, 1, 3);
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list