- buf, offset2 * 2, buf_size);
- guess_palette(sub_header->rects[0].rgba_palette,
- palette, alpha, 0xffff00);
- sub_header->rects[0].x = x1;
- sub_header->rects[0].y = y1;
- sub_header->rects[0].w = w;
- sub_header->rects[0].h = h;
- sub_header->rects[0].nb_colors = 4;
- sub_header->rects[0].linesize = w;
- sub_header->rects[0].bitmap = bitmap;
+ buf, offset2, buf_size, is_8bit);
+ sub_header->rects[0]->data[1] = av_mallocz(AVPALETTE_SIZE);
+ if (!sub_header->rects[0]->data[1])
+ goto fail;
+ if (is_8bit) {
+ if (yuv_palette == 0)
+ goto fail;
+ sub_header->rects[0]->nb_colors = 256;
+ yuv_a_to_rgba(yuv_palette, alpha,
+ (uint32_t *)sub_header->rects[0]->data[1],
+ 256);
+ } else {
+ sub_header->rects[0]->nb_colors = 4;
+ guess_palette(ctx,
+ (uint32_t *)sub_header->rects[0]->data[1],
+ colormap, alpha, 0xffff00);
+ }
+ sub_header->rects[0]->x = x1;
+ sub_header->rects[0]->y = y1;
+ sub_header->rects[0]->w = w;
+ sub_header->rects[0]->h = h;
+ sub_header->rects[0]->type = SUBTITLE_BITMAP;
+ sub_header->rects[0]->linesize[0] = w;
+
+#if FF_API_AVPICTURE
+FF_DISABLE_DEPRECATION_WARNINGS
+{
+ int j;
+ AVSubtitleRect *rect;
+ rect = sub_header->rects[0];
+ 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