diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-17 14:48:40 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-17 15:13:19 +0300 |
commit | 441d5a7084b56fd9874daede2ef90356b3bf9d16 (patch) | |
tree | 8bce92071141b185bcd67abbb0cc1cf9429340b5 /libavcodec/h264_sei.c | |
parent | ec6bef68f14f08e1295ea9c65fcb8b3f2e53193e (diff) | |
parent | b0017579b6e8de3d0d13dcfe0a4dd848dc6baa37 (diff) |
Merge commit 'b0017579b6e8de3d0d13dcfe0a4dd848dc6baa37'
* commit 'b0017579b6e8de3d0d13dcfe0a4dd848dc6baa37':
h264: Add support for Closed Caption export
Conflicts:
libavcodec/h264.c
libavcodec/h264_sei.c
See: 8234f0e3b485811d60c228c40a94a141c46e61ca
Merged-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/h264_sei.c')
-rw-r--r-- | libavcodec/h264_sei.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c index fa0f4bf2ca..dc0769d7a2 100644 --- a/libavcodec/h264_sei.c +++ b/libavcodec/h264_sei.c @@ -43,9 +43,9 @@ void ff_h264_reset_sei(H264Context *h) h->sei_frame_packing_present = 0; h->sei_display_orientation_present = 0; h->sei_reguserdata_afd_present = 0; - if (h->a53_caption) - av_freep(&h->a53_caption); + h->a53_caption_size = 0; + av_freep(&h->a53_caption); } static int decode_picture_timing(H264Context *h) @@ -159,13 +159,16 @@ FF_ENABLE_DEPRECATION_WARNINGS return AVERROR(EINVAL); user_data_type_code = get_bits(&h->gb, 8); if (user_data_type_code == 0x3) { - skip_bits(&h->gb, 1); - if (get_bits(&h->gb, 1)) { - skip_bits(&h->gb, 1); + skip_bits(&h->gb, 1); // reserved + + flag = get_bits(&h->gb, 1); // process_cc_data_flag + if (flag) { + skip_bits(&h->gb, 1); // zero bit cc_count = get_bits(&h->gb, 5); - skip_bits(&h->gb, 8); + skip_bits(&h->gb, 8); // reserved size -= 2; - if (cc_count && size >= cc_count*3) { + + if (cc_count && size >= cc_count * 3) { int i; uint8_t *tmp; if ((int64_t)h->a53_caption_size + (int64_t)cc_count*3 > INT_MAX) @@ -176,13 +179,14 @@ FF_ENABLE_DEPRECATION_WARNINGS if (!tmp) return AVERROR(ENOMEM); h->a53_caption = tmp; + for (i = 0; i < cc_count; i++) { h->a53_caption[h->a53_caption_size++] = get_bits(&h->gb, 8); h->a53_caption[h->a53_caption_size++] = get_bits(&h->gb, 8); h->a53_caption[h->a53_caption_size++] = get_bits(&h->gb, 8); } - skip_bits(&h->gb, 8); + skip_bits(&h->gb, 8); // marker_bits } } } |