Implement support for OSD/overlays
Many projects need to overlay additional textures (subtitles, on-screen controllers, etc.) on top of the video being rendered. We need to design an API for this, and of course implement it as well.
Most likely, the API will look something like the user providing a list of ra_tex
s (or perhaps pl_plane
s?) plus a pl_rect2d
for each. In addition, the meaning of the pl_rect2d
would have to be decided, probably by using an enum. For example, we could support giving the coordinate as any one of:
- relative to video reference rect (0, 0, image.width, image.height) in absolute coordinates
- relative to the
src_rect
in relative coordinates (0.0, 0.0, 1.0, 1.0) - relative to the
dst_rect
in relative coordinates - relative to the target in absolute coordinates (0, 0, fbo.width, fbo.height)
- (possibly?) relative to the source or target in relative coordinates
This should provide projects with the greatest deal of flexibility while keeping the conversion boilerplate as inside libplacebo as possible.
In addition, we will have to figure out how to handle OSD mixing with respect to interpolation, as well as OSD plane colorimetry. We might need to support multiple locations where users can set OSDs, either at the pl_image
level or at the pl_target
level. Perhaps the aforementioned enum could simply distinguish between absolute | relative_to_size | relative_to_rect
, with one OSD
struct being attached to the pl_image and pl_target respectively.