From: Bill F. <bil...@mi...> - 2002-07-17 07:51:03
|
OK, here's a revised set of patches to modify the GUI next and previous buttons to skip by chapter instead of by MRL for input plugins that support chapters or their equivalents (currently only implemented for the dvdnav input plugin). If the xine gui.skip_by_chapter configuration variable is set to 0 (defaults to 1), then the old xine behavior of always skipping by MRL will be used. A new function was added to xine-lib's xine-engine/load_plugins.c called xine_get_input_plugin_capabilities which takes a (xine_t *) argument, and is used to get the input plugin capabilities and examine them for the INPUT_CAP_CHAPTERS capability. There are three patches, one for xine-ui, one for xine-lib, and one for xine-dvdnav. -Regards -Bill xine-ui-0.9.12-skip_chapter.patch: -------------------------------------------------------------------------------- diff -ur xine-ui-0.9.12a/doc/README.config_en xine-ui-0.9.12b/doc/README.config_en --- xine-ui-0.9.12a/doc/README.config_en Sun Jun 16 05:06:50 2002 +++ xine-ui-0.9.12b/doc/README.config_en Thu Jul 4 23:24:17 2002 @@ -296,6 +296,14 @@ gui.warn_unhandled_codec Display popup window on unhandled codecs { never, video only, audio only, always } + +gui.skip_by_chapter If set and plugin supports it (currently only + dvdnav), play next|previous button will skip + by chapter. + + A value of 0 will revert to the original xine + behavior of always skipping to the next|previous + mrl. *** NOTE: following values shouldn't be changed by user: diff -ur xine-ui-0.9.12a/src/xitk/actions.c xine-ui-0.9.12b/src/xitk/actions.c --- xine-ui-0.9.12a/src/xitk/actions.c Sun Jun 16 05:06:51 2002 +++ xine-ui-0.9.12b/src/xitk/actions.c Wed Jul 17 02:14:12 2002 @@ -45,6 +45,7 @@ #include "viewlog.h" #include "errors.h" #include "i18n.h" +#include "kbindings.h" #include "xitk.h" @@ -387,22 +388,32 @@ void gui_nextprev(xitk_widget_t *w, void *data) { - if(((int)data) == GUI_NEXT) { - gGui->ignore_status = 0; - gui_status_callback (XINE_STOP); + if (gGui->skip_by_chapter && (xine_get_input_plugin_capabilities (gGui->xine) & INPUT_CAP_CHAPTERS)) { + if(((int)data) == GUI_NEXT) { + gui_execute_action_id(ACTID_EVENT_NEXT); + } + else if(((int)data) == GUI_PREV) { + gui_execute_action_id(ACTID_EVENT_PRIOR); + } } - else if(((int)data) == GUI_PREV) { - gGui->ignore_status = 1; - gGui->playlist_cur--; - if ((gGui->playlist_cur>=0) && (gGui->playlist_cur < gGui->playlist_num)) { - gui_set_current_mrl(gGui->playlist[gGui->playlist_cur]); - if(!xine_play (gGui->xine, gGui->filename, 0, 0 )) - gui_handle_xine_error(); + else { + if(((int)data) == GUI_NEXT) { + gGui->ignore_status = 0; + gui_status_callback (XINE_STOP); + } + else if(((int)data) == GUI_PREV) { + gGui->ignore_status = 1; + gGui->playlist_cur--; + if ((gGui->playlist_cur>=0) && (gGui->playlist_cur < gGui->playlist_num)) { + gui_set_current_mrl(gGui->playlist[gGui->playlist_cur]); + if(!xine_play (gGui->xine, gGui->filename, 0, 0 )) + gui_handle_xine_error(); - } else { - gGui->playlist_cur = 0; + } else { + gGui->playlist_cur = 0; + } + gGui->ignore_status = 0; } - gGui->ignore_status = 0; } panel_check_pause(); diff -ur xine-ui-0.9.12a/src/xitk/event.c xine-ui-0.9.12b/src/xitk/event.c --- xine-ui-0.9.12a/src/xitk/event.c Sat Jun 22 14:02:47 2002 +++ xine-ui-0.9.12b/src/xitk/event.c Thu Jul 4 22:55:43 2002 @@ -753,6 +753,11 @@ _("time between two screensaver fake events, 0 to disable"), NULL, ssaver_timeout_cb, NULL); + gGui->skip_by_chapter = + gGui->config->register_bool (gGui->config, "gui.skip_by_chapter", 1, + _("play next|previous chapter instead of mrl (dvdnav)"), + NULL, NULL, NULL); + XLockDisplay (gGui->display); gGui->screen = DefaultScreen(gGui->display); diff -ur xine-ui-0.9.12a/src/xitk/event.h xine-ui-0.9.12b/src/xitk/event.h --- xine-ui-0.9.12a/src/xitk/event.h Sun Jun 16 05:06:51 2002 +++ xine-ui-0.9.12b/src/xitk/event.h Wed Jul 17 02:12:42 2002 @@ -116,6 +116,8 @@ int ssaver_timeout; + int skip_by_chapter; + kbinding_t *kbindings; } gGui_t; diff -ur xine-ui-0.9.12a/src/xitk/panel.c xine-ui-0.9.12b/src/xitk/panel.c --- xine-ui-0.9.12a/src/xitk/panel.c Sat Jun 22 14:02:48 2002 +++ xine-ui-0.9.12b/src/xitk/panel.c Thu Jul 4 23:05:00 2002 @@ -736,7 +736,10 @@ b.callback = gui_nextprev; b.userdata = (void *)GUI_PREV; xitk_list_append_content(panel->widget_list->l, (w = xitk_button_create(gGui->skin_config, &b))); - xitk_set_widget_tips(w, _("Play previous entry from playlist")); + if (gGui->skip_by_chapter) + xitk_set_widget_tips(w, _("Play previous chapter or mrl")); + else + xitk_set_widget_tips(w, _("Play previous entry from playlist")); /* Stop button */ b.skin_element_name = "Stop"; @@ -765,7 +768,10 @@ b.callback = gui_nextprev; b.userdata = (void *)GUI_NEXT; xitk_list_append_content(panel->widget_list->l, (w = xitk_button_create(gGui->skin_config, &b))); - xitk_set_widget_tips(w, _("Play next entry from playlist")); + if (gGui->skip_by_chapter) + xitk_set_widget_tips(w, _("Play next chapter or mrl")); + else + xitk_set_widget_tips(w, _("Play next entry from playlist")); /* Eject button */ b.skin_element_name = "Eject"; -------------------------------------------------------------------------------- xine-lib-0.9.12-skip_chapter.patch: -------------------------------------------------------------------------------- diff -ur xine-lib-0.9.12b/include/xine.h.tmpl.in xine-lib-0.9.12c/include/xine.h.tmpl.in --- xine-lib-0.9.12b/include/xine.h.tmpl.in Thu Jun 20 14:34:48 2002 +++ xine-lib-0.9.12c/include/xine.h.tmpl.in Wed Jul 17 02:35:21 2002 @@ -1018,6 +1018,48 @@ /** @} end of xine_management */ + /** + * \defgroup input_group Input. + * @{ + */ + + /** + * + * \defgroup input_cap input plugin capabilities + * @{ + */ + +/** + * \def INPUT_CAP_* + * bits to define various input plugin capabilities + * \sa xine_get_input_plugin_capabilities() + */ +#define INPUT_CAP_NOCAP 0x00000000 +#define INPUT_CAP_SEEKABLE 0x00000001 +#define INPUT_CAP_BLOCK 0x00000002 +#define INPUT_CAP_AUTOPLAY 0x00000004 +#define INPUT_CAP_GET_DIR 0x00000008 +#define INPUT_CAP_BROWSABLE 0x00000010 +#define INPUT_CAP_CLUT 0x00000020 +#define INPUT_CAP_AUDIOLANG 0x00000040 +#define INPUT_CAP_SPULANG 0x00000080 +#define INPUT_CAP_VARIABLE_BITRATE 0x00000100 +#define INPUT_CAP_PREVIEW 0x00000200 /* Requires INPUT_CAP_SEEKABLE */ +#define INPUT_CAP_CHAPTERS 0x00000400 + +/** + * \fn uint32_t xine_get_input_plugin_capabilities(xine_t *self) + * \brief Request input plugin capabilities + * \param self Current xine engine configuration ( #see xine_init() ) + * \return bitwise OR of all available capabilities. + * + */ +uint32_t xine_get_input_plugin_capabilities(xine_t *self); + + /** @} end of input_cap */ + + /** @} end of input_group */ + /** * \defgroup audio_group Audio. * @{ diff -ur xine-lib-0.9.12b/src/input/input_plugin.h xine-lib-0.9.12c/src/input/input_plugin.h --- xine-lib-0.9.12b/src/input/input_plugin.h Sat May 25 17:23:02 2002 +++ xine-lib-0.9.12c/src/input/input_plugin.h Sun Jul 14 14:28:46 2002 @@ -294,6 +294,7 @@ #define INPUT_CAP_SPULANG 0x00000080 #define INPUT_CAP_VARIABLE_BITRATE 0x00000100 #define INPUT_CAP_PREVIEW 0x00000200 /* Requires INPUT_CAP_SEEKABLE */ +#define INPUT_CAP_CHAPTERS 0x00000400 #define INPUT_OPTIONAL_UNSUPPORTED 0 diff -ur xine-lib-0.9.12b/src/xine-engine/load_plugins.c xine-lib-0.9.12c/src/xine-engine/load_plugins.c --- xine-lib-0.9.12b/src/xine-engine/load_plugins.c Sat Jun 15 14:00:44 2002 +++ xine-lib-0.9.12c/src/xine-engine/load_plugins.c Sun Jul 14 22:46:21 2002 @@ -403,6 +403,15 @@ return NULL; } +uint32_t xine_get_input_plugin_capabilities(xine_t *this) { + + if (!this || !this->cur_input_plugin + || !this->cur_input_plugin->get_capabilities) + return INPUT_CAP_NOCAP; + + return this->cur_input_plugin->get_capabilities(this->cur_input_plugin); +} + /** *************************************************************** * Decoder plugins section */ -------------------------------------------------------------------------------- xine-dvdnav-0.9.12-skip_chapter.patch: -------------------------------------------------------------------------------- diff -ur xine-dvdnav-0.9.12.dist/input/input_dvdnav.c xine-dvdnav-0.9.12.mod/input/input_dvdnav.c --- xine-dvdnav-0.9.12.dist/input/input_dvdnav.c Mon Jun 24 13:25:09 2002 +++ xine-dvdnav-0.9.12.mod/input/input_dvdnav.c Sun Jul 14 15:25:27 2002 @@ -168,7 +168,8 @@ #if CAN_SEEK INPUT_CAP_SEEKABLE | INPUT_CAP_VARIABLE_BITRATE | #endif - INPUT_CAP_AUDIOLANG | INPUT_CAP_SPULANG | INPUT_CAP_GET_DIR; + INPUT_CAP_AUDIOLANG | INPUT_CAP_SPULANG | INPUT_CAP_GET_DIR | + INPUT_CAP_CHAPTERS; } void read_ahead_cb(void *this_gen, cfg_entry_t *entry) { -------------------------------------------------------------------------------- |