Advertisement
Guest User

Untitled

a guest
Mar 1st, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.24 KB | None | 0 0
  1. diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
  2. index 9e076e89da..378c9ccac4 100644
  3. --- a/libavcodec/mpeg12dec.c
  4. +++ b/libavcodec/mpeg12dec.c
  5. @@ -1636,12 +1636,16 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
  6.          memcpy(pan_scan->data, &s1->pan_scan, sizeof(s1->pan_scan));
  7.  
  8.          if (s1->a53_caption) {
  9. -            AVFrameSideData *sd = av_frame_new_side_data(
  10. -                s->current_picture_ptr->f, AV_FRAME_DATA_A53_CC,
  11. -                s1->a53_caption_size);
  12. -            if (sd)
  13. -                memcpy(sd->data, s1->a53_caption, s1->a53_caption_size);
  14. -            av_freep(&s1->a53_caption);
  15. +            AVBufferRef *buf = av_buffer_create(s1->a53_caption, s1->a53_caption_size, NULL, NULL, 0);
  16. +            if (buf) {
  17. +                AVFrameSideData *sd = av_frame_new_side_data_from_buf(s->current_picture_ptr->f,
  18. +                                                                      AV_FRAME_DATA_A53_CC, buf);
  19. +                if (!sd)
  20. +                    av_buffer_unref(&buf);
  21. +            } else
  22. +                av_free(s1->a53_caption);
  23. +            s1->a53_caption = NULL;
  24. +            s1->a53_caption_size = 0;
  25.          }
  26.  
  27.          if (s1->has_stereo3d) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement