xine-lib 1.2.13-20230125hg15249
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_tosd_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_targb_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   '_'

Referenced by osd_search().

◆ CLIP0MAX

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

Referenced by _osd_show().

◆ FONT_OVERLAP

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

◆ FONT_VERSION

#define FONT_VERSION   2

Referenced by osd_renderer_load_font().

◆ FT_LOAD_FLAGS

#define FT_LOAD_FLAGS   (FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING)

Referenced by osd_render_text().

◆ 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"

Referenced by osd_set_encoding().

Typedef Documentation

◆ osd_fontchar_t

Function Documentation

◆ _osd_hide()

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

◆ _osd_show()

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

◆ _update_clipping()

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

◆ _x_osd_renderer_init()

osd_renderer_t * _x_osd_renderer_init ( xine_stream_t * stream)

◆ 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

◆ 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

◆ osd_filled_rect()

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

◆ 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

◆ osd_get_capabilities()

static uint32_t osd_get_capabilities ( osd_object_t * osd)
static

◆ osd_get_palette()

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

◆ osd_get_text_size()

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

◆ osd_hide()

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

◆ osd_line()

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

◆ osd_lookup_native()

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

◆ osd_new_object()

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

◆ osd_point()

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

◆ osd_render_text()

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

◆ osd_renderer_close()

static void osd_renderer_close ( osd_renderer_t * this_gen)
static

◆ osd_renderer_load_font()

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

◆ osd_renderer_unload_font()

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

◆ 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

◆ osd_set_encoding()

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

◆ osd_set_extent()

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

◆ osd_set_font()

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

◆ osd_set_palette()

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

◆ osd_set_position()

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

◆ osd_set_text_palette()

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

◆ 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

◆ 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 )

◆ update_text_palette()

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

Variable Documentation

◆ textpalettes_color

const clut_t textpalettes_color[NUMBER_OF_TEXT_PALETTES][TEXT_PALETTE_SIZE]
static

◆ 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
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().