avcodec: Add support for Closed Caption export in h264
[ffmpeg.git] / libavcodec / h264.c
index baedcf4..f62ad6a 100644 (file)
@@ -879,6 +879,15 @@ static void decode_postinit(H264Context *h, int setup_finished)
         }
     }
 
+    if (h->a53_caption) {
+        AVFrameSideData *sd =
+            av_frame_new_side_data(cur->f, AV_FRAME_DATA_A53_CC, h->a53_caption_size);
+        if (sd)
+            memcpy(sd->data, h->a53_caption, h->a53_caption_size);
+        av_freep(&h->a53_caption);
+        h->a53_caption_size = 0;
+    }
+
     cur->mmco_reset = h->mmco_reset;
     h->mmco_reset = 0;