xine-lib: xine-lib-1.2.12/src/xine-engine/osd.c File Reference

xine-lib 1.2.12

Data Structures | Macros | Typedefs | Functions | Variables
osd.c File Reference
`#include <stdlib.h>`
`#include <string.h>`
`#include <stdio.h>`
`#include <pthread.h>`
`#include <zlib.h>`
`#include <sys/types.h>`
`#include <errno.h>`
`#include <basedir.h>`
`#include <xine/xine_internal.h>`
`#include "xine-engine/bswap.h"`
`#include <xine/xineutils.h>`
`#include <xine/video_out.h>`
`#include <xine/osd.h>`
`#include "xine_private.h"`

## Data Structures
struct | osd_renderer_private_t
struct | osd_fontchar_s
struct | osd_font_s

## Macros
#define | LOG_MODULE "osd"
#define | LOG_VERBOSE
#define | FONT_VERSION 2
#define | ALIAS_CHARACTER_CONV '#'
#define | ALIAS_CHARACTER_FONT '_'
#define | UCS2_ENCODING "UCS-2LE"
#define | KERNING_DEFAULT ft_kerning_default
#define | FT_LOAD_FLAGS (FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING)
#define | CLIP0MAX(val, max) { int32_t _v = val; if (_v > (int32_t)(max)) _v = max; _v &= ~(_v >> 31); val = _v; }
#define | FONT_OVERLAP 1/10 /* overlap between consecutive characters */

## Typedefs
typedef struct osd_fontchar_s | osd_fontchar_t

## Functions
static void | osd_free_ft2 (osd_object_t *osd __attr_unused)
static osd_object_t * | osd_new_object (osd_renderer_t *this, int width, int height)
static void | osd_set_extent (osd_object_t *osd, int extent_width, int extent_height)
static void | osd_set_video_window (osd_object_t *osd, int window_x, int window_y, int window_width, int window_height)
static argb_layer_t * | argb_layer_create ()
static void | argb_layer_destroy (argb_layer_t *argb_layer)
void | set_argb_layer_ptr (argb_layer_t **dst, argb_layer_t *src)
static int | _osd_hide (osd_object_t *osd, int64_t vpts)
static int | _osd_show (osd_object_t *osd, int64_t vpts, int unscaled)
static int | osd_show_scaled (osd_object_t *osd, int64_t vpts)
static int | osd_show_unscaled (osd_object_t *osd, int64_t vpts)
static int | osd_hide (osd_object_t *osd, int64_t vpts)
static void | osd_clear (osd_object_t *osd)
static void | _update_clipping (osd_object_t *osd, int x1, int y1, int x2, int y2)
static void | osd_point (osd_object_t *osd, int x, int y, int color)
static void | osd_line (osd_object_t *osd, int x1, int y1, int x2, int y2, int color)
static void | osd_filled_rect (osd_object_t *osd, int x1, int y1, int x2, int y2, int color)
static void | osd_set_palette (osd_object_t *osd, const uint32_t *color, const uint8_t *trans)
static void | osd_set_text_palette (osd_object_t *osd, int palette_number, int color_base)
static void | osd_get_palette (osd_object_t *osd, uint32_t *color, uint8_t *trans)
static void | osd_set_position (osd_object_t *osd, int x, int y)
static int | osd_renderer_load_font (osd_renderer_t *this, const char *filename)
static int | osd_renderer_unload_font (osd_renderer_t *this, const char *fontname)
static int | osd_lookup_native (osd_object_t *osd, const char *fontname, int size)
static int | osd_set_font (osd_object_t *osd, const char *fontname, int size)
static int | osd_search (osd_fontchar_t *array, size_t n, uint16_t code)
static void | osd_free_encoding (osd_object_t *osd)
static int | osd_set_encoding (osd_object_t *osd, const char *encoding)
static int | osd_render_text (osd_object_t *osd, int x1, int y1, const char *text, int color_base)
static int | osd_get_text_size (osd_object_t *osd, const char *text, int *width, int *height)
static void | osd_free_object (osd_object_t *osd_to_close)
static void | osd_renderer_close (osd_renderer_t *this_gen)
static void | update_text_palette (void *this_gen, xine_cfg_entry_t *entry)
static void | osd_draw_bitmap (osd_object_t *osd, const uint8_t *bitmap, int x1, int y1, int width, int height, const uint8_t *palette_map)
static void | osd_set_argb_buffer (osd_object_t *osd, uint32_t *argb_buffer, int dirty_x, int dirty_y, int dirty_width, int dirty_height)
static uint32_t | osd_get_capabilities (osd_object_t *osd)
osd_renderer_t * | _x_osd_renderer_init (xine_stream_t *stream)

