From 3365514951e9c07ec3a21bb3898e5796c214f8b7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 28 Sep 2012 21:38:52 +0200 Subject: sub: allow rendering OSD in ASS image format directly, simplify Before this commit, the OSD was drawn using libass, but the resulting bitmaps were converted to the internal mplayer OSD format. We want to get rid of the old OSD format, because it's monochrome, and can't even be rendered directly using modern video output methods (like with OpenGL/Direct3D/VDPAU). Change it so that VOs can get the ASS images directly, without additional conversions. (This also has the consequence that the OSD can render colors now.) Currently, this is vo_gl3 only. The other VOs still use the old method. Also, the old OSD format is still used for all VOs with DVD subtitles (spudec). Rewrite sub.c. Remove all the awkward flags and bounding boxes and change detection things. It turns out that much of that isn't needed. Move code related to converting subtitle images to img_convert.c. (It has to be noted that all of these conversions were already done before in some places, and that the new code actually makes less use of them.) --- sub/dec_sub.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'sub/dec_sub.h') diff --git a/sub/dec_sub.h b/sub/dec_sub.h index df6aaf9b91..9c75506c4c 100644 --- a/sub/dec_sub.h +++ b/sub/dec_sub.h @@ -4,21 +4,26 @@ #include #include -#define MAX_OSD_PARTS 8 - struct sh_sub; struct osd_state; struct ass_track; enum sub_bitmap_format { - SUBBITMAP_EMPTY, + SUBBITMAP_EMPTY = 0,// no bitmaps; always has num_parts==0 SUBBITMAP_LIBASS, // A8, with a per-surface blend color (libass.color) - SUBBITMAP_RGBA, // B8G8R8A8 + SUBBITMAP_RGBA, // B8G8R8A8, can be scaled SUBBITMAP_OLD, // I8A8 (monochrome), premultiplied alpha + SUBBITMAP_OLD_PLANAR, // like previous, but bitmap points to old_osd_planar SUBBITMAP_COUNT }; +// For SUBBITMAP_OLD_PANAR +struct old_osd_planar { + unsigned char *bitmap; + unsigned char *alpha; +}; + typedef struct mp_eosd_res { int w, h; // screen dimensions, including black borders int mt, mb, ml, mr; // borders (top, bottom, left, right) -- cgit v1.2.3