mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
sub, vo_opengl: use packed sub-bitmaps directly if available
The previous few commits changed sd_lavc.c's output to packed RGB sub- images. In particular, this means all sub-bitmaps are part of a larger, single bitmap. Change the vo_opengl OSD code such that it can make use of this, and upload the pre-packed image, instead of packing and copying them again. This complicates the upload code a bit (4 code paths due to messy PBO handling). The plan is to make sub-bitmaps always packed, but some more work is required to reach this point. The plan is to pack libass images as well. Since this implies a copy, this will make it easy to refcount the result. (This is all targeted towards vo_opengl. Other VOs, vo_xv, vo_x11, and vo_wayland in particular, will become less efficient. Although at least vo_vdpau and vo_direct3d could be switched to the new method as well.)
This commit is contained in:
16
sub/osd.h
16
sub/osd.h
@@ -42,6 +42,11 @@ struct sub_bitmap {
|
||||
int x, y;
|
||||
int dw, dh;
|
||||
|
||||
// If the containing struct sub_bitmaps has the packed field set, then this
|
||||
// is the position within the source. (Strictly speaking this is redundant
|
||||
// with the bitmap pointer.)
|
||||
int src_x, src_y;
|
||||
|
||||
struct {
|
||||
uint32_t color;
|
||||
} libass;
|
||||
@@ -60,6 +65,17 @@ struct sub_bitmaps {
|
||||
struct sub_bitmap *parts;
|
||||
int num_parts;
|
||||
|
||||
// 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)
|
||||
// Other formats have this set to NULL.
|
||||
struct mp_image *packed;
|
||||
|
||||
// Bounding box for the packed image. All parts will be within the bounding
|
||||
// box. (The origin of the box is at (0,0).)
|
||||
int packed_w, packed_h;
|
||||
|
||||
int change_id; // Incremented on each change
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user