fixed vpxenc bug where ivf files would be read incorrectly
authorJames Berry <jamesberry@google.com>
Mon, 13 Dec 2010 18:10:58 +0000 (13:10 -0500)
committerJames Berry <jamesberry@google.com>
Mon, 13 Dec 2010 19:40:18 +0000 (14:40 -0500)
read_frame would incorrectly insert detect->buf into img
for ivf files.  detect->position now set to 4 if input file is
detected to be ivf in file_is_ivf to keep this from occuring.

Change-Id: I5e235dd3033985bc62707a35c13af5984620208e

vpxenc.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 0ae391f..4baeefc
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -347,12 +347,12 @@ unsigned int file_is_ivf(FILE *infile,
                          unsigned int *fourcc,
                          unsigned int *width,
                          unsigned int *height,
-                         char          detect[4])
+                         struct detect_buffer *detect)
 {
     char raw_hdr[IVF_FILE_HDR_SZ];
     int is_ivf = 0;
 
-    if(memcmp(detect, "DKIF", 4) != 0)
+    if(memcmp(detect->buf, "DKIF", 4) != 0)
         return 0;
 
     /* See write_ivf_file_header() for more documentation on the file header
@@ -376,6 +376,7 @@ unsigned int file_is_ivf(FILE *infile,
     {
         *width = mem_get_le16(raw_hdr + 12);
         *height = mem_get_le16(raw_hdr + 14);
+        detect->position = 4;
     }
 
     return is_ivf;
@@ -1390,7 +1391,7 @@ int main(int argc, const char **argv_)
             }
         }
         else if (detect.buf_read == 4 &&
-                 file_is_ivf(infile, &fourcc, &cfg.g_w, &cfg.g_h, detect.buf))
+                 file_is_ivf(infile, &fourcc, &cfg.g_w, &cfg.g_h, &detect))
         {
             file_type = FILE_TYPE_IVF;
             switch (fourcc)