mux: mp4: encode spsext
authorFrancois Cartegnie <fcvlcdev@free.fr>
Fri, 27 May 2016 08:56:42 +0000 (10:56 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Fri, 27 May 2016 09:45:33 +0000 (11:45 +0200)
modules/mux/mp4/libmp4mux.c

index 10fbc34..30cc46f 100644 (file)
@@ -839,6 +839,31 @@ static bo_t *GetAvcCTag(es_format_t *p_fmt)
         bo_add_mem(avcC, i_pps_size, p_pps);
     }
 
+    if( p_sps[1] == PROFILE_H264_HIGH ||
+        p_sps[1] == PROFILE_H264_HIGH_10 ||
+        p_sps[1] == PROFILE_H264_HIGH_422 ||
+        p_sps[1] == PROFILE_H264_HIGH_444 ||
+        p_sps[1] == PROFILE_H264_HIGH_444_PREDICTIVE )
+    {
+        h264_sequence_parameter_set_t *p_spsdata = h264_decode_sps( p_sps, i_sps_size, true );
+        if( p_spsdata )
+        {
+            uint8_t data[3];
+            if( h264_get_chroma_luma( p_spsdata, &data[0], &data[1], &data[2]) )
+            {
+                bo_add_8(avcC, 0xFC | data[0]);
+                bo_add_8(avcC, 0xF8 | (data[1] - 8));
+                bo_add_8(avcC, 0xF8 | (data[2] - 8));
+                bo_add_8(avcC, (i_ext_size > 0 ? 1 : 0));
+                if (i_ext_size > 0) {
+                    bo_add_16be(avcC, i_ext_size);
+                    bo_add_mem(avcC, i_ext_size, p_ext);
+                }
+            }
+            h264_release_sps( p_spsdata );
+        }
+    }
+
     return avcC;
 }