]> git.sesse.net Git - x264/blobdiff - input/ffms.c
cli: Use memory-mapped input frames for yuv and y4m
[x264] / input / ffms.c
index 054728b258026fc0bdf6ef0f92964b3e8ad7ef52..42b992c1b221c72559c57b4ad51c64d5a0e9a4e2 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * ffms.c: ffmpegsource input
  *****************************************************************************
- * Copyright (C) 2009-2013 x264 project
+ * Copyright (C) 2009-2015 x264 project
  *
  * Authors: Mike Gurlitz <mike.gurlitz@gmail.com>
  *          Steven Walters <kemuri9@gmail.com>
@@ -69,9 +69,9 @@ static int handle_jpeg( int csp, int *fullrange )
 {
     switch( csp )
     {
-        case PIX_FMT_YUVJ420P: *fullrange = 1; return PIX_FMT_YUV420P;
-        case PIX_FMT_YUVJ422P: *fullrange = 1; return PIX_FMT_YUV422P;
-        case PIX_FMT_YUVJ444P: *fullrange = 1; return PIX_FMT_YUV444P;
+        case AV_PIX_FMT_YUVJ420P: *fullrange = 1; return AV_PIX_FMT_YUV420P;
+        case AV_PIX_FMT_YUVJ422P: *fullrange = 1; return AV_PIX_FMT_YUV422P;
+        case AV_PIX_FMT_YUVJ444P: *fullrange = 1; return AV_PIX_FMT_YUV444P;
         default:                               return csp;
     }
 }
@@ -105,7 +105,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
     {
         x264_struct_stat index_s, input_s;
         if( !x264_stat( opt->index_file, &index_s ) && !x264_stat( psz_filename, &input_s ) &&
-            input_s.st_mtime < index_s.st_mtime )
+            input_s.st_mtime < index_s.st_mtime && index_s.st_size )
             idx = FFMS_ReadIndex( idx_filename, &e );
     }
     if( !idx )
@@ -175,10 +175,11 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
     return 0;
 }
 
-static int picture_alloc( cli_pic_t *pic, int csp, int width, int height )
+static int picture_alloc( cli_pic_t *pic, hnd_t handle, int csp, int width, int height )
 {
-    if( x264_cli_pic_alloc( pic, csp, width, height ) )
+    if( x264_cli_pic_alloc( pic, X264_CSP_NONE, width, height ) )
         return -1;
+    pic->img.csp = csp;
     pic->img.planes = 4;
     return 0;
 }
@@ -208,7 +209,7 @@ static int read_frame( cli_pic_t *pic, hnd_t handle, int i_frame )
     return 0;
 }
 
-static void picture_clean( cli_pic_t *pic )
+static void picture_clean( cli_pic_t *pic, hnd_t handle )
 {
     memset( pic, 0, sizeof(cli_pic_t) );
 }