xine-lib: xine-lib-1.2.13/src/xine-engine/video_overlay.c File Reference

xine-lib 1.2.13-20230125hg15249

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
video_overlay.c File Reference
`#include <stdlib.h>`
`#include <string.h>`
`#include <unistd.h>`
`#include <pthread.h>`
`#include <sys/types.h>`
`#include <xine/buffer.h>`
`#include <xine/xine_internal.h>`
`#include <xine/sorted_array.h>`
`#include <xine/xineutils.h>`
`#include <xine/video_overlay.h>`
`#include "bswap.h"`

## Data Structures
struct | _video_overlay_node_t
struct | video_overlay_s

## Macros
#define | LOG_MODULE "video_overlay"
#define | INT64_MAX (int64_t)(((uint64_t)1 << (8 * sizeof (uint64_t) - 1)) - 1)
#define | _VOVL_EVENT_INDEX_FIRST MAX_EVENTS
#define | _VOVL_EVENT_INDEX_LAST (MAX_EVENTS + 2)
#define | LUT_SIZE (sizeof(overlay->color)/sizeof(overlay->color[0]))
#define | GET_DIM(dest, src, max) dest = src; if (dest < 0) dest = 0; else if (dest > max) dest = max;
#define | MAKE_LINE(offs)

## Typedefs
typedef struct video_overlay_s | video_overlay_t

## Enumerations
enum | _video_overlay_node_index_t { _VOVL_FREE_FIRST = 0 , _VOVL_FREE_LAST , _VOVL_USED_FIRST , _VOVL_USED_LAST , _VOVL_LAST }

## Functions
static void | _video_overlay_list_init (_video_overlay_node_t *a, uint32_t n)
static void | _video_overlay_node_remove (_video_overlay_node_t *a, uint32_t indx)
static void | _video_overlay_node_append (_video_overlay_node_t *a, uint32_t used, uint32_t indx)
static uint32_t | _vovl_bits_test (const uint32_t *field, uint32_t bit)
static uint32_t | _vovl_bits_set (uint32_t *field, uint32_t bit)
static void | _vovl_event_free_reset (video_overlay_t *this)
static uint32_t | _vovl_event_free_get (video_overlay_t *this)
static void | _vovl_event_free_put (video_overlay_t *this, uint32_t u)
static void | add_showing_handle (video_overlay_t *this, int32_t handle, int changed)
static void | remove_showing_handle (video_overlay_t *this, int32_t handle)
static int32_t | video_overlay_get_handle (video_overlay_manager_t *this_gen, int object_type)
static void | _video_overlay_free_handle (video_overlay_t *this, int32_t handle)
static void | video_overlay_free_handle (video_overlay_manager_t *this_gen, int32_t handle)
static void | video_overlay_init (video_overlay_manager_t *this_gen)
static void | _video_overlay_clip_trans (uint8_t *tab)
static int32_t | video_overlay_add_event (video_overlay_manager_t *this_gen, void *event_gen)
static int | video_overlay_event (video_overlay_t *this, int64_t vpts)
void | _x_overlay_clut_yuv2rgb (vo_overlay_t *overlay, int video_color_matrix)
static void | clut_to_argb (const uint32_t *color, const uint8_t *trans, int num_items, uint32_t *argb, const char *format)
void | _x_overlay_to_argb32 (const vo_overlay_t *overlay, uint32_t *rgba_buf, int stride, const char *format)
static void | video_overlay_multiple_overlay_blend (video_overlay_manager_t *this_gen, int64_t vpts, vo_driver_t *output, vo_frame_t *vo_img, int enabled)
static void | video_overlay_flush_events (video_overlay_manager_t *this_gen)
static int | video_overlay_redraw_needed (video_overlay_manager_t *this_gen, int64_t vpts)
static void | video_overlay_dispose (video_overlay_manager_t *this_gen)
static int | _video_overlay_event_cmp (void *a, void *b)
video_overlay_manager_t * | _x_video_overlay_new_manager (xine_t *xine)

## Variables
static const uint32_t | _vovl_bits [32]

## Macro Definition Documentation

## ◆ _VOVL_EVENT_INDEX_FIRST

#define _VOVL_EVENT_INDEX_FIRST MAX_EVENTS

Referenced by _vovl_event_free_get(), _vovl_event_free_put(), and _vovl_event_free_reset().

## ◆ _VOVL_EVENT_INDEX_LAST

#define _VOVL_EVENT_INDEX_LAST (MAX_EVENTS + 2)

Referenced by _vovl_event_free_get(), _vovl_event_free_put(), and _vovl_event_free_reset().

## ◆ GET_DIM

#define GET_DIM | ( |  | dest,
|  |  | src,
|  |  | max ) dest = src; if (dest < 0) dest = 0; else if (dest > max) dest = max;

