summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xine-engine/osd.c28
-rw-r--r--src/xine-engine/osd.h39
-rw-r--r--src/xine-engine/xine_interface.c70
3 files changed, 105 insertions, 32 deletions
diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c
index 1db60b349..7e427be29 100644
--- a/src/xine-engine/osd.c
+++ b/src/xine-engine/osd.c
@@ -54,26 +54,6 @@
#endif
#define MIN(a,b) ( (a) < (b) ) ? (a) : (b)
-struct osd_object_s {
- osd_object_t *next;
- osd_renderer_t *renderer;
-
- int width, height; /* work area dimentions */
- uint8_t *area; /* work area */
- int display_x,display_y; /* where to display it in screen */
-
- /* clipping box inside work area */
- int x1, y1;
- int x2, y2;
-
- uint32_t color[OVL_PALETTE_SIZE]; /* color lookup table */
- uint8_t trans[OVL_PALETTE_SIZE]; /* mixer key table */
-
- int32_t handle;
-
- osd_font_t *font;
-};
-
typedef struct osd_fontchar_s {
uint16_t code;
uint16_t width;
@@ -393,7 +373,7 @@ static void osd_filled_rect (osd_object_t *osd,
* set palette (color and transparency)
*/
-static void osd_set_palette(osd_object_t *osd, uint32_t *color, uint8_t *trans ) {
+static void osd_set_palette(osd_object_t *osd, const uint32_t *color, const uint8_t *trans ) {
memcpy(osd->color, color, sizeof(osd->color));
memcpy(osd->trans, trans, sizeof(osd->trans));
@@ -573,7 +553,7 @@ static int osd_renderer_unload_font(osd_renderer_t *this, char *fontname ) {
set the font of osd object
*/
-static int osd_set_font( osd_object_t *osd, char *fontname, int size) {
+static int osd_set_font( osd_object_t *osd, const char *fontname, int size) {
osd_renderer_t *this = osd->renderer;
osd_font_t *font;
@@ -614,7 +594,7 @@ static int osd_set_font( osd_object_t *osd, char *fontname, int size) {
* no \n yet
*/
static int osd_render_text (osd_object_t *osd, int x1, int y1,
- char *text, int color_base) {
+ const char *text, int color_base) {
osd_renderer_t *this = osd->renderer;
osd_font_t *font;
@@ -682,7 +662,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
/*
get width and height of how text will be renderized
*/
-static int osd_get_text_size(osd_object_t *osd, char *text, int *width, int *height) {
+static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, int *height) {
osd_renderer_t *this = osd->renderer;
osd_font_t *font;
diff --git a/src/xine-engine/osd.h b/src/xine-engine/osd.h
index c3e61106f..26b53bdad 100644
--- a/src/xine-engine/osd.h
+++ b/src/xine-engine/osd.h
@@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* OSD stuff (text and graphic primitives)
- * $Id: osd.h,v 1.10 2002/10/23 17:12:33 guenter Exp $
+ * $Id: osd.h,v 1.11 2002/11/20 18:41:14 mroi Exp $
*/
#ifndef HAVE_OSD_H
@@ -28,12 +28,37 @@
#ifdef __OSD_C__
#include "video_out/alphablend.h"
#endif
-typedef struct osd_object_s osd_object_t;
+typedef struct osd_object_s osd_object_t;
typedef struct osd_renderer_s osd_renderer_t;
typedef struct osd_font_s osd_font_t;
-/* WARNING: this should be kept in sync with include/xine.h.tmpl.in */
+struct osd_object_s {
+ osd_object_t *next;
+ osd_renderer_t *renderer;
+
+ int width, height; /* work area dimentions */
+ uint8_t *area; /* work area */
+ int display_x,display_y; /* where to display it in screen */
+
+ /* clipping box inside work area */
+ int x1, y1;
+ int x2, y2;
+
+ uint32_t color[OVL_PALETTE_SIZE]; /* color lookup table */
+ uint8_t trans[OVL_PALETTE_SIZE]; /* mixer key table */
+
+ int32_t handle;
+
+ osd_font_t *font;
+};
+
+/* this one is public */
+struct xine_osd_s {
+ osd_object_t osd;
+};
+
+/* WARNING: this should be kept in sync with include/xine.h.in */
struct osd_renderer_s {
/*
@@ -79,7 +104,7 @@ struct osd_renderer_s {
/*
* set palette (color and transparency)
*/
- void (*set_palette) (osd_object_t *osd, uint32_t *color, uint8_t *trans );
+ void (*set_palette) (osd_object_t *osd, const uint32_t *color, const uint8_t *trans );
/*
* set on existing text palette
@@ -109,7 +134,7 @@ struct osd_renderer_s {
* set the font of osd object
*/
- int (*set_font) (osd_object_t *osd, char *fontname, int size);
+ int (*set_font) (osd_object_t *osd, const char *fontname, int size);
/*
@@ -122,12 +147,12 @@ struct osd_renderer_s {
* Use OSD_TEXT1, OSD_TEXT2, ... for some preasssigned color indices.
*/
int (*render_text) (osd_object_t *osd, int x1, int y1,
- char *text, int color_base);
+ const char *text, int color_base);
/*
* get width and height of how text will be renderized
*/
- int (*get_text_size) (osd_object_t *osd, char *text,
+ int (*get_text_size) (osd_object_t *osd, const char *text,
int *width, int *height);
/*
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index 439bc97cc..b394954f5 100644
--- a/src/xine-engine/xine_interface.c
+++ b/src/xine-engine/xine_interface.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_interface.c,v 1.30 2002/11/20 11:57:50 mroi Exp $
+ * $Id: xine_interface.c,v 1.31 2002/11/20 18:41:14 mroi Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -519,3 +519,71 @@ const char *xine_get_meta_info (xine_stream_t *stream, int info) {
return stream->meta_info[info];
}
+xine_osd_t *xine_osd_new(xine_stream_t *stream, int x, int y, int width, int height) {
+ xine_osd_t *this = (xine_osd_t *)stream->osd_renderer->new_object(stream->osd_renderer, width, height);
+ this->osd.renderer->set_position(&this->osd, x, y);
+ return this;
+}
+
+void xine_osd_draw_point(xine_osd_t *this, int x, int y, int color) {
+ this->osd.area[x + y * this->osd.width] = color;
+}
+
+void xine_osd_draw_line(xine_osd_t *this, int x1, int y1, int x2, int y2, int color) {
+ this->osd.renderer->line(&this->osd, x1, y1, x2, y2, color);
+}
+
+void xine_osd_draw_rect(xine_osd_t *this, int x1, int y1, int x2, int y2, int color, int filled) {
+ if (filled) {
+ this->osd.renderer->filled_rect(&this->osd, x1, y1, x2, y2, color);
+ } else {
+ this->osd.renderer->line(&this->osd, x1, y1, x2, y1, color);
+ this->osd.renderer->line(&this->osd, x2, y1, x2, y2, color);
+ this->osd.renderer->line(&this->osd, x2, y2, x1, y2, color);
+ this->osd.renderer->line(&this->osd, x1, y2, x1, y1, color);
+ }
+}
+
+void xine_osd_draw_text(xine_osd_t *this, int x1, int y1, const char *text, int color_base) {
+ this->osd.renderer->render_text(&this->osd, x1, y1, text, color_base);
+}
+
+void xine_osd_get_text_size(xine_osd_t *this, const char *text, int *width, int *height) {
+ this->osd.renderer->get_text_size(&this->osd, text, width, height);
+}
+
+void xine_osd_set_font(xine_osd_t *this, const char *fontname, int size) {
+ this->osd.renderer->set_font(&this->osd, fontname, size);
+}
+
+void xine_osd_set_position(xine_osd_t *this, int x, int y) {
+ this->osd.renderer->set_position(&this->osd, x, y);
+}
+
+void xine_osd_show(xine_osd_t *this, int64_t vpts) {
+ this->osd.renderer->show(&this->osd, vpts);
+}
+
+void xine_osd_hide(xine_osd_t *this, int64_t vpts) {
+ this->osd.renderer->hide(&this->osd, vpts);
+}
+
+void xine_osd_clear(xine_osd_t *this) {
+ this->osd.renderer->clear(&this->osd);
+}
+
+void xine_osd_free(xine_osd_t *this) {
+ this->osd.renderer->free_object(&this->osd);
+}
+
+void xine_osd_set_palette(xine_osd_t *this, const uint32_t *const color, const uint8_t *const trans) {
+ this->osd.renderer->set_palette(&this->osd, color, trans);
+}
+
+void xine_osd_set_text_palette(xine_osd_t *this, int palette_number, int color_base) {
+ this->osd.renderer->set_text_palette(&this->osd, palette_number, color_base);
+}
+
+void xine_osd_get_palette(xine_osd_t *this, uint32_t *color, uint8_t *trans) {
+ this->osd.renderer->get_palette(&this->osd, color, trans);
+}