|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Detect DVD menu from UII am attempting to write a simple UI for xine that will primarily be
used to watch DVDs on a home theater system running MythTV. I have a very simple remote control with only eight buttons: up, down, left, right, play, stop, esc and mute. I would like use up, down, left, right and play as select when I'm navigating DVD menus, and then as volume up, volume down, seek -60s, seek +60s, and play/pause when the movie is playing. To accomplish this, I need to be able to detect whether or not we're in a DVD menu. How can I do this using the xine API? Jonathan ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ xine-devel mailing list xine-devel@... https://lists.sourceforge.net/lists/listinfo/xine-devel |
|
|
Re: Detect DVD menu from UIOn Sun, 2009-04-12 at 21:15 +0300, Jonathan Dieter wrote:
> I am attempting to write a simple UI for xine that will primarily be > used to watch DVDs on a home theater system running MythTV. > > I have a very simple remote control with only eight buttons: up, down, > left, right, play, stop, esc and mute. > > I would like use up, down, left, right and play as select when I'm > navigating DVD menus, and then as volume up, volume down, seek -60s, > seek +60s, and play/pause when the movie is playing. > > To accomplish this, I need to be able to detect whether or not we're in > a DVD menu. How can I do this using the xine API? UI, so have patched xine's default ui to handle multiple keybindings if one is for a menu. Attached is the patch. The only thing I don't like is that the variable that tells us whether we're on a menu or not is global. Jonathan [xine-multiple-keypress.patch] diff -ur xine-ui-0.99.5/src/xitk/kbindings.c xine-ui-0.99.5b/src/xitk/kbindings.c --- xine-ui-0.99.5/src/xitk/kbindings.c 2007-04-10 01:39:35.000000000 +0300 +++ xine-ui-0.99.5b/src/xitk/kbindings.c 2009-04-13 18:52:38.112331308 +0300 @@ -36,6 +36,7 @@ #include "common.h" extern gGui_t *gGui; +extern int is_menu; #undef TRACE_KBINDINGS @@ -173,6 +174,17 @@ char buf[256]; } kbinding_file_t; +/* + * action_ids that are menu-only + */ +static const action_id_t menu_only_actions[] = { + ACTID_EVENT_UP, + ACTID_EVENT_DOWN, + ACTID_EVENT_LEFT, + ACTID_EVENT_RIGHT, + ACTID_EVENT_SELECT, + 0 +}; /* * Default key mapping table. @@ -525,6 +537,15 @@ 0, 0 , 0, 0 , 0 , 0} }; +static int _action_id_is_menu_only(action_id_t action) { + int i; + + for(i=0; menu_only_actions[i] != 0; i++) + if(menu_only_actions[i] == action) + return 1; + return 0; +} + static int _kbinding_get_is_gui_from_default(char *action) { int i; @@ -587,6 +608,7 @@ if(i != j && j != found) { if((!strcmp(kbt->entry[i]->key, kbt->entry[j]->key)) && (kbt->entry[i]->modifier == kbt->entry[j]->modifier) && + (_action_id_is_menu_only(kbt->entry[i]->action_id) == _action_id_is_menu_only(kbt->entry[j]->action_id)) && (strcasecmp(kbt->entry[i]->key, "void"))) { char action1[1024], action2[1024]; char *dna = _("and"); @@ -1377,9 +1399,12 @@ for(i = 0, k = kbt->entry[0]; kbt->entry[i]->action != NULL; i++, k = kbt->entry[i]) { if(k && k->key && strlen(k->key) && ((!(strcmp(k->key, key))) && (modifier == k->modifier))) { kret = k; - goto __found; + if(is_menu == _action_id_is_menu_only(k->action_id)) + goto __found; } } + if(kret != NULL) + goto __found; /* Not case sensitive */ /* @@ -1392,7 +1417,8 @@ for(i = 0, k = kbt->entry[0]; kbt->entry[i]->action != NULL; i++, k = kbt->entry[i]) { if(k && k->key && strlen(k->key) && ((!(strcmp(k->key, key))) && (k->modifier == KEYMOD_NOMOD))) { kret = k; - break; + if(is_menu == _action_id_is_menu_only(k->action_id)) + break; } } @@ -1628,6 +1654,7 @@ for(i = 0; kbt->entry[i]->action != NULL; i++) { if((!strcmp(kbt->entry[i]->key, kbe->key)) && (kbt->entry[i]->modifier == kbe->modifier) && + (_action_id_is_menu_only(kbt->entry[i]->action_id) == _action_id_is_menu_only(kbe->action_id)) && (strcasecmp(kbt->entry[i]->key, "void"))) { return i; } diff -ur xine-ui-0.99.5/src/xitk/main.c xine-ui-0.99.5b/src/xitk/main.c --- xine-ui-0.99.5/src/xitk/main.c 2007-04-24 01:48:20.000000000 +0300 +++ xine-ui-0.99.5b/src/xitk/main.c 2009-04-13 18:52:38.114330908 +0300 @@ -75,6 +75,8 @@ gGui_t *gGui; extern _panel_t *panel; +int is_menu; + static char **video_driver_ids; static char **audio_driver_ids; static window_attributes_t window_attribute; @@ -564,6 +566,8 @@ char *configfile = NULL; char **backends, *backend; + is_menu = 0; + configfile = (char *) xine_xmalloc(strlen(xine_get_homedir()) + strlen(cfgdir) + strlen(cfgfile) @@ -1299,6 +1303,13 @@ break; case XINE_EVENT_UI_NUM_BUTTONS: + { + xine_ui_data_t *pevent = (xine_ui_data_t *) event->data; + if(pevent->num_buttons == 0) + is_menu = 0; + else + is_menu = 1; + } break; case XINE_EVENT_SPU_BUTTON: ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ xine-devel mailing list xine-devel@... https://lists.sourceforge.net/lists/listinfo/xine-devel |
|
|
Re: Detect DVD menu from UIHi Jonathan,
I've registered your patch and consider to check and apply (as I'll find time :-( ). Don't worry about the global variable, the alternative could be a global function to check the variable in local scope; this would prevent setting this variable from somewhere else; but I think we should know what we are doing... Cheers, Hans-Dieter Jonathan Dieter wrote: > On Sun, 2009-04-12 at 21:15 +0300, Jonathan Dieter wrote: > >>I am attempting to write a simple UI for xine that will primarily be >>used to watch DVDs on a home theater system running MythTV. >> >>I have a very simple remote control with only eight buttons: up, down, >>left, right, play, stop, esc and mute. >> >>I would like use up, down, left, right and play as select when I'm >>navigating DVD menus, and then as volume up, volume down, seek -60s, >>seek +60s, and play/pause when the movie is playing. >> >>To accomplish this, I need to be able to detect whether or not we're in >>a DVD menu. How can I do this using the xine API? > > > Ok, I've worked it out. Also decided it would be crazy to write my own > UI, so have patched xine's default ui to handle multiple keybindings if > one is for a menu. > > Attached is the patch. The only thing I don't like is that the variable > that tells us whether we're on a menu or not is global. > > Jonathan > ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ xine-devel mailing list xine-devel@... https://lists.sourceforge.net/lists/listinfo/xine-devel |
| Free embeddable forum powered by Nabble | Forum Help |