From: Rocky B. <ro...@us...> - 2002-10-06 14:36:16
|
Update of /cvsroot/xine/xine-vcdnav/input In directory usw-pr-cvs1:/tmp/cvs-serv3064 Modified Files: xineplug_inp_vcd.c Log Message: All configuration variables can change inside xine. Well, *almost* all of them: autoplay_devices needs more work. Patch from Gert Vervoort for gcc < 3.0 (and possibly other C compilers). Index: xineplug_inp_vcd.c =================================================================== RCS file: /cvsroot/xine/xine-vcdnav/input/xineplug_inp_vcd.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- xineplug_inp_vcd.c 6 Oct 2002 13:19:16 -0000 1.16 +++ xineplug_inp_vcd.c 6 Oct 2002 14:36:13 -0000 1.17 @@ -165,6 +165,8 @@ xineplug_vcd_open (input_plugin_t *this_gen, const char *mrl) { vcdplayer_input_t *this = (vcdplayer_input_t *) this_gen; + char *intended_vcd_device = NULL; + vcdinfo_itemid_t itemid; free(this->mrl); @@ -173,9 +175,6 @@ else this->mrl = strdup(mrl); - char *intended_vcd_device = NULL; - vcdinfo_itemid_t itemid; - dbg_print(INPUT_DBG_CALL, "Called with %s\n", this->mrl); if (!vcdplayer_parse_mrl(this->default_vcd_device, this->mrl, @@ -802,41 +801,60 @@ xine_send_event(xine, &mevent.event); } -void -_xineplug_autoplay_devices_changed_cb(void *this_gen, xine_cfg_entry_t *entry) -{ - vcdplayer_input_t *this = (vcdplayer_input_t*)this_gen; - - dbg_print(INPUT_DBG_CALL, "Called\n"); - if ( (NULL == this) || (NULL == entry->str_value) ) return; - - free(this->autoplay_devices); - this->autoplay_devices = strdup(entry->str_value); -} - -void -_xineplug_default_vcd_dev_changed_cb(void *this_gen, xine_cfg_entry_t *entry) -{ - vcdplayer_input_t *this = (vcdplayer_input_t*)this_gen; +#define _XINEPLUG_NUM_CALLBACK(fn_name, var) \ + static void fn_name(void *this_gen, xine_cfg_entry_t *entry) \ +{ \ + vcdplayer_input_t *this = (vcdplayer_input_t*)this_gen; \ +\ + dbg_print(INPUT_DBG_CALL, "Called setting %d\n", entry->num_value); \ + if ( NULL == this ) return; \ +\ + this->var = entry->num_value; \ +} + +#define _XINEPLUG_ENUM_CALLBACK(fn_name, enum_type, var) \ + static void fn_name(void *this_gen, xine_cfg_entry_t *entry) \ +{ \ + vcdplayer_input_t *this = (vcdplayer_input_t*)this_gen; \ +\ + dbg_print(INPUT_DBG_CALL, "Called setting %d\n", entry->num_value); \ + if ( NULL == this ) return; \ +\ + this->var = (enum_type) entry->num_value; \ +} + +#define _XINEPLUG_STR_CALLBACK(fn_name, var) \ + static void fn_name(void *this_gen, xine_cfg_entry_t *entry) \ +{ \ + vcdplayer_input_t *this = (vcdplayer_input_t*)this_gen; \ +\ + dbg_print(INPUT_DBG_CALL, "Called setting %s\n", entry->str_value); \ + if ( (NULL == this) || (NULL == entry->str_value) ) return; \ +\ + free(this->var); \ + this->var = strdup(entry->str_value); \ +} + +_XINEPLUG_STR_CALLBACK(_xineplug_autoplay_devices_changed_cb, + autoplay_devices) + +_XINEPLUG_STR_CALLBACK(_xineplug_default_vcd_dev_changed_cb, + default_vcd_device) + +_XINEPLUG_STR_CALLBACK(_xineplug_title_format_str_changed_cb, + title_format_str) + +_XINEPLUG_NUM_CALLBACK(_xineplug_show_rejected_cb, + show_rejected) - dbg_print(INPUT_DBG_CALL, "Called\n"); - if ( (NULL == this) || (NULL == entry->str_value) ) return; - - free(this->default_vcd_device); - this->default_vcd_device = strdup(entry->str_value); -} +_XINEPLUG_NUM_CALLBACK(_xineplug_wrap_next_prev_cb, + wrap_next_prev) -void -_xineplug_title_format_str_changed_cb(void *this_gen, xine_cfg_entry_t *entry) -{ - vcdplayer_input_t *this = (vcdplayer_input_t*)this_gen; +_XINEPLUG_NUM_CALLBACK(_xineplug_slider_length_cb, + slider_length) - dbg_print(INPUT_DBG_CALL, "Called\n"); - if ( (NULL == this) || (NULL == entry->str_value) ) return; - - free(this->title_format_str); - this->title_format_str = strdup(entry->str_value); -} +_XINEPLUG_ENUM_CALLBACK(_xineplug_default_autoplay_cb, vcdinfo_item_enum_t, + default_autoplay) static void * xineplug_vcd_init (xine_t *xine, void *data) @@ -932,12 +950,12 @@ this); - this->default_autoplay = (vcdinfo_item_enum_t) - config->register_range(config, - "vcdx.autoplay", - (int) VCDINFO_ITEM_TYPE_ENTRY, - 1, 2, - _("Default type to use on autoplay (1=track, 2=entry)"), + this->default_autoplay = VCDINFO_ITEM_TYPE_ENTRY; + config->register_range(config, + "vcdx.autoplay", + (int) VCDINFO_ITEM_TYPE_ENTRY, + 1, 2, + _("Default type to use on autoplay (1=track, 2=entry)"), "This specifies what do for the when no entry is given in a mrl for\n" "example vcdx:// or vcdx:///dev/dvd:. The values can be 1, play the\n" "first track (e.g. vcdx://:T1) or 2, play the first entry\n" @@ -945,8 +963,8 @@ "\n" "The default is currently 2 play the first entry. As playback control\n" "advances this will probably be changed to autonavigate.\n", - 10, - NULL, NULL); + 10, + _xineplug_default_autoplay_cb, this); this->default_vcd_device = NULL; @@ -957,8 +975,7 @@ "The default device in a MRL when none is listed. The default is " DEFAULT_VCD_DEVICE, 10, - _xineplug_default_vcd_dev_changed_cb, - this); + _xineplug_default_vcd_dev_changed_cb, this); this->current_vcd_device = this->default_vcd_device; @@ -966,10 +983,10 @@ check_solaris_vold_device(this); #endif - this->slider_length = - config->register_range(config, "vcdx.length_reporting", - (int) VCDPLAYER_SLIDER_LENGTH_AUTO, - 0, 2, + this->slider_length = 1; + config->register_range(config, "vcdx.length_reporting", + (int) VCDPLAYER_SLIDER_LENGTH_AUTO, + 0, 2, _("Position slider range? 0 = auto 1 = track, 2 = entry"), "This setting affects the range the stream playback position slider\n" "takes during playing. The possible values are 0, 1.\n" @@ -980,7 +997,8 @@ "\n" "1: track always. The range always indicates the range of the current track\n" "independent of the currently selected item.\n", - 10, NULL, NULL); + 10, + _xineplug_slider_length_cb, this); #if READAHEAD_FINISHED config->register_bool(config, "vcdx.use_readahead", @@ -992,11 +1010,11 @@ read_ahead_cb, this); #endif - this->show_rejected = (bool) - config->register_bool(config, - "vcdx.show_rejected", - (int) false, - "Show 'rejected'LIDs?", + this->show_rejected = false; + config->register_bool(config, + "vcdx.show_rejected", + (int) false, + _("Show 'rejected'LIDs?"), "This setting is takes a boolean value (0 = false, 1 = true).\n" "Some playback list IDs (LIDs) are marked a not normally showable\n" "in a list. Setting this to configuration variable to true, you can\n" @@ -1004,7 +1022,9 @@ "the MRL.\n" "\n" "The default is 0 - don't show such 'rejected' LIDs.\n", - 10, NULL, NULL); + 10, + _xineplug_show_rejected_cb, + this); this->title_format_str = NULL; config->register_string(config, @@ -1030,10 +1050,10 @@ _xineplug_title_format_str_changed_cb, this); - this->wrap_next_prev = (bool) - config->register_bool(config, - "vcdx.wrap_next_prev", - (int) true, + this->wrap_next_prev = true; + config->register_bool(config, + "vcdx.wrap_next_prev", + (int) true, _("Do next and previous wrap around in track/entry mode?"), "This setting is takes a boolean value (0 = false, 1 = true) and only\n" "has meaning when playing by track, or entry - not by playback control\n" @@ -1044,7 +1064,9 @@ "to wrap around. When PBC is in effect, next/prev do what PBC indicates.\n" "\n" "The default is 1 - turn wrapping on.\n", - 10, NULL, NULL); + 10, + _xineplug_wrap_next_prev_cb, + this); gl_default_vcd_log_handler = vcd_log_set_handler (_xineplug_log_handler); |