avcodec/ccaption_dec: remove usage of extra buffer

This commit is contained in:
Paul B Mahol 2020-06-16 17:08:04 +02:00
parent d5b1760665
commit 9887bcc6c6
1 changed files with 1 additions and 12 deletions

View File

@ -242,9 +242,6 @@ typedef struct CCaptionSubContext {
int screen_touched; int screen_touched;
int64_t last_real_time; int64_t last_real_time;
char prev_cmd[2]; char prev_cmd[2];
/* buffer to store pkt data */
uint8_t *pktbuf;
int pktbuf_size;
int readorder; int readorder;
} CCaptionSubContext; } CCaptionSubContext;
@ -279,8 +276,6 @@ static av_cold int close_decoder(AVCodecContext *avctx)
{ {
CCaptionSubContext *ctx = avctx->priv_data; CCaptionSubContext *ctx = avctx->priv_data;
av_bprint_finalize(&ctx->buffer, NULL); av_bprint_finalize(&ctx->buffer, NULL);
av_freep(&ctx->pktbuf);
ctx->pktbuf_size = 0;
return 0; return 0;
} }
@ -795,13 +790,7 @@ static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avp
int ret = 0; int ret = 0;
int i; int i;
av_fast_padded_malloc(&ctx->pktbuf, &ctx->pktbuf_size, len); bptr = avpkt->data;
if (!ctx->pktbuf) {
av_log(ctx, AV_LOG_WARNING, "Insufficient Memory of %d truncated to %d\n", len, ctx->pktbuf_size);
return AVERROR(ENOMEM);
}
memcpy(ctx->pktbuf, avpkt->data, len);
bptr = ctx->pktbuf;
for (i = 0; i < len; i += 3) { for (i = 0; i < len; i += 3) {
uint8_t cc_type = *(bptr + i) & 3; uint8_t cc_type = *(bptr + i) & 3;