summaryrefslogtreecommitdiff
path: root/src/xine-engine/osd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine/osd.c')
-rw-r--r--src/xine-engine/osd.c308
1 files changed, 154 insertions, 154 deletions
diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c
index 48b44ca4c..73fe76a0a 100644
--- a/src/xine-engine/osd.c
+++ b/src/xine-engine/osd.c
@@ -1,18 +1,18 @@
/*
* Copyright (C) 2000-2005 the xine project
- *
+ *
* This file is part of xine, a free video player.
- *
+ *
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -102,10 +102,10 @@ static const char *const textpalettes_str[NUMBER_OF_TEXT_PALETTES+1] = {
"white-black-transparent",
"white-none-transparent",
"white-none-translucid",
- "yellow-black-transparent",
+ "yellow-black-transparent",
NULL};
-/*
+/*
Palette entries as used by osd fonts:
0: not used by font, always transparent
@@ -116,10 +116,10 @@ static const char *const textpalettes_str[NUMBER_OF_TEXT_PALETTES+1] = {
6: font border. if the font is to be displayed without border this
will probably be adjusted to font background or near.
7-9: transition between border and foreground
- 10: font color (foreground)
+ 10: font color (foreground)
*/
-/*
+/*
The palettes below were made by hand, ie, i just throw
values that seemed to do the transitions i wanted.
This can surelly be improved a lot. [Miguel]
@@ -207,7 +207,7 @@ struct osd_font_s {
uint16_t size;
uint16_t num_fontchars;
uint16_t loaded;
-};
+};
#ifdef HAVE_FT2
struct osd_ft2context_s {
@@ -241,11 +241,11 @@ static inline void osd_free_ft2 (osd_object_t *osd __attr_unused) {}
*/
static osd_object_t *XINE_MALLOC osd_new_object (osd_renderer_t *this, int width, int height) {
-
+
osd_object_t *osd;
-
- pthread_mutex_lock (&this->osd_mutex);
-
+
+ pthread_mutex_lock (&this->osd_mutex);
+
osd = calloc(1, sizeof(osd_object_t));
osd->renderer = this;
osd->next = this->osds;
@@ -256,12 +256,12 @@ static osd_object_t *XINE_MALLOC osd_new_object (osd_renderer_t *this, int width
osd->video_window_width = 0;
osd->video_window_height = 0;
osd->extent_width = 0;
- osd->extent_height = 0;
+ osd->extent_height = 0;
osd->width = width;
osd->height = height;
osd->area = calloc(width, height);
osd->area_touched = 0;
-
+
osd->x1 = osd->argb_layer.x1 = width;
osd->y1 = osd->argb_layer.y1 = height;
osd->x2 = osd->argb_layer.x2 = 0;
@@ -269,8 +269,8 @@ static osd_object_t *XINE_MALLOC osd_new_object (osd_renderer_t *this, int width
pthread_mutex_init(&osd->argb_layer.mutex, NULL);
- memcpy(osd->color, textpalettes_color[0], sizeof(textpalettes_color[0]));
- memcpy(osd->trans, textpalettes_trans[0], sizeof(textpalettes_trans[0]));
+ memcpy(osd->color, textpalettes_color[0], sizeof(textpalettes_color[0]));
+ memcpy(osd->trans, textpalettes_trans[0], sizeof(textpalettes_trans[0]));
osd->handle = -1;
@@ -278,11 +278,11 @@ static osd_object_t *XINE_MALLOC osd_new_object (osd_renderer_t *this, int width
osd->cd = (iconv_t)-1;
osd->encoding = NULL;
#endif
-
- pthread_mutex_unlock (&this->osd_mutex);
+
+ pthread_mutex_unlock (&this->osd_mutex);
lprintf("osd=%p size: %dx%d\n", osd, width, height);
-
+
return osd;
}
@@ -324,7 +324,7 @@ static int _osd_hide (osd_object_t *osd, int64_t vpts);
* the object is not changed. there may be subsequent drawing on it.
*/
static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) {
-
+
osd_renderer_t *this = osd->renderer;
video_overlay_manager_t *ovl_manager;
rle_elem_t rle, *rle_p=0;
@@ -332,21 +332,21 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) {
uint8_t *c;
lprintf("osd=%p vpts=%"PRId64"\n", osd, vpts);
-
+
this->stream->xine->port_ticket->acquire(this->stream->xine->port_ticket, 1);
-
+
ovl_manager = this->stream->video_out->get_overlay_manager(this->stream->video_out);
-
+
if( osd->handle < 0 ) {
if( (osd->handle = ovl_manager->get_handle(ovl_manager, 0)) == -1 ) {
this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 1);
return 0;
}
}
-
- pthread_mutex_lock (&this->osd_mutex);
-
- /* clip update area to allowed range */
+
+ pthread_mutex_lock (&this->osd_mutex);
+
+ /* clip update area to allowed range */
if(osd->x1 > osd->width)
osd->x1 = osd->width;
if(osd->x2 > osd->width)
@@ -360,13 +360,13 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) {
if(osd->y1 < 0) osd->y1 = 0;
if(osd->y2 < 0) osd->y2 = 0;
-#ifdef DEBUG_RLE
+#ifdef DEBUG_RLE
lprintf("osd_show %p rle starts\n", osd);
-#endif
+#endif
/* check if osd is valid (something drawn on it) */
if( osd->x2 > osd->x1 && osd->y2 > osd->y1 ) {
-
+
this->event.object.handle = osd->handle;
memset( this->event.object.overlay, 0, sizeof(*this->event.object.overlay) );
@@ -386,12 +386,12 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) {
this->event.object.overlay->extent_width = osd->extent_width;
this->event.object.overlay->extent_height = osd->extent_height;
-
+
this->event.object.overlay->hili_top = 0;
this->event.object.overlay->hili_bottom = this->event.object.overlay->height;
this->event.object.overlay->hili_left = 0;
this->event.object.overlay->hili_right = this->event.object.overlay->width;
-
+
/* there will be at least that many rle objects (one for each row) */
this->event.object.overlay->num_rle = 0;
if (!osd->area_touched) {
@@ -403,13 +403,13 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) {
Rely on lazy page allocation to avoid us actually taking up
this much RAM */
this->event.object.overlay->data_size = osd->width * osd->height;
- rle_p = this->event.object.overlay->rle =
+ rle_p = this->event.object.overlay->rle =
malloc(this->event.object.overlay->data_size * sizeof(rle_elem_t) );
-
+
for( y = osd->y1; y < osd->y2; y++ ) {
-#ifdef DEBUG_RLE
+#ifdef DEBUG_RLE
lprintf("osd_show %p y = %d: ", osd, y);
-#endif
+#endif
c = osd->area + y * osd->width + osd->x1;
/* initialize a rle object with the first pixel's color */
@@ -419,17 +419,17 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) {
/* loop over the remaining pixels in the row */
for( x = osd->x1 + rle.len; x < osd->x2; x++, c++ ) {
if( rle.color != *c ) {
-#ifdef DEBUG_RLE
+#ifdef DEBUG_RLE
lprintf("(%d, %d), ", rle.len, rle.color);
#endif
*rle_p++ = rle;
- this->event.object.overlay->num_rle++;
+ this->event.object.overlay->num_rle++;
rle.color = *c;
rle.len = 1;
} else {
rle.len++;
- }
+ }
}
#ifdef DEBUG_RLE
lprintf("(%d, %d)\n", rle.len, rle.color);
@@ -441,13 +441,13 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) {
lprintf("osd_show %p rle ends\n", osd);
#endif
lprintf("num_rle = %d\n", this->event.object.overlay->num_rle);
-
- memcpy(this->event.object.overlay->hili_color, osd->color, sizeof(osd->color));
- memcpy(this->event.object.overlay->hili_trans, osd->trans, sizeof(osd->trans));
- memcpy(this->event.object.overlay->color, osd->color, sizeof(osd->color));
- memcpy(this->event.object.overlay->trans, osd->trans, sizeof(osd->trans));
+
+ memcpy(this->event.object.overlay->hili_color, osd->color, sizeof(osd->color));
+ memcpy(this->event.object.overlay->hili_trans, osd->trans, sizeof(osd->trans));
+ memcpy(this->event.object.overlay->color, osd->color, sizeof(osd->color));
+ memcpy(this->event.object.overlay->trans, osd->trans, sizeof(osd->trans));
}
-
+
this->event.event_type = OVERLAY_EVENT_SHOW;
this->event.vpts = vpts;
ovl_manager->add_event(ovl_manager, (void *)&this->event);
@@ -455,10 +455,10 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) {
/* osd empty - hide it */
_osd_hide(osd, vpts);
}
- pthread_mutex_unlock (&this->osd_mutex);
-
+ pthread_mutex_unlock (&this->osd_mutex);
+
this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 1);
-
+
return 1;
}
@@ -480,24 +480,24 @@ static int osd_show_unscaled (osd_object_t *osd, int64_t vpts) {
* send event to hide osd at given pts (0=now)
* the object is not changed. there may be subsequent drawing on it.
*/
-static int _osd_hide (osd_object_t *osd, int64_t vpts) {
+static int _osd_hide (osd_object_t *osd, int64_t vpts) {
osd_renderer_t *this = osd->renderer;
video_overlay_manager_t *ovl_manager;
-
+
lprintf("osd=%p vpts=%"PRId64"\n",osd, vpts);
-
+
if( osd->handle < 0 )
return 0;
-
+
this->event.object.handle = osd->handle;
-
+
/* not really needed this, but good pratice to clean it up */
memset( this->event.object.overlay, 0, sizeof(this->event.object.overlay) );
-
+
this->event.event_type = OVERLAY_EVENT_HIDE;
this->event.vpts = vpts;
-
+
ovl_manager = this->stream->video_out->get_overlay_manager(this->stream->video_out);
ovl_manager->add_event(ovl_manager, (void *)&this->event);
@@ -546,14 +546,14 @@ static void osd_clear (osd_object_t *osd) {
static void osd_point (osd_object_t *osd, int x, int y, int color) {
uint8_t *c;
-
+
lprintf("osd=%p (%d x %d)\n", osd, x, y);
-
+
if (x < 0 || x >= osd->width)
return;
if (y < 0 || y >= osd->height)
return;
-
+
/* update clipping area */
osd->x1 = MIN(osd->x1, x);
osd->x2 = MAX(osd->x2, (x + 1));
@@ -571,14 +571,14 @@ 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) {
-
+
uint8_t *c;
int dx, dy, t, inc, d, inc1, inc2;
int swap_x = 0;
int swap_y = 0;
lprintf("osd=%p (%d,%d)-(%d,%d)\n",osd, x1,y1, x2,y2 );
-
+
/* sort line */
if (x2 < x1) {
t = x1;
@@ -593,7 +593,7 @@ static void osd_line (osd_object_t *osd,
swap_y = 1;
}
- /* clip line */
+ /* clip line */
if (x1 < 0) {
y1 = y1 + (y2-y1) * -x1 / (x2-x1);
x1 = 0;
@@ -610,20 +610,20 @@ static void osd_line (osd_object_t *osd,
x2 = x1 + (x2-x1) * (osd->height-y1) / (y2-y1);
y2 = osd->height;
}
-
+
if (x1 >= osd->width || y1 >= osd->height)
return;
-
+
/* update clipping area */
osd->x1 = MIN( osd->x1, x1 );
osd->x2 = MAX( osd->x2, x2 );
osd->y1 = MIN( osd->y1, y1 );
osd->y2 = MAX( osd->y2, y2 );
osd->area_touched = 1;
-
+
dx = x2 - x1;
dy = y2 - y1;
-
+
/* unsort line */
if (swap_x) {
t = x1;
@@ -642,7 +642,7 @@ static void osd_line (osd_object_t *osd,
t = x2; x2 = x1; x1 = t;
t = y2; y2 = y1; y1 = t;
}
-
+
if( y2 > y1 ) inc = 1; else inc = -1;
inc1 = 2*dy;
@@ -650,11 +650,11 @@ static void osd_line (osd_object_t *osd,
inc2 = 2*(dy-dx);
c = osd->area + y1 * osd->width + x1;
-
+
while(x1<x2)
{
*c++ = color;
-
+
x1++;
if( d<0 ) {
d+=inc1;
@@ -679,8 +679,8 @@ static void osd_line (osd_object_t *osd,
c = osd->area + y1 * osd->width + x1;
while(y1<y2) {
- *c = color;
-
+ *c = color;
+
c += osd->width;
y1++;
if( d<0 ) {
@@ -705,17 +705,17 @@ static void osd_filled_rect (osd_object_t *osd,
int x, y, dx, dy;
lprintf("osd=%p (%d,%d)-(%d,%d)\n",osd, x1,y1, x2,y2 );
-
+
/* sort rectangle */
x = MIN( x1, x2 );
dx = MAX( x1, x2 );
y = MIN( y1, y2 );
dy = MAX( y1, y2 );
-
+
/* clip rectangle */
if (x >= osd->width || y >= osd->height)
return;
-
+
if (x < 0) {
dx += x;
x = 0;
@@ -727,7 +727,7 @@ static void osd_filled_rect (osd_object_t *osd,
dx = MIN( dx, osd->width );
dy = MIN( dy, osd->height );
-
+
/* update clipping area */
osd->x1 = MIN( osd->x1, x );
osd->x2 = MAX( osd->x2, dx );
@@ -754,7 +754,7 @@ static void osd_set_palette(osd_object_t *osd, const uint32_t *color, const uint
}
/*
- * set on existing text palette
+ * set on existing text palette
* (-1 to set user specified palette)
*/
@@ -773,7 +773,7 @@ static void osd_set_text_palette(osd_object_t *osd, int palette_number,
memcpy(&osd->color[color_base], textpalettes_color[palette_number],
sizeof(textpalettes_color[palette_number]));
memcpy(&osd->trans[color_base], textpalettes_trans[palette_number],
- sizeof(textpalettes_trans[palette_number]));
+ sizeof(textpalettes_trans[palette_number]));
}
@@ -809,7 +809,7 @@ static uint16_t gzread_i16(gzFile *fp) {
}
/*
- load bitmap font into osd engine
+ load bitmap font into osd engine
*/
static int osd_renderer_load_font(osd_renderer_t *this, char *filename) {
@@ -817,7 +817,7 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) {
gzFile *fp;
osd_font_t *font = NULL;
int i, ret = 0;
-
+
lprintf("name=%s\n", filename );
/* load quick & dirt font format */
@@ -828,36 +828,36 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) {
gzread(fp, font->name, sizeof(font->name) );
font->version = gzread_i16(fp);
-
+
if( font->version == FONT_VERSION ) {
-
+
font->size = gzread_i16(fp);
font->num_fontchars = gzread_i16(fp);
font->loaded = 1;
-
+
font->fontchar = malloc( sizeof(osd_fontchar_t) * font->num_fontchars );
-
+
lprintf("font '%s' chars=%d\n", font->name, font->num_fontchars);
-
+
/* load all characters */
for( i = 0; i < font->num_fontchars; i++ ) {
font->fontchar[i].code = gzread_i16(fp);
font->fontchar[i].width = gzread_i16(fp);
font->fontchar[i].height = gzread_i16(fp);
font->fontchar[i].bmp = malloc(font->fontchar[i].width*font->fontchar[i].height);
- if( gzread(fp, font->fontchar[i].bmp,
+ if( gzread(fp, font->fontchar[i].bmp,
font->fontchar[i].width*font->fontchar[i].height) <= 0 )
break;
}
-
+
/* check if all expected characters were loaded */
if( i == font->num_fontchars ) {
osd_font_t *known_font;
ret = 1;
-
+
lprintf("font '%s' loaded\n",font->name);
-
- /* check if font is already known to us */
+
+ /* check if font is already known to us */
known_font = this->fonts;
while( known_font ) {
if( !strcasecmp(known_font->name,font->name) &&
@@ -865,16 +865,16 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) {
break;
known_font = known_font->next;
}
-
+
if( !known_font ) {
-
+
/* new font, add it to list */
font->filename = strdup(filename);
font->next = this->fonts;
this->fonts = font;
-
+
} else {
-
+
if( !known_font->loaded ) {
/* the font was preloaded before.
* add loaded characters to the existing entry.
@@ -885,7 +885,7 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) {
known_font->fontchar = font->fontchar;
free(font);
} else {
- xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
+ xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
_("font '%s-%d' already loaded, weird.\n"), font->name, font->size);
while( --i >= 0 ) {
free(font->fontchar[i].bmp);
@@ -893,13 +893,13 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) {
free(font->fontchar);
free(font);
}
-
+
}
} else {
-
+
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
_("font '%s' loading failed (%d < %d)\n") ,font->name, i, font->num_fontchars);
-
+
while( --i >= 0 ) {
free(font->fontchar[i].bmp);
}
@@ -925,13 +925,13 @@ static int osd_renderer_unload_font(osd_renderer_t *this, char *fontname ) {
osd_font_t *font, *last;
osd_object_t *osd;
int i, ret = 0;
-
+
lprintf("font '%s'\n", fontname);
pthread_mutex_lock (&this->osd_mutex);
osd = this->osds;
- while( osd ) {
+ while( osd ) {
if( !strcasecmp(osd->font->name, fontname) )
osd->font = NULL;
osd = osd->next;
@@ -943,14 +943,14 @@ static int osd_renderer_unload_font(osd_renderer_t *this, char *fontname ) {
if ( !strcasecmp(font->name,fontname) ) {
free( font->filename );
-
+
if( font->loaded ) {
for( i = 0; i < font->num_fontchars; i++ ) {
free( font->fontchar[i].bmp );
}
free( font->fontchar );
}
-
+
if( last )
last->next = font->next;
else
@@ -991,7 +991,7 @@ static int osd_lookup_fontconfig( osd_object_t *osd, const char *const fontname,
match = FcFontMatch(NULL, pat, &result);
FcPatternDestroy(pat);
-
+
if ( ! match ) {
FcFontSetDestroy(fs);
xprintf(osd->renderer->stream->xine, XINE_VERBOSITY_LOG,
@@ -1052,7 +1052,7 @@ static int osd_lookup_xdg( osd_object_t *osd, const char *const fontname ) {
data_dirs++;
}
- xprintf(osd->renderer->stream->xine, XINE_VERBOSITY_LOG,
+ xprintf(osd->renderer->stream->xine, XINE_VERBOSITY_LOG,
_("osd: error loading font %s with in XDG data directories.\n"), fontname);
return 0;
}
@@ -1073,7 +1073,7 @@ static int osd_set_font_freetype2( osd_object_t *osd, const char *fontname, int
FT_Done_Face (osd->ft2->face);
osd->ft2->face = NULL;
}
-
+
do { /* while 0 */
#ifdef HAVE_FONTCONFIG
if ( osd_lookup_fontconfig(osd, fontname, size) )
@@ -1102,11 +1102,11 @@ static int osd_set_font_freetype2( osd_object_t *osd, const char *fontname, int
set the font of osd object
*/
-static int osd_set_font( osd_object_t *osd, const char *fontname, int size) {
+static int osd_set_font( osd_object_t *osd, const char *fontname, int size) {
int ret = 1;
lprintf("osd=%p font '%s'\n", osd, fontname);
-
+
pthread_mutex_lock (&osd->renderer->osd_mutex);
#ifdef HAVE_FT2
@@ -1121,7 +1121,7 @@ static int osd_set_font( osd_object_t *osd, const char *fontname, int size) {
font = osd->renderer->fonts;
while( font ) {
- if( !strcasecmp(font->name, fontname) && (size>=font->size)
+ if( !strcasecmp(font->name, fontname) && (size>=font->size)
&& (best<font->size)) {
ret = 1;
osd->font = font;
@@ -1137,7 +1137,7 @@ static int osd_set_font( osd_object_t *osd, const char *fontname, int size) {
ret = osd_renderer_load_font(osd->renderer, osd->font->filename);
if(!ret)
osd->font = NULL;
- }
+ }
}
pthread_mutex_unlock (&osd->renderer->osd_mutex);
@@ -1167,29 +1167,29 @@ static int osd_search(osd_fontchar_t *array, size_t n, uint16_t code) {
if (array[right].code == code)
return right;
- else
+ else
return ALIAS_CHARACTER_FONT < n ? ALIAS_CHARACTER_FONT : n;
#else
size_t i;
-
+
for( i = 0; i < n; i++ ) {
if( font->fontchar[i].code == unicode )
break;
}
- if (i < n)
+ if (i < n)
return i;
- else
+ else
return ALIAS_CHARACTER_FONT < n ? ALIAS_CHARACTER_FONT : n;
#endif
}
#ifdef HAVE_ICONV
-/*
- * get next unicode value
+/*
+ * get next unicode value
*/
-static uint16_t osd_iconv_getunicode(xine_t *xine,
+static uint16_t osd_iconv_getunicode(xine_t *xine,
iconv_t cd, const char *encoding, ICONV_CONST char **inbuf,
size_t *inbytesleft) {
uint16_t unicode;
@@ -1241,7 +1241,7 @@ static void osd_free_encoding(osd_object_t *osd) {
/*
- * set encoding of text
+ * set encoding of text
*
* NULL ... no conversion (iso-8859-1)
* "" ... locale encoding
@@ -1306,7 +1306,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
#endif
lprintf("osd=%p (%d,%d) \"%s\"\n", osd, x1, y1, text);
-
+
/* some sanity checks for the color indices */
if( color_base < 0 )
color_base = 0;
@@ -1322,7 +1322,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
#ifdef HAVE_FT2
if (osd->ft2) proceed = 1;
#endif
-
+
if (proceed == 0) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("osd: font isn't defined\n"));
pthread_mutex_unlock(&this->osd_mutex);
@@ -1336,10 +1336,10 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
inbuf = text;
inbytesleft = strlen(text);
-
+
while( inbytesleft ) {
#ifdef HAVE_ICONV
- unicode = osd_iconv_getunicode(this->stream->xine, osd->cd, osd->encoding,
+ unicode = osd_iconv_getunicode(this->stream->xine, osd->cd, osd->encoding,
(ICONV_CONST char **)&inbuf, &inbytesleft);
#else
unicode = inbuf[0];
@@ -1397,7 +1397,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
while (s < src + slot->bitmap.width) {
if ((d >= dst) && (d < dst + osd->width) && *s)
*d = (uint8_t)(*s/25) + (uint8_t) color_base;
-
+
d++;
s++;
}
@@ -1416,15 +1416,15 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
#endif
i = osd_search(font->fontchar, font->num_fontchars, unicode);
-
- lprintf("font '%s' [%d, U+%04X == U+%04X] %dx%d -> %d,%d\n", font->name, i,
- unicode, font->fontchar[i].code, font->fontchar[i].width,
+
+ lprintf("font '%s' [%d, U+%04X == U+%04X] %dx%d -> %d,%d\n", font->name, i,
+ unicode, font->fontchar[i].code, font->fontchar[i].width,
font->fontchar[i].height, x1, y1);
-
+
if ( i != font->num_fontchars ) {
dst = osd->area + y1 * osd->width;
src = font->fontchar[i].bmp;
-
+
for( y = 0; y < font->fontchar[i].height; y++ ) {
uint8_t *s = src;
uint8_t *d = dst + x1;
@@ -1436,7 +1436,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
while (s < src + font->fontchar[i].width) {
if((d >= dst) && (d < dst + osd->width) && (*s > 1)) /* skip drawing transparency */
*d = *s + (uint8_t) color_base;
-
+
d++;
s++;
}
@@ -1444,12 +1444,12 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
dst += osd->width;
}
x1 += font->fontchar[i].width - (font->fontchar[i].width * FONT_OVERLAP);
-
+
if( x1 > osd->x2 ) osd->x2 = x1;
- if( y1 + font->fontchar[i].height > osd->y2 )
+ if( y1 + font->fontchar[i].height > osd->y2 )
osd->y2 = y1 + font->fontchar[i].height;
}
-
+
#ifdef HAVE_FT2
} /* !(osd->ft2) */
#endif
@@ -1481,7 +1481,7 @@ static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, in
#endif
lprintf("osd=%p \"%s\"\n", osd, text);
-
+
pthread_mutex_lock (&this->osd_mutex);
{
@@ -1491,7 +1491,7 @@ static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, in
#ifdef HAVE_FT2
if (osd->ft2) proceed = 1;
#endif
-
+
if (proceed == 0) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("osd: font isn't defined\n"));
pthread_mutex_unlock(&this->osd_mutex);
@@ -1504,10 +1504,10 @@ static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, in
inbuf = text;
inbytesleft = strlen(text);
-
+
while( inbytesleft ) {
#ifdef HAVE_ICONV
- unicode = osd_iconv_getunicode(this->stream->xine, osd->cd, osd->encoding,
+ unicode = osd_iconv_getunicode(this->stream->xine, osd->cd, osd->encoding,
(ICONV_CONST char **)&inbuf, &inbytesleft);
#else
unicode = inbuf[0];
@@ -1598,7 +1598,7 @@ static void osd_preload_fonts (osd_renderer_t *this, char *path) {
int len;
len = strlen (entry->d_name);
-
+
if ( (len > 12) && !strncmp (&entry->d_name[len-12], ".xinefont.gz", 12)) {
s = strdup(entry->d_name);
@@ -1609,15 +1609,15 @@ static void osd_preload_fonts (osd_renderer_t *this, char *path) {
*p++ = '\0';
font = calloc(1, sizeof(osd_font_t) );
-
+
strncpy(font->name, s, sizeof(font->name));
font->size = atoi(p);
- lprintf("font '%s' size %d is preloaded\n",
+ lprintf("font '%s' size %d is preloaded\n",
font->name, font->size);
asprintf (&font->filename, "%s/%s", path, entry->d_name);
-
+
font->next = this->fonts;
this->fonts = font;
}
@@ -1634,30 +1634,30 @@ static void osd_preload_fonts (osd_renderer_t *this, char *path) {
*/
static void osd_free_object (osd_object_t *osd_to_close) {
-
+
osd_renderer_t *this = osd_to_close->renderer;
video_overlay_manager_t *ovl_manager;
osd_object_t *osd, *last;
if( osd_to_close->handle >= 0 ) {
osd_hide(osd_to_close,0);
-
+
this->event.object.handle = osd_to_close->handle;
-
+
/* not really needed this, but good pratice to clean it up */
memset( this->event.object.overlay, 0, sizeof(this->event.object.overlay) );
this->event.event_type = OVERLAY_EVENT_FREE_HANDLE;
this->event.vpts = 0;
-
+
this->stream->xine->port_ticket->acquire(this->stream->xine->port_ticket, 1);
ovl_manager = this->stream->video_out->get_overlay_manager(this->stream->video_out);
ovl_manager->add_event(ovl_manager, (void *)&this->event);
this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 1);
-
+
osd_to_close->handle = -1; /* handle will be freed */
}
-
- pthread_mutex_lock (&this->osd_mutex);
+
+ pthread_mutex_lock (&this->osd_mutex);
last = NULL;
osd = this->osds;
@@ -1667,7 +1667,7 @@ static void osd_free_object (osd_object_t *osd_to_close) {
osd_free_ft2 (osd);
osd_free_encoding(osd);
-
+
if( last )
last->next = osd->next;
else
@@ -1680,7 +1680,7 @@ static void osd_free_object (osd_object_t *osd_to_close) {
last = osd;
osd = osd->next;
}
- pthread_mutex_unlock (&this->osd_mutex);
+ pthread_mutex_unlock (&this->osd_mutex);
}
static void osd_renderer_close (osd_renderer_t *this) {
@@ -1768,7 +1768,7 @@ static void osd_set_argb_buffer(osd_object_t *osd, uint32_t *argb_buffer,
}
static uint32_t osd_get_capabilities (osd_object_t *osd) {
-
+
osd_renderer_t *this = osd->renderer;
uint32_t capabilities = 0;
uint32_t vo_capabilities;
@@ -1786,14 +1786,14 @@ static uint32_t osd_get_capabilities (osd_object_t *osd) {
if (vo_capabilities & VO_CAP_CUSTOM_EXTENT_OVERLAY)
capabilities |= XINE_OSD_CAP_CUSTOM_EXTENT;
-
+
if (vo_capabilities & VO_CAP_ARGB_LAYER_OVERLAY)
capabilities |= XINE_OSD_CAP_ARGB_LAYER;
if (vo_capabilities & VO_CAP_VIDEO_WINDOW_OVERLAY)
capabilities |= XINE_OSD_CAP_VIDEO_WINDOW;
- return capabilities;
+ return capabilities;
}
@@ -1805,7 +1805,7 @@ osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) {
osd_renderer_t *this;
- this = calloc(1, sizeof(osd_renderer_t));
+ this = calloc(1, sizeof(osd_renderer_t));
this->stream = stream;
this->event.object.overlay = calloc(1, sizeof(vo_overlay_t));
@@ -1826,20 +1826,20 @@ osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) {
osd_preload_fonts(this, fontpath);
free(fontpath);
-
+
data_dirs++;
}
}
this->textpalette = this->stream->xine->config->register_enum (this->stream->xine->config,
"ui.osd.text_palette", 0,
- textpalettes_str,
+ textpalettes_str,
_("palette (foreground-border-background) to use for subtitles and OSD"),
_("The palette for on-screen-display and some subtitle formats that do "
"not specify any colouring themselves. The palettes are listed in the "
"form: foreground-border-background."),
10, update_text_palette, this);
-
+
/*
* set up function pointer
*/