summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/audio_out.c41
-rw-r--r--src/xine-engine/configfile.c494
-rw-r--r--src/xine-engine/configfile.h152
-rw-r--r--src/xine-engine/load_plugins.c10
-rw-r--r--src/xine-engine/metronom.c14
-rw-r--r--src/xine-engine/video_out.c32
-rw-r--r--src/xine-engine/xine.c16
7 files changed, 575 insertions, 184 deletions
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index 9fd141769..a3dbd5319 100644
--- a/src/xine-engine/audio_out.c
+++ b/src/xine-engine/audio_out.c
@@ -17,7 +17,7 @@
* along with self program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_out.c,v 1.30 2001/11/17 17:29:39 jcdutton Exp $
+ * $Id: audio_out.c,v 1.31 2001/11/18 03:53:25 guenter Exp $
*
* 22-8-2001 James imported some useful AC3 sections from the previous alsa driver.
* (c) 2001 Andy Lo A Foe <andy@alsaplayer.org>
@@ -350,8 +350,10 @@ static void *ao_loop (void *this_gen) {
/* drop package */
- xprintf (VERBOSE|AUDIO, "audio_out: audio package (vpts = %d %d) dropped\n",
- buf->vpts, gap);
+#ifdef AUDIO_OUT_LOG
+ printf ("audio_out: audio package (vpts = %d %d) dropped\n",
+ buf->vpts, gap);
+#endif
} else {
@@ -464,6 +466,7 @@ static void *ao_loop (void *this_gen) {
/* ac3 seems to be swabbed data */
swab(buf->mem,this->frame_buffer+4, ac5_length );
+
if (ac5_length <= 248) {
ac5_pcm_length = 64;
} else if (ac5_length <= 504) {
@@ -482,6 +485,24 @@ static void *ao_loop (void *this_gen) {
break;
+
+
+
+
+ memset(this->frame_buffer,0xff,6144);
+ this->frame_buffer[0] = 0xf872; /* spdif syncword */
+ this->frame_buffer[1] = 0x4e1f; /* ............. */
+ this->frame_buffer[2] = 0x0001; /* */
+
+ this->frame_buffer[3] = 0x3ee0;
+
+ /* ac3 seems to be swabbed data */
+ swab(buf->mem,this->frame_buffer+4, 2014 );
+
+ this->driver->write(this->driver, this->frame_buffer, 1024);
+
+ break;
+
}
}
@@ -541,7 +562,9 @@ static int ao_open(ao_instance_t *this,
this->frame_rate_factor = (double) this->output_frame_rate / (double) this->input_frame_rate;
this->audio_step = (uint32_t) 90000 * (uint32_t) 32768 / this->input_frame_rate;
this->frames_per_kpts = this->output_frame_rate * 1024 / 90000;
- xprintf (VERBOSE|AUDIO, "audio_out : audio_step %d pts per 32768 frames\n", this->audio_step);
+#ifdef AUDIO_OUT_LOG
+ printf ("audio_out : audio_step %d pts per 32768 frames\n", this->audio_step);
+#endif
this->metronom->set_audio_rate(this->metronom, this->audio_step);
@@ -644,6 +667,7 @@ ao_instance_t *ao_new_instance (ao_driver_t *driver, metronom_t *metronom,
ao_instance_t *this;
int i;
+ static char *resample_modes[] = {"auto", "off", "on", NULL};
this = xine_xmalloc (sizeof (ao_instance_t)) ;
@@ -664,8 +688,12 @@ ao_instance_t *ao_new_instance (ao_driver_t *driver, metronom_t *metronom,
this->zero_space = xine_xmalloc (ZERO_BUF_SIZE * 2 * 6);
this->gap_tolerance = driver->get_gap_tolerance (this->driver);
- this->resample_conf = config->lookup_int (config, "audio_resample_mode", 0);
- this->force_rate = config->lookup_int (config, "audio_force_rate", 0);
+ this->resample_conf = config->register_enum (config, "audio.resample_mode", 0,
+ resample_modes, "adjust whether resampling is done or not",
+ NULL, NULL, NULL);
+ this->force_rate = config->register_range (config, "audio.force_rate", 0,
+ 0, 96000, "if !=0 always resample to given rate",
+ NULL, NULL, NULL);
/*
* pre-allocate memory for samples
@@ -688,4 +716,3 @@ ao_instance_t *ao_new_instance (ao_driver_t *driver, metronom_t *metronom,
return this;
}
-
diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c
index 0eddae1a9..8926aff7d 100644
--- a/src/xine-engine/configfile.c
+++ b/src/xine-engine/configfile.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: configfile.c,v 1.5 2001/11/17 14:26:39 f1rmb Exp $
+ * $Id: configfile.c,v 1.6 2001/11/18 03:53:25 guenter Exp $
*
* config file management - implementation
*
@@ -27,49 +27,64 @@
#include "config.h"
#endif
+#include <sys/stat.h>
+#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
#include "configfile.h"
#include "xineutils.h"
-/*
+
+/*
* internal utility functions
- *******************************/
+ */
-void config_file_add (config_values_t *this, char *key, char *value) {
+static char *copy_string (char *str) {
- cfg_entry_t *entry;
- int len;
+ char *cpy;
+ int len;
- entry = (cfg_entry_t *) xine_xmalloc (sizeof (cfg_entry_t));
+ len = strlen (str);
+
+ cpy = xine_xmalloc (len+256);
+
+ strncpy (cpy, str, len);
- len = strlen (key);
- entry->key = (char *) xine_xmalloc (len+2);
- strncpy (entry->key, key, len+1);
+ return cpy;
+}
+
+static cfg_entry_t *config_file_add (config_values_t *this, char *key) {
+
+ cfg_entry_t *entry;
- len = strlen (value);
- entry->value = (char *) xine_xmalloc (len+21);
- strncpy (entry->value, value, len+1);
+ entry = (cfg_entry_t *) xine_xmalloc (sizeof (cfg_entry_t));
+ entry->key = copy_string (key);
+ entry->type = CONFIG_TYPE_UNKNOWN;
- entry->next = NULL;
+ entry->next = NULL;
- if (this->data->gConfigLast)
- this->data->gConfigLast->next = entry;
+ if (this->last)
+ this->last->next = entry;
else
- this->data->gConfig = entry;
+ this->first = entry;
- this->data->gConfigLast = entry;
-
-}
+ this->last = entry;
+ printf ("configfile: add entry key=%s\n", key);
+ return entry;
+}
+/*
+ * external interface
+ */
-cfg_entry_t *config_file_search (config_values_t *this, char *key) {
+cfg_entry_t *config_file_lookup_entry (config_values_t *this, char *key) {
cfg_entry_t *entry;
- entry = this->data->gConfig;
+ entry = this->first;
while (entry && strcmp (entry->key, key))
entry = entry->next;
@@ -77,118 +92,314 @@ cfg_entry_t *config_file_search (config_values_t *this, char *key) {
return entry;
}
+static char *config_file_register_string (config_values_t *this,
+ char *key, char *def_value,
+ char *description,
+ char *help,
+ config_cb_t changed_cb,
+ void *cb_data) {
+ cfg_entry_t *entry;
-/*
- * external interface
- ***********************/
+ assert (key);
+ assert (def_value);
+ assert (description);
-static char *config_file_lookup_str (config_values_t *this,
- char *key, char*str_default) {
- cfg_entry_t *entry;
+ printf ("configfile: registering %s\n", key);
- if(key == NULL)
- return ((str_default != NULL) ? str_default : NULL);
-
- entry = config_file_search (this, key);
+ /* make sure this entry exists, create it if not */
- if (entry)
- return entry->value;
+ entry = config_file_lookup_entry (this, key);
- if(str_default)
- config_file_add (this, key, str_default);
+ if (!entry) {
+ entry = config_file_add (this, key);
+ entry->unknown_value = copy_string(def_value);
+ }
+
+ /* convert entry to string type if necessary */
- return str_default;
-}
+ if (entry->type != CONFIG_TYPE_STRING) {
+ entry->type = CONFIG_TYPE_STRING;
+ entry->str_value = entry->unknown_value;
+ }
+ /* fill out rest of struct */
+ entry->str_default = copy_string(def_value);
+ entry->description = description;
+ entry->help = help;
+ entry->callback = changed_cb;
+ entry->callback_data = cb_data;
+ return entry->str_value;
+}
-static int config_file_lookup_int (config_values_t *this,
- char *key, int n_default) {
+static int config_file_register_num (config_values_t *this,
+ char *key, int def_value,
+ char *description,
+ char *help,
+ config_cb_t changed_cb,
+ void *cb_data) {
cfg_entry_t *entry;
- char str[25];
- if(key == NULL)
- return n_default;
+ assert (key);
+ assert (description);
+
+ printf ("configfile: registering %s\n", key);
+
+ /* make sure this entry exists, create it if not */
- entry = config_file_search (this, key);
+ entry = config_file_lookup_entry (this, key);
- if (entry) {
- int n;
+ if (!entry) {
+ entry = config_file_add (this, key);
+ entry->unknown_value = NULL;
+ }
+
+ /* convert entry to num type if necessary */
- if (sscanf (entry->value, "%d", &n) == 1)
- return n;
+ if (entry->type != CONFIG_TYPE_NUM) {
+ entry->type = CONFIG_TYPE_NUM;
+
+ if (entry->unknown_value)
+ sscanf (entry->unknown_value, "%d", &entry->num_value);
+ else
+ entry->num_value = def_value;
}
- sprintf (str, "%d", n_default);
+
+ /* fill out rest of struct */
- config_file_add (this, key, str);
+ entry->num_default = def_value;
+ entry->description = description;
+ entry->help = help;
+ entry->callback = changed_cb;
+ entry->callback_data = cb_data;
- return n_default;
+ return entry->num_value;
}
+static int config_file_register_bool (config_values_t *this,
+ char *key, int def_value,
+ char *description,
+ char *help,
+ config_cb_t changed_cb,
+ void *cb_data) {
+ cfg_entry_t *entry;
+ assert (key);
+ assert (description);
+
+ printf ("configfile: registering %s\n", key);
+
+ /* make sure this entry exists, create it if not */
+
+ entry = config_file_lookup_entry (this, key);
+
+ if (!entry) {
+ entry = config_file_add (this, key);
+ entry->unknown_value = NULL;
+ }
+
+ /* convert entry to bool type if necessary */
+
+ if (entry->type != CONFIG_TYPE_BOOL) {
+ entry->type = CONFIG_TYPE_BOOL;
+
+ if (entry->unknown_value)
+ sscanf (entry->unknown_value, "%d", &entry->num_value);
+ else
+ entry->num_value = def_value;
+ }
+
+
+ /* fill out rest of struct */
+
+ entry->num_default = def_value;
+ entry->description = description;
+ entry->help = help;
+ entry->callback = changed_cb;
+ entry->callback_data = cb_data;
+
+ return entry->num_value;
+}
+
+static int config_file_register_range (config_values_t *this,
+ char *key, int def_value,
+ int min, int max,
+ char *description,
+ char *help,
+ config_cb_t changed_cb,
+ void *cb_data) {
-static void config_file_set_int (config_values_t *this,
- char *key, int value) {
-
cfg_entry_t *entry;
- if(key == NULL)
- return;
+ assert (key);
+ assert (description);
- entry = config_file_search (this, key);
+ printf ("configfile: registering %s\n", key);
- if (entry) {
- sprintf (entry->value, "%d", value);
+ /* make sure this entry exists, create it if not */
+
+ entry = config_file_lookup_entry (this, key);
+ if (!entry) {
+ entry = config_file_add (this, key);
+ entry->unknown_value = NULL;
}
- else {
- char str[25];
- sprintf (str, "%d", value);
+
+ /* convert entry to range type if necessary */
- config_file_add (this, key, str);
+ if (entry->type != CONFIG_TYPE_RANGE) {
+ entry->type = CONFIG_TYPE_RANGE;
+
+ if (entry->unknown_value)
+ sscanf (entry->unknown_value, "%d", &entry->num_value);
+ else
+ entry->num_value = def_value;
}
+
+ /* fill out rest of struct */
+
+ entry->num_default = def_value;
+ entry->range_min = min;
+ entry->range_max = max;
+ entry->description = description;
+ entry->help = help;
+ entry->callback = changed_cb;
+ entry->callback_data = cb_data;
+
+ return entry->num_value;
}
+static int config_file_parse_enum (char *str, char **values) {
+ char **value;
+ int i;
+
+
+ value = values;
+ i = 0;
+ while (*value) {
-static void config_file_set_str (config_values_t *this,
- char *key, char *value) {
+ printf ("configfile: parse enum, >%s< ?= >%s<\n",
+ *value, str);
+
+ if (!strcmp (*value, str))
+ return i;
+
+ value++;
+ i++;
+ }
+
+ printf ("configfile: warning, >%s< is not a valid enum here, using 0\n",
+ str);
+
+ return 0;
+}
+
+static int config_file_register_enum (config_values_t *this,
+ char *key, int def_value,
+ char **values,
+ char *description,
+ char *help,
+ config_cb_t changed_cb,
+ void *cb_data) {
cfg_entry_t *entry;
- if(key == NULL || value == NULL)
- return;
+ assert (key);
+ assert (values);
+ assert (description);
- entry = config_file_search (this, key);
+ printf ("configfile: registering %s\n", key);
- if (entry) {
- int len;
+ /* make sure this entry exists, create it if not */
+
+ entry = config_file_lookup_entry (this, key);
+ if (!entry) {
+ entry = config_file_add (this, key);
+ entry->unknown_value = NULL;
+ }
+
+ /* convert entry to enum type if necessary */
- free (entry->value);
+ if (entry->type != CONFIG_TYPE_ENUM) {
+ entry->type = CONFIG_TYPE_ENUM;
- len = strlen (value);
- entry->value = (char *) xine_xmalloc (len+20);
- strncpy (entry->value, value, len);
+ if (entry->unknown_value)
+ entry->num_value = config_file_parse_enum (entry->unknown_value, values);
+ else
+ entry->num_value = def_value;
}
- else {
- config_file_add (this, key, value);
+
+ /* fill out rest of struct */
+
+ entry->num_default = def_value;
+ entry->enum_values = values;
+ entry->description = description;
+ entry->help = help;
+ entry->callback = changed_cb;
+ entry->callback_data = cb_data;
+
+ return entry->num_value;
+}
+
+static void config_file_update_num (config_values_t *this,
+ char *key, int value) {
+
+ cfg_entry_t *entry;
+
+ entry = this->lookup_entry (this, key);
+
+ if (!entry) {
+
+ printf ("configfile: WARNING! tried to update unknown key %s (to %d)\n",
+ key, value);
+ return;
+
}
+
+ entry->num_value = value;
+
+ if (entry->callback)
+ entry->callback (entry->callback_data, entry);
}
+static void config_file_update_string (config_values_t *this,
+ char *key, char *value) {
+
+ cfg_entry_t *entry;
+
+ entry = this->lookup_entry (this, key);
+
+ if (!entry) {
+
+ printf ("configfile: WARNING! tried to update unknown key %s (to %s)\n",
+ key, value);
+ return;
+
+ }
+ entry->str_value = copy_string (value);
+ if (entry->callback)
+ entry->callback (entry->callback_data, entry);
+}
static void config_file_save (config_values_t *this) {
FILE *f_config;
char filename[1024];
- sprintf (filename, "%s/.xinerc", xine_get_homedir());
+ sprintf (filename, "%s/.xine", xine_get_homedir());
+ mkdir (filename, 0755);
+
+ sprintf (filename, "%s/.xine/config", xine_get_homedir());
+
+ printf ("writing config file to %s\n", filename);
f_config = fopen (filename, "w");
@@ -196,22 +407,76 @@ static void config_file_save (config_values_t *this) {
cfg_entry_t *entry;
- fprintf (f_config, "#\n# xine config file\n#\n");
+ fprintf (f_config, "#\n# xine config file\n#\n\n");
- entry = this->data->gConfig;
+ entry = this->first;
while (entry) {
- fprintf (f_config, "%s:%s\n",entry->key,entry->value);
+ fprintf (f_config, "# %s\n", entry->description);
+ switch (entry->type) {
+ case CONFIG_TYPE_UNKNOWN:
+
+ fprintf (f_config, "%s:%s\n",
+ entry->key, entry->unknown_value);
+
+ break;
+ case CONFIG_TYPE_RANGE:
+ fprintf (f_config, "# [%d..%d], default: %d\n",
+ entry->range_min, entry->range_max, entry->num_default);
+ fprintf (f_config, "%s:%d\n", entry->key, entry->num_value);
+ fprintf (f_config, "\n");
+ break;
+ case CONFIG_TYPE_STRING:
+ fprintf (f_config, "# string, default: %s\n",
+ entry->str_default);
+ fprintf (f_config, "%s:%s\n", entry->key, entry->str_value);
+ fprintf (f_config, "\n");
+ break;
+ case CONFIG_TYPE_ENUM: {
+ int i;
+ char **value;
+
+ fprintf (f_config, "# {");
+ value = entry->enum_values;
+ while (*value) {
+ fprintf (f_config, " %s ", *value);
+ value++;
+ }
+
+ fprintf (f_config, "}, default: %d\n",
+ entry->num_default);
+ fprintf (f_config, "%s:", entry->key);
+
+ i = 0; value = entry->enum_values;
+ while (i< (entry->num_value-1)) {
+ i++;
+ value++;
+ }
+
+ fprintf (f_config, "%s\n", *value);
+ fprintf (f_config, "\n");
+ break;
+ }
+ case CONFIG_TYPE_NUM:
+ fprintf (f_config, "# numeric, default: %d\n",
+ entry->num_default);
+ fprintf (f_config, "%s:%d\n", entry->key, entry->num_value);
+ fprintf (f_config, "\n");
+ break;
+ case CONFIG_TYPE_BOOL:
+ fprintf (f_config, "# bool, default: %d\n",
+ entry->num_default);
+ fprintf (f_config, "%s:%d\n", entry->key, entry->num_value);
+ fprintf (f_config, "\n");
+ break;
+ }
+
entry = entry->next;
- }
-
+ }
fclose (f_config);
}
}
-
-
-
static void config_file_read (config_values_t *this, char *filename){
FILE *f_config;
@@ -222,56 +487,56 @@ static void config_file_read (config_values_t *this, char *filename){
char line[1024];
char *value;
-
+
while (fgets (line, 1023, f_config)) {
line[strlen(line)-1]= (char) 0; /* eliminate lf */
if (line[0] == '#')
continue;
-
+
if ((value = strchr (line, ':'))) {
+
+ cfg_entry_t *entry;
+
*value = (char) 0;
- value++;
-
- config_file_add (this, line, value);
+ value++;
+
+ entry = config_file_add (this, line);
+ entry->unknown_value = copy_string (value);
}
-
}
fclose (f_config);
}
}
-
-
-
config_values_t *config_file_init (char *filename) {
config_values_t *this;
- cfg_data_t *data;
if ( (this = xine_xmalloc(sizeof(config_values_t))) ) {
- if ( (data = xine_xmalloc(sizeof(cfg_data_t))) ) {
- data->gConfig = NULL;
- data->gConfigLast = NULL;
- this->data = data;
- config_file_read (this, filename);
- }
- else {
- fprintf (stderr, "WARNING: could not allocate config data\n");
- }
- }
- else {
- fprintf (stderr, "WARNING: could not allocate config values list\n");
+ this->first = NULL;
+ this->last = NULL;
+
+ config_file_read (this, filename);
+
+ } else {
+ printf ("configfile: could not allocate config object\n");
+ exit (1);
}
- this->lookup_str = config_file_lookup_str;
- this->lookup_int = config_file_lookup_int;
- this->set_str = config_file_set_str;
- this->set_int = config_file_set_int;
- this->save = config_file_save;
- this->read = config_file_read;
+ this->register_string = config_file_register_string;
+ this->register_range = config_file_register_range;
+ this->register_enum = config_file_register_enum;
+ this->register_num = config_file_register_num;
+ this->register_bool = config_file_register_bool;
+ this->update_num = config_file_update_num;
+ this->update_string = config_file_update_string;
+ this->parse_enum = config_file_parse_enum;
+ this->lookup_entry = config_file_lookup_entry;
+ this->save = config_file_save;
+ this->read = config_file_read;
return this;
}
@@ -279,6 +544,9 @@ config_values_t *config_file_init (char *filename) {
/*
* $Log: configfile.c,v $
+ * Revision 1.6 2001/11/18 03:53:25 guenter
+ * new configfile interface, code cleanup, xprintf is gone
+ *
* Revision 1.5 2001/11/17 14:26:39 f1rmb
* Add 'xine_' prefix to all of xine-utils functions (what about cpu
* acceleration?). Merge xine-utils header files to a new one "xineutils.h".
diff --git a/src/xine-engine/configfile.h b/src/xine-engine/configfile.h
index eb332afea..a5c195f1b 100644
--- a/src/xine-engine/configfile.h
+++ b/src/xine-engine/configfile.h
@@ -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: configfile.h,v 1.3 2001/07/26 11:12:26 f1rmb Exp $
+ * $Id: configfile.h,v 1.4 2001/11/18 03:53:25 guenter Exp $
*
* config file management
*
@@ -32,54 +32,143 @@ extern "C" {
#include <inttypes.h>
-typedef struct cfg_entry_s {
- struct cfg_entry_s *next;
- char *key;
- char *value;
-} cfg_entry_t;
+typedef struct cfg_entry_s cfg_entry_t;
+typedef void (*config_cb_t) (void *, cfg_entry_t *);
-typedef struct {
- cfg_entry_t *gConfig;
- cfg_entry_t *gConfigLast;
-} cfg_data_t;
+struct cfg_entry_s {
+ cfg_entry_t *next;
+
+ char *key;
+ int type;
+
+ /* type unknown */
+ char *unknown_value;
+
+ /* type string */
+ char *str_value;
+ char *str_default;
+
+ /* common to range, enum, num, bool: */
+
+ int num_value;
+ int num_default;
+
+ /* type range specific: */
+ int range_min;
+ int range_max;
+
+ /* type enum specific: */
+ char **enum_values;
+
+ /* help info for the user */
+ char *description;
+ char *help;
+
+ /* callback function and data for live changeable values */
+ config_cb_t callback;
+ void *callback_data;
+};
+
+/*
+ * config entry data types
+ */
+
+#define CONFIG_TYPE_UNKNOWN 0
+#define CONFIG_TYPE_RANGE 1
+#define CONFIG_TYPE_STRING 2
+#define CONFIG_TYPE_ENUM 3
+#define CONFIG_TYPE_NUM 4
+#define CONFIG_TYPE_BOOL 5
typedef struct config_values_s config_values_t;
struct config_values_s {
+
/*
- * lookup config values
+ * register config values
+ *
+ * these functions return the current value of the
+ * registered item, i.e. the default value if it was
+ * not found in the config file or the current value
+ * from the config file otherwise
*/
- char* (*lookup_str) (config_values_t *this,
- char *key, char *str_default);
-
- int (*lookup_int) (config_values_t *this,
- char *key, int n_default);
-
+
+ char* (*register_string) (config_values_t *this,
+ char *key,
+ char *def_value,
+ char *description,
+ char *help,
+ config_cb_t changed_cb,
+ void *cb_data);
+
+ int (*register_range) (config_values_t *this,
+ char *key,
+ int def_value,
+ int min, int max,
+ char *description,
+ char *help,
+ config_cb_t changed_cb,
+ void *cb_data);
+
+ int (*register_enum) (config_values_t *this,
+ char *key,
+ int def_value,
+ char **values,
+ char *description,
+ char *help,
+ config_cb_t changed_cb,
+ void *cb_data);
+
+ int (*register_num) (config_values_t *this,
+ char *key,
+ int def_value,
+ char *description,
+ char *help,
+ config_cb_t changed_cb,
+ void *cb_data);
+
+ int (*register_bool) (config_values_t *this,
+ char *key,
+ int def_value,
+ char *description,
+ char *help,
+ config_cb_t changed_cb,
+ void *cb_data);
+
+ /* convenience function to update range, enum, num and bool values */
+ void (*update_num) (config_values_t *this,
+ char *key, int value);
+
+ /* convenience function to update string values */
+ void (*update_string) (config_values_t *this,
+ char *key, char *value);
+
+ /* small utility function for enum handling */
+ int (*parse_enum) (char *str, char **values);
+
/*
- * set config values
+ * lookup config entries
+ *
+ * remember to call the changed_cb if it exists
+ * and you changed the value of this item
*/
-
- void (*set_str) (config_values_t *this,
- char *key, char *value) ;
-
- void (*set_int) (config_values_t *this,
- char *key, int value) ;
-
+
+ cfg_entry_t* (*lookup_entry) (config_values_t *this,
+ char *key);
+
/*
* write config file to disk
*/
void (*save) (config_values_t *this);
/*
- * read config file from disk, ovverriding values in memory
- * if you also want to clear values that are not in the file,
- * use _init instead!
+ * read config file from disk, overriding values in memory
*/
void (*read) (config_values_t *this, char *filename);
/*
- * contains private data of this config file
+ * config values are stored here:
*/
- cfg_data_t *data;
+ cfg_entry_t *first, *last;
};
/*
@@ -96,6 +185,9 @@ config_values_t *config_file_init (char *filename);
/*
* $Log: configfile.h,v $
+ * Revision 1.4 2001/11/18 03:53:25 guenter
+ * new configfile interface, code cleanup, xprintf is gone
+ *
* Revision 1.3 2001/07/26 11:12:26 f1rmb
* Updated doxy sections in xine.h.tmpl.in. Added man3. Removed french man page. Added API doc in html. Add new rpm package (doc). Fixes some little bugs in
* proto decl, etc...
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index a1feeac35..147e3b88a 100644
--- a/src/xine-engine/load_plugins.c
+++ b/src/xine-engine/load_plugins.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: load_plugins.c,v 1.54 2001/11/17 14:26:39 f1rmb Exp $
+ * $Id: load_plugins.c,v 1.55 2001/11/18 03:53:25 guenter Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -179,7 +179,7 @@ void load_demux_plugins (xine_t *this,
}
void xine_list_demux_plugins (config_values_t *config,
- char **identifiers, char **mimetypes) {
+ char **identifiers, char **mimetypes) {
DIR *dir;
xine_t *this;
int sizeid, sizemime;
@@ -193,7 +193,6 @@ void xine_list_demux_plugins (config_values_t *config,
*mimetypes = xine_xmalloc (sizemime);
this->config = config;
- xine_debug = config->lookup_int (config, "xine_debug", 0);
install_segv_handler();
@@ -223,10 +222,9 @@ void xine_list_demux_plugins (config_values_t *config,
plugin_name = str;
if(!(plugin = dlopen (str, RTLD_LAZY))) {
- fprintf(stderr, "load_plugins: cannot open demux plugin %s:\n%s\n",
+ printf ("load_plugins: cannot open demux plugin %s:\n%s\n",
str, dlerror());
- }
- else {
+ } else {
void *(*initplug) (int, xine_t *);
if((initplug = dlsym(plugin, "init_demuxer_plugin")) != NULL) {
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c
index 950f80cd2..2924d6a4b 100644
--- a/src/xine-engine/metronom.c
+++ b/src/xine-engine/metronom.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: metronom.c,v 1.36 2001/11/17 14:26:39 f1rmb Exp $
+ * $Id: metronom.c,v 1.37 2001/11/18 03:53:25 guenter Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -389,7 +389,9 @@ static void metronom_set_audio_rate (metronom_t *this, uint32_t pts_per_smpls) {
pthread_mutex_unlock (&this->lock);
- xprintf (METRONOM | VERBOSE, "metronom: %d pts per %d samples\n", pts_per_smpls, AUDIO_SAMPLE_NUM);
+#ifdef METRONOM_LOG
+ printf ("metronom: %d pts per %d samples\n", pts_per_smpls, AUDIO_SAMPLE_NUM);
+#endif
}
@@ -613,9 +615,11 @@ static uint32_t metronom_got_audio_samples (metronom_t *this, uint32_t pts,
uint32_t nsamples, uint32_t scr) {
uint32_t vpts;
-
- xprintf (METRONOM | VERBOSE, "metronom: got %d audio samples (pts=%d)\n",
- nsamples,pts);
+
+#ifdef METRONOM_LOG
+ printf ("metronom: got %d audio samples (pts=%d)\n",
+ nsamples,pts);
+#endif
pthread_mutex_lock (&this->lock);
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index b9c98703d..ad8cb6df9 100644
--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.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: video_out.c,v 1.55 2001/11/17 14:26:39 f1rmb Exp $
+ * $Id: video_out.c,v 1.56 2001/11/18 03:53:25 guenter Exp $
*
*/
@@ -203,8 +203,6 @@ static void *video_out_loop (void *this_gen) {
cur_pts = this->metronom->get_current_time (this->metronom);
- xprintf (VERBOSE|VIDEO, "video_out : video loop iteration at audio pts %d\n", cur_pts);
-
#ifdef VIDEO_OUT_LOG
printf ("video_out : video loop iteration at audio pts %d\n", cur_pts);
#endif
@@ -227,10 +225,6 @@ static void *video_out_loop (void *this_gen) {
if (diff >this->pts_per_half_frame) {
- xprintf (VERBOSE|VIDEO, "video_out : throwing away image with pts %d because "
- "it's too old (diff : %d > %d).\n",pts,diff,
- this->pts_per_half_frame);
-
printf ( "video_out : throwing away image with pts %d because "
"it's too old (diff : %d > %d).\n",pts,diff,
this->pts_per_half_frame);
@@ -286,8 +280,12 @@ static void *video_out_loop (void *this_gen) {
pthread_mutex_lock (&img->mutex);
img->driver_locked = 1;
+
+#ifdef VIDEO_OUT_LOG
if (!img->display_locked)
- xprintf (VERBOSE|VIDEO, "video_out: ALERT! frame was not locked for display queue\n");
+ printf ("video_out: ALERT! frame was not locked for display queue\n");
+#endif
+
img->display_locked = 0;
pthread_mutex_unlock (&img->mutex);
@@ -485,17 +483,17 @@ static int vo_frame_draw (vo_frame_t *img) {
img->PTS = pic_vpts;
this->num_frames_delivered++;
- xprintf (VERBOSE|VIDEO,"video_out: got image. vpts for picture is %d\n", pic_vpts);
-
cur_vpts = this->metronom->get_current_time(this->metronom);
diff = pic_vpts - cur_vpts;
frames_to_skip = ((-1 * diff) / this->pts_per_frame + 3) * 2;
- xprintf (VERBOSE|VIDEO,"video_out:: delivery diff : %d\n",diff);
- if( img->display_locked )
- {
+#ifdef VIDEO_OUT_LOG
+ printf ("video_out: delivery diff : %d\n",diff);
+#endif
+
+ if (img->display_locked) {
printf ("video_out: ALERT! frame is already locked for displaying\n");
return frames_to_skip;
}
@@ -505,7 +503,9 @@ static int vo_frame_draw (vo_frame_t *img) {
if (diff<(-1 * this->pts_per_half_frame)) {
this->num_frames_discarded++;
- xprintf (VERBOSE|VIDEO, "vo_frame_draw: rejected, %d frames to skip\n", frames_to_skip);
+#ifdef VIDEO_OUT_LOG
+ printf ("video_out: frame rejected, %d frames to skip\n", frames_to_skip);
+#endif
/* printf ("vo_frame_draw: rejected, %d frames to skip\n", frames_to_skip); */
@@ -527,7 +527,9 @@ static int vo_frame_draw (vo_frame_t *img) {
* put frame into FIFO-Buffer
*/
- xprintf (VERBOSE|VIDEO, "frame is ok => appending to display buffer\n");
+#ifdef VIDEO_OUT_LOG
+ printf ("video_out: frame is ok => appending to display buffer\n");
+#endif
this->last_frame = img;
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 70eaadf45..89329a9e8 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.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.c,v 1.75 2001/11/17 22:40:01 miguelfreitas Exp $
+ * $Id: xine.c,v 1.76 2001/11/18 03:53:25 guenter Exp $
*
* top-level xine functions
*
@@ -57,9 +57,6 @@
#define __FUNCTION__ __func__
#endif
-/* debugging purposes only */
-uint32_t xine_debug;
-
void * xine_notify_stream_finished_thread (void * this_gen) {
xine_t *this = this_gen;
xine_event_t event;
@@ -386,11 +383,12 @@ xine_t *xine_init (vo_driver_t *vo,
config_values_t *config) {
xine_t *this = xine_xmalloc (sizeof (xine_t));
+ static char *demux_strategies[] = {"default", "reverse", "content",
+ "extension", NULL};
+
printf("xine_init entered\n");
this->config = config;
- xine_debug = config->lookup_int (config, "xine_debug", 0);
-
/* probe for optimized memcpy or config setting */
xine_probe_fast_memcpy(config);
@@ -425,7 +423,9 @@ xine_t *xine_init (vo_driver_t *vo,
load_input_plugins (this, config, INPUT_PLUGIN_IFACE_VERSION);
- this->demux_strategy = config->lookup_int (config, "demux_strategy", 0);
+ this->demux_strategy = config->register_enum (config, "misc.demux_strategy", 0,
+ demux_strategies, "demuxer selection strategy",
+ NULL, NULL, NULL);
load_demux_plugins(this, config, DEMUXER_PLUGIN_IFACE_VERSION);
@@ -487,7 +487,7 @@ int xine_get_current_position (xine_t *this) {
pthread_mutex_lock (&this->xine_lock);
if (!this->cur_input_plugin) {
- xprintf (VERBOSE|INPUT, "xine_get_current_position: no input source\n");
+ printf ("xine: xine_get_current_position: no input source\n");
pthread_mutex_unlock (&this->xine_lock);
return 0;
}