diff options
Diffstat (limited to 'libavcodec/libzvbi-teletextdec.c')
-rw-r--r-- | libavcodec/libzvbi-teletextdec.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c index 3733d885d6..9f632df8cc 100644 --- a/libavcodec/libzvbi-teletextdec.c +++ b/libavcodec/libzvbi-teletextdec.c @@ -86,8 +86,8 @@ static int chop_spaces_utf8(const unsigned char* t, int len) static void subtitle_rect_free(AVSubtitleRect **sub_rect) { - av_freep(&(*sub_rect)->pict.data[0]); - av_freep(&(*sub_rect)->pict.data[1]); + av_freep(&(*sub_rect)->data[0]); + av_freep(&(*sub_rect)->data[1]); av_freep(&(*sub_rect)->ass); av_freep(sub_rect); } @@ -199,7 +199,7 @@ static void fix_transparency(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi // Hack for transparency, inspired by VLC code... for (iy = 0; iy < resy; iy++) { - uint8_t *pixel = sub_rect->pict.data[0] + iy * sub_rect->pict.linesize[0]; + uint8_t *pixel = sub_rect->data[0] + iy * sub_rect->linesize[0]; vbi_char *vc = page->text + (iy / BITMAP_CHAR_HEIGHT + chop_top) * page->columns; vbi_char *vcnext = vc + page->columns; for (; vc < vcnext; vc++) { @@ -246,13 +246,13 @@ static int gen_sub_bitmap(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_pa return 0; } - if ((ret = avpicture_alloc(&sub_rect->pict, AV_PIX_FMT_PAL8, resx, resy)) < 0) - return ret; - // Yes, we want to allocate the palette on our own because AVSubtitle works this way - sub_rect->pict.data[1] = NULL; + sub_rect->data[0] = av_mallocz(resx * resy); + sub_rect->linesize[0] = resx; + if (!sub_rect->data[0]) + return AVERROR(ENOMEM); vbi_draw_vt_page_region(page, VBI_PIXFMT_PAL8, - sub_rect->pict.data[0], sub_rect->pict.linesize[0], + sub_rect->data[0], sub_rect->linesize[0], 0, chop_top, page->columns, page->rows - chop_top, /*reveal*/ 1, /*flash*/ 1); @@ -262,9 +262,9 @@ static int gen_sub_bitmap(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_pa sub_rect->w = resx; sub_rect->h = resy; sub_rect->nb_colors = (int)cmax + 1; - sub_rect->pict.data[1] = av_mallocz(AVPALETTE_SIZE); - if (!sub_rect->pict.data[1]) { - av_freep(&sub_rect->pict.data[0]); + sub_rect->data[1] = av_mallocz(AVPALETTE_SIZE); + if (!sub_rect->data[1]) { + av_freep(&sub_rect->data[0]); return AVERROR(ENOMEM); } for (ci = 0; ci < cmax; ci++) { @@ -274,10 +274,10 @@ static int gen_sub_bitmap(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_pa g = VBI_G(page->color_map[ci]); b = VBI_B(page->color_map[ci]); a = VBI_A(page->color_map[ci]); - ((uint32_t *)sub_rect->pict.data[1])[ci] = RGBA(r, g, b, a); - ff_dlog(ctx, "palette %0x\n", ((uint32_t *)sub_rect->pict.data[1])[ci]); + ((uint32_t *)sub_rect->data[1])[ci] = RGBA(r, g, b, a); + ff_dlog(ctx, "palette %0x\n", ((uint32_t *)sub_rect->data[1])[ci]); } - ((uint32_t *)sub_rect->pict.data[1])[cmax] = RGBA(0, 0, 0, 0); + ((uint32_t *)sub_rect->data[1])[cmax] = RGBA(0, 0, 0, 0); sub_rect->type = SUBTITLE_BITMAP; return 0; } @@ -466,6 +466,15 @@ static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *data_si } else { ret = AVERROR(ENOMEM); } + +#if FF_API_AVPICTURE +FF_DISABLE_DEPRECATION_WARNINGS + for (j = 0; j < 4; j++) { + sub->rects[0]->pict.data[j] = sub->rects[0]->data[j]; + sub->rects[0]->pict.linesize[j] = sub->rects[0]->linesize[j]; + } +FF_ENABLE_DEPRECATION_WARNINGS +#endif } else { av_log(avctx, AV_LOG_DEBUG, "sending empty sub\n"); sub->rects = NULL; |