Lines Matching defs:sub_rect
44 AVSubtitleRect *sub_rect;
86 static void subtitle_rect_free(AVSubtitleRect **sub_rect)
88 av_freep(&(*sub_rect)->pict.data[0]);
89 av_freep(&(*sub_rect)->pict.data[1]);
90 av_freep(&(*sub_rect)->ass);
91 av_freep(sub_rect);
127 static int gen_sub_text(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page *page, int chop_top)
180 sub_rect->type = SUBTITLE_ASS;
181 if ((ret = create_ass_text(ctx, buf.str, &sub_rect->ass)) < 0) {
185 av_log(ctx, AV_LOG_DEBUG, "subtext:%s:txetbus\n", sub_rect->ass);
187 sub_rect->type = SUBTITLE_NONE;
193 static void fix_transparency(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page *page,
200 uint8_t *pixel = sub_rect->pict.data[0] + iy * sub_rect->pict.linesize[0];
225 static int gen_sub_bitmap(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page *page, int chop_top)
243 sub_rect->type = SUBTITLE_NONE;
247 if ((ret = avpicture_alloc(&sub_rect->pict, AV_PIX_FMT_PAL8, resx, resy)) < 0)
250 sub_rect->pict.data[1] = NULL;
253 sub_rect->pict.data[0], sub_rect->pict.linesize[0],
257 fix_transparency(ctx, sub_rect, page, chop_top, cmax, resx, resy);
258 sub_rect->x = ctx->x_offset;
259 sub_rect->y = ctx->y_offset + chop_top * BITMAP_CHAR_HEIGHT;
260 sub_rect->w = resx;
261 sub_rect->h = resy;
262 sub_rect->nb_colors = (int)cmax + 1;
263 sub_rect->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
264 if (!sub_rect->pict.data[1]) {
265 av_freep(&sub_rect->pict.data[0]);
275 ((uint32_t *)sub_rect->pict.data[1])[ci] = RGBA(r, g, b, a);
276 av_dlog(ctx, "palette %0x\n", ((uint32_t *)sub_rect->pict.data[1])[ci]);
278 ((uint32_t *)sub_rect->pict.data[1])[cmax] = RGBA(0, 0, 0, 0);
279 sub_rect->type = SUBTITLE_BITMAP;
332 cur_page->sub_rect = av_mallocz(sizeof(*cur_page->sub_rect));
336 if (cur_page->sub_rect) {
338 gen_sub_bitmap(ctx, cur_page->sub_rect, &page, chop_top) :
339 gen_sub_text (ctx, cur_page->sub_rect, &page, chop_top);
341 av_freep(&cur_page->sub_rect);
459 if (ctx->pages->sub_rect->type != SUBTITLE_NONE) {
463 sub->rects[0] = ctx->pages->sub_rect;
472 subtitle_rect_free(&ctx->pages->sub_rect);
521 subtitle_rect_free(&ctx->pages[--ctx->nb_pages].sub_rect);