struct
{
int i_nal;
- x264_nal_t nal[3]; /* for now 3 is enought */
+ x264_nal_t nal[4]; /* for now 4 is enough */
int i_bitstream; /* size of p_bitstream */
uint8_t *p_bitstream; /* will hold data for all nal */
bs_t bs;
/* Put SPS and PPS */
if( h->i_frame == 0 )
{
+ /* identify ourself */
+ x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ x264_sei_version_write( &h->out.bs );
+ x264_nal_end( h );
+
/* generate sequence parameters */
x264_nal_start( h, NAL_SPS, NAL_PRIORITY_HIGHEST );
x264_sps_write( &h->out.bs, h->sps );
/* Write SPS and PPS */
if( i_nal_type == NAL_SLICE_IDR )
{
+ if( h->fenc->i_frame == 0 )
+ {
+ /* identify ourself */
+ x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ x264_sei_version_write( &h->out.bs );
+ x264_nal_end( h );
+ }
+
/* generate sequence parameters */
x264_nal_start( h, NAL_SPS, NAL_PRIORITY_HIGHEST );
x264_sps_write( &h->out.bs, h->sps );
bs_rbsp_trailing( s );
}
+void x264_sei_version_write( bs_t *s )
+{
+ int i;
+ // random ID number generated according to ISO-11578
+ const uint8_t uuid[16] = {
+ 0xdc, 0x45, 0xe9, 0xbd, 0xe6, 0xd9, 0x48, 0xb7,
+ 0x96, 0x2c, 0xd8, 0x20, 0xd9, 0x23, 0xee, 0xef
+ };
+ char version[256];
+ int length;
+ sprintf( version, "x264 - core 0x%x - H.264/MPEG-4 AVC codec - Copyleft 2005 - http://www.videolan.org/x264.html",
+ X264_BUILD );
+ length = strlen(version)+1+16;
+
+ bs_write( s, 8, 0x5 ); // payload_type = user_data_unregistered
+ while( length > 255 )
+ bs_write( s, 8, 255 ), length -= 255;
+ bs_write( s, 8, length ); // payload_size
+
+ for( i = 0; i < 16; i++ )
+ bs_write( s, 8, uuid[i] );
+ for( i = 0; i < length-16; i++ )
+ bs_write( s, 8, version[i] );
+
+ bs_rbsp_trailing( s );
+}
void x264_sps_write( bs_t *s, x264_sps_t *sps );
void x264_pps_init( x264_pps_t *pps, int i_id, x264_param_t *param, x264_sps_t *sps );
void x264_pps_write( bs_t *s, x264_pps_t *pps );
+void x264_sei_version_write( bs_t *s );
#endif