]> git.sesse.net Git - x264/blobdiff - input/input.h
cli: Use memory-mapped input frames for yuv and y4m
[x264] / input / input.h
index 86cd11963714862bbe470716f10285d6b87aa736..55970a0150a6c9e5b866fbcceea3591e104d5d2d 100644 (file)
@@ -88,20 +88,20 @@ typedef struct
 typedef struct
 {
     int (*open_file)( char *psz_filename, hnd_t *p_handle, video_info_t *info, cli_input_opt_t *opt );
-    int (*picture_alloc)( cli_pic_t *pic, int csp, int width, int height );
+    int (*picture_alloc)( cli_pic_t *pic, hnd_t handle, int csp, int width, int height );
     int (*read_frame)( cli_pic_t *pic, hnd_t handle, int i_frame );
     int (*release_frame)( cli_pic_t *pic, hnd_t handle );
-    void (*picture_clean)( cli_pic_t *pic );
+    void (*picture_clean)( cli_pic_t *pic, hnd_t handle );
     int (*close_file)( hnd_t handle );
 } cli_input_t;
 
 extern const cli_input_t raw_input;
 extern const cli_input_t y4m_input;
 extern const cli_input_t avs_input;
-extern cli_input_t thread_input;
+extern const cli_input_t thread_input;
 extern const cli_input_t lavf_input;
 extern const cli_input_t ffms_input;
-extern cli_input_t timecode_input;
+extern const cli_input_t timecode_input;
 
 extern cli_input_t cli_input;
 
@@ -125,9 +125,25 @@ int      x264_cli_csp_is_invalid( int csp );
 int      x264_cli_csp_depth_factor( int csp );
 int      x264_cli_pic_alloc( cli_pic_t *pic, int csp, int width, int height );
 int      x264_cli_pic_alloc_aligned( cli_pic_t *pic, int csp, int width, int height );
+int      x264_cli_pic_init_noalloc( cli_pic_t *pic, int csp, int width, int height );
 void     x264_cli_pic_clean( cli_pic_t *pic );
 uint64_t x264_cli_pic_plane_size( int csp, int width, int height, int plane );
 uint64_t x264_cli_pic_size( int csp, int width, int height );
 const x264_cli_csp_t *x264_cli_get_csp( int csp );
 
+typedef struct
+{
+    int align_mask;
+#ifdef _WIN32
+    void *map_handle;
+#elif HAVE_MMAP
+    int fd;
+#endif
+} cli_mmap_t;
+
+int x264_cli_mmap_init( cli_mmap_t *h, FILE *fh );
+void *x264_cli_mmap( cli_mmap_t *h, int64_t offset, size_t size );
+int x264_cli_munmap( cli_mmap_t *h, void *addr, size_t size );
+void x264_cli_mmap_close( cli_mmap_t *h );
+
 #endif