Overlay blending
[Video]

Data Structures

struct  gavl_overlay_t
 Overlay structure. More...

Typedefs

typedef struct
gavl_overlay_blend_context_s 
gavl_overlay_blend_context_t
 Opaque blend context.

Functions

GAVL_PUBLIC
gavl_overlay_blend_context_t
gavl_overlay_blend_context_create ()
 Create a blend context.
GAVL_PUBLIC void gavl_overlay_blend_context_destroy (gavl_overlay_blend_context_t *ctx)
 Destroy a blend context and free all associated memory.
GAVL_PUBLIC gavl_video_options_tgavl_overlay_blend_context_get_options (gavl_overlay_blend_context_t *ctx)
 Get options from a blend context.
GAVL_PUBLIC int gavl_overlay_blend_context_init (gavl_overlay_blend_context_t *ctx, const gavl_video_format_t *frame_format, gavl_video_format_t *overlay_format)
 Initialize the blend context.
GAVL_PUBLIC void gavl_overlay_blend_context_set_overlay (gavl_overlay_blend_context_t *ctx, gavl_overlay_t *ovl)
 Set a new overlay.
GAVL_PUBLIC void gavl_overlay_blend (gavl_overlay_blend_context_t *ctx, gavl_video_frame_t *dst_frame)
 Blend overlay onto video frame.

Detailed Description

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.


Typedef Documentation

typedef struct gavl_overlay_blend_context_s gavl_overlay_blend_context_t

Opaque blend context.

You don't want to know what's inside.


Function Documentation

GAVL_PUBLIC gavl_overlay_blend_context_t* gavl_overlay_blend_context_create (  ) 

Create a blend context.

Returns:
A newly allocated blend context.
GAVL_PUBLIC void gavl_overlay_blend_context_destroy ( gavl_overlay_blend_context_t ctx  ) 

Destroy a blend context and free all associated memory.

Parameters:
ctx A blend context
GAVL_PUBLIC gavl_video_options_t* gavl_overlay_blend_context_get_options ( gavl_overlay_blend_context_t ctx  ) 

Get options from a blend context.

Parameters:
ctx A blend context
Returns:
Options (See Video conversion options)
GAVL_PUBLIC int gavl_overlay_blend_context_init ( gavl_overlay_blend_context_t ctx,
const gavl_video_format_t frame_format,
gavl_video_format_t overlay_format 
)

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_PUBLIC void gavl_overlay_blend_context_set_overlay ( gavl_overlay_blend_context_t ctx,
gavl_overlay_t ovl 
)

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_PUBLIC void gavl_overlay_blend ( gavl_overlay_blend_context_t ctx,
gavl_video_frame_t dst_frame 
)

Blend overlay onto video frame.

Parameters:
ctx A blend context
dst_frame Destination frame
Generated on Fri Jun 8 17:27:53 2012 for gavl by  doxygen 1.6.3