Referenced by _x_overlay_to_argb32().

## ◆ INT64_MAX

#define INT64_MAX (int64_t)(((uint64_t)1 << (8 * sizeof (uint64_t) - 1)) - 1)

Referenced by _x_video_overlay_new_manager(), and video_overlay_event().

## ◆ LOG_MODULE

#define LOG_MODULE "video_overlay"

Referenced by add_showing_handle(), video_overlay_add_event(), video_overlay_event(), video_overlay_multiple_overlay_blend(), and video_overlay_redraw_needed().

## ◆ LUT_SIZE

#define LUT_SIZE (sizeof(overlay->color)/sizeof(overlay->color[0]))

Referenced by _x_overlay_to_argb32().

## ◆ MAKE_LINE

#define MAKE_LINE | ( |  | offs | ) |

Value:
while (1) { \
int pleft = prest > pixels ? pixels : prest; \
pixels -= pleft; \
prest -= pleft; \
while (pleft > 0) { \
*rgba++ = color; \
pleft--; \
} \
if (pixels <= 0) \
break; \
if (rle >= rle_end) \
goto _fill; \
color = colors[rle->color + offs]; \
prest = rle->len; \
rle++; \
}
_fill
static void _fill(crypto_input_plugin_t *this)
Definition input_crypto.c:82

Referenced by _x_overlay_to_argb32().

## Typedef Documentation

## ◆ video_overlay_t

typedef struct video_overlay_s video_overlay_t

## Enumeration Type Documentation

## ◆ _video_overlay_node_index_t

enum _video_overlay_node_index_t

Enumerator
_VOVL_FREE_FIRST |
_VOVL_FREE_LAST |
_VOVL_USED_FIRST |
_VOVL_USED_LAST |
_VOVL_LAST |

## Function Documentation

## ◆ _video_overlay_clip_trans()

static void _video_overlay_clip_trans | ( | uint8_t * | tab | ) |
| static

References OVL_PALETTE_SIZE, and v.

Referenced by video_overlay_add_event().

## ◆ _video_overlay_event_cmp()

static int _video_overlay_event_cmp | ( | void * | a,
|  | void * | b )
| static

References video_overlay_event_s::vpts.

Referenced by _x_video_overlay_new_manager().

## ◆ _video_overlay_free_handle()

static void _video_overlay_free_handle | ( | video_overlay_t * | this,
|  | int32_t | handle )
| static

References _video_overlay_node_append(), _video_overlay_node_remove(), _x_freep(), NULL, and set_argb_layer_ptr().

Referenced by video_overlay_dispose(), video_overlay_event(), video_overlay_free_handle(), and video_overlay_init().

## ◆ _video_overlay_list_init()

static void _video_overlay_list_init | ( | _video_overlay_node_t * | a,
|  | uint32_t | n )
| static

References _VOVL_FREE_FIRST, _VOVL_FREE_LAST, _VOVL_LAST, _VOVL_USED_FIRST, _VOVL_USED_LAST, _video_overlay_node_t::next, and _video_overlay_node_t::prev.

Referenced by _x_video_overlay_new_manager().

## ◆ _video_overlay_node_append()

static void _video_overlay_node_append | ( | _video_overlay_node_t * | a,
|  | uint32_t | used,
|  | uint32_t | indx )
| static

References _VOVL_FREE_LAST, _VOVL_LAST, _VOVL_USED_LAST, _video_overlay_node_t::next, and _video_overlay_node_t::prev.

Referenced by _video_overlay_free_handle(), add_showing_handle(), remove_showing_handle(), and video_overlay_get_handle().

## ◆ _video_overlay_node_remove()

static void _video_overlay_node_remove | ( | _video_overlay_node_t * | a,
|  | uint32_t | indx )
| static

References _VOVL_LAST, _video_overlay_node_t::next, and _video_overlay_node_t::prev.

Referenced by _video_overlay_free_handle(), add_showing_handle(), remove_showing_handle(), and video_overlay_get_handle().

## ◆ _vovl_bits_set()

static uint32_t _vovl_bits_set | ( | uint32_t * | field,
|  | uint32_t | bit )
| static

References _vovl_bits, and field.

Referenced by video_overlay_event().

## ◆ _vovl_bits_test()

static uint32_t _vovl_bits_test | ( | const uint32_t * | field,
|  | uint32_t | bit )
| static

References _vovl_bits, and field.

Referenced by video_overlay_event().

## ◆ _vovl_event_free_get()

static uint32_t _vovl_event_free_get | ( | video_overlay_t * | this | ) |
| static

References _VOVL_EVENT_INDEX_FIRST, _VOVL_EVENT_INDEX_LAST, MAX_EVENTS, and v.

