Overlay blending does one elemental operation: Take a partly transparent overlay (in an alpha capable pixelformat) and blend it onto a video frame. Blending can be used for subtitles or OSD in playback applications, and also for lots of weird effects. In the current implementation, there is only one overlay pixelformat, which can be blended onto a cetrtain destination format. Therefore, the incoming overlay will be converted to the pixelformat necessary for the conversion. For OSD and Subtitle applications, this happens only once for each overlay, since the converted overlay is remembered by the blend context.
Note that gavl doesn't (and never will) support text subtitles. To blend text strings onto a video frame, you must render it into a gavl_overlay_t with some typesetting library (e.g. freetype) first.
◆ gavl_overlay_blend_context_t
Opaque blend context.
You don't want to know what's inside.
◆ gavl_overlay_blend_context_create()
Create a blend context.
- Returns
- A newly allocated blend context.
◆ gavl_overlay_blend_context_destroy()
Destroy a blend context and free all associated memory.
- Parameters
-
◆ gavl_overlay_blend_context_get_options()
◆ gavl_overlay_blend_context_init()
Initialize the blend context.
- Parameters
-
ctx | A blend context |
frame_format | The format of the destination frames |
overlay_format | The format of the overlays |
Initialize a blend context for a given frame- and overlayformat. The image_width and image_height members for the overlay format represent the maximum overlay size. The actual displayed size will be determined by the ovl_rect of the overlay. The overlay_format might be changed to something, which can directly be blended. Make sure you have a gavl_video_converter_t nearby.
◆ gavl_overlay_blend_context_set_overlay()
Set a new overlay.
- Parameters
-
ctx | A blend context |
ovl | An overlay |
This function sets a new overlay, regardless of whether the last one has expired or not.
◆ gavl_overlay_blend()
Blend overlay onto video frame.
- Parameters
-
ctx | A blend context |
dst_frame | Destination frame |