/*****************************************************************************
- * input.h: x264 file input modules
+ * input.h: file input
*****************************************************************************
- * Copyright (C) 2003-2009 x264 project
+ * Copyright (C) 2003-2010 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
*****************************************************************************/
#ifndef X264_INPUT_H
#define X264_INPUT_H
+#include "x264cli.h"
+
/* options that are used by only some demuxers */
typedef struct
{
- char *index;
- char *resolution; /* resolution string parsed by raw yuv input */
+ char *index_file;
+ char *resolution;
+ char *colorspace;
+ int bit_depth;
char *timebase;
int seek;
} cli_input_opt_t;
/* properties of the source given by the demuxer */
typedef struct
{
- int csp; /* X264_CSP_YV12 or X264_CSP_I420 */
- int fps_num;
- int fps_den;
+ int csp; /* colorspace of the input */
+ uint32_t fps_num;
+ uint32_t fps_den;
int height;
int interlaced;
- int sar_width;
- int sar_height;
+ int num_frames;
+ uint32_t sar_width;
+ uint32_t sar_height;
int tff;
- int timebase_num;
- int timebase_den;
+ int thread_safe; /* demuxer is thread_input safe */
+ uint32_t timebase_num;
+ uint32_t timebase_den;
int vfr;
int width;
} video_info_t;
+/* image data type used by x264cli */
+typedef struct
+{
+ int csp; /* colorspace */
+ int width; /* width of the picture */
+ int height; /* height of the picture */
+ int planes; /* number of planes */
+ uint8_t *plane[4]; /* pointers for each plane */
+ int stride[4]; /* strides for each plane */
+} cli_image_t;
+
+typedef struct
+{
+ cli_image_t img;
+ int64_t pts; /* input pts */
+ int64_t duration; /* frame duration - used for vfr */
+ void *opaque; /* opaque handle */
+} cli_pic_t;
+
typedef struct
{
int (*open_file)( char *psz_filename, hnd_t *p_handle, video_info_t *info, cli_input_opt_t *opt );
- int (*get_frame_total)( hnd_t handle );
- int (*picture_alloc)( x264_picture_t *pic, int i_csp, int i_width, int i_height );
- int (*read_frame)( x264_picture_t *p_pic, hnd_t handle, int i_frame );
- int (*release_frame)( x264_picture_t *pic, hnd_t handle );
- void (*picture_clean)( x264_picture_t *pic );
+ int (*picture_alloc)( cli_pic_t *pic, 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 );
int (*close_file)( hnd_t handle );
} cli_input_t;
-extern const cli_input_t yuv_input;
+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 ffms_input;
extern cli_input_t timecode_input;
+extern cli_input_t input;
+
+/* extended colorspace list that isn't supported by libx264 but by the cli */
+#define X264_CSP_I422 X264_CSP_MAX /* yuv 4:2:2 planar */
+#define X264_CSP_I444 (X264_CSP_MAX+1) /* yuv 4:4:4 planar */
+#define X264_CSP_BGR (X264_CSP_MAX+2) /* packed bgr 24bits */
+#define X264_CSP_BGRA (X264_CSP_MAX+3) /* packed bgr 32bits */
+#define X264_CSP_RGB (X264_CSP_MAX+4) /* packed rgb 24bits */
+#define X264_CSP_CLI_MAX (X264_CSP_MAX+5) /* end of list */
+#define X264_CSP_OTHER 0x4000 /* non x264 colorspace */
+
+typedef struct
+{
+ const char *name;
+ int planes;
+ float width[4];
+ float height[4];
+ int mod_width;
+ int mod_height;
+} x264_cli_csp_t;
+
+extern const x264_cli_csp_t x264_cli_csps[];
+
+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 );
+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 );
+
#endif