Referenced by video_overlay_add_event().

## ◆ _vovl_event_free_put()

static void _vovl_event_free_put | ( | video_overlay_t * | this,
|  | uint32_t | u )
| static

References _VOVL_EVENT_INDEX_FIRST, and _VOVL_EVENT_INDEX_LAST.

Referenced by video_overlay_add_event(), video_overlay_event(), and video_overlay_free_handle().

## ◆ _vovl_event_free_reset()

static void _vovl_event_free_reset | ( | video_overlay_t * | this | ) |
| static

References _VOVL_EVENT_INDEX_FIRST, _VOVL_EVENT_INDEX_LAST, video_overlay_s::list_free, and MAX_EVENTS.

Referenced by video_overlay_init().

## ◆ _x_overlay_clut_yuv2rgb()

void _x_overlay_clut_yuv2rgb | ( | vo_overlay_t * | overlay,
|  | int | video_color_matrix )

References _x_clut_yuv2rgb(), vo_overlay_s::color, vo_overlay_s::hili_color, vo_overlay_s::hili_rgb_clut, and vo_overlay_s::rgb_clut.

Referenced by _opengl2_overlay_blend(), mmal_overlay_blend(), raw_overlay_blend(), vaapi_overlay_end(), and vdpau_overlay_end().

## ◆ _x_overlay_to_argb32()

void _x_overlay_to_argb32 | ( | const vo_overlay_t * | overlay,
|  | uint32_t * | rgba_buf,
|  | int | stride,
|  | const char * | format )

References _fill(), clut_to_argb(), rle_elem_s::color, vo_overlay_s::color, GET_DIM, vo_overlay_s::height, vo_overlay_s::hili_bottom, vo_overlay_s::hili_color, vo_overlay_s::hili_left, vo_overlay_s::hili_right, vo_overlay_s::hili_top, vo_overlay_s::hili_trans, LUT_SIZE, MAKE_LINE, vo_overlay_s::num_rle, vo_overlay_s::rle, vo_overlay_s::trans, and vo_overlay_s::width.

Referenced by mmal_overlay_blend(), opengl2_upload_overlay(), raw_process_ovl(), vaapi_overlay_end(), and vdpau_overlay_end().

## ◆ _x_video_overlay_new_manager()

video_overlay_manager_t * _x_video_overlay_new_manager | ( | xine_t * | xine | ) |

References _video_overlay_event_cmp(), _video_overlay_list_init(), INT64_MAX, MAX_EVENTS, MAX_OBJECTS, MAX_SHOWING, NULL, video_overlay_add_event(), video_overlay_dispose(), video_overlay_flush_events(), video_overlay_free_handle(), video_overlay_get_handle(), video_overlay_init(), video_overlay_multiple_overlay_blend(), video_overlay_redraw_needed(), XINE_SARRAY_MODE_LAST, xine_sarray_new(), and xine_sarray_set_mode().

Referenced by _x_vo_new_port().

## ◆ add_showing_handle()

static void add_showing_handle | ( | video_overlay_t * | this,
|  | int32_t | handle,
|  | int | changed )
| static

References _video_overlay_node_append(), _video_overlay_node_remove(), _VOVL_FREE_FIRST, _VOVL_LAST, LOG_MODULE, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by video_overlay_event().

## ◆ clut_to_argb()

static void clut_to_argb | ( | const uint32_t * | color,
|  | const uint8_t * | trans,
|  | int | num_items,
|  | uint32_t * | argb,
|  | const char * | format )
| static

References clut_s::foo, and v.

Referenced by _x_overlay_to_argb32().

## ◆ remove_showing_handle()

static void remove_showing_handle | ( | video_overlay_t * | this,
|  | int32_t | handle )
| static

References _video_overlay_node_append(), and _video_overlay_node_remove().

Referenced by video_overlay_event(), and video_overlay_free_handle().

## ◆ video_overlay_add_event()

static int32_t video_overlay_add_event | ( | video_overlay_manager_t * | this_gen,
|  | void * | event_gen )
| static