## Variables
static const char *const | textpalettes_str [NUMBER_OF_TEXT_PALETTES+1]
static const clut_t | textpalettes_color [NUMBER_OF_TEXT_PALETTES][TEXT_PALETTE_SIZE]
static const uint8_t | textpalettes_trans [NUMBER_OF_TEXT_PALETTES][TEXT_PALETTE_SIZE]

## Macro Definition Documentation

## ◆ ALIAS_CHARACTER_CONV

#define ALIAS_CHARACTER_CONV '#'

## ◆ ALIAS_CHARACTER_FONT

#define ALIAS_CHARACTER_FONT '_'

## ◆ CLIP0MAX

#define CLIP0MAX | ( |  | val,
|  |  | max
| ) |  | { int32_t _v = val; if (_v > (int32_t)(max)) _v = max; _v &= ~(_v >> 31); val = _v; }

## ◆ FONT_OVERLAP

#define FONT_OVERLAP 1/10 /* overlap between consecutive characters */

## ◆ FONT_VERSION

#define FONT_VERSION 2

## ◆ FT_LOAD_FLAGS

#define FT_LOAD_FLAGS (FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING)

## ◆ KERNING_DEFAULT

#define KERNING_DEFAULT ft_kerning_default

## ◆ LOG_MODULE

#define LOG_MODULE "osd"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ UCS2_ENCODING

#define UCS2_ENCODING "UCS-2LE"

## Typedef Documentation

## ◆ osd_fontchar_t

typedef struct osd_fontchar_s osd_fontchar_t

## Function Documentation

## ◆ _osd_hide()

static int _osd_hide | ( | osd_object_t * | osd,
|  | int64_t | vpts
| ) |  |
| static

References video_overlay_manager_s::add_event, osd_object_s::handle, lprintf, OVERLAY_EVENT_HIDE, and osd_object_s::renderer.

Referenced by _osd_show(), and osd_hide().

## ◆ _osd_show()

static int _osd_show | ( | osd_object_t * | osd,
|  | int64_t | vpts,
|  | int | unscaled
| ) |  |
| static

References _osd_hide(), xine_ticket_s::acquire, osd_object_s::area_touched, osd_object_s::argb_layer, CLIP0MAX, osd_object_s::display_x, osd_object_s::display_y, osd_object_s::extent_height, osd_object_s::extent_width, osd_object_s::handle, osd_object_s::height, lprintf, NULL, OVERLAY_EVENT_SHOW, xine_private_t::port_ticket, xine_ticket_s::release, osd_object_s::renderer, set_argb_layer_ptr(), osd_object_s::video_window_height, osd_object_s::video_window_width, osd_object_s::video_window_x, osd_object_s::video_window_y, osd_object_s::width, osd_object_s::x1, osd_object_s::x2, osd_object_s::y1, and osd_object_s::y2.

Referenced by osd_show_scaled(), and osd_show_unscaled().

## ◆ _update_clipping()

static void _update_clipping | ( | osd_object_t * | osd,
|  | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2
| ) |  |
| static

References osd_object_s::area_touched, MAX, MIN, osd_object_s::x1, osd_object_s::x2, osd_object_s::y1, and osd_object_s::y2.

Referenced by osd_draw_bitmap(), osd_filled_rect(), osd_line(), and osd_point().

## ◆ _x_osd_renderer_init()

osd_renderer_t * _x_osd_renderer_init | ( | xine_stream_t * | stream | ) |

