summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/xine.h.in35
-rw-r--r--src/input/input_dvd.c32
-rw-r--r--src/xine-engine/xine_interface.c66
3 files changed, 67 insertions, 66 deletions
diff --git a/include/xine.h.in b/include/xine.h.in
index 81f55fd34..9fb371004 100644
--- a/include/xine.h.in
+++ b/include/xine.h.in
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine.h.in,v 1.13 2002/09/13 18:25:22 guenter Exp $
+ * $Id: xine.h.in,v 1.14 2002/09/14 19:04:07 guenter Exp $
*
* public xine-lib (libxine) interface and documentation
*
@@ -29,6 +29,8 @@
* model
* (2) as a rule of thumb, never free() or realloc() any pointers
* returned by the xine engine (unless stated otherwise)
+ * or, in other words:
+ * do not free() stuff you have not malloc()ed
* (3) xine is multi-threaded, make sure your programming environment
* can handle this.
* for x11-related stuff this means that you either have to properly
@@ -702,26 +704,29 @@ int xine_config_register_bool (xine_p self,
xine_config_cb_t changed_cb,
void *cb_data);
+/*
+ * the following functions will copy data from the internal xine_config
+ * data database to the xine_cfg_entry_t *entry you provide
+ *
+ * they return 1 on success, 0 on failure
+ */
+
/*
* get first config item
*/
-xine_cfg_entry_t *xine_config_get_first_entry (xine_p self);
+int xine_config_get_first_entry (xine_p self, xine_cfg_entry_t *entry);
/*
* get next config item (iterate through the items)
- * this will return NULL when called after returning the last item
- *
- * do not free() or realloc() the pointer returned by this function.
*/
-xine_cfg_entry_t *xine_config_get_next_entry (xine_p self);
+int xine_config_get_next_entry (xine_p self, xine_cfg_entry_t *entry);
/*
* search for a config entry by key
- *
- * do not free() or realloc() the pointer returned by this function.
*/
-xine_cfg_entry_t *xine_config_lookup_entry (xine_p self, const char *key);
+int xine_config_lookup_entry (xine_p self, const char *key,
+ xine_cfg_entry_t *entry);
/*
* update a config entry (which was returned from lookup_entry() )
@@ -729,17 +734,15 @@ xine_cfg_entry_t *xine_config_lookup_entry (xine_p self, const char *key);
* xine will make a deep copy of the data in the entry into it's internal
* config database.
*/
-void xine_config_update_entry (xine_p self,
- xine_cfg_entry_t *entry);
+void xine_config_update_entry (xine_p self,
+ xine_cfg_entry_t *entry);
/*
* load/save config data from/to afile (e.g. $HOME/.xine/config)
*/
-void xine_load_config (xine_p self,
- const char *cfg_filename);
-void xine_save_config (xine_p self,
- const char *cfg_filename);
-void xine_reset_config (xine_p self);
+void xine_load_config (xine_p self, const char *cfg_filename);
+void xine_save_config (xine_p self, const char *cfg_filename);
+void xine_reset_config (xine_p self);
/*
* xine event mechanism
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c
index 6c33f8694..f12f541a2 100644
--- a/src/input/input_dvd.c
+++ b/src/input/input_dvd.c
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: input_dvd.c,v 1.78 2002/09/13 17:18:42 mroi Exp $
+ * $Id: input_dvd.c,v 1.79 2002/09/14 19:04:07 guenter Exp $
*
*/
@@ -385,7 +385,7 @@ static int dvdnav_plugin_open (input_plugin_t *this_gen, const char *mrl) {
dvdnav_input_plugin_t *this = (dvdnav_input_plugin_t *) this_gen;
dvdnav_status_t ret;
char *intended_dvd_device;
- xine_cfg_entry_t *region_entry, *lang_entry, *cache_entry;
+ xine_cfg_entry_t region_entry, lang_entry, cache_entry;
trace_print("Called\n");
/* printf("input_dvd: open1: dvdnav=%p opened=%d\n",this->dvdnav, this->opened); */
@@ -506,27 +506,20 @@ static int dvdnav_plugin_open (input_plugin_t *this_gen, const char *mrl) {
}
}
-
/* Set region code */
- region_entry = xine_config_lookup_entry (this->xine,
- "input.dvd_region");
- if(region_entry) {
- region_changed_cb(this, region_entry);
- }
+ if (xine_config_lookup_entry (this->xine, "input.dvd_region",
+ &region_entry))
+ region_changed_cb (this, &region_entry);
/* Set languages */
- lang_entry = xine_config_lookup_entry(this->xine,
- "input.dvdnav_language");
- if(lang_entry) {
- language_changed_cb(this, lang_entry);
- }
+ if (xine_config_lookup_entry (this->xine, "input.dvdnav_language",
+ &lang_entry))
+ language_changed_cb (this, &lang_entry);
/* Set cache usage */
- cache_entry = xine_config_lookup_entry(this->xine,
- "input.dvdnav_use_readahead");
- if(cache_entry) {
- read_ahead_cb(this, cache_entry);
- }
+ if (xine_config_lookup_entry(this->xine, "input.dvdnav_use_readahead",
+ &cache_entry))
+ read_ahead_cb(this, &cache_entry);
if(this->mode == MODE_TITLE) {
int tt, i, pr, found;
@@ -1490,6 +1483,9 @@ static void *init_input_plugin (xine_t *xine, void *data) {
/*
* $Log: input_dvd.c,v $
+ * Revision 1.79 2002/09/14 19:04:07 guenter
+ * latest xine_config api changes as proposed by james
+ *
* Revision 1.78 2002/09/13 17:18:42 mroi
* dvd playback should work again
*
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index 0b2532141..d1e68099c 100644
--- a/src/xine-engine/xine_interface.c
+++ b/src/xine-engine/xine_interface.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_interface.c,v 1.11 2002/09/13 18:25:23 guenter Exp $
+ * $Id: xine_interface.c,v 1.12 2002/09/14 19:04:08 guenter Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -159,49 +159,50 @@ int xine_config_register_bool (xine_p self,
/*
* helper function:
*
- * copy current config entry data to public struct
- * and return it
+ * copy current config entry data to user-provided memory
+ * and return status
*/
-xine_cfg_entry_t *xine_config_get_current_entry (xine_p this) {
+static int xine_config_get_current_entry (xine_p this,
+ xine_cfg_entry_t *entry) {
config_values_t *config = this->config;
if (!config->cur)
- return NULL;
-
- config->public_entry.key = config->cur->key;
- config->public_entry.type = config->cur->type;
-
- config->public_entry.unknown_value = config->cur->unknown_value;
- config->public_entry.str_value = config->cur->str_value;
- config->public_entry.str_default = config->cur->str_default;
- config->public_entry.str_sticky = config->cur->str_sticky;
- config->public_entry.num_value = config->cur->num_value;
- config->public_entry.num_default = config->cur->num_default;
- config->public_entry.range_min = config->cur->range_min;
- config->public_entry.range_max = config->cur->range_max;
- config->public_entry.enum_values = config->cur->enum_values;
-
- config->public_entry.description = config->cur->description;
- config->public_entry.help = config->cur->help;
- config->public_entry.callback = config->cur->callback;
- config->public_entry.callback_data = config->cur->callback_data;
- config->public_entry.exp_level = config->cur->exp_level;
-
- return &config->public_entry;
+ return 0;
+
+ entry->key = config->cur->key;
+ entry->type = config->cur->type;
+
+ entry->unknown_value = config->cur->unknown_value;
+ entry->str_value = config->cur->str_value;
+ entry->str_default = config->cur->str_default;
+ entry->str_sticky = config->cur->str_sticky;
+ entry->num_value = config->cur->num_value;
+ entry->num_default = config->cur->num_default;
+ entry->range_min = config->cur->range_min;
+ entry->range_max = config->cur->range_max;
+ entry->enum_values = config->cur->enum_values;
+
+ entry->description = config->cur->description;
+ entry->help = config->cur->help;
+ entry->callback = config->cur->callback;
+ entry->callback_data = config->cur->callback_data;
+ entry->exp_level = config->cur->exp_level;
+
+ return 1;
}
/*
* get first config item
*/
-xine_cfg_entry_t *xine_config_get_first_entry (xine_p this) {
+int xine_config_get_first_entry (xine_p this, xine_cfg_entry_t *entry) {
config_values_t *config = this->config;
config->cur = config->first;
- return xine_config_get_current_entry (this);
+ return xine_config_get_current_entry (this, entry);
}
@@ -209,13 +210,13 @@ xine_cfg_entry_t *xine_config_get_first_entry (xine_p this) {
* get next config item (iterate through the items)
* this will return NULL when called after returning the last item
*/
-xine_cfg_entry_t *xine_config_get_next_entry (xine_p this) {
+int xine_config_get_next_entry (xine_p this, xine_cfg_entry_t *entry) {
config_values_t *config = this->config;
config->cur = config->cur->next;
- return xine_config_get_current_entry (this);
+ return xine_config_get_current_entry (this, entry);
}
@@ -223,13 +224,14 @@ xine_cfg_entry_t *xine_config_get_next_entry (xine_p this) {
* search for a config entry by key
*/
-xine_cfg_entry_t *xine_config_lookup_entry (xine_p this, const char *key) {
+int xine_config_lookup_entry (xine_p this, const char *key,
+ xine_cfg_entry_t *entry) {
config_values_t *config = this->config;
config->cur = config->lookup_entry (config, key);
- return xine_config_get_current_entry (this);
+ return xine_config_get_current_entry (this, entry);
}