shithub: libvpx

Download patch

ref: f1cf4058159fde599b14bcfa1f71b6bf6b686d9a
parent: 9adcc4d681ee027c9bc6a77a5aa73780fb6173ea
parent: 096ab11012cd958c9cc3c149f877c37d80b36b2f
author: Dmitry Kovalev <dkovalev@google.com>
date: Wed Jan 15 07:15:48 EST 2014

Merge "Removing pass number check from ivf_write_file_header()."

--- a/ivfenc.c
+++ b/ivfenc.c
@@ -20,9 +20,6 @@
                            int frame_cnt) {
   char header[32];
 
-  if (cfg->g_pass != VPX_RC_ONE_PASS && cfg->g_pass != VPX_RC_LAST_PASS)
-    return;
-
   header[0] = 'D';
   header[1] = 'K';
   header[2] = 'I';
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -1393,7 +1393,11 @@
 static void open_output_file(struct stream_state *stream,
                              struct VpxEncoderConfig *global) {
   const char *fn = stream->config.out_fn;
+  const struct vpx_codec_enc_cfg *const cfg = &stream->config.cfg;
 
+  if (cfg->g_pass == VPX_RC_FIRST_PASS)
+    return;
+
   stream->file = strcmp(fn, "-") ? fopen(fn, "wb") : set_binary_mode(stdout);
 
   if (!stream->file)
@@ -1404,18 +1408,23 @@
 
   if (stream->config.write_webm) {
     stream->ebml.stream = stream->file;
-    write_webm_file_header(&stream->ebml, &stream->config.cfg,
+    write_webm_file_header(&stream->ebml, cfg,
                            &global->framerate,
                            stream->config.stereo_fmt,
                            global->codec->fourcc);
-  } else
-    ivf_write_file_header(stream->file, &stream->config.cfg,
-                          global->codec->fourcc, 0);
+  } else {
+    ivf_write_file_header(stream->file, cfg, global->codec->fourcc, 0);
+  }
 }
 
 
 static void close_output_file(struct stream_state *stream,
-                              unsigned int         fourcc) {
+                              unsigned int fourcc) {
+  const struct vpx_codec_enc_cfg *const cfg = &stream->config.cfg;
+
+  if (cfg->g_pass == VPX_RC_FIRST_PASS)
+    return;
+
   if (stream->config.write_webm) {
     write_webm_file_footer(&stream->ebml, stream->hash);
     free(stream->ebml.cue_list);
--