References _, xine_s::basedir_handle, xine_s::config, osd_font_s::filename, lprintf, osd_font_s::name, osd_font_s::next, NULL, osd_clear(), osd_draw_bitmap(), osd_filled_rect(), osd_free_object(), osd_get_capabilities(), osd_get_palette(), osd_get_text_size(), osd_hide(), osd_line(), osd_new_object(), osd_point(), osd_render_text(), osd_renderer_close(), osd_set_argb_buffer(), osd_set_encoding(), osd_set_extent(), osd_set_font(), osd_set_palette(), osd_set_position(), osd_set_text_palette(), osd_set_video_window(), osd_show_scaled(), osd_show_unscaled(), PACKAGE, config_values_s::register_enum, osd_font_s::size, textpalettes_str, update_text_palette(), xine_stream_s::xine, xine_str2uint32(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by xine_stream_new().

## ◆ argb_layer_create()

static argb_layer_t * argb_layer_create | ( |  | ) |
| static

References argb_layer_s::mutex, and NULL.

Referenced by osd_set_argb_buffer().

## ◆ argb_layer_destroy()

static void argb_layer_destroy | ( | argb_layer_t * | argb_layer | ) |
| static

References argb_layer_s::mutex.

Referenced by set_argb_layer_ptr().

## ◆ osd_clear()

static void osd_clear | ( | osd_object_t * | osd | ) |
| static

References osd_object_s::area, osd_object_s::area_touched, osd_object_s::argb_layer, osd_object_s::height, lprintf, argb_layer_s::mutex, osd_object_s::width, osd_object_s::x1, argb_layer_s::x1, osd_object_s::x2, argb_layer_s::x2, osd_object_s::y1, argb_layer_s::y1, osd_object_s::y2, and argb_layer_s::y2.

Referenced by _x_osd_renderer_init().

## ◆ osd_draw_bitmap()

static void osd_draw_bitmap | ( | osd_object_t * | osd,
|  | const uint8_t * | bitmap,
|  | int | x1,
|  | int | y1,
|  | int | width,
|  | int | height,
|  | const uint8_t * | palette_map
| ) |  |
| static

References _update_clipping(), osd_object_s::area, height, lprintf, osd_object_s::width, and width.

Referenced by _x_osd_renderer_init(), and vdr_execute_rpc_command().

## ◆ osd_filled_rect()

static void osd_filled_rect | ( | osd_object_t * | osd,
|  | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2,
|  | int | color
| ) |  |
| static

References _update_clipping(), osd_object_s::area, osd_object_s::height, lprintf, MAX, MIN, and osd_object_s::width.

Referenced by _x_osd_renderer_init().

## ◆ osd_free_encoding()

static void osd_free_encoding | ( | osd_object_t * | osd | ) |
| static

References _x_freep(), and iconv_close.

Referenced by osd_free_object(), and osd_set_encoding().

## ◆ osd_free_ft2()

static void osd_free_ft2 | ( | osd_object_t *osd | __attr_unused | ) |
| inlinestatic

Referenced by osd_free_object().

## ◆ osd_free_object()

static void osd_free_object | ( | osd_object_t * | osd_to_close | ) |
| static

References _x_freep(), xine_ticket_s::acquire, osd_object_s::argb_layer, osd_object_s::handle, NULL, osd_free_encoding(), osd_free_ft2(), osd_hide(), OVERLAY_EVENT_FREE_HANDLE, xine_private_t::port_ticket, xine_ticket_s::release, osd_object_s::renderer, and set_argb_layer_ptr().

Referenced by _x_osd_renderer_init(), and osd_renderer_close().

## ◆ osd_get_capabilities()

static uint32_t osd_get_capabilities | ( | osd_object_t * | osd | ) |
| static

References xine_ticket_s::acquire, xine_private_t::port_ticket, xine_ticket_s::release, osd_object_s::renderer, VO_CAP_ARGB_LAYER_OVERLAY, VO_CAP_CUSTOM_EXTENT_OVERLAY, VO_CAP_UNSCALED_OVERLAY, VO_CAP_VIDEO_WINDOW_OVERLAY, XINE_OSD_CAP_ARGB_LAYER, XINE_OSD_CAP_CUSTOM_EXTENT, XINE_OSD_CAP_FREETYPE2, XINE_OSD_CAP_UNSCALED, and XINE_OSD_CAP_VIDEO_WINDOW.

Referenced by _x_osd_renderer_init().

## ◆ osd_get_palette()

static void osd_get_palette | ( | osd_object_t * | osd,
|  | uint32_t * | color,
|  | uint8_t * | trans
| ) |  |
| static

References osd_object_s::color, and osd_object_s::trans.

Referenced by _x_osd_renderer_init().

## ◆ osd_get_text_size()

static int osd_get_text_size | ( | osd_object_t * | osd,
|  | const char * | text,
|  | int * | width,
|  | int * | height
| ) |  |
| static

References _, osd_object_s::font, FONT_OVERLAP, osd_font_s::fontchar, osd_object_s::ft2, height, osd_fontchar_s::height, ICONV_CONST, KERNING_DEFAULT, lprintf, osd_font_s::num_fontchars, osd_search(), osd_object_s::renderer, osd_font_s::size, width, osd_fontchar_s::width, XINE_VERBOSITY_LOG, and xprintf.

Referenced by _x_osd_renderer_init().

## ◆ osd_hide()

static int osd_hide | ( | osd_object_t * | osd,
|  | int64_t | vpts
| ) |  |
| static

References _osd_hide(), xine_ticket_s::acquire, xine_private_t::port_ticket, xine_ticket_s::release, and osd_object_s::renderer.

Referenced by _x_osd_renderer_init(), osd_free_object(), and vdr_execute_rpc_command().

## ◆ osd_line()

static void osd_line | ( | osd_object_t * | osd,
|  | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2,
|  | int | color
| ) |  |
| static

References _update_clipping(), osd_object_s::area, osd_object_s::height, height, lprintf, osd_object_s::width, and width.

Referenced by _x_osd_renderer_init().

## ◆ osd_lookup_native()

static int osd_lookup_native | ( | osd_object_t * | osd,
|  | const char * | fontname,
|  | int | size
| ) |  |
| static

References osd_object_s::font, osd_renderer_s::fonts, lprintf, osd_font_s::name, osd_font_s::next, osd_object_s::renderer, and osd_font_s::size.

Referenced by osd_set_font().

## ◆ osd_new_object()

static osd_object_t * osd_new_object | ( | osd_renderer_t * | this,
|  | int | width,
|  | int | height
| ) |  |
| static

References osd_object_s::area, osd_object_s::area_touched, osd_object_s::color, osd_object_s::extent_height, osd_object_s::extent_width, osd_object_s::handle, osd_object_s::height, height, lprintf, osd_object_s::next, NULL, osd_object_s::renderer, textpalettes_color, textpalettes_trans, osd_object_s::trans, osd_object_s::video_window_height, osd_object_s::video_window_width, osd_object_s::video_window_x, osd_object_s::video_window_y, osd_object_s::width, width, osd_object_s::x1, osd_object_s::x2, osd_object_s::y1, and osd_object_s::y2.

Referenced by _x_osd_renderer_init().

## ◆ osd_point()

static void osd_point | ( | osd_object_t * | osd,
|  | int | x,
|  | int | y,
|  | int | color
| ) |  |
| static

References _update_clipping(), osd_object_s::area, osd_object_s::height, lprintf, and osd_object_s::width.

Referenced by _x_osd_renderer_init().

## ◆ osd_render_text()

static int osd_render_text | ( | osd_object_t * | osd,
|  | int | x1,
|  | int | y1,
|  | const char * | text,
|  | int | color_base
| ) |  |
| static

References _, osd_object_s::area, osd_object_s::area_touched, osd_fontchar_s::bmp, osd_fontchar_s::code, osd_object_s::font, FONT_OVERLAP, osd_font_s::fontchar, osd_object_s::ft2, FT_LOAD_FLAGS, osd_object_s::height, height, osd_fontchar_s::height, ICONV_CONST, KERNING_DEFAULT, lprintf, osd_font_s::name, osd_font_s::num_fontchars, osd_search(), OVL_PALETTE_SIZE, osd_object_s::renderer, osd_font_s::size, TEXT_PALETTE_SIZE, osd_object_s::width, osd_fontchar_s::width, osd_object_s::x1, osd_object_s::x2, XINE_VERBOSITY_LOG, xprintf, osd_object_s::y1, and osd_object_s::y2.

Referenced by _x_osd_renderer_init().

## ◆ osd_renderer_close()

static void osd_renderer_close | ( | osd_renderer_t * | this_gen | ) |
| static

References _x_freep(), xine_s::config, NULL, osd_free_object(), osd_renderer_unload_font(), and config_values_s::unregister_callbacks.

Referenced by _x_osd_renderer_init().

## ◆ osd_renderer_load_font()

static int osd_renderer_load_font | ( | osd_renderer_t * | this,
|  | const char * | filename
| ) |  |
| static

References _, _X_LE_16, osd_fontchar_s::bmp, osd_fontchar_s::code, osd_font_s::data, osd_font_s::filename, FONT_VERSION, osd_font_s::fontchar, osd_fontchar_s::height, osd_font_s::loaded, lprintf, osd_font_s::name, osd_font_s::next, NULL, osd_font_s::num_fontchars, osd_font_s::size, osd_font_s::version, osd_fontchar_s::width, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by osd_set_font().

## ◆ osd_renderer_unload_font()

static int osd_renderer_unload_font | ( | osd_renderer_t * | this,
|  | const char * | fontname
| ) |  |
| static

References _x_freep(), osd_fontchar_s::bmp, osd_font_s::data, osd_object_s::font, osd_font_s::fontchar, osd_font_s::loaded, lprintf, osd_font_s::name, osd_object_s::next, osd_font_s::next, NULL, and osd_font_s::num_fontchars.

Referenced by osd_renderer_close().

## ◆ osd_search()

static int osd_search | ( | osd_fontchar_t * | array,
|  | size_t | n,
|  | uint16_t | code
| ) |  |
| static

References ALIAS_CHARACTER_FONT, and code.

Referenced by osd_get_text_size(), and osd_render_text().

## ◆ osd_set_argb_buffer()

static void osd_set_argb_buffer | ( | osd_object_t * | osd,
|  | uint32_t * | argb_buffer,
|  | int | dirty_x,
|  | int | dirty_y,
|  | int | dirty_width,
|  | int | dirty_height
| ) |  |
| static

References osd_object_s::argb_layer, argb_layer_create(), argb_layer_s::buffer, osd_object_s::height, MAX, MIN, argb_layer_s::mutex, set_argb_layer_ptr(), osd_object_s::width, osd_object_s::x1, argb_layer_s::x1, osd_object_s::x2, argb_layer_s::x2, osd_object_s::y1, argb_layer_s::y1, osd_object_s::y2, and argb_layer_s::y2.

Referenced by _x_osd_renderer_init().

## ◆ osd_set_encoding()

static int osd_set_encoding | ( | osd_object_t * | osd,
|  | const char * | encoding
| ) |  |
| static

References _, iconv_open, lprintf, NULL, osd_free_encoding(), osd_object_s::renderer, osd_renderer_s::stream, UCS2_ENCODING, xine_stream_s::xine, xine_get_system_encoding(), XINE_VERBOSITY_LOG, and xprintf.

Referenced by _x_osd_renderer_init().

## ◆ osd_set_extent()

static void osd_set_extent | ( | osd_object_t * | osd,
|  | int | extent_width,
|  | int | extent_height
| ) |  |
| static

References osd_object_s::extent_height, and osd_object_s::extent_width.

Referenced by _x_osd_renderer_init().

## ◆ osd_set_font()

static int osd_set_font | ( | osd_object_t * | osd,
|  | const char * | fontname,
|  | int | size
| ) |  |
| static

References osd_font_s::filename, osd_object_s::font, osd_font_s::loaded, lprintf, NULL, osd_lookup_native(), osd_renderer_s::osd_mutex, osd_renderer_load_font(), and osd_object_s::renderer.

Referenced by _x_osd_renderer_init().

## ◆ osd_set_palette()

static void osd_set_palette | ( | osd_object_t * | osd,
|  | const uint32_t * | color,
|  | const uint8_t * | trans
| ) |  |
| static

References osd_object_s::color, and osd_object_s::trans.

Referenced by _x_osd_renderer_init().

## ◆ osd_set_position()

static void osd_set_position | ( | osd_object_t * | osd,
|  | int | x,
|  | int | y
| ) |  |
| static

References osd_object_s::display_x, and osd_object_s::display_y.

Referenced by _x_osd_renderer_init(), and vdr_execute_rpc_command().

## ◆ osd_set_text_palette()

static void osd_set_text_palette | ( | osd_object_t * | osd,
|  | int | palette_number,
|  | int | color_base
| ) |  |
| static

References osd_object_s::color, OVL_PALETTE_SIZE, osd_object_s::renderer, TEXT_PALETTE_SIZE, osd_renderer_s::textpalette, textpalettes_color, textpalettes_trans, and osd_object_s::trans.

Referenced by _x_osd_renderer_init().

## ◆ osd_set_video_window()

static void osd_set_video_window | ( | osd_object_t * | osd,
|  | int | window_x,
|  | int | window_y,
|  | int | window_width,
|  | int | window_height
| ) |  |
| static

References osd_object_s::video_window_height, osd_object_s::video_window_width, osd_object_s::video_window_x, and osd_object_s::video_window_y.

Referenced by _x_osd_renderer_init().

## ◆ osd_show_scaled()

static int osd_show_scaled | ( | osd_object_t * | osd,
|  | int64_t | vpts
| ) |  |
| static

References _osd_show().

Referenced by _x_osd_renderer_init().

## ◆ osd_show_unscaled()

static int osd_show_unscaled | ( | osd_object_t * | osd,
|  | int64_t | vpts
| ) |  |
| static

References _osd_show().

Referenced by _x_osd_renderer_init().

## ◆ set_argb_layer_ptr()

void set_argb_layer_ptr | ( | argb_layer_t ** | dst,
|  | argb_layer_t * | src
| ) |  |

References argb_layer_destroy(), argb_layer_s::mutex, and argb_layer_s::ref_count.

Referenced by _osd_show(), internal_video_overlay_free_handle(), osd_free_object(), osd_set_argb_buffer(), and video_overlay_event().

## ◆ update_text_palette()

static void update_text_palette | ( | void * | this_gen,
|  | xine_cfg_entry_t * | entry
| ) |  |
| static

References lprintf, xine_cfg_entry_s::num_value, and textpalettes_str.

Referenced by _x_osd_renderer_init().

## Variable Documentation

## ◆ textpalettes_color

const clut_t textpalettes_color[NUMBER_OF_TEXT_PALETTES][TEXT_PALETTE_SIZE]
| static

Referenced by osd_new_object(), and osd_set_text_palette().

## ◆ textpalettes_str

const char* const textpalettes_str[NUMBER_OF_TEXT_PALETTES+1]
| static

Initial value:
= {
"white-black-transparent",
"white-none-transparent",
"white-none-translucid",
"yellow-black-transparent",
NULL}
NULL
NULL
Definition: xine_plugin.c:78

Referenced by _x_osd_renderer_init(), and update_text_palette().

## ◆ textpalettes_trans

const uint8_t textpalettes_trans[NUMBER_OF_TEXT_PALETTES][TEXT_PALETTE_SIZE]
| static

Initial value:
= {
{0, 0, 3, 6, 8, 10, 12, 14, 15, 15, 15 },
{0, 0, 0, 0, 0, 0, 2, 6, 9, 12, 15 },
{0, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15 },
{0, 0, 3, 6, 8, 10, 12, 14, 15, 15, 15 },
}

Referenced by osd_new_object(), and osd_set_text_palette().