[FFmpeg-trac] #4616(avformat:open): Closed Captions: Data Ignored since exceeding screen width

FFmpeg trac at avcodec.org
Thu Aug 27 19:05:28 CEST 2015


#4616: Closed Captions: Data Ignored since exceeding screen width
-------------------------------------+-------------------------------------
             Reporter:  cehoyos      |                    Owner:
                 Type:  defect       |                   Status:  open
             Priority:  normal       |                Component:  avformat
              Version:  git-master   |               Resolution:
             Keywords:  cc mov       |               Blocked By:
  videolan                           |  Reproduced by developer:  1
             Blocking:               |
Analyzed by developer:  1            |
-------------------------------------+-------------------------------------

Comment (by cehoyos):

 The following has the same effect:
 {{{
 diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
 index 9f67caa..0534e8b 100644
 --- a/libavcodec/ccaption_dec.c
 +++ b/libavcodec/ccaption_dec.c
 @@ -23,6 +23,7 @@
  #include "ass.h"
  #include "libavutil/internal.h"
  #include "libavutil/opt.h"
 +#include "libavutil/intreadwrite.h"

  #define SCREEN_ROWS 15
  #define SCREEN_COLUMNS 32
 @@ -528,6 +529,7 @@ static int decode(AVCodecContext *avctx, void *data,
 int *got_sub, AVPacket *avp
      int len = avpkt->size;
      int ret = 0;
      int i;
 +int offset = 0;

      if ( ctx->pktbuf->size < len) {
          ret = av_buffer_realloc(&ctx->pktbuf, len);
 @@ -537,7 +539,9 @@ static int decode(AVCodecContext *avctx, void *data,
 int *got_sub, AVPacket *avp
              ret = 0;
          }
      }
 +    if (AV_RB32(avpkt->data + 4) == 0x63646174)
 +        offset = 8;
 -    memcpy(ctx->pktbuf->data, avpkt->data, len);
 +    memcpy(ctx->pktbuf->data, avpkt->data + offset, len-offset);
      bptr = ctx->pktbuf->data;


 }}}
 Btw: Why is this memcpy() needed?

--
Ticket URL: <https://trac.ffmpeg.org/ticket/4616#comment:21>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list