diff options
Diffstat (limited to 'sub/osd.h')
-rw-r--r-- | sub/osd.h | 44 |
1 files changed, 37 insertions, 7 deletions
@@ -24,11 +24,11 @@ #include "options/m_option.h" -// NOTE: VOs must support at least SUBBITMAP_RGBA. +// NOTE: VOs must support at least SUBBITMAP_BGRA. enum sub_bitmap_format { SUBBITMAP_EMPTY = 0,// no bitmaps; always has num_parts==0 SUBBITMAP_LIBASS, // A8, with a per-surface blend color (libass.color) - SUBBITMAP_RGBA, // B8G8R8A8 (MSB=A, LSB=B), scaled, premultiplied alpha + SUBBITMAP_BGRA, // IMGFMT_BGRA (MSB=A, LSB=B), scaled, premultiplied alpha SUBBITMAP_COUNT }; @@ -64,7 +64,7 @@ struct sub_bitmaps { // Packed representation of the bitmap data. If non-NULL, then the // parts[].bitmap pointer points into the image data here (and stride will // correspond to packed->stride[0]). - // SUBBITMAP_RGBA: IMGFMT_BGRA (exact match) + // SUBBITMAP_BGRA: IMGFMT_BGRA (exact match) // SUBBITMAP_LIBASS: IMGFMT_Y8 (not the same, but compatible layout) // Other formats have this set to NULL. struct mp_image *packed; @@ -73,9 +73,30 @@ struct sub_bitmaps { // box. (The origin of the box is at (0,0).) int packed_w, packed_h; - int change_id; // Incremented on each change + int change_id; // Incremented on each change (0 is never used) + + bool video_color_space; // True if the bitmap is in video color space }; +struct sub_bitmap_list { + // Combined change_id - of any of the existing items change (even if they + // e.g. go away and are removed from items[]), this is incremented. + int64_t change_id; + + // Bounding box for rendering. It's notable that SUBBITMAP_LIBASS images are + // always within these bounds, while SUBBITMAP_BGRA is not necessarily. + int w, h; + + // Sorted by sub_bitmaps.render_index. Unused parts are not in the array, + // and you cannot index items[] with render_index. + struct sub_bitmaps **items; + int num_items; +}; + +struct sub_bitmap_copy_cache; +struct sub_bitmaps *sub_bitmaps_copy(struct sub_bitmap_copy_cache **cache, + struct sub_bitmaps *in); + struct mp_osd_res { int w, h; // screen dimensions, including black borders int mt, mb, ml, mr; // borders (top, bottom, left, right) @@ -134,10 +155,11 @@ struct osd_style_opts { int align_x; int align_y; float blur; - int bold; - int italic; + bool bold; + bool italic; int justify; int font_provider; + char *fonts_dir; }; extern const struct m_sub_options osd_style_conf; @@ -183,8 +205,12 @@ void osd_draw(struct osd_state *osd, struct mp_osd_res res, const bool formats[SUBBITMAP_COUNT], void (*cb)(void *ctx, struct sub_bitmaps *imgs), void *cb_ctx); +struct sub_bitmap_list *osd_render(struct osd_state *osd, struct mp_osd_res res, + double video_pts, int draw_flags, + const bool formats[SUBBITMAP_COUNT]); + struct mp_image; -bool osd_draw_on_image(struct osd_state *osd, struct mp_osd_res res, +void osd_draw_on_image(struct osd_state *osd, struct mp_osd_res res, double video_pts, int draw_flags, struct mp_image *dest); struct mp_image_pool; @@ -209,6 +235,9 @@ struct osd_external_ass { char *data; int res_x, res_y; int z; + bool hidden; + + double *out_rc; // hack to pass boundary rect, [x0, y0, x1, y1] }; // defined in osd_libass.c and osd_dummy.c @@ -216,5 +245,6 @@ void osd_set_external(struct osd_state *osd, struct osd_external_ass *ov); void osd_set_external_remove_owner(struct osd_state *osd, void *owner); void osd_get_text_size(struct osd_state *osd, int *out_screen_h, int *out_font_h); void osd_get_function_sym(char *buffer, size_t buffer_size, int osd_function); +void osd_mangle_ass(bstr *dst, const char *in, bool replace_newlines); #endif /* MPLAYER_SUB_H */ |