]> git.videolan.org Git - x264.git/commitdiff
Write x264's version in a SEI message.
authorLoren Merritt <pengvado@videolan.org>
Tue, 22 Feb 2005 22:08:07 +0000 (22:08 +0000)
committerLoren Merritt <pengvado@videolan.org>
Tue, 22 Feb 2005 22:08:07 +0000 (22:08 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@136 df754926-b1dd-0310-bc7b-ec298dee348c

common/common.h
encoder/encoder.c
encoder/set.c
encoder/set.h

index 2dab995ee07ee30cec0216ce3598e3a0a0940b85..8667c76e4650c0b336b6a53f505437a2a13ca8f7 100644 (file)
@@ -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;
index 65e40d3607b4b085d0647c83d69622993db8173d..78932774ab688b7531744cbed2930b50fa115cf2 100644 (file)
@@ -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 );
index 841ec7636da06515936a12c66705034cd5ab110e..c0bfa08b355fd4cc42cdac02c793b01b71e0dc9f 100644 (file)
@@ -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 );
+}
index 44cae08862d0a7149bdd5926df1cde0f52921c7e..62f3540efb5574723ad093008cf55b03182d0f82 100644 (file)
@@ -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