diff options
| author | phintuka <phintuka> | 2012-03-19 11:53:04 +0000 |
|---|---|---|
| committer | phintuka <phintuka> | 2012-03-19 11:53:04 +0000 |
| commit | fd3ac02950f6454542ff7bdae89f08659cbdd395 (patch) | |
| tree | 92f21c9f06291cba1fcda01d64e86ddb83af6690 | |
| parent | 5f137a1e8f3bc62ee977c741fcc8b4ffccf034b6 (diff) | |
| download | xineliboutput-fd3ac02950f6454542ff7bdae89f08659cbdd395.tar.gz xineliboutput-fd3ac02950f6454542ff7bdae89f08659cbdd395.tar.bz2 | |
Added user handle to frontend->vdr message callback
| -rw-r--r-- | frontend_local.c | 8 | ||||
| -rw-r--r-- | xine_fbfe_frontend.c | 9 | ||||
| -rw-r--r-- | xine_frontend.c | 16 | ||||
| -rw-r--r-- | xine_frontend.h | 15 | ||||
| -rw-r--r-- | xine_frontend_internal.h | 5 | ||||
| -rw-r--r-- | xine_frontend_main.c | 4 | ||||
| -rw-r--r-- | xine_sxfe_frontend.c | 22 |
7 files changed, 41 insertions, 38 deletions
diff --git a/frontend_local.c b/frontend_local.c index f0dc4d23..17db7b98 100644 --- a/frontend_local.c +++ b/frontend_local.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: frontend_local.c,v 1.58 2012-03-18 12:22:25 phintuka Exp $ + * $Id: frontend_local.c,v 1.59 2012-03-19 11:51:22 phintuka Exp $ * */ @@ -51,7 +51,7 @@ class cRwLockBlock //----------------- keyboard control handler (C callback) -------------------- extern "C" { - static void keypress_handler(const char *keymap, const char *key) + static void keypress_handler(void *h, const char *keymap, const char *key) { if(!strncmp("INFO ", keymap, 5)) { @@ -342,12 +342,14 @@ void cXinelibLocal::Action(void) Cancel(-1); } else { LOGDBG("cXinelibLocal::Action - fe created"); + curr_fe->fe_message_cb = keypress_handler; + curr_fe->fe_message_h = this; if(!curr_fe->fe_display_open(curr_fe, xc.xpos, xc.ypos, xc.width, xc.height, xc.fullscreen, xc.hud_osd, xc.opengl, xc.modeswitch, xc.modeline, xc.display_aspect, - keypress_handler, 0/*no_x_kbd*/, 0/*gui_hotkeys*/, + 0/*no_x_kbd*/, 0/*gui_hotkeys*/, xc.video_port, xc.scale_video, NULL, diff --git a/xine_fbfe_frontend.c b/xine_fbfe_frontend.c index 27cd54b4..72ea5ed7 100644 --- a/xine_fbfe_frontend.c +++ b/xine_fbfe_frontend.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_fbfe_frontend.c,v 1.49 2012-03-13 12:53:41 phintuka Exp $ + * $Id: xine_fbfe_frontend.c,v 1.50 2012-03-19 11:51:22 phintuka Exp $ * */ @@ -120,7 +120,7 @@ static int fbfe_display_open(frontend_t *this_gen, int xpos, int ypos, int width, int height, int fullscreen, int hud, int opengl, int modeswitch, const char *modeline, int aspect, - fe_keypress_f keyfunc, int no_x_kbd, int gui_hotkeys, + int no_x_kbd, int gui_hotkeys, const char *video_port, int scale_video, const char *aspect_controller, int window_id) { @@ -132,9 +132,8 @@ static int fbfe_display_open(frontend_t *this_gen, if(this->fd_tty >= 0) this->fe.fe_display_close(this_gen); - if(keyfunc) { - this->x.keypress = keyfunc; - this->x.keypress("KBD", ""); + if(this->fe.fe_message_cb) { + this->fe.fe_message_cb(this->fe.fe_message_h, "KBD", ""); } LOGDBG("fbfe_display_open(width=%d, height=%d, fullscreen=%d, display=%s)", diff --git a/xine_frontend.c b/xine_frontend.c index cb4499c6..f73db36e 100644 --- a/xine_frontend.c +++ b/xine_frontend.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_frontend.c,v 1.125 2012-03-13 12:53:41 phintuka Exp $ + * $Id: xine_frontend.c,v 1.126 2012-03-19 11:51:21 phintuka Exp $ * */ @@ -1153,8 +1153,8 @@ static void input_event_cb(frontend_t *this_gen, const char *keymap, const char { fe_t *this = (fe_t*)this_gen; - if (this->keypress) { - this->keypress(keymap, key); + if (this->fe.fe_message_cb) { + this->fe.fe_message_cb(this->fe.fe_message_h, keymap, key); } } @@ -1173,7 +1173,7 @@ static int fe_xine_play(frontend_t *this_gen) if(!find_input_plugin(this)) return -1; - this->input_plugin->f.xine_input_event = this->keypress ? input_event_cb : NULL; + this->input_plugin->f.xine_input_event = this->fe.fe_message_cb ? input_event_cb : NULL; this->input_plugin->f.fe_control = fe_control; this->input_plugin->f.fe_handle = this_gen; @@ -1376,8 +1376,8 @@ static int fe_send_input_event(frontend_t *this_gen, const char *map, this->shutdown_time = time(NULL) + this->shutdown_timeout; /* local mode: --> vdr callback */ - if(this->keypress) { - this->keypress(map, key); + if (this->fe.fe_message_cb) { + this->fe.fe_message_cb(this->fe.fe_message_h, map, key); return FE_OK; } @@ -1444,8 +1444,8 @@ static int fe_send_event(frontend_t *this_gen, const char *data) LOGDBG("Event: %s", data); /* local mode: --> vdr callback */ - if (this->keypress) { - this->keypress(data, NULL); + if (this->fe.fe_message_cb) { + this->fe.fe_message_cb(this->fe.fe_message_h, data, NULL); return FE_OK; } diff --git a/xine_frontend.h b/xine_frontend.h index cd064e15..9b36795e 100644 --- a/xine_frontend.h +++ b/xine_frontend.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_frontend.h,v 1.28 2012-03-13 12:53:41 phintuka Exp $ + * $Id: xine_frontend.h,v 1.29 2012-03-19 11:53:04 phintuka Exp $ * */ @@ -17,8 +17,6 @@ extern "C" { #define FE_VERSION_STR XINELIBOUTPUT_VERSION /*"1.0.0pre1"*/ -typedef void (*fe_keypress_f)(const char *keymap, const char *name); - typedef struct frontend_config_s frontend_config_t; typedef struct frontend_s frontend_t; @@ -80,7 +78,7 @@ struct frontend_s { int winwidth, int winheight, int fullscreen, int hud, int opengl, int modeswitch, const char *modeline, - int aspect, fe_keypress_f keypresshandler, + int aspect, int no_x_kbd, int gui_hotkeys, const char *video_port, int scale_video, @@ -124,11 +122,18 @@ struct frontend_s { char *(*grab)(frontend_t*, int *size, int jpeg, int quality, int width, int height); - /* events from frontend -> xine/vdr */ + /* frontend services: events from frontend -> xine/vdr */ int (*send_event)(frontend_t *fe, const char *data); int (*send_input_event)(frontend_t *fe, const char *map, const char *key, int repeat, int release); + + /* Control messages frontend -> VDR (local mode) + * frontend should fill following pointers + */ + void *fe_message_h; + void (*fe_message_cb)(void *, const char *keymap, const char *name); + #if 0 frontend_config_t config; #endif diff --git a/xine_frontend_internal.h b/xine_frontend_internal.h index 9dce35b9..96d1d0da 100644 --- a/xine_frontend_internal.h +++ b/xine_frontend_internal.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_frontend_internal.h,v 1.10 2012-03-13 12:53:41 phintuka Exp $ + * $Id: xine_frontend_internal.h,v 1.11 2012-03-19 11:51:21 phintuka Exp $ * */ @@ -41,9 +41,6 @@ typedef struct fe_s { /* if set before xine_init(), will be called by video driver wrapper for each frame */ void (*frame_draw_cb)(void *, vo_frame_t *); - /* vdr callbacks */ - fe_keypress_f keypress; - /* xine stuff */ xine_t *xine; xine_stream_t *stream; diff --git a/xine_frontend_main.c b/xine_frontend_main.c index aa568dc6..5d283350 100644 --- a/xine_frontend_main.c +++ b/xine_frontend_main.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_frontend_main.c,v 1.102 2012-03-13 12:53:41 phintuka Exp $ + * $Id: xine_frontend_main.c,v 1.103 2012-03-19 11:51:21 phintuka Exp $ * */ @@ -550,7 +550,7 @@ int main(int argc, char *argv[]) /* Initialize display */ if (!fe->fe_display_open(fe, xpos, ypos, width, height, fullscreen, hud, opengl, modeswitch, - "", aspect, NULL, noxkbd, gui_hotkeys, + "", aspect, noxkbd, gui_hotkeys, video_port, scale_video, aspect_controller, window_id)) { fprintf(stderr, "Error opening display\n"); diff --git a/xine_sxfe_frontend.c b/xine_sxfe_frontend.c index b18e8c48..9e7b27fd 100644 --- a/xine_sxfe_frontend.c +++ b/xine_sxfe_frontend.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_sxfe_frontend.c,v 1.203 2012-03-13 12:53:41 phintuka Exp $ + * $Id: xine_sxfe_frontend.c,v 1.204 2012-03-19 11:51:21 phintuka Exp $ * */ @@ -384,7 +384,7 @@ static void update_window_title(sxfe_t *this) { XLockDisplay(this->display); - if (!this->x.keypress) { /* handler is set only in local mode */ + if (!this->fe.fe_message_cb) { /* handler is set only in local mode */ char *name = NULL; if (XFetchName(this->display, this->window[0], &name) && name) { char *newname = NULL; @@ -1502,7 +1502,7 @@ static void create_windows(sxfe_t *this) } /* Window name */ - const char *initial_title = (!this->x.keypress) ? "Connecting to VDR ..." : "Local VDR"; + const char *initial_title = (!this->fe.fe_message_cb) ? "Connecting to VDR ..." : "Local VDR"; XStoreName(this->display, this->window[0], initial_title); XStoreName(this->display, this->window[1], initial_title); @@ -2238,7 +2238,7 @@ static int sxfe_display_open(frontend_t *this_gen, int xpos, int ypos, int width, int height, int fullscreen, int hud, int opengl, int modeswitch, const char *modeline, int aspect, - fe_keypress_f keyfunc, int no_x_kbd, int gui_hotkeys, + int no_x_kbd, int gui_hotkeys, const char *video_port, int scale_video, const char *aspect_controller, int window_id) { @@ -2247,16 +2247,16 @@ static int sxfe_display_open(frontend_t *this_gen, if(this->display) this->fe.fe_display_close(this_gen); + LOGDBG("sxfe_display_open(width=%d, height=%d, fullscreen=%d, display=%s)", + width, height, fullscreen, video_port); + pthread_mutex_init(&this->video_win_mutex, NULL); - if(keyfunc) { - this->x.keypress = keyfunc; - this->x.keypress("XKeySym", ""); /* triggers learning mode */ + if(this->fe.fe_message_cb) { + /* trigger key learning mode */ + this->fe.fe_message_cb(this->fe.fe_message_h, "XKeySym", ""); } - LOGDBG("sxfe_display_open(width=%d, height=%d, fullscreen=%d, display=%s)", - width, height, fullscreen, video_port); - #if defined(HAVE_XRENDER) || defined(HAVE_OPENGL) this->osd_width = OSD_DEF_WIDTH; this->osd_height = OSD_DEF_HEIGHT; @@ -2626,7 +2626,7 @@ static void XKeyEvent_handler(sxfe_t *this, XKeyEvent *kev) fe_event = "POWER_OFF"; break; case XK_Escape: - if (!this->x.keypress) /* ESC exits only in remote mode */ + if (!this->fe.fe_message_cb) /* ESC exits only in remote mode */ fe_event = "QUIT"; break; default:; |
