Commit e2efb4b7 authored by Loren Merritt's avatar Loren Merritt

Write x264's version in a SEI message.


git-svn-id: svn://svn.videolan.org/x264/trunk@136 df754926-b1dd-0310-bc7b-ec298dee348c
parent 3ada9c05
......@@ -179,7 +179,7 @@ struct x264_t
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;
......
......@@ -526,6 +526,11 @@ int x264_encoder_headers( x264_t *h, x264_nal_t **pp_nal, int *pi_nal )
/* 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 );
......@@ -1103,6 +1108,14 @@ do_encode:
/* 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 );
......
......@@ -377,3 +377,29 @@ void x264_pps_write( bs_t *s, x264_pps_t *pps )
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 );
}
......@@ -28,5 +28,6 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param );
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment