Switch indentation over to K&R style, replace all tabs by spaces.

patch by Christoph Egger <Christoph_Egger -- at -- gmx -- dot -- de>


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16410 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
diego 2005-09-06 18:44:04 +00:00
parent f80470335c
commit 7e13572ce9
1 changed files with 271 additions and 292 deletions

View File

@ -2,13 +2,13 @@
vo_ggi.c - General Graphics Interface (GGI) Renderer for MPlayer vo_ggi.c - General Graphics Interface (GGI) Renderer for MPlayer
(C) Alex Beregszaszi (C) Alex Beregszaszi
Uses libGGI - http://www.ggi-project.org/ Uses libGGI - http://www.ggi-project.org/
TODO: TODO:
* check on many devices * check on many devices
* implement gamma handling (VAA isn't obsoleted?) * implement gamma handling (VAA isn't obsoleted?)
BUGS: BUGS:
* palettized playback has bad colors, probably swapped palette? * palettized playback has bad colors, probably swapped palette?
* fbdev & DR produces two downscaled images * fbdev & DR produces two downscaled images
@ -42,22 +42,23 @@
/* maximum buffers */ /* maximum buffers */
#undef GGI_FLIP #undef GGI_FLIP
static vo_info_t info = static vo_info_t info =
{ {
"General Graphics Interface (GGI) output", "General Graphics Interface (GGI) output",
"ggi", "ggi",
"Alex Beregszaszi", "Alex Beregszaszi",
"major" "major"
}; };
LIBVO_EXTERN (ggi) LIBVO_EXTERN(ggi)
static struct ggi_conf_s { static struct ggi_conf_s {
char *driver; char *driver;
ggi_visual_t parentvis; ggi_visual_t parentvis;
ggi_visual_t vis; ggi_visual_t vis;
/* source image format */ /* source image format */
int srcwidth; int srcwidth;
int srcheight; int srcheight;
@ -67,16 +68,16 @@ static struct ggi_conf_s {
/* dirty region */ /* dirty region */
struct { struct {
int x1, y1; int x1, y1;
int x2, y2; int x2, y2;
} flushregion; } flushregion;
/* destination */ /* destination */
int dstwidth; int dstwidth;
int dstheight; int dstheight;
int async; int async;
int voflags; int voflags;
} ggi_conf; } ggi_conf;
@ -84,70 +85,70 @@ static struct ggi_conf_s {
#ifdef HAVE_GGIWMH #ifdef HAVE_GGIWMH
static void window_ontop(void) static void window_ontop(void)
{ {
mp_msg(MSGT_VO, MSGL_V, "[ggi] debug: window_ontop() called\n"); mp_msg(MSGT_VO, MSGL_V, "[ggi] debug: window_ontop() called\n");
ggiWmhZOrder(ggi_conf.parentvis, ZO_TOP); ggiWmhZOrder(ggi_conf.parentvis, ZO_TOP);
return; return;
} }
#endif #endif
static void set_graphtype(uint32_t format, ggi_mode *mode) static void set_graphtype(uint32_t format, ggi_mode *mode)
{ {
switch(format) switch (format) {
{ case IMGFMT_RGB4:
case IMGFMT_RGB4: mode->graphtype = GT_4BIT;
mode->graphtype = GT_4BIT; break;
break; case IMGFMT_BGR4:
case IMGFMT_BGR4: mode->graphtype = GT_4BIT;
mode->graphtype = GT_4BIT; GT_SETSUBSCHEME(mode->graphtype, GT_SUB_HIGHBIT_RIGHT);
GT_SETSUBSCHEME(mode->graphtype, GT_SUB_HIGHBIT_RIGHT); break;
break; case IMGFMT_RGB8:
case IMGFMT_RGB8: case IMGFMT_BGR8:
case IMGFMT_BGR8: mode->graphtype = GT_8BIT;
mode->graphtype = GT_8BIT; break;
break; case IMGFMT_RGB15:
case IMGFMT_RGB15: case IMGFMT_BGR15:
case IMGFMT_BGR15: mode->graphtype = GT_15BIT;
mode->graphtype = GT_15BIT; break;
break; case IMGFMT_RGB16:
case IMGFMT_RGB16: case IMGFMT_BGR16:
case IMGFMT_BGR16: mode->graphtype = GT_16BIT;
mode->graphtype = GT_16BIT; break;
break; case IMGFMT_RGB24:
case IMGFMT_RGB24: case IMGFMT_BGR24:
case IMGFMT_BGR24: mode->graphtype = GT_24BIT;
mode->graphtype = GT_24BIT; break;
break; case IMGFMT_RGB32:
case IMGFMT_RGB32: case IMGFMT_BGR32:
case IMGFMT_BGR32: mode->graphtype = GT_32BIT;
mode->graphtype = GT_32BIT; break;
break;
} }
return; return;
} }
static int config(uint32_t width, uint32_t height, uint32_t d_width, static int config(uint32_t width, uint32_t height, uint32_t d_width,
uint32_t d_height, uint32_t flags, char *title, uint32_t format) uint32_t d_height, uint32_t flags, char *title,
uint32_t format)
{ {
ggi_mode mode = { ggi_mode mode = {
1, /* frames */ 1, /* frames */
{ 0, 0 }, /* top, left corner */ {0, 0}, /* top, left corner */
{ width, height }, /* bottem, right corner */ {width, height}, /* bottem, right corner */
{ GGI_AUTO, GGI_AUTO }, /* size */ {GGI_AUTO, GGI_AUTO}, /* size */
GT_AUTO, /* graphtype */ GT_AUTO, /* graphtype */
{ GGI_AUTO, GGI_AUTO } /* dots per pixel */ {GGI_AUTO, GGI_AUTO} /* dots per pixel */
}; };
ggi_mode parentmode = ggi_mode parentmode = {
{ 1, /* frames */
1, /* frames */ {width, height}, /* visible */
{ width, height }, /* visible */ {GGI_AUTO, GGI_AUTO}, /* virt */
{ GGI_AUTO, GGI_AUTO }, /* virt */ {GGI_AUTO, GGI_AUTO}, /* size */
{ GGI_AUTO, GGI_AUTO }, /* size */ GT_AUTO, /* graphtype */
GT_AUTO, /* graphtype */ {GGI_AUTO, GGI_AUTO} /* dots per pixel */
{ GGI_AUTO, GGI_AUTO } /* dots per pixel */
}; };
set_graphtype(format, &parentmode); set_graphtype(format, &parentmode);
#if 0 #if 0
@ -162,22 +163,19 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
ggiCheckMode(ggi_conf.parentvis, &parentmode); ggiCheckMode(ggi_conf.parentvis, &parentmode);
if (ggiSetMode(ggi_conf.parentvis, &parentmode) < 0) if (ggiSetMode(ggi_conf.parentvis, &parentmode) < 0) {
{
mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to set display mode\n"); mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to set display mode\n");
return(-1); return (-1);
} }
if (ggiGetMode(ggi_conf.parentvis, &parentmode) < 0) {
if (ggiGetMode(ggi_conf.parentvis, &parentmode) < 0)
{
mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to get display mode\n"); mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to get display mode\n");
return(-1); return (-1);
} }
if ((parentmode.graphtype == GT_INVALID)
if ((parentmode.graphtype == GT_INVALID) || (parentmode.graphtype == GT_AUTO)) || (parentmode.graphtype == GT_AUTO))
{ {
mp_msg(MSGT_VO, MSGL_ERR, "[ggi] not supported depth/bpp\n"); mp_msg(MSGT_VO, MSGL_ERR, "[ggi] not supported depth/bpp\n");
return(-1); return (-1);
} }
#if 0 #if 0
@ -196,16 +194,13 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
ggiCheckMode(ggi_conf.vis, &mode); ggiCheckMode(ggi_conf.vis, &mode);
if (ggiSetMode(ggi_conf.vis, &mode) < 0) if (ggiSetMode(ggi_conf.vis, &mode) < 0) {
{ mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to set video mode\n");
mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to set video mode\n"); return (-1);
return(-1);
} }
if (ggiGetMode(ggi_conf.vis, &mode) < 0) {
if (ggiGetMode(ggi_conf.vis, &mode) < 0) mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to get video mode\n");
{ return (-1);
mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to get video mode\n");
return(-1);
} }
#ifdef HAVE_GGIWMH #ifdef HAVE_GGIWMH
@ -222,7 +217,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
vo_depthonscreen = GT_DEPTH(parentmode.graphtype); vo_depthonscreen = GT_DEPTH(parentmode.graphtype);
vo_screenwidth = parentmode.visible.x; vo_screenwidth = parentmode.visible.x;
vo_screenheight = parentmode.visible.y; vo_screenheight = parentmode.visible.y;
vo_dx = vo_dy = 0; vo_dx = vo_dy = 0;
vo_dwidth = mode.virt.x; vo_dwidth = mode.virt.x;
vo_dheight = mode.virt.y; vo_dheight = mode.virt.y;
@ -234,23 +229,17 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
ggi_conf.dstwidth = mode.virt.x; ggi_conf.dstwidth = mode.virt.x;
ggi_conf.dstheight = mode.virt.y; ggi_conf.dstheight = mode.virt.y;
ggi_conf.voflags = flags; ggi_conf.voflags = flags;
if (IMGFMT_IS_RGB(ggi_conf.srcformat)) if (IMGFMT_IS_RGB(ggi_conf.srcformat)) {
{ ggi_conf.srcdepth = IMGFMT_RGB_DEPTH(ggi_conf.srcformat);
ggi_conf.srcdepth = IMGFMT_RGB_DEPTH(ggi_conf.srcformat); } else if (IMGFMT_IS_BGR(ggi_conf.srcformat)) {
} ggi_conf.srcdepth = IMGFMT_BGR_DEPTH(ggi_conf.srcformat);
else } else {
if (IMGFMT_IS_BGR(ggi_conf.srcformat))
{
ggi_conf.srcdepth = IMGFMT_BGR_DEPTH(ggi_conf.srcformat);
}
else
{
mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] Unknown image format: %s\n", mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] Unknown image format: %s\n",
vo_format_name(ggi_conf.srcformat)); vo_format_name(ggi_conf.srcformat));
return(-1); return (-1);
} }
ggiSetFlags(ggi_conf.vis, GGIFLAG_ASYNC); ggiSetFlags(ggi_conf.vis, GGIFLAG_ASYNC);
@ -262,18 +251,18 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
ggi_conf.async = 1; ggi_conf.async = 1;
mp_msg(MSGT_VO, MSGL_INFO, "[ggi] input: %dx%dx%d, output: %dx%dx%d\n", mp_msg(MSGT_VO, MSGL_INFO, "[ggi] input: %dx%dx%d, output: %dx%dx%d\n",
ggi_conf.srcwidth, ggi_conf.srcheight, ggi_conf.srcdepth, ggi_conf.srcwidth, ggi_conf.srcheight, ggi_conf.srcdepth,
vo_dwidth, vo_dheight, vo_dbpp); vo_dwidth, vo_dheight, vo_dbpp);
mp_msg(MSGT_VO, MSGL_INFO, "[ggi] async mode: %s\n", mp_msg(MSGT_VO, MSGL_INFO, "[ggi] async mode: %s\n",
ggi_conf.async ? "yes" : "no"); ggi_conf.async ? "yes" : "no");
ggi_conf.srcbpp = (ggi_conf.srcdepth+7)/8; ggi_conf.srcbpp = (ggi_conf.srcdepth + 7) / 8;
ggi_conf.flushregion.x1 = ggi_conf.flushregion.y1 = 0; ggi_conf.flushregion.x1 = ggi_conf.flushregion.y1 = 0;
ggi_conf.flushregion.x2 = ggi_conf.dstwidth; ggi_conf.flushregion.x2 = ggi_conf.dstwidth;
ggi_conf.flushregion.y2 = ggi_conf.dstheight; ggi_conf.flushregion.y2 = ggi_conf.dstheight;
return(0); return (0);
} }
static uint32_t get_image(mp_image_t *mpi) static uint32_t get_image(mp_image_t *mpi)
@ -281,50 +270,50 @@ static uint32_t get_image(mp_image_t *mpi)
/* GGI DirectRendering supports (yet) only BGR/RGB modes */ /* GGI DirectRendering supports (yet) only BGR/RGB modes */
if ( if (
#if 1 #if 1
(IMGFMT_IS_RGB(mpi->imgfmt) && (IMGFMT_IS_RGB(mpi->imgfmt) &&
(IMGFMT_RGB_DEPTH(mpi->imgfmt) != vo_dbpp)) || (IMGFMT_RGB_DEPTH(mpi->imgfmt) != vo_dbpp)) ||
(IMGFMT_IS_BGR(mpi->imgfmt) && (IMGFMT_IS_BGR(mpi->imgfmt) &&
(IMGFMT_BGR_DEPTH(mpi->imgfmt) != vo_dbpp)) || (IMGFMT_BGR_DEPTH(mpi->imgfmt) != vo_dbpp)) ||
#else #else
(mpi->imgfmt != ggi_conf.srcformat) || (mpi->imgfmt != ggi_conf.srcformat) ||
#endif #endif
((mpi->type != MP_IMGTYPE_STATIC) && (mpi->type != MP_IMGTYPE_TEMP)) || ((mpi->type != MP_IMGTYPE_STATIC) && (mpi->type != MP_IMGTYPE_TEMP)) ||
(mpi->flags & MP_IMGFLAG_PLANAR) || (mpi->flags & MP_IMGFLAG_PLANAR) ||
(mpi->flags & MP_IMGFLAG_YUV) || (mpi->flags & MP_IMGFLAG_YUV) ||
(mpi->width != ggi_conf.srcwidth) || (mpi->width != ggi_conf.srcwidth) ||
(mpi->height != ggi_conf.srcheight) (mpi->height != ggi_conf.srcheight))
)
{ {
return(VO_FALSE); return (VO_FALSE);
} }
mpi->planes[1] = mpi->planes[2] = NULL; mpi->planes[1] = mpi->planes[2] = NULL;
mpi->stride[1] = mpi->stride[2] = 0; mpi->stride[1] = mpi->stride[2] = 0;
mpi->planes[0] = NULL; mpi->planes[0] = NULL;
mpi->stride[0] = ggi_conf.srcwidth * ggi_conf.srcbpp; mpi->stride[0] = ggi_conf.srcwidth * ggi_conf.srcbpp;
mpi->flags |= MP_IMGFLAG_DIRECT; mpi->flags |= MP_IMGFLAG_DIRECT;
#ifdef GGI_FLIP #ifdef GGI_FLIP
if (ggi_conf.voflags & VOFLAG_FLIPPING) if (ggi_conf.voflags & VOFLAG_FLIPPING) {
{ mpi->stride[0] = -mpi->stride[0];
mpi->stride[0] = -mpi->stride[0];
} }
#endif #endif
return(VO_TRUE); return (VO_TRUE);
} }
static int draw_frame(uint8_t *src[]) static int draw_frame(uint8_t *src[])
{ {
ggiPutBox(ggi_conf.vis, 0, 0, ggi_conf.dstwidth, ggi_conf.dstheight, src[0]); ggiPutBox(ggi_conf.vis, 0, 0,
ggi_conf.dstwidth, ggi_conf.dstheight,
src[0]);
ggi_conf.flushregion.x1 = ggi_conf.flushregion.y1 = 0; ggi_conf.flushregion.x1 = ggi_conf.flushregion.y1 = 0;
ggi_conf.flushregion.x2 = ggi_conf.dstwidth; ggi_conf.flushregion.x2 = ggi_conf.dstwidth;
ggi_conf.flushregion.y2 = ggi_conf.dstheight; ggi_conf.flushregion.y2 = ggi_conf.dstheight;
return(0); return (0);
} }
static void draw_osd(void) static void draw_osd(void)
@ -334,29 +323,30 @@ static void draw_osd(void)
static void flip_page(void) static void flip_page(void)
{ {
ggiFlushRegion(ggi_conf.vis, ggi_conf.flushregion.x1, ggi_conf.flushregion.y1, ggiFlushRegion(ggi_conf.vis,
ggi_conf.flushregion.x2 - ggi_conf.flushregion.x1, ggi_conf.flushregion.x1, ggi_conf.flushregion.y1,
ggi_conf.flushregion.y2 - ggi_conf.flushregion.y1); ggi_conf.flushregion.x2 - ggi_conf.flushregion.x1,
ggi_conf.flushregion.y2 - ggi_conf.flushregion.y1);
ggi_conf.flushregion.x1 = ggi_conf.flushregion.x2 = -1; ggi_conf.flushregion.x1 = ggi_conf.flushregion.x2 = -1;
ggi_conf.flushregion.y1 = ggi_conf.flushregion.y2 = -1; ggi_conf.flushregion.y1 = ggi_conf.flushregion.y2 = -1;
} }
static int draw_slice(uint8_t *src[], int stride[], int w, int h, static int draw_slice(uint8_t *src[], int stride[],
int x, int y) int w, int h, int x, int y)
{ {
ggiPutBox(ggi_conf.vis, x, y, w, h, src[0]); ggiPutBox(ggi_conf.vis, x, y, w, h, src[0]);
if ((ggi_conf.flushregion.x1 == -1) || (x < ggi_conf.flushregion.x1)) if ((ggi_conf.flushregion.x1 == -1) || (x < ggi_conf.flushregion.x1))
ggi_conf.flushregion.x1 = x; ggi_conf.flushregion.x1 = x;
if ((ggi_conf.flushregion.y1 == -1) || (y < ggi_conf.flushregion.y1)) if ((ggi_conf.flushregion.y1 == -1) || (y < ggi_conf.flushregion.y1))
ggi_conf.flushregion.y1 = y; ggi_conf.flushregion.y1 = y;
if ((ggi_conf.flushregion.x2 == -1) || ((x + w) > ggi_conf.flushregion.x2)) if ((ggi_conf.flushregion.x2 == -1) || ((x + w) > ggi_conf.flushregion.x2))
ggi_conf.flushregion.x2 = x + w; ggi_conf.flushregion.x2 = x + w;
if ((ggi_conf.flushregion.y2 == -1) || ((y + h) > ggi_conf.flushregion.y2)) if ((ggi_conf.flushregion.y2 == -1) || ((y + h) > ggi_conf.flushregion.y2))
ggi_conf.flushregion.y2 = y + h; ggi_conf.flushregion.y2 = y + h;
return(1); return (1);
} }
static int query_format(uint32_t format) static int query_format(uint32_t format)
@ -364,90 +354,78 @@ static int query_format(uint32_t format)
ggi_mode mode; ggi_mode mode;
uint32_t vfcap; uint32_t vfcap;
vfcap = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_ACCEPT_STRIDE; vfcap = VFCAP_CSP_SUPPORTED
| VFCAP_CSP_SUPPORTED_BY_HW
| VFCAP_ACCEPT_STRIDE;
if ((!vo_depthonscreen || !vo_dbpp) && ggi_conf.parentvis) if ((!vo_depthonscreen || !vo_dbpp) && ggi_conf.parentvis) {
{ if (ggiGetMode(ggi_conf.parentvis, &mode) == 0) {
if (ggiGetMode(ggi_conf.parentvis, &mode) == 0) vo_depthonscreen = GT_DEPTH(mode.graphtype);
{ vo_dbpp = GT_SIZE(mode.graphtype);
vo_depthonscreen = GT_DEPTH(mode.graphtype); }
vo_dbpp = GT_SIZE(mode.graphtype);
}
} }
if ((IMGFMT_IS_BGR(format) && (IMGFMT_BGR_DEPTH(format) == vo_dbpp)) || if ((IMGFMT_IS_BGR(format) && (IMGFMT_BGR_DEPTH(format) == vo_dbpp)) ||
(IMGFMT_IS_RGB(format) && (IMGFMT_RGB_DEPTH(format) == vo_dbpp))) (IMGFMT_IS_RGB(format) && (IMGFMT_RGB_DEPTH(format) == vo_dbpp)))
{ {
return vfcap; return vfcap;
} }
if (IMGFMT_IS_BGR(format) || IMGFMT_IS_RGB(format)) {
set_graphtype(format, &mode);
if (IMGFMT_IS_BGR(format) || IMGFMT_IS_RGB(format)) if (ggiCheckMode(ggi_conf.parentvis, &mode) < 0) {
{ return 0;
set_graphtype(format, &mode); } else {
return vfcap;
if (ggiCheckMode(ggi_conf.parentvis, &mode) < 0) { }
return 0;
} else {
return vfcap;
}
} }
return (0);
return(0);
} }
static int preinit(const char *arg) static int preinit(const char *arg)
{ {
if (ggiInit() != 0) if (ggiInit() != 0) {
{ mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to initialize GGI\n");
mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to initialize GGI\n"); return (-1);
return(-1);
} }
#ifdef HAVE_GGIWMH #ifdef HAVE_GGIWMH
if (ggiWmhInit() < 0) if (ggiWmhInit() < 0) {
{ mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to initialize libggiwmh\n");
mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to initialize libggiwmh\n"); return (-1);
return(-1);
} }
#endif #endif
if ((char *)arg) if ((char *) arg) {
{ int i = 0;
int i = 0; ggi_conf.driver = strdup(arg);
ggi_conf.driver = strdup(arg); while (ggi_conf.driver[i]) {
while (ggi_conf.driver[i]) { if (ggi_conf.driver[i] == '.')
if (ggi_conf.driver[i] == '.') ggi_conf.driver[i] = ',';
ggi_conf.driver[i] = ','; i++;
i++; }
} } else {
ggi_conf.driver = NULL;
} }
else
ggi_conf.driver = NULL;
ggi_conf.parentvis = ggiOpen(ggi_conf.driver); ggi_conf.parentvis = ggiOpen(ggi_conf.driver);
if (ggi_conf.parentvis == NULL) if (ggi_conf.parentvis == NULL) {
{ mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to open '%s' output\n",
mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to open '%s' output\n", (ggi_conf.driver == NULL) ? "default" : ggi_conf.driver);
(ggi_conf.driver == NULL) ? "default" : ggi_conf.driver); ggiExit();
ggiExit(); return (-1);
return(-1);
} }
ggi_conf.vis = ggiOpen("display-sub", ggi_conf.parentvis); ggi_conf.vis = ggiOpen("display-sub", ggi_conf.parentvis);
if (ggi_conf.vis == NULL) if (ggi_conf.vis == NULL) {
{ mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to open the video output\n");
mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to open the video output\n"); ggiExit();
ggiExit(); return (-1);
return(-1);
} }
#ifdef HAVE_GGIWMH #ifdef HAVE_GGIWMH
ggiWmhAttach(ggi_conf.parentvis); ggiWmhAttach(ggi_conf.parentvis);
#endif #endif
mp_msg(MSGT_VO, MSGL_V, "[ggi] using '%s' output\n", mp_msg(MSGT_VO, MSGL_V, "[ggi] using '%s' output\n",
(ggi_conf.driver == NULL) ? "default" : ggi_conf.driver); (ggi_conf.driver == NULL) ? "default" : ggi_conf.driver);
return 0; return 0;
} }
@ -455,7 +433,7 @@ static int preinit(const char *arg)
static void uninit(void) static void uninit(void)
{ {
if (ggi_conf.driver) if (ggi_conf.driver)
free(ggi_conf.driver); free(ggi_conf.driver);
#ifdef HAVE_GGIWMH #ifdef HAVE_GGIWMH
ggiWmhDetach(ggi_conf.parentvis); ggiWmhDetach(ggi_conf.parentvis);
@ -469,17 +447,16 @@ static void uninit(void)
static int control(uint32_t request, void *data, ...) static int control(uint32_t request, void *data, ...)
{ {
switch(request) switch (request) {
{ case VOCTRL_QUERY_FORMAT:
case VOCTRL_QUERY_FORMAT: return query_format(*((uint32_t *) data));
return query_format(*((uint32_t*)data)); case VOCTRL_GET_IMAGE:
case VOCTRL_GET_IMAGE: return get_image(data);
return get_image(data);
#ifdef HAVE_GGIWMH #ifdef HAVE_GGIWMH
case VOCTRL_ONTOP: case VOCTRL_ONTOP:
vo_ontop = (!(vo_ontop)); vo_ontop = (!(vo_ontop));
window_ontop(); window_ontop();
return VO_TRUE; return VO_TRUE;
#endif #endif
} }
return VO_NOTIMPL; return VO_NOTIMPL;
@ -491,101 +468,103 @@ extern void mplayer_put_key(int code);
static void check_events(void) static void check_events(void)
{ {
struct timeval tv = {0, 0}; struct timeval tv = {0, 0};
ggi_event event; ggi_event event;
ggi_event_mask mask; ggi_event_mask mask;
if ((mask = ggiEventPoll(ggi_conf.parentvis, emAll, &tv))) if ((mask = ggiEventPoll(ggi_conf.parentvis, emAll, &tv))) {
if (ggiEventRead(ggi_conf.parentvis, &event, emAll) != 0) if (ggiEventRead(ggi_conf.parentvis, &event, emAll) != 0) {
{ mp_dbg(MSGT_VO, MSGL_DBG3,
mp_dbg(MSGT_VO, MSGL_DBG3, "type: %4x, origin: %4x, sym: %4x, label: %4x, button=%4x\n", "type: %4x, origin: %4x, "
event.any.origin, event.any.type, event.key.sym, event.key.label, event.key.button); "sym: %4x, label: %4x, button=%4x\n",
event.any.origin, event.any.type, event.key.sym,
event.key.label, event.key.button);
switch (event.any.type) { switch (event.any.type) {
case evKeyPress: case evKeyPress:
switch(event.key.sym) switch (event.key.sym) {
{ case GIIK_PAsterisk: /* PStar */
case GIIK_PAsterisk: /* PStar */ case GIIUC_Asterisk:
case GIIUC_Asterisk: mplayer_put_key('*');
mplayer_put_key('*'); break;
break; case GIIK_PSlash:
case GIIK_PSlash: case GIIUC_Slash:
case GIIUC_Slash: mplayer_put_key('/');
mplayer_put_key('/'); break;
break; case GIIK_PPlus:
case GIIK_PPlus: case GIIUC_Plus:
case GIIUC_Plus: mplayer_put_key('+');
mplayer_put_key('+'); break;
break; case GIIK_PMinus:
case GIIK_PMinus: case GIIUC_Minus:
case GIIUC_Minus: mplayer_put_key('-');
mplayer_put_key('-'); break;
break; case GIIUC_o:
case GIIUC_o: case GIIUC_O:
case GIIUC_O: mplayer_put_key('o');
mplayer_put_key('o'); break;
break; case GIIUC_g:
case GIIUC_g: case GIIUC_G:
case GIIUC_G: mplayer_put_key('g');
mplayer_put_key('g'); break;
break; case GIIUC_z:
case GIIUC_z: case GIIUC_Z:
case GIIUC_Z: mplayer_put_key('z');
mplayer_put_key('z'); break;
break; case GIIUC_x:
case GIIUC_x: case GIIUC_X:
case GIIUC_X: mplayer_put_key('x');
mplayer_put_key('x'); break;
break; case GIIUC_m:
case GIIUC_m: case GIIUC_M:
case GIIUC_M: mplayer_put_key('m');
mplayer_put_key('m'); break;
break; case GIIUC_d:
case GIIUC_d: case GIIUC_D:
case GIIUC_D: mplayer_put_key('d');
mplayer_put_key('d'); break;
break; case GIIUC_q:
case GIIUC_q: case GIIUC_Q:
case GIIUC_Q: mplayer_put_key('q');
mplayer_put_key('q'); break;
break; case GIIUC_h:
case GIIUC_h: case GIIUC_H:
case GIIUC_H: mplayer_put_key('h');
mplayer_put_key('h'); break;
break; case GIIUC_l:
case GIIUC_l: case GIIUC_L:
case GIIUC_L: mplayer_put_key('l');
mplayer_put_key('l'); break;
break; case GIIUC_Space:
case GIIUC_Space: case GIIUC_p:
case GIIUC_p: case GIIUC_P:
case GIIUC_P: mplayer_put_key('p');
mplayer_put_key('p'); break;
break; case GIIK_Up:
case GIIK_Up: mplayer_put_key(KEY_UP);
mplayer_put_key(KEY_UP); break;
break; case GIIK_Down:
case GIIK_Down: mplayer_put_key(KEY_DOWN);
mplayer_put_key(KEY_DOWN); break;
break; case GIIK_Left:
case GIIK_Left: mplayer_put_key(KEY_LEFT);
mplayer_put_key(KEY_LEFT); break;
break; case GIIK_Right:
case GIIK_Right: mplayer_put_key(KEY_RIGHT);
mplayer_put_key(KEY_RIGHT); break;
break; case GIIK_PageUp:
case GIIK_PageUp: mplayer_put_key(KEY_PAGE_UP);
mplayer_put_key(KEY_PAGE_UP); break;
break; case GIIK_PageDown:
case GIIK_PageDown: mplayer_put_key(KEY_PAGE_DOWN);
mplayer_put_key(KEY_PAGE_DOWN); break;
break; default:
default: break;
break; } /* switch */
} /* switch */
break; break;
} /* switch */ } /* switch */
} /* if */ } /* if */
} /* if */
return; return;
} }