From a17a7661906ba295d67afd80ac0770422e1b02b3 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Wed, 14 Oct 2015 11:33:25 +0200 Subject: lavc: Add data and linesize to AVSubtitleRect Use the new fields directly instead of the ones from AVPicture. This removes a layer of indirection which serves no pratical purpose whatsoever, and will help in removing AVPicture structure completely later. Every subtitle encoder/decoder seamlessly points to the new arrays, so it is possible to deprecate AVSubtitleRect.pict. Signed-off-by: Vittorio Giovara --- libavcodec/dvbsubdec.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'libavcodec/dvbsubdec.c') diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index f1d02d77d3..be68c58516 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -1350,6 +1350,7 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf, i = 0; for (display = ctx->display_list; display; display = display->next) { + int j; region = get_region(ctx, display->region_id); rect = sub->rects[i]; @@ -1362,7 +1363,7 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf, rect->h = region->height; rect->nb_colors = 16; rect->type = SUBTITLE_BITMAP; - rect->pict.linesize[0] = region->width; + rect->linesize[0] = region->width; clut = get_clut(ctx, region->clut); @@ -1382,20 +1383,29 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf, break; } - rect->pict.data[1] = av_mallocz(AVPALETTE_SIZE); - if (!rect->pict.data[1]) { + rect->data[1] = av_mallocz(AVPALETTE_SIZE); + if (!rect->data[1]) { av_free(sub->rects); return AVERROR(ENOMEM); } - memcpy(rect->pict.data[1], clut_table, (1 << region->depth) * sizeof(uint32_t)); + memcpy(rect->data[1], clut_table, (1 << region->depth) * sizeof(uint32_t)); - rect->pict.data[0] = av_malloc(region->buf_size); - if (!rect->pict.data[0]) { - av_free(rect->pict.data[1]); + rect->data[0] = av_malloc(region->buf_size); + if (!rect->data[0]) { + av_free(rect->data[1]); av_free(sub->rects); return AVERROR(ENOMEM); } - memcpy(rect->pict.data[0], region->pbuf, region->buf_size); + memcpy(rect->data[0], region->pbuf, region->buf_size); + +#if FF_API_AVPICTURE +FF_DISABLE_DEPRECATION_WARNINGS + for (j = 0; j < 4; j++) { + rect->pict.data[j] = rect->data[j]; + rect->pict.linesize[j] = rect->linesize[j]; + } +FF_ENABLE_DEPRECATION_WARNINGS +#endif i++; } -- cgit v1.2.3