]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/h264_sei.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavcodec / h264_sei.c
index 81edeb27c6f7b4d5c7c3d9c00c95a66c17f23a5b..62320e2d6abc2aec7e40fee5921bcb20af427e7d 100644 (file)
@@ -95,6 +95,43 @@ static int decode_picture_timing(H264Context *h){
     return 0;
 }
 
+static int decode_user_data_itu_t_t35(H264Context *h, int size) {
+    MpegEncContext * const s = &h->s;
+    uint32_t user_identifier;
+    int dtg_active_format;
+
+    if (size < 7)
+        return -1;
+    size -= 7;
+
+    skip_bits(&s->gb, 8);   // country_code
+    skip_bits(&s->gb, 16);  // provider_code
+    user_identifier = get_bits_long(&s->gb, 32);
+
+    switch (user_identifier) {
+        case 0x44544731:    // "DTG1" - AFD_data
+            if (size < 1)
+                return -1;
+            skip_bits(&s->gb, 1);
+            if (get_bits(&s->gb, 1)) {
+                skip_bits(&s->gb, 6);
+                if (size < 2)
+                    return -1;
+                skip_bits(&s->gb, 4);
+                dtg_active_format = get_bits(&s->gb, 4);
+                s->avctx->dtg_active_format = dtg_active_format;
+            } else {
+                skip_bits(&s->gb, 6);
+            }
+            break;
+        default:
+            skip_bits(&s->gb, size * 8);
+            break;
+    }
+
+    return 0;
+}
+
 static int decode_unregistered_user_data(H264Context *h, int size){
     MpegEncContext * const s = &h->s;
     uint8_t user_data[16+256];
@@ -191,6 +228,10 @@ int ff_h264_decode_sei(H264Context *h){
             if(decode_picture_timing(h) < 0)
                 return -1;
             break;
+        case SEI_TYPE_USER_DATA_ITU_T_T35:
+            if(decode_user_data_itu_t_t35(h, size) < 0)
+                return -1;
+            break;
         case SEI_TYPE_USER_DATA_UNREGISTERED:
             if(decode_unregistered_user_data(h, size) < 0)
                 return -1;