diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-10-22 21:18:03 +0200 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-10-22 21:41:53 +0200 |
commit | ee573b4d31d49280df0fbec61af6184130d26737 (patch) | |
tree | 46f462f7e70dadd32d21e932449cd3124404a7a2 /libavcodec/pgssubdec.c | |
parent | 37498a4b202e332e690ba02b9ab04afcbb08c9a5 (diff) | |
parent | a17a7661906ba295d67afd80ac0770422e1b02b3 (diff) | |
download | ffmpeg-ee573b4d31d49280df0fbec61af6184130d26737.tar.gz |
Merge commit 'a17a7661906ba295d67afd80ac0770422e1b02b3'
* commit 'a17a7661906ba295d67afd80ac0770422e1b02b3':
lavc: Add data and linesize to AVSubtitleRect
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavcodec/pgssubdec.c')
-rw-r--r-- | libavcodec/pgssubdec.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 50fc5b6e64..a70c84b4b0 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -166,9 +166,9 @@ static int decode_rle(AVCodecContext *avctx, AVSubtitleRect *rect, rle_bitmap_end = buf + buf_size; - rect->pict.data[0] = av_malloc_array(rect->w, rect->h); + rect->data[0] = av_malloc_array(rect->w, rect->h); - if (!rect->pict.data[0]) + if (!rect->data[0]) return AVERROR(ENOMEM); pixel_count = 0; @@ -190,7 +190,7 @@ static int decode_rle(AVCodecContext *avctx, AVSubtitleRect *rect, } if (run > 0 && pixel_count + run <= rect->w * rect->h) { - memset(rect->pict.data[0] + pixel_count, color, run); + memset(rect->data[0] + pixel_count, color, run); pixel_count += run; } else if (!run) { /* @@ -523,6 +523,8 @@ static int display_end_segment(AVCodecContext *avctx, void *data, } for (i = 0; i < ctx->presentation.object_count; i++) { PGSSubObject *object; + AVSubtitleRect *rect; + int j; sub->rects[i] = av_mallocz(sizeof(*sub->rects[0])); if (!sub->rects[i]) { @@ -553,7 +555,7 @@ static int display_end_segment(AVCodecContext *avctx, void *data, sub->rects[i]->w = object->w; sub->rects[i]->h = object->h; - sub->rects[i]->pict.linesize[0] = object->w; + sub->rects[i]->linesize[0] = object->w; if (object->rle) { if (object->rle_remaining_len) { @@ -578,15 +580,24 @@ static int display_end_segment(AVCodecContext *avctx, void *data, } /* Allocate memory for colors */ sub->rects[i]->nb_colors = 256; - sub->rects[i]->pict.data[1] = av_mallocz(AVPALETTE_SIZE); - if (!sub->rects[i]->pict.data[1]) { + sub->rects[i]->data[1] = av_mallocz(AVPALETTE_SIZE); + if (!sub->rects[i]->data[1]) { avsubtitle_free(sub); return AVERROR(ENOMEM); } if (!ctx->forced_subs_only || ctx->presentation.objects[i].composition_flag & 0x40) - memcpy(sub->rects[i]->pict.data[1], palette->clut, sub->rects[i]->nb_colors * sizeof(uint32_t)); - + memcpy(sub->rects[i]->data[1], palette->clut, sub->rects[i]->nb_colors * sizeof(uint32_t)); + +#if FF_API_AVPICTURE +FF_DISABLE_DEPRECATION_WARNINGS + rect = sub->rects[i]; + 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 } return 1; } |