diff options
-rw-r--r-- | xine_frontend.c | 28 | ||||
-rw-r--r-- | xine_input_vdr.c | 30 | ||||
-rw-r--r-- | xine_input_vdr.h | 4 |
3 files changed, 39 insertions, 23 deletions
diff --git a/xine_frontend.c b/xine_frontend.c index 23edcdf9..c37d2042 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.95 2009-02-10 16:07:52 phintuka Exp $ + * $Id: xine_frontend.c,v 1.96 2009-02-25 14:34:24 phintuka Exp $ * */ @@ -552,7 +552,7 @@ static int fe_xine_init(frontend_t *this_gen, const char *audio_driver, if(this->xine) this->fe.xine_exit(this_gen); - + this->stream = NULL; this->video_port = NULL; this->audio_port = NULL; @@ -1269,9 +1269,25 @@ static int fe_send_input_event(frontend_t *this_gen, const char *map, /* remote mode: --> input plugin --> vdr */ if (find_input_plugin(this)) { - if (this->input_plugin->f.input_control) { - this->input_plugin->f.input_control(this->input_plugin, map, key, repeat, release); - return FE_OK; + if (this->input_plugin->f.post_vdr_event) { + char *msg = NULL; + if (map) { + if (asprintf(&msg, "KEY %s %s %s %s\r\n", map, key, + repeat?"Repeat":"", release?"Release":"") < 0) + msg = NULL; + } else { + if (asprintf(&msg, "KEY %s\r\n", key) < 0) + msg = NULL; + } + + if (msg) { + int r = this->input_plugin->f.post_vdr_event(this->input_plugin, msg); + free(msg); + if (r > 0) + return FE_OK; + } + LOGMSG("fe_send_input_event: message KEY %s lost", key); + return FE_ERROR; } } @@ -1406,7 +1422,7 @@ static void *fe_control(frontend_t *this_gen, const char *cmd) posts->pip_stream = NULL; } return NULL; - + } else if(!strncmp(cmd, "POST ", 5)) { char *name = strdup(cmd+5), *args = name, *pt; diff --git a/xine_input_vdr.c b/xine_input_vdr.c index 7ed846ef..37ef9e0f 100644 --- a/xine_input_vdr.c +++ b/xine_input_vdr.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_input_vdr.c,v 1.234 2009-02-25 14:27:57 phintuka Exp $ + * $Id: xine_input_vdr.c,v 1.235 2009-02-25 14:34:24 phintuka Exp $ * */ @@ -3252,9 +3252,13 @@ static void vdr_event_cb (void *user_data, const xine_event_t *event) LOGDBG("XINE_EVENT (input) %d --> %s", event->type, vdr_keymap[i].name); - if(this->funcs.input_control) { + if(this->funcs.post_vdr_event) { /* remote mode: -> input_plugin -> connection -> VDR */ - this->funcs.input_control(&this->iface, NULL, vdr_keymap[i].name, 0, 0); + char *msg=NULL; + if (asprintf(&msg, "KEY %s\r\n", vdr_keymap[i].name) >= 0) { + this->funcs.post_vdr_event(&this->iface, msg); + free(msg); + } } if(this->funcs.xine_input_event) { /* local mode: -> VDR */ @@ -3977,24 +3981,20 @@ static int vdr_plugin_write(vdr_input_plugin_if_t *this_if, const char *data, in * * It is safe to cancel thread while this function is being executed. */ -static int vdr_plugin_keypress(vdr_input_plugin_if_t *this_if, - const char *map, const char *key, - int repeat, int release) +static int post_vdr_event(vdr_input_plugin_if_t *this_if, const char *msg) { vdr_input_plugin_t *this = (vdr_input_plugin_t *) this_if; + int result = -1; mutex_lock_cancellable(&this->lock); - if(key && this->fd_control >= 0) { - if(map) - printf_control(this, "KEY %s %s %s %s\r\n", map, key, - repeat?"Repeat":"", release?"Release":""); - else - printf_control(this, "KEY %s\r\n", key); - } + if (msg && this->fd_control >= 0) + result = write_control(this, msg); + else + LOGMSG("post_vdr_event: error ! \"%s\" not delivered.", msg ?: "<null>"); mutex_unlock_cancellable(&this->lock); - return 0; + return result; } @@ -5218,7 +5218,7 @@ static input_plugin_t *vdr_class_get_instance (input_class_t *class_gen, this->funcs.push_input_osd = vdr_plugin_exec_osd_command; /*this->funcs.xine_input_event= NULL; -- frontend sets this */ } else { - this->funcs.input_control = vdr_plugin_keypress; + this->funcs.post_vdr_event = post_vdr_event; } /* buffer */ diff --git a/xine_input_vdr.h b/xine_input_vdr.h index 5f8065eb..1039ca8c 100644 --- a/xine_input_vdr.h +++ b/xine_input_vdr.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_input_vdr.h,v 1.9 2008-11-12 00:42:48 phintuka Exp $ + * $Id: xine_input_vdr.h,v 1.10 2009-02-25 14:34:24 phintuka Exp $ * */ @@ -41,7 +41,7 @@ typedef struct vdr_input_plugin_funcs_s { struct frontend_s *fe_handle; /* frontend --> input plugin (remote mode) */ - int (*input_control) (struct vdr_input_plugin_if_s *, const char *, const char *, int, int); + int (*post_vdr_event) (struct vdr_input_plugin_if_s *, const char *); } vdr_input_plugin_funcs_t; typedef struct vdr_input_plugin_if_s { |