#include <stdarg.h>
-#define X264_BUILD 104
+#define X264_BUILD 107
/* x264_t:
* opaque handler for encoder */
#define X264_CSP_YV12 0x0002 /* yvu 4:2:0 planar */
#define X264_CSP_NV12 0x0003 /* yuv 4:2:0, with one y plane and one packed u+v */
#define X264_CSP_MAX 0x0004 /* end of list */
-#define X264_CSP_VFLIP 0x1000 /* */
+#define X264_CSP_VFLIP 0x1000 /* the csp is vertically flipped */
+#define X264_CSP_HIGH_DEPTH 0x2000 /* the csp has a depth of 16 bits per pixel component */
/* Slice type */
#define X264_TYPE_AUTO 0x0000 /* Let x264 choose the right type */
{
int i_rc_method; /* X264_RC_* */
- int i_qp_constant; /* 0 to (51 + 6*(BIT_DEPTH-8)) */
+ int i_qp_constant; /* 0 to (51 + 6*(x264_bit_depth-8)) */
int i_qp_min; /* min allowed QP value */
int i_qp_max; /* max allowed QP value */
int i_qp_step; /* max QP step between frames */
int b_annexb; /* if set, place start codes (4 bytes) before NAL units,
* otherwise place size (4 bytes) before NAL units. */
int i_sps_id; /* SPS and PPS id number */
- int b_vfr_input; /* VFR input */
+ int b_vfr_input; /* VFR input. If 1, use timebase and timestamps for ratecontrol purposes.
+ * If 0, use fps only. */
+ int b_pulldown; /* use explicity set timebase for CFR */
uint32_t i_fps_num;
uint32_t i_fps_den;
uint32_t i_timebase_num; /* Timebase numerator */
uint32_t i_timebase_den; /* Timebase denominator */
- int b_dts_compress; /* DTS compression: this algorithm eliminates negative DTS
- * by compressing them to be less than the second PTS.
- * Warning: this will change the timebase! */
int b_tff;
* Currently available presets are, ordered from fastest to slowest: */
static const char * const x264_preset_names[] = { "ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo", 0 };
-/* Warning: the speed of these presets scales dramatically. Ultrafast is a full
+/* The presets can also be indexed numerically, as in:
+ * x264_param_default_preset( ¶m, "3", ... )
+ * with ultrafast mapping to "0" and placebo mapping to "9". This mapping may
+ * of course change if new presets are added in between, but will always be
+ * ordered from fastest to slowest.
+ *
+ * Warning: the speed of these presets scales dramatically. Ultrafast is a full
* 100 times faster than placebo!
*
* Currently available tunings are: */
* Picture structures and functions
****************************************************************************/
+/* x264_bit_depth:
+ * Specifies the number of bits per pixel that x264 uses. This is also the
+ * bit depth that x264 encodes in. If this value is > 8, x264 will read
+ * two bytes of input data for each pixel sample, and expect the upper
+ * (16-x264_bit_depth) bits to be zero.
+ * Note: The flag X264_CSP_HIGH_DEPTH must be used to specify the
+ * colorspace depth as well. */
+extern const int x264_bit_depth;
+
enum pic_struct_e
{
PIC_STRUCT_AUTO = 0, // automatically decide (default)
double dpb_output_time;
} x264_hrd_t;
+/* Arbitrary user SEI:
+ * Payload size is in bytes and the payload pointer must be valid.
+ * Payload types and syntax can be found in Annex D of the H.264 Specification.
+ * SEI payload alignment bits as described in Annex D must be included at the
+ * end of the payload if needed.
+ * The payload should not be NAL-encapsulated.
+ * Payloads are written first in order of input, apart from in the case when HRD
+ * is enabled where payloads are written after the Buffering Period SEI. */
+
+typedef struct
+{
+ int payload_size;
+ int payload_type;
+ uint8_t *payload;
+} x264_sei_payload_t;
+
+typedef struct
+{
+ int num_payloads;
+ x264_sei_payload_t *payloads;
+ /* In: optional callback to free each payload AND x264_sei_payload_t when used. */
+ void (*sei_free)( void* );
+} x264_sei_t;
+
typedef struct
{
int i_csp; /* Colorspace */
int b_keyframe;
/* In: user pts, Out: pts of encoded picture (user)*/
int64_t i_pts;
- /* Out: frame dts. Since the pts of the first frame is always zero,
+ /* Out: frame dts. When the pts of the first frame is close to zero,
* initial frames may have a negative dts which must be dealt with by any muxer */
int64_t i_dts;
/* In: custom encoding parameters to be set from this frame forwards
x264_image_properties_t prop;
/* Out: HRD timing information. Output only when i_nal_hrd is set. */
x264_hrd_t hrd_timing;
+ /* In: arbitrary user SEI (e.g subtitles, AFDs) */
+ x264_sei_t extra_sei;
/* private user data. libx264 doesn't touch this,
not even copy it from input to output frames. */
void *opaque;