References _video_overlay_clip_trans(), _vovl_event_free_get(), _vovl_event_free_put(), _x_freep(), vo_overlay_s::argb_layer, video_overlay_event_s::event_type, video_overlay_object_s::handle, vo_overlay_s::hili_trans, LOG_MODULE, MAX_EVENTS, MAX_OBJECTS, NULL, video_overlay_event_s::object, video_overlay_object_s::overlay, OVERLAY_EVENT_HIDE, OVERLAY_EVENT_SHOW, video_overlay_object_s::pts, vo_overlay_s::rle, set_argb_layer_ptr(), vo_overlay_s::trans, video_overlay_event_s::vpts, xine_sarray_add(), xine_sarray_remove_ptr(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _x_video_overlay_new_manager().

## ◆ video_overlay_dispose()

static void video_overlay_dispose | ( | video_overlay_manager_t * | this_gen | ) |
| static

References _video_overlay_free_handle(), _x_freep(), MAX_EVENTS, MAX_OBJECTS, and xine_sarray_delete().

Referenced by _x_video_overlay_new_manager().

## ◆ video_overlay_event()

static int video_overlay_event | ( | video_overlay_t * | this,
|  | int64_t | vpts )
| static

References _video_overlay_free_handle(), _vovl_bits_set(), _vovl_bits_test(), _vovl_event_free_put(), _x_freep(), add_showing_handle(), vo_overlay_s::argb_layer, video_overlay_object_s::handle, vo_overlay_s::hili_bottom, vo_overlay_s::hili_color, vo_overlay_s::hili_left, vo_overlay_s::hili_rgb_clut, vo_overlay_s::hili_right, vo_overlay_s::hili_top, vo_overlay_s::hili_trans, INT64_MAX, LOG_MODULE, MAX_EVENTS, MAX_OBJECTS, NULL, video_overlay_event_s::object, video_overlay_object_s::overlay, OVERLAY_EVENT_FREE_HANDLE, OVERLAY_EVENT_HIDE, OVERLAY_EVENT_MENU_BUTTON, OVERLAY_EVENT_SHOW, remove_showing_handle(), vo_overlay_s::rle, set_argb_layer_ptr(), video_overlay_event_s::vpts, xine_sarray_binary_search(), xine_sarray_get(), xine_sarray_remove(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by video_overlay_flush_events(), video_overlay_multiple_overlay_blend(), and video_overlay_redraw_needed().

## ◆ video_overlay_flush_events()

static void video_overlay_flush_events | ( | video_overlay_manager_t * | this_gen | ) |
| static

References video_overlay_event().

Referenced by _x_video_overlay_new_manager().

## ◆ video_overlay_free_handle()

static void video_overlay_free_handle | ( | video_overlay_manager_t * | this_gen,
|  | int32_t | handle )
| static

References _video_overlay_free_handle(), _vovl_event_free_put(), _x_freep(), video_overlay_object_s::handle, MAX_EVENTS, MAX_OBJECTS, NULL, video_overlay_event_s::object, video_overlay_object_s::overlay, OVERLAY_EVENT_NULL, remove_showing_handle(), vo_overlay_s::rle, xine_sarray_get(), and xine_sarray_remove().

Referenced by _x_video_overlay_new_manager().

## ◆ video_overlay_get_handle()

static int32_t video_overlay_get_handle | ( | video_overlay_manager_t * | this_gen,
|  | int | object_type )
| static

References _video_overlay_node_append(), _video_overlay_node_remove(), _VOVL_FREE_FIRST, and _VOVL_LAST.

Referenced by _x_video_overlay_new_manager().

## ◆ video_overlay_init()

static void video_overlay_init | ( | video_overlay_manager_t * | this_gen | ) |
| static

References _video_overlay_free_handle(), _vovl_event_free_reset(), MAX_EVENTS, MAX_OBJECTS, MAX_SHOWING, NULL, and xine_sarray_clear().

Referenced by _x_video_overlay_new_manager().

## ◆ video_overlay_multiple_overlay_blend()

static void video_overlay_multiple_overlay_blend | ( | video_overlay_manager_t * | this_gen,
|  | int64_t | vpts,
|  | vo_driver_t * | output,
|  | vo_frame_t * | vo_img,
|  | int | enabled )
| static

References _VOVL_LAST, _VOVL_USED_FIRST, enabled, LOG_MODULE, video_overlay_event(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _x_video_overlay_new_manager().

## ◆ video_overlay_redraw_needed()

static int video_overlay_redraw_needed | ( | video_overlay_manager_t * | this_gen,
|  | int64_t | vpts )
| static

References LOG_MODULE, video_overlay_event(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _x_video_overlay_new_manager().

## Variable Documentation

## ◆ _vovl_bits

const uint32_t _vovl_bits[32]
| static

Initial value:
= {
0x00000001, 0x00000002, 0x00000004, 0x00000008,
0x00000010, 0x00000020, 0x00000040, 0x00000080,
0x00000100, 0x00000200, 0x00000400, 0x00000800,
0x00001000, 0x00002000, 0x00004000, 0x00008000,
0x00010000, 0x00020000, 0x00040000, 0x00080000,
0x00100000, 0x00200000, 0x00400000, 0x00800000,
0x01000000, 0x02000000, 0x04000000, 0x08000000,
0x10000000, 0x20000000, 0x40000000, 0x80000000
}

Referenced by _vovl_bits_set(), and _vovl_bits_test().