Lines Matching refs:sub_rect
48 AVSubtitleRect *sub_rect; member
141 static void subtitle_rect_free(AVSubtitleRect **sub_rect) in subtitle_rect_free() argument
143 av_freep(&(*sub_rect)->data[0]); in subtitle_rect_free()
144 av_freep(&(*sub_rect)->data[1]); in subtitle_rect_free()
145 av_freep(&(*sub_rect)->ass); in subtitle_rect_free()
146 av_freep(sub_rect); in subtitle_rect_free()
166 static int gen_sub_text(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page *page, int chop_to… in gen_sub_text() argument
218 sub_rect->type = SUBTITLE_ASS; in gen_sub_text()
219 sub_rect->ass = create_ass_text(ctx, buf.str); in gen_sub_text()
221 if (!sub_rect->ass) { in gen_sub_text()
225 av_log(ctx, AV_LOG_DEBUG, "subtext:%s:txetbus\n", sub_rect->ass); in gen_sub_text()
227 sub_rect->type = SUBTITLE_NONE; in gen_sub_text()
294 static int gen_sub_ass(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page *page, int chop_top) in gen_sub_ass() argument
396 sub_rect->type = SUBTITLE_ASS; in gen_sub_ass()
397 …sub_rect->ass = ff_ass_get_dialog(ctx->readorder++, 0, is_subtitle_page ? "Subtitle" : "Teletext",… in gen_sub_ass()
399 if (!sub_rect->ass) { in gen_sub_ass()
403 av_log(ctx, AV_LOG_DEBUG, "subtext:%s:txetbus\n", sub_rect->ass); in gen_sub_ass()
405 sub_rect->type = SUBTITLE_NONE; in gen_sub_ass()
411 static void fix_transparency(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page *page, in fix_transparency() argument
418 uint8_t *pixel = sub_rect->data[0] + iy * sub_rect->linesize[0]; in fix_transparency()
450 static int gen_sub_bitmap(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page *page, int chop_… in gen_sub_bitmap() argument
465 sub_rect->type = SUBTITLE_NONE; in gen_sub_bitmap()
469 sub_rect->data[0] = av_mallocz(resx * resy); in gen_sub_bitmap()
470 sub_rect->linesize[0] = resx; in gen_sub_bitmap()
471 if (!sub_rect->data[0]) in gen_sub_bitmap()
475 sub_rect->data[0], sub_rect->linesize[0], in gen_sub_bitmap()
479 fix_transparency(ctx, sub_rect, page, chop_top, resx, resy); in gen_sub_bitmap()
480 sub_rect->x = ctx->x_offset; in gen_sub_bitmap()
481 sub_rect->y = ctx->y_offset + chop_top * BITMAP_CHAR_HEIGHT; in gen_sub_bitmap()
482 sub_rect->w = resx; in gen_sub_bitmap()
483 sub_rect->h = resy; in gen_sub_bitmap()
484 … sub_rect->nb_colors = ctx->opacity > 0 && ctx->opacity < 255 ? 2 * VBI_NB_COLORS : VBI_NB_COLORS; in gen_sub_bitmap()
485 sub_rect->data[1] = av_mallocz(AVPALETTE_SIZE); in gen_sub_bitmap()
486 if (!sub_rect->data[1]) { in gen_sub_bitmap()
487 av_freep(&sub_rect->data[0]); in gen_sub_bitmap()
497 ((uint32_t *)sub_rect->data[1])[ci] = RGBA(r, g, b, a); in gen_sub_bitmap()
498 ((uint32_t *)sub_rect->data[1])[ci + VBI_NB_COLORS] = RGBA(r, g, b, ctx->opacity); in gen_sub_bitmap()
499 ff_dlog(ctx, "palette %0x\n", ((uint32_t *)sub_rect->data[1])[ci]); in gen_sub_bitmap()
501 ((uint32_t *)sub_rect->data[1])[VBI_TRANSPARENT_BLACK] = RGBA(0, 0, 0, 0); in gen_sub_bitmap()
502 ((uint32_t *)sub_rect->data[1])[VBI_TRANSPARENT_BLACK + VBI_NB_COLORS] = RGBA(0, 0, 0, 0); in gen_sub_bitmap()
503 sub_rect->type = SUBTITLE_BITMAP; in gen_sub_bitmap()
543 cur_page->sub_rect = av_mallocz(sizeof(*cur_page->sub_rect)); in handler()
547 if (cur_page->sub_rect) { in handler()
550 res = gen_sub_bitmap(ctx, cur_page->sub_rect, &page, chop_top); in handler()
553 res = gen_sub_text(ctx, cur_page->sub_rect, &page, chop_top); in handler()
556 res = gen_sub_ass(ctx, cur_page->sub_rect, &page, chop_top); in handler()
563 av_freep(&cur_page->sub_rect); in handler()
699 if (ctx->pages->sub_rect->type != SUBTITLE_NONE) { in teletext_decode_frame()
703 sub->rects[0] = ctx->pages->sub_rect; in teletext_decode_frame()
720 subtitle_rect_free(&ctx->pages->sub_rect); in teletext_decode_frame()
777 subtitle_rect_free(&ctx->pages[--ctx->nb_pages].sub_rect); in teletext_close_decoder()