summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
authorDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2003-11-16 23:33:42 +0000
committerDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2003-11-16 23:33:42 +0000
commit847f0e85e8b0c8135294258a9507fba03cc1cc30 (patch)
tree0a74838023ea90c3bb53c7c4f737bab5dc84e427 /src/xine-engine
parentb88ff04361ced758928d2ad8b87cb8986d044a35 (diff)
downloadxine-lib-847f0e85e8b0c8135294258a9507fba03cc1cc30.tar.gz
xine-lib-847f0e85e8b0c8135294258a9507fba03cc1cc30.tar.bz2
New stream/meta info (safe) stuff.
BIG NOTE: use helpers to access to these informations (get/set/reset): _x_{stream,meta}_info_{get,set,reset}() are for internal use, don't use *_public() ones from inside the beast ;-) Some wrongly names "xine_" fonction renaming. CVS patchset: 5757 CVS date: 2003/11/16 23:33:42
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/audio_decoder.c10
-rw-r--r--src/xine-engine/audio_out.c24
-rw-r--r--src/xine-engine/configfile.c247
-rw-r--r--src/xine-engine/info_helper.c236
-rw-r--r--src/xine-engine/info_helper.h80
-rw-r--r--src/xine-engine/video_decoder.c16
-rw-r--r--src/xine-engine/video_out.c16
-rw-r--r--src/xine-engine/xine.c128
-rw-r--r--src/xine-engine/xine_interface.c39
-rw-r--r--src/xine-engine/xine_internal.h9
10 files changed, 507 insertions, 298 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index d90829636..344b7c793 100644
--- a/src/xine-engine/audio_decoder.c
+++ b/src/xine-engine/audio_decoder.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: audio_decoder.c,v 1.110 2003/11/16 15:41:15 mroi Exp $
+ * $Id: audio_decoder.c,v 1.111 2003/11/16 23:33:48 f1rmb Exp $
*
*
* functions that implement audio decoding
@@ -200,7 +200,7 @@ static void *audio_decoder_loop (void *stream_gen) {
default:
- if (stream->stream_info[XINE_STREAM_INFO_IGNORE_AUDIO])
+ if (_x_stream_info_get(stream, XINE_STREAM_INFO_IGNORE_AUDIO))
break;
xine_profiler_start_count (prof_audio_decode);
@@ -294,8 +294,8 @@ static void *audio_decoder_loop (void *stream_gen) {
stream->audio_decoder_streamtype = streamtype;
stream->audio_decoder_plugin = _x_get_audio_decoder (stream, streamtype);
- stream->stream_info[XINE_STREAM_INFO_AUDIO_HANDLED] =
- (stream->audio_decoder_plugin != NULL);
+ _x_stream_info_set(stream, XINE_STREAM_INFO_AUDIO_HANDLED,
+ (stream->audio_decoder_plugin != NULL));
}
if (audio_type != stream->audio_type) {
@@ -317,7 +317,7 @@ static void *audio_decoder_loop (void *stream_gen) {
stream->audio_decoder_plugin->decode_data (stream->audio_decoder_plugin, buf);
if (buf->type != buftype_unknown &&
- !stream->stream_info[XINE_STREAM_INFO_AUDIO_HANDLED]) {
+ !_x_stream_info_get(stream, XINE_STREAM_INFO_AUDIO_HANDLED)) {
xine_log (stream->xine, XINE_LOG_MSG,
"audio_decoder: no plugin available to handle '%s'\n",
_x_buf_audio_name( buf->type ) );
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index 21d243ccb..62140b326 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.151 2003/11/16 15:41:15 mroi Exp $
+ * $Id: audio_out.c,v 1.152 2003/11/16 23:33:48 f1rmb Exp $
*
* 22-8-2001 James imported some useful AC3 sections from the previous alsa driver.
* (c) 2001 Andy Lo A Foe <andy@alsaplayer.org>
@@ -1276,30 +1276,30 @@ static int ao_open(xine_audio_port_t *this_gen, xine_stream_t *stream,
/*
* set metainfo
*/
- stream->stream_info[XINE_STREAM_INFO_AUDIO_MODE] = mode;
+ _x_stream_info_set(stream, XINE_STREAM_INFO_AUDIO_MODE, mode);
switch (mode) {
case AO_CAP_MODE_MONO:
- stream->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] = 1;
+ _x_stream_info_set(stream, XINE_STREAM_INFO_AUDIO_CHANNELS, 1);
break;
case AO_CAP_MODE_STEREO:
- stream->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] = 2;
+ _x_stream_info_set(stream, XINE_STREAM_INFO_AUDIO_CHANNELS, 2);
break;
case AO_CAP_MODE_4CHANNEL:
- stream->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] = 4;
+ _x_stream_info_set(stream, XINE_STREAM_INFO_AUDIO_CHANNELS, 4);
break;
case AO_CAP_MODE_4_1CHANNEL:
case AO_CAP_MODE_5CHANNEL:
case AO_CAP_MODE_5_1CHANNEL:
- stream->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] = 6;
+ _x_stream_info_set(stream, XINE_STREAM_INFO_AUDIO_CHANNELS, 6);
break;
case AO_CAP_MODE_A52:
case AO_CAP_MODE_AC5:
default:
- stream->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] = 255; /* unknown */
+ _x_stream_info_set(stream, XINE_STREAM_INFO_AUDIO_CHANNELS, 255); /* unknown */
}
- stream->stream_info[XINE_STREAM_INFO_AUDIO_BITS] = bits;
- stream->stream_info[XINE_STREAM_INFO_AUDIO_SAMPLERATE] = rate;
+ _x_stream_info_set(stream, XINE_STREAM_INFO_AUDIO_BITS, bits);
+ _x_stream_info_set(stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, rate);
stream->metronom->set_audio_rate(stream->metronom, this->audio_step);
@@ -1333,9 +1333,9 @@ static void ao_put_buffer (xine_audio_port_t *this_gen,
pts = buf->vpts;
if (stream) {
- buf->format.bits = stream->stream_info[XINE_STREAM_INFO_AUDIO_BITS];
- buf->format.rate = stream->stream_info[XINE_STREAM_INFO_AUDIO_SAMPLERATE];
- buf->format.mode = stream->stream_info[XINE_STREAM_INFO_AUDIO_MODE];
+ buf->format.bits = _x_stream_info_get(stream, XINE_STREAM_INFO_AUDIO_BITS);
+ buf->format.rate = _x_stream_info_get(stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE);
+ buf->format.mode = _x_stream_info_get(stream, XINE_STREAM_INFO_AUDIO_MODE);
_x_extra_info_merge( buf->extra_info, stream->audio_decoder_extra_info );
buf->vpts = stream->metronom->got_audio_samples(stream->metronom, pts, buf->num_frames);
}
diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c
index f9bf84951..b171fd751 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.55 2003/11/11 18:45:00 f1rmb Exp $
+ * $Id: configfile.c,v 1.56 2003/11/16 23:33:48 f1rmb Exp $
*
* config object (was: file) management - implementation
*
@@ -145,7 +145,7 @@ static void config_insert(config_values_t *this, cfg_entry_t *new_entry) {
this->first = new_entry;
}
-static cfg_entry_t *xine_config_add (config_values_t *this, const char *key, int exp_level) {
+static cfg_entry_t *__config_add (config_values_t *this, const char *key, int exp_level) {
cfg_entry_t *entry;
@@ -158,15 +158,14 @@ static cfg_entry_t *xine_config_add (config_values_t *this, const char *key, int
entry->exp_level = exp_level;
config_insert(this, entry);
-#ifdef LOG
- printf ("configfile: add entry key=%s\n", key);
-#endif
+
+ lprintf ("configfile: add entry key=%s\n", key);
return entry;
}
-static void _xine_config_lookup_entry_int (config_values_t *this, const char *key,
- cfg_entry_t **entry, cfg_entry_t **prev) {
+static void __config_lookup_entry_int (config_values_t *this, const char *key,
+ cfg_entry_t **entry, cfg_entry_t **prev) {
*entry = this->first;
*prev = NULL;
@@ -181,41 +180,39 @@ static void _xine_config_lookup_entry_int (config_values_t *this, const char *ke
* external interface
*/
-static cfg_entry_t *_xine_config_lookup_entry(config_values_t *this, const char *key) {
+static cfg_entry_t *__config_lookup_entry(config_values_t *this, const char *key) {
cfg_entry_t *entry, *prev;
pthread_mutex_lock(&this->config_lock);
- _xine_config_lookup_entry_int(this, key, &entry, &prev);
+ __config_lookup_entry_int(this, key, &entry, &prev);
pthread_mutex_unlock(&this->config_lock);
return entry;
}
-static char *_xine_config_register_string (config_values_t *this,
- const char *key,
- const char *def_value,
- const char *description,
- const char *help,
- int exp_level,
- xine_config_cb_t changed_cb,
- void *cb_data) {
+static char *__config_register_string (config_values_t *this,
+ const char *key,
+ const char *def_value,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data) {
cfg_entry_t *entry, *prev;
XINE_ASSERT(key, "Register key is NULL. This is a required argument.");
XINE_ASSERT(def_value, "Default value is NULL. This is a required argument.");
-#ifdef LOG
- printf ("configfile: registering %s\n", key);
-#endif
+ lprintf ("configfile: registering %s\n", key);
/* make sure this entry exists, create it if not */
pthread_mutex_lock(&this->config_lock);
- _xine_config_lookup_entry_int(this, key, &entry, &prev);
+ __config_lookup_entry_int(this, key, &entry, &prev);
if (!entry) {
- entry = xine_config_add (this, key, exp_level);
+ entry = __config_add (this, key, exp_level);
entry->unknown_value = strdup(def_value);
} else {
if (!entry->next)
@@ -258,28 +255,26 @@ static char *_xine_config_register_string (config_values_t *this,
return entry->str_value;
}
-static int _xine_config_register_num (config_values_t *this,
- const char *key, int def_value,
- const char *description,
- const char *help,
- int exp_level,
- xine_config_cb_t changed_cb,
- void *cb_data) {
+static int __config_register_num (config_values_t *this,
+ const char *key, int def_value,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data) {
cfg_entry_t *entry, *prev;
XINE_ASSERT(key, "Register key is NULL. This is a required argument.");
-#ifdef LOG
- printf ("configfile: registering %s\n", key);
-#endif
+ lprintf ("configfile: registering %s\n", key);
/* make sure this entry exists, create it if not */
pthread_mutex_lock(&this->config_lock);
- _xine_config_lookup_entry_int(this, key, &entry, &prev);
+ __config_lookup_entry_int(this, key, &entry, &prev);
if (!entry) {
- entry = xine_config_add (this, key, exp_level);
+ entry = __config_add (this, key, exp_level);
entry->unknown_value = NULL;
} else {
if (!entry->next)
@@ -324,29 +319,27 @@ static int _xine_config_register_num (config_values_t *this,
return entry->num_value;
}
-static int _xine_config_register_bool (config_values_t *this,
- const char *key,
- int def_value,
- const char *description,
- const char *help,
- int exp_level,
- xine_config_cb_t changed_cb,
- void *cb_data) {
+static int __config_register_bool (config_values_t *this,
+ const char *key,
+ int def_value,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data) {
cfg_entry_t *entry, *prev;
XINE_ASSERT(key, "Register key is NULL. This is a required argument.");
-#ifdef LOG
- printf ("configfile: registering %s\n", key);
-#endif
+ lprintf ("configfile: registering %s\n", key);
/* make sure this entry exists, create it if not */
pthread_mutex_lock(&this->config_lock);
- _xine_config_lookup_entry_int(this, key, &entry, &prev);
+ __config_lookup_entry_int(this, key, &entry, &prev);
if (!entry) {
- entry = xine_config_add (this, key, exp_level);
+ entry = __config_add (this, key, exp_level);
entry->unknown_value = NULL;
} else {
if (!entry->next)
@@ -391,30 +384,28 @@ static int _xine_config_register_bool (config_values_t *this,
return entry->num_value;
}
-static int _xine_config_register_range (config_values_t *this,
- const char *key,
- int def_value,
- int min, int max,
- const char *description,
- const char *help,
- int exp_level,
- xine_config_cb_t changed_cb,
- void *cb_data) {
+static int __config_register_range (config_values_t *this,
+ const char *key,
+ int def_value,
+ int min, int max,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data) {
cfg_entry_t *entry, *prev;
XINE_ASSERT(key, "Register key is NULL. This is a required argument.");
-#ifdef LOG
- printf ("configfile: registering range %s\n", key);
-#endif
+ lprintf ("configfile: registering range %s\n", key);
/* make sure this entry exists, create it if not */
pthread_mutex_lock(&this->config_lock);
- _xine_config_lookup_entry_int(this, key, &entry, &prev);
+ __config_lookup_entry_int(this, key, &entry, &prev);
if (!entry) {
- entry = xine_config_add (this, key, exp_level);
+ entry = __config_add (this, key, exp_level);
entry->unknown_value = NULL;
} else {
if (!entry->next)
@@ -460,7 +451,7 @@ static int _xine_config_register_range (config_values_t *this,
return entry->num_value;
}
-static int xine_config_parse_enum (const char *str, char **values) {
+static int __config_parse_enum (const char *str, char **values) {
char **value;
int i;
@@ -471,10 +462,7 @@ static int xine_config_parse_enum (const char *str, char **values) {
while (*value) {
-#ifdef LOG
- printf ("configfile: parse enum, >%s< ?= >%s<\n",
- *value, str);
-#endif
+ lprintf ("configfile: parse enum, >%s< ?= >%s<\n", *value, str);
if (!strcmp (*value, str))
return i;
@@ -483,39 +471,34 @@ static int xine_config_parse_enum (const char *str, char **values) {
i++;
}
-#ifdef LOG
- printf ("configfile: warning, >%s< is not a valid enum here, using 0\n",
- str);
-#endif
+ lprintf ("configfile: warning, >%s< is not a valid enum here, using 0\n", str);
return 0;
}
-static int _xine_config_register_enum (config_values_t *this,
- const char *key,
- int def_value,
- char **values,
- const char *description,
- const char *help,
- int exp_level,
- xine_config_cb_t changed_cb,
- void *cb_data) {
+static int __config_register_enum (config_values_t *this,
+ const char *key,
+ int def_value,
+ char **values,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data) {
cfg_entry_t *entry, *prev;
XINE_ASSERT(key, "Register key is NULL. This is a required argument.");
XINE_ASSERT(values, "Argument 'values' is NULL. This is a required argument.");
-#ifdef LOG
- printf ("configfile: registering enum %s\n", key);
-#endif
+ lprintf ("configfile: registering enum %s\n", key);
/* make sure this entry exists, create it if not */
pthread_mutex_lock(&this->config_lock);
- _xine_config_lookup_entry_int(this, key, &entry, &prev);
+ __config_lookup_entry_int(this, key, &entry, &prev);
if (!entry) {
- entry = xine_config_add (this, key, exp_level);
+ entry = __config_add (this, key, exp_level);
entry->unknown_value = NULL;
} else {
if (!entry->next)
@@ -541,7 +524,7 @@ static int _xine_config_register_enum (config_values_t *this,
entry->type = CONFIG_TYPE_ENUM;
if (entry->unknown_value)
- entry->num_value = xine_config_parse_enum (entry->unknown_value, values);
+ entry->num_value = __config_parse_enum (entry->unknown_value, values);
else
entry->num_value = def_value;
@@ -561,7 +544,7 @@ static int _xine_config_register_enum (config_values_t *this,
return entry->num_value;
}
-static void xine_config_shallow_copy(xine_cfg_entry_t *dest, cfg_entry_t *src)
+static void __config_shallow_copy(xine_cfg_entry_t *dest, cfg_entry_t *src)
{
dest->key = src->key;
dest->type = src->type;
@@ -580,24 +563,19 @@ static void xine_config_shallow_copy(xine_cfg_entry_t *dest, cfg_entry_t *src)
dest->callback_data = src->callback_data;
}
-static void xine_config_update_num (config_values_t *this,
- const char *key, int value) {
-
+static void __config_update_num (config_values_t *this,
+ const char *key, int value) {
+
cfg_entry_t *entry;
entry = this->lookup_entry (this, key);
-#ifdef LOG
- printf ("configfile: updating %s to %d\n",
- key, value);
-#endif
+ lprintf ("configfile: updating %s to %d\n", key, value);
if (!entry) {
-#ifdef LOG
- printf ("configfile: WARNING! tried to update unknown key %s (to %d)\n",
- key, value);
-#endif
+ lprintf ("configfile: WARNING! tried to update unknown key %s (to %d)\n", key, value);
+
return;
}
@@ -614,7 +592,7 @@ static void xine_config_update_num (config_values_t *this,
if (entry->callback) {
xine_cfg_entry_t cb_entry;
- xine_config_shallow_copy(&cb_entry, entry);
+ __config_shallow_copy(&cb_entry, entry);
/* do not enter the callback from within a locked context */
pthread_mutex_unlock(&this->config_lock);
entry->callback (entry->callback_data, &cb_entry);
@@ -622,17 +600,14 @@ static void xine_config_update_num (config_values_t *this,
pthread_mutex_unlock(&this->config_lock);
}
-static void xine_config_update_string (config_values_t *this,
+static void __config_update_string (config_values_t *this,
const char *key,
const char *value) {
cfg_entry_t *entry;
char *str_free = NULL;
-#ifdef LOG
- printf ("configfile: updating %s to %s\n",
- key, value);
-#endif
+ lprintf ("configfile: updating %s to %s\n", key, value);
entry = this->lookup_entry (this, key);
@@ -658,7 +633,7 @@ static void xine_config_update_string (config_values_t *this,
if (entry->callback) {
xine_cfg_entry_t cb_entry;
- xine_config_shallow_copy(&cb_entry, entry);
+ __config_shallow_copy(&cb_entry, entry);
/* FIXME: find a solution which does not enter the callback with the lock acquired,
* but does also handle the char* leak- and race-free without unnecessary string copying */
entry->callback (entry->callback_data, &cb_entry);
@@ -676,10 +651,7 @@ void xine_config_load (xine_t *xine, const char *filename) {
config_values_t *this = xine->config;
FILE *f_config;
-#ifdef LOG
- printf ("configfile: reading from file '%s'\n",
- filename);
-#endif
+ lprintf ("configfile: reading from file '%s'\n", filename);
f_config = fopen (filename, "r");
@@ -711,9 +683,9 @@ void xine_config_load (xine_t *xine, const char *filename) {
*value = (char) 0;
value++;
- if (!(entry = _xine_config_lookup_entry(this, line))) {
+ if (!(entry = __config_lookup_entry(this, line))) {
pthread_mutex_lock(&this->config_lock);
- entry = xine_config_add (this, line, 50);
+ entry = __config_add (this, line, 50);
entry->unknown_value = strdup(value);
pthread_mutex_unlock(&this->config_lock);
} else {
@@ -722,10 +694,10 @@ void xine_config_load (xine_t *xine, const char *filename) {
case XINE_CONFIG_TYPE_ENUM:
case XINE_CONFIG_TYPE_NUM:
case XINE_CONFIG_TYPE_BOOL:
- xine_config_update_num (this, entry->key, atoi(value));
+ __config_update_num (this, entry->key, atoi(value));
break;
case XINE_CONFIG_TYPE_STRING:
- xine_config_update_string (this, entry->key, value);
+ __config_update_string (this, entry->key, value);
break;
case CONFIG_TYPE_UNKNOWN:
pthread_mutex_lock(&this->config_lock);
@@ -759,9 +731,8 @@ void xine_config_save (xine_t *xine, const char *filename) {
if (stat(temp, &backup_stat) != 0) {
char line[1024];
-#ifdef LOG
- printf("configfile: backing up configfile to %s\n", temp);
-#endif
+ lprintf("configfile: backing up configfile to %s\n", temp);
+
f_backup = fopen(temp, "w");
f_config = fopen(filename, "r");
@@ -795,9 +766,8 @@ void xine_config_save (xine_t *xine, const char *filename) {
return;
}
-#ifdef LOG
- printf ("configfile: writing config file to %s\n", filename);
-#endif
+ lprintf ("configfile: writing config file to %s\n", filename);
+
f_config = fopen(filename, "w");
if (f_config) {
@@ -814,9 +784,7 @@ void xine_config_save (xine_t *xine, const char *filename) {
while (entry) {
-#ifdef LOG
- printf ("configfile: saving key '%s'\n", entry->key);
-#endif
+ lprintf ("configfile: saving key '%s'\n", entry->key);
if (entry->description)
fprintf (f_config, "# %s\n", entry->description);
@@ -903,16 +871,14 @@ void xine_config_save (xine_t *xine, const char *filename) {
unlink(temp);
}
-static void xine_config_dispose (config_values_t *this) {
+static void __config_dispose (config_values_t *this) {
cfg_entry_t *entry, *last;
pthread_mutex_lock(&this->config_lock);
entry = this->first;
-#ifdef LOG
- printf ("configfile: dispose\n");
-#endif
+ lprintf ("configfile: dispose\n");
while (entry) {
last = entry;
@@ -937,15 +903,14 @@ static void xine_config_dispose (config_values_t *this) {
}
-static void xine_config_unregister_cb (config_values_t *this,
- const char *key) {
+static void __config_unregister_cb (config_values_t *this, const char *key) {
cfg_entry_t *entry;
XINE_ASSERT(key, "Register key is NULL. This is a required argument.");
XINE_ASSERT(this, "Argument 'this' is NULL. Cannot find key if this is not set.");
- entry = _xine_config_lookup_entry (this, key);
+ entry = __config_lookup_entry (this, key);
if (entry) {
pthread_mutex_lock(&this->config_lock);
entry->callback = NULL;
@@ -974,17 +939,17 @@ config_values_t *_x_config_init (void) {
pthread_mutex_init(&this->config_lock, NULL);
- this->register_string = _xine_config_register_string;
- this->register_range = _xine_config_register_range;
- this->register_enum = _xine_config_register_enum;
- this->register_num = _xine_config_register_num;
- this->register_bool = _xine_config_register_bool;
- this->update_num = xine_config_update_num;
- this->update_string = xine_config_update_string;
- this->parse_enum = xine_config_parse_enum;
- this->lookup_entry = _xine_config_lookup_entry;
- this->unregister_callback = xine_config_unregister_cb;
- this->dispose = xine_config_dispose;
+ this->register_string = __config_register_string;
+ this->register_range = __config_register_range;
+ this->register_enum = __config_register_enum;
+ this->register_num = __config_register_num;
+ this->register_bool = __config_register_bool;
+ this->update_num = __config_update_num;
+ this->update_string = __config_update_string;
+ this->parse_enum = __config_parse_enum;
+ this->lookup_entry = __config_lookup_entry;
+ this->unregister_callback = __config_unregister_cb;
+ this->dispose = __config_dispose;
return this;
}
@@ -993,9 +958,7 @@ int _x_config_change_opt(config_values_t *config, const char *opt) {
cfg_entry_t *entry;
int handled = 0;
-#ifdef LOG
- printf ("configfile: change_opt '%s'\n", opt);
-#endif
+ lprintf ("configfile: change_opt '%s'\n", opt);
if(config && opt) {
char *key, *value;
diff --git a/src/xine-engine/info_helper.c b/src/xine-engine/info_helper.c
index fe234916e..5221cd034 100644
--- a/src/xine-engine/info_helper.c
+++ b/src/xine-engine/info_helper.c
@@ -20,23 +20,114 @@
* stream metainfo helper functions
* hide some xine engine details from demuxers and reduce code duplication
*
- * $id$
+ * $Id: info_helper.c,v 1.6 2003/11/16 23:33:48 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include <stdio.h>
#include <string.h>
#define XINE_ENGINE_INTERNAL
#include "info_helper.h"
-/* Remove trailing separator chars (\n,\r,\t, space,...)
+/* ******************* Stream Info *************************** */
+
+/*
+ * Compare stream_info, private and public values,
+ * return 1 if it's identical, otherwirse 0.
+ */
+static int __stream_info_is_identical(xine_stream_t *stream, int info) {
+
+ if(stream->stream_info_public[info] == stream->stream_info[info])
+ return 1;
+
+ return 0;
+}
+
+/*
+ * Check if 'info' is in bounds.
+ */
+static int __info_valid(int info) {
+ if ((info >= 0) && (info < XINE_STREAM_INFO_MAX))
+ return 1;
+ else {
+ fprintf(stderr, "Error: invalid STREAM_INFO %d. Ignored.\n", info);
+ return 0;
+ }
+}
+
+static void __stream_info_set_unlocked(xine_stream_t *stream, int info, int value) {
+ if(__info_valid(info))
+ stream->stream_info[info] = value;
+}
+
+/*
+ * Reset private info.
+ */
+void _x_stream_info_reset(xine_stream_t *stream, int info) {
+ pthread_mutex_lock(&stream->info_mutex);
+ __stream_info_set_unlocked(stream, info, 0);
+ pthread_mutex_unlock(&stream->info_mutex);
+}
+
+/*
+ * Reset public info value.
+ */
+void _x_stream_info_public_reset(xine_stream_t *stream, int info) {
+ pthread_mutex_lock(&stream->info_mutex);
+ if(__info_valid(info))
+ stream->stream_info_public[info] = 0;
+ pthread_mutex_unlock(&stream->info_mutex);
+}
+
+/*
+ * Set private info value.
+ */
+void _x_stream_info_set(xine_stream_t *stream, int info, int value) {
+ pthread_mutex_lock(&stream->info_mutex);
+ __stream_info_set_unlocked(stream, info, value);
+ pthread_mutex_unlock(&stream->info_mutex);
+}
+
+/*
+ * Retrieve private info value.
+ */
+uint32_t _x_stream_info_get(xine_stream_t *stream, int info) {
+ uint32_t stream_info = 0;
+
+ pthread_mutex_lock(&stream->info_mutex);
+ stream_info = stream->stream_info[info];
+ pthread_mutex_unlock(&stream->info_mutex);
+
+ return stream_info;
+}
+
+/*
+ * Retrieve public info value
+ */
+uint32_t _x_stream_info_get_public(xine_stream_t *stream, int info) {
+ uint32_t stream_info = 0;
+
+ pthread_mutex_lock(&stream->info_mutex);
+ stream_info = stream->stream_info_public[info];
+ if(__info_valid(info) && (!__stream_info_is_identical(stream, info)))
+ stream_info = stream->stream_info_public[info] = stream->stream_info[info];
+ pthread_mutex_unlock(&stream->info_mutex);
+
+ return stream_info;
+}
+
+/* **************** Meta Info *********************** */
+
+/*
+ * Remove trailing separator chars (\n,\r,\t, space,...)
* at the end of the string
*/
-static void chomp (char *str) {
+static void __chomp(char *str) {
int i, len;
len = strlen(str);
@@ -50,58 +141,127 @@ static void chomp (char *str) {
}
}
-static int info_valid(int info) {
- if ((info >= 0) && (info < XINE_STREAM_INFO_MAX)) {
- return 1;
- } else {
- fprintf(stderr, "Error: invalid STREAM_INFO %d. Ignored.\n", info);
+/*
+ * Compare stream_info, public and private values,
+ * return 1 if it's identical, otherwise 0.
+ */
+static int __meta_info_is_identical(xine_stream_t *stream, int info) {
+
+ if((!(stream->meta_info_public[info] && stream->meta_info[info])) ||
+ ((stream->meta_info_public[info] && stream->meta_info[info]) &&
+ strcmp(stream->meta_info_public[info], stream->meta_info[info])))
return 0;
- }
+
+ return 1;
}
-static int meta_valid(int info) {
- if ((info >= 0) && (info < XINE_STREAM_INFO_MAX)) {
+/*
+ * Check if 'info' is in bounds.
+ */
+static int __meta_valid(int info) {
+ if ((info >= 0) && (info < XINE_STREAM_INFO_MAX))
return 1;
- } else {
+ else {
fprintf(stderr, "Error: invalid META_INFO %d. Ignored.\n", info);
return 0;
}
}
-void xine_set_stream_info(xine_stream_t *stream, int info, int value) {
- if(info_valid(info))
- stream->stream_info [info] = value;
-}
+/*
+ * Set private meta info to value (can be NULL).
+ */
+static void __meta_info_set_unlocked(xine_stream_t *stream, int info, const char *value) {
+ if(__meta_valid(info)) {
+
+ if(stream->meta_info[info])
+ free(stream->meta_info[info]);
-void xine_clear_meta_info(xine_stream_t *stream, int info) {
- if(meta_valid(info) && stream->meta_info [info]) {
- free(stream->meta_info [info]);
- stream->meta_info [info] = NULL;
+ stream->meta_info[info] = (value) ? strdup(value) : NULL;
+
+ if(stream->meta_info[info] && strlen(stream->meta_info[info]))
+ __chomp(stream->meta_info[info]);
}
}
-void xine_set_meta_info(xine_stream_t *stream, int info, const char *str) {
- if(str && meta_valid(info)) {
- xine_clear_meta_info(stream, info);
- stream->meta_info [info] = strdup(str);
- chomp(stream->meta_info [info]);
+/*
+ * Reset (nullify) private info value.
+ */
+void _x_meta_info_reset(xine_stream_t *stream, int info) {
+ pthread_mutex_lock(&stream->meta_mutex);
+ __meta_info_set_unlocked(stream, info, NULL);
+ pthread_mutex_unlock(&stream->meta_mutex);
+}
+
+/*
+ * Reset (nullify) public info value.
+ */
+static void __meta_info_public_reset_unlocked(xine_stream_t *stream, int info) {
+ if(__meta_valid(info)) {
+ if(stream->meta_info_public[info])
+ free(stream->meta_info_public[info]);
+ stream->meta_info_public[info] = NULL;
}
}
+void _x_meta_info_public_reset(xine_stream_t *stream, int info) {
+ pthread_mutex_lock(&stream->meta_mutex);
+ __meta_info_public_reset_unlocked(stream, info);
+ pthread_mutex_unlock(&stream->meta_mutex);
+}
+
+/*
+ * Set private meta info value.
+ */
+void _x_meta_info_set(xine_stream_t *stream, int info, const char *str) {
+ pthread_mutex_lock(&stream->meta_mutex);
+ if(str)
+ __meta_info_set_unlocked(stream, info, str);
+ pthread_mutex_unlock(&stream->meta_mutex);
+}
-void xine_set_metan_info(xine_stream_t *stream, int info, const char *buf,
- int len) {
- if(meta_valid(info)) {
- char *tmp;
+/*
+ * Set private meta info from buf, 'len' bytes long.
+ */
+void _x_meta_info_n_set(xine_stream_t *stream, int info, const char *buf, int len) {
+ pthread_mutex_lock(&stream->meta_mutex);
+ if(__meta_valid(info) && len) {
+ char str[len + 1];
- xine_clear_meta_info(stream, info);
+ snprintf(str, len + 1 , "%s", buf);
+ __meta_info_set_unlocked(stream, info, (const char *) &str[0]);
+ }
+ pthread_mutex_unlock(&stream->meta_mutex);
+}
+
+/*
+ * Retrieve private info value.
+ */
+const char *_x_meta_info_get(xine_stream_t *stream, int info) {
+ const char *meta_info = NULL;
+
+ pthread_mutex_lock(&stream->meta_mutex);
+ meta_info = stream->meta_info[info];
+ pthread_mutex_unlock(&stream->meta_mutex);
+
+ return meta_info;
+}
+
+/*
+ * Retrieve public info value.
+ */
+const char *_x_meta_info_get_public(xine_stream_t *stream, int info) {
+ const char *meta_info = NULL;
+
+ pthread_mutex_lock(&stream->meta_mutex);
+ meta_info = stream->meta_info_public[info];
+ if(__meta_valid(info) && (!__meta_info_is_identical(stream, info))) {
+ __meta_info_public_reset_unlocked(stream, info);
- if(len) {
- tmp = malloc(len + 1);
- xine_fast_memcpy(tmp, buf, len);
- tmp[len] = '\0';
-
- stream->meta_info [info] = tmp;
- chomp(stream->meta_info [info]);
- }
+ if(stream->meta_info[info])
+ stream->meta_info_public[info] = strdup(stream->meta_info[info]);
+
+ meta_info = stream->meta_info_public[info];
}
+ pthread_mutex_unlock(&stream->meta_mutex);
+
+ return meta_info;
}
diff --git a/src/xine-engine/info_helper.h b/src/xine-engine/info_helper.h
index f7598d661..a163823a5 100644
--- a/src/xine-engine/info_helper.h
+++ b/src/xine-engine/info_helper.h
@@ -37,7 +37,47 @@
* value the value to assign
*
*/
-void xine_set_stream_info(xine_stream_t *stream, int info, int value);
+void _x_stream_info_set(xine_stream_t *stream, int info, int value);
+
+/*
+ * reset a stream info (internal ones only)
+ *
+ * params :
+ * *stream the xine stream
+ * info meta info id (see xine.h, XINE_STREAM_INFO_*)
+ *
+ */
+void _x_stream_info_reset(xine_stream_t *stream, int info);
+
+/*
+ * reset a stream info (public ones only)
+ *
+ * params :
+ * *stream the xine stream
+ * info meta info id (see xine.h, XINE_STREAM_INFO_*)
+ *
+ */
+void _x_stream_info_public_reset(xine_stream_t *stream, int info);
+
+/*
+ * retrieve stream info (internal ones only)
+ *
+ * params :
+ * *stream the xine stream
+ * info meta info id (see xine.h, XINE_STREAM_INFO_*)
+ *
+ */
+uint32_t _x_stream_info_get(xine_stream_t *stream, int info);
+
+/*
+ * retrieve stream info (public ones only)
+ *
+ * params :
+ * *stream the xine stream
+ * info meta info id (see xine.h, XINE_STREAM_INFO_*)
+ *
+ */
+uint32_t _x_stream_info_get_public(xine_stream_t *stream, int info);
/*
* set a stream meta info
@@ -48,7 +88,7 @@ void xine_set_stream_info(xine_stream_t *stream, int info, int value);
* *str null-terminated string
*
*/
-void xine_set_meta_info(xine_stream_t *stream, int info, const char *str);
+void _x_meta_info_set(xine_stream_t *stream, int info, const char *str);
/*
* set a stream meta info
@@ -60,16 +100,46 @@ void xine_set_meta_info(xine_stream_t *stream, int info, const char *str);
* len length of the metainfo
*
*/
-void xine_set_metan_info(xine_stream_t *stream, int info, const char *buf, int len);
+void _x_meta_info_n_set(xine_stream_t *stream, int info, const char *buf, int len);
+
+/*
+ * reset a stream meta info (internal ones only)
+ *
+ * params :
+ * *stream the xine stream
+ * info meta info id (see xine.h, XINE_META_INFO_*)
+ *
+ */
+void _x_meta_info_reset(xine_stream_t *stream, int info);
+
+/*
+ * reset a stream meta info (public ones only)
+ *
+ * params :
+ * *stream the xine stream
+ * info meta info id (see xine.h, XINE_META_INFO_*)
+ *
+ */
+void _x_meta_info_public_reset(xine_stream_t *stream, int info);
+
+/*
+ * retrieve stream meta info (internal ones only)
+ *
+ * params :
+ * *stream the xine stream
+ * info meta info id (see xine.h, XINE_META_INFO_*)
+ *
+ */
+const char *_x_meta_info_get(xine_stream_t *stream, int info);
/*
- * clear a stream meta info
+ * retrieve stream meta info (public ones only)
*
* params :
* *stream the xine stream
* info meta info id (see xine.h, XINE_META_INFO_*)
*
*/
-void xine_clear_meta_info(xine_stream_t *stream, int info);
+const char *_x_meta_info_get_public(xine_stream_t *stream, int info);
#endif /* INFO_HELPER_H */
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index 662179b59..724683a23 100644
--- a/src/xine-engine/video_decoder.c
+++ b/src/xine-engine/video_decoder.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_decoder.c,v 1.138 2003/11/16 15:41:15 mroi Exp $
+ * $Id: video_decoder.c,v 1.139 2003/11/16 23:33:48 f1rmb Exp $
*
*/
@@ -277,7 +277,7 @@ static void *video_decoder_loop (void *stream_gen) {
if ( (buf->type & 0xFF000000) == BUF_VIDEO_BASE ) {
- if (stream->stream_info[XINE_STREAM_INFO_IGNORE_VIDEO])
+ if (_x_stream_info_get(stream, XINE_STREAM_INFO_IGNORE_VIDEO))
break;
xine_profiler_start_count (prof_video_decode);
@@ -300,22 +300,20 @@ static void *video_decoder_loop (void *stream_gen) {
stream->video_decoder_streamtype = streamtype;
stream->video_decoder_plugin = _x_get_video_decoder (stream, streamtype);
- stream->stream_info[XINE_STREAM_INFO_VIDEO_HANDLED] =
- (stream->video_decoder_plugin != NULL);
+ _x_stream_info_set(stream, XINE_STREAM_INFO_VIDEO_HANDLED, (stream->video_decoder_plugin != NULL));
}
if (stream->video_decoder_plugin)
stream->video_decoder_plugin->decode_data (stream->video_decoder_plugin, buf);
if (buf->type != buftype_unknown &&
- !stream->stream_info[XINE_STREAM_INFO_VIDEO_HANDLED]) {
+ !_x_stream_info_get(stream, XINE_STREAM_INFO_VIDEO_HANDLED)) {
xine_log (stream->xine, XINE_LOG_MSG,
"video_decoder: no plugin available to handle '%s'\n",
_x_buf_video_name( buf->type ) );
- if( !stream->meta_info[XINE_META_INFO_VIDEOCODEC] )
- stream->meta_info[XINE_META_INFO_VIDEOCODEC]
- = strdup (_x_buf_video_name( buf->type ));
+ if( !_x_meta_info_get(stream, XINE_META_INFO_VIDEOCODEC))
+ _x_meta_info_set(stream, XINE_META_INFO_VIDEOCODEC, _x_buf_video_name( buf->type ));
buftype_unknown = buf->type;
@@ -332,7 +330,7 @@ static void *video_decoder_loop (void *stream_gen) {
int i,j;
- if (stream->stream_info[XINE_STREAM_INFO_IGNORE_SPU])
+ if (_x_stream_info_get(stream, XINE_STREAM_INFO_IGNORE_SPU))
break;
xine_profiler_start_count (prof_spu_decode);
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index b7d7626f6..0a4318075 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.178 2003/11/16 15:41:15 mroi Exp $
+ * $Id: video_out.c,v 1.179 2003/11/16 23:33:48 f1rmb Exp $
*
* frame allocation / queuing / scheduling / output functions
*/
@@ -469,10 +469,10 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) {
pthread_mutex_lock(&this->streams_lock);
for (stream = xine_list_first_content(this->streams); stream;
stream = xine_list_next_content(this->streams)) {
- stream->stream_info[XINE_STREAM_INFO_SKIPPED_FRAMES] =
- 1000 * this->num_frames_skipped / this->num_frames_delivered;
- stream->stream_info[XINE_STREAM_INFO_DISCARDED_FRAMES] =
- 1000 * this->num_frames_discarded / this->num_frames_delivered;
+ _x_stream_info_set(stream, XINE_STREAM_INFO_SKIPPED_FRAMES,
+ 1000 * this->num_frames_skipped / this->num_frames_delivered);
+ _x_stream_info_set(stream, XINE_STREAM_INFO_DISCARDED_FRAMES,
+ 1000 * this->num_frames_discarded / this->num_frames_delivered);
/* we send XINE_EVENT_DROPPED_FRAMES to frontend to warn that
* number of skipped or discarded frames is too high.
@@ -485,9 +485,9 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) {
event.stream = stream;
event.data = &data;
event.data_length = sizeof(data);
- data.skipped_frames = stream->stream_info[XINE_STREAM_INFO_SKIPPED_FRAMES];
+ data.skipped_frames = _x_stream_info_get(stream, XINE_STREAM_INFO_SKIPPED_FRAMES);
data.skipped_threshold = this->warn_skipped_threshold * 10;
- data.discarded_frames = stream->stream_info[XINE_STREAM_INFO_DISCARDED_FRAMES];
+ data.discarded_frames = _x_stream_info_get(stream, XINE_STREAM_INFO_DISCARDED_FRAMES);
data.discarded_threshold = this->warn_discarded_threshold * 10;
xine_event_send(stream, &event);
}
@@ -769,7 +769,7 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts) {
if (img && !img->next) {
if (!img->stream ||
- img->stream->stream_info[XINE_STREAM_INFO_VIDEO_HAS_STILL] ||
+ _x_stream_info_get(img->stream, XINE_STREAM_INFO_VIDEO_HAS_STILL) ||
img->stream->video_fifo->size(img->stream->video_fifo) < 10) {
#ifdef LOG
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index d10004c77..0a163833d 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.266 2003/11/16 15:41:15 mroi Exp $
+ * $Id: xine.c,v 1.267 2003/11/16 23:33:48 f1rmb Exp $
*/
/*
@@ -126,7 +126,7 @@ void _x_extra_info_merge( extra_info_t *dst, extra_info_t *src ) {
}
}
-static void _x_set_speed_internal (xine_stream_t *stream, int speed) {
+static void __set_speed_internal (xine_stream_t *stream, int speed) {
stream->xine->clock->set_speed (stream->xine->clock, speed);
@@ -148,7 +148,7 @@ static void _x_set_speed_internal (xine_stream_t *stream, int speed) {
}
-static void xine_stop_internal (xine_stream_t *stream) {
+static void __stop_internal (xine_stream_t *stream) {
int finished_count_audio = 0;
int finished_count_video = 0;
@@ -161,7 +161,7 @@ static void xine_stop_internal (xine_stream_t *stream) {
}
/* make sure we're not in "paused" state */
- _x_set_speed_internal (stream, XINE_SPEED_NORMAL);
+ __set_speed_internal (stream, XINE_SPEED_NORMAL);
/* Don't change status if we're quitting */
if (stream->status != XINE_STATUS_QUIT)
@@ -190,7 +190,7 @@ static void xine_stop_internal (xine_stream_t *stream) {
* some input plugin may have changed speed by itself, we must ensure
* the engine is not paused.
*/
- _x_set_speed_internal (stream, XINE_SPEED_NORMAL);
+ __set_speed_internal (stream, XINE_SPEED_NORMAL);
_x_demux_flush_engine( stream );
lprintf ("flush engine done\n");
@@ -224,7 +224,7 @@ void xine_stop (xine_stream_t *stream) {
if (stream->video_out)
stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 1);
- xine_stop_internal (stream);
+ __stop_internal (stream);
if (stream->slave && (stream->slave_affection & XINE_MASTER_SLAVE_STOP))
xine_stop(stream->slave);
@@ -239,7 +239,7 @@ void xine_stop (xine_stream_t *stream) {
}
-static void xine_close_internal (xine_stream_t *stream) {
+static void __close_internal (xine_stream_t *stream) {
int i ;
@@ -252,7 +252,7 @@ static void xine_close_internal (xine_stream_t *stream) {
}
}
- xine_stop_internal( stream );
+ __stop_internal( stream );
lprintf ("disposing demux\n");
if (stream->demux_plugin) {
@@ -274,8 +274,10 @@ static void xine_close_internal (xine_stream_t *stream) {
*/
for (i=0; i<XINE_STREAM_INFO_MAX; i++) {
- stream->stream_info[i] = 0;
- xine_clear_meta_info(stream, i);
+ _x_stream_info_reset(stream, i);
+ _x_stream_info_public_reset(stream, i);
+ _x_meta_info_reset(stream, i);
+ _x_meta_info_public_reset(stream, i);
}
}
@@ -283,12 +285,12 @@ void xine_close (xine_stream_t *stream) {
pthread_mutex_lock (&stream->frontend_lock);
- xine_close_internal (stream);
+ __close_internal (stream);
pthread_mutex_unlock (&stream->frontend_lock);
}
-static int xine_stream_rewire_audio(xine_post_out_t *output, void *data)
+static int __stream_rewire_audio(xine_post_out_t *output, void *data)
{
xine_stream_t *stream = (xine_stream_t *)output->data;
xine_audio_port_t *new_port = (xine_audio_port_t *)data;
@@ -312,7 +314,7 @@ static int xine_stream_rewire_audio(xine_post_out_t *output, void *data)
return 1;
}
-static int xine_stream_rewire_video(xine_post_out_t *output, void *data)
+static int __stream_rewire_video(xine_post_out_t *output, void *data)
{
xine_stream_t *stream = (xine_stream_t *)output->data;
xine_video_port_t *new_port = (xine_video_port_t *)data;
@@ -361,10 +363,7 @@ xine_stream_t *xine_stream_new (xine_t *this,
stream->xine = this;
stream->status = XINE_STATUS_STOP;
- for (i=0; i<XINE_STREAM_INFO_MAX; i++) {
- stream->stream_info[i] = 0;
- stream->meta_info[i] = NULL;
- }
+
stream->spu_decoder_plugin = NULL;
stream->spu_decoder_streamtype = -1;
stream->audio_out = ao;
@@ -402,6 +401,9 @@ xine_stream_t *xine_stream_new (xine_t *this,
* init mutexes and conditions
*/
+
+ pthread_mutex_init (&stream->info_mutex, NULL);
+ pthread_mutex_init (&stream->meta_mutex, NULL);
pthread_mutex_init (&stream->demux_lock, NULL);
pthread_mutex_init (&stream->frontend_lock, NULL);
pthread_mutex_init (&stream->event_queues_lock, NULL);
@@ -416,6 +418,16 @@ xine_stream_t *xine_stream_new (xine_t *this,
pthread_cond_init (&stream->next_audio_port_wired, NULL);
/*
+ * Clear meta/stream info
+ */
+ for (i = 0; i < XINE_STREAM_INFO_MAX; i++) {
+ _x_stream_info_reset(stream, i);
+ _x_stream_info_public_reset(stream, i);
+ _x_meta_info_reset(stream, i);
+ _x_meta_info_public_reset(stream, i);
+ }
+
+ /*
* event queues
*/
@@ -452,17 +464,17 @@ xine_stream_t *xine_stream_new (xine_t *this,
stream->video_source.name = "video source";
stream->video_source.type = XINE_POST_DATA_VIDEO;
stream->video_source.data = stream;
- stream->video_source.rewire = xine_stream_rewire_video;
+ stream->video_source.rewire = __stream_rewire_video;
stream->audio_source.name = "audio source";
stream->audio_source.type = XINE_POST_DATA_AUDIO;
stream->audio_source.data = stream;
- stream->audio_source.rewire = xine_stream_rewire_audio;
+ stream->audio_source.rewire = __stream_rewire_audio;
return stream;
}
-static void mrl_unescape(char *mrl) {
+static void __mrl_unescape(char *mrl) {
int i, len = strlen(mrl);
for (i = 0; i < len; i++) {
@@ -479,7 +491,7 @@ static void mrl_unescape(char *mrl) {
mrl[len] = 0;
}
-static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
+static int __open_internal (xine_stream_t *stream, const char *mrl) {
const char *stream_setup;
@@ -489,7 +501,7 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
* stop engine if necessary
*/
- xine_close_internal (stream);
+ __close_internal (stream);
lprintf ("engine should be stopped now\n");
@@ -515,8 +527,8 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
stream->input_plugin->input_class->get_description(stream->input_plugin->input_class));
if (stream->input_plugin->input_class->eject_media)
stream->eject_class = stream->input_plugin->input_class;
- stream->meta_info[XINE_META_INFO_INPUT_PLUGIN]
- = strdup (stream->input_plugin->input_class->get_identifier (stream->input_plugin->input_class));
+ _x_meta_info_set(stream, XINE_META_INFO_INPUT_PLUGIN,
+ (stream->input_plugin->input_class->get_identifier (stream->input_plugin->input_class)));
if (!stream->input_plugin->open(stream->input_plugin)) {
xine_log (stream->xine, XINE_LOG_MSG,
@@ -562,7 +574,7 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
memcpy(demux_name, tmp, strlen(tmp));
demux_name[strlen(tmp)] = '\0';
}
- mrl_unescape(demux_name);
+ __mrl_unescape(demux_name);
if (!(stream->demux_plugin = _x_find_demux_plugin_by_name(stream, demux_name, stream->input_plugin))) {
xine_log(stream->xine, XINE_LOG_MSG,
_("xine: specified demuxer %s failed to start\n"), demux_name);
@@ -572,8 +584,8 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
return 0;
}
- stream->meta_info[XINE_META_INFO_SYSTEMLAYER]
- = strdup (stream->demux_plugin->demux_class->get_identifier(stream->demux_plugin->demux_class));
+ _x_meta_info_set(stream, XINE_META_INFO_SYSTEMLAYER,
+ (stream->demux_plugin->demux_class->get_identifier(stream->demux_plugin->demux_class)));
free(demux_name);
} else {
printf("xine: error while parsing mrl\n");
@@ -636,7 +648,7 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
memcpy(demux_name, tmp, strlen(tmp));
demux_name[strlen(tmp)] = '\0';
}
- mrl_unescape(demux_name);
+ __mrl_unescape(demux_name);
if (!(stream->demux_plugin = _x_find_demux_plugin_last_probe(stream, demux_name, stream->input_plugin))) {
xine_log(stream->xine, XINE_LOG_MSG,
_("xine: last_probed demuxer %s failed to start\n"), demux_name);
@@ -647,8 +659,8 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
}
lprintf ("demux and input plugin found\n");
- stream->meta_info[XINE_META_INFO_SYSTEMLAYER]
- = strdup (stream->demux_plugin->demux_class->get_identifier(stream->demux_plugin->demux_class));
+ _x_meta_info_set(stream, XINE_META_INFO_SYSTEMLAYER,
+ (stream->demux_plugin->demux_class->get_identifier(stream->demux_plugin->demux_class)));
free(demux_name);
} else {
printf("xine: error while parsing mrl\n");
@@ -661,7 +673,7 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
if (strncasecmp(stream_setup, "novideo", 7) == 0) {
stream_setup += 7;
if (*stream_setup == ';' || *stream_setup == '\0') {
- stream->stream_info[XINE_STREAM_INFO_IGNORE_VIDEO] = 1;
+ _x_stream_info_set(stream, XINE_STREAM_INFO_IGNORE_VIDEO, 1);
} else {
printf("xine: error while parsing mrl\n");
stream->err = XINE_ERROR_MALFORMED_MRL;
@@ -674,7 +686,7 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
if (strncasecmp(stream_setup, "noaudio", 7) == 0) {
stream_setup += 7;
if (*stream_setup == ';' || *stream_setup == '\0') {
- stream->stream_info[XINE_STREAM_INFO_IGNORE_AUDIO] = 1;
+ _x_stream_info_set(stream, XINE_STREAM_INFO_IGNORE_AUDIO, 1);
} else {
printf("xine: error while parsing mrl\n");
stream->err = XINE_ERROR_MALFORMED_MRL;
@@ -687,7 +699,7 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
if (strncasecmp(stream_setup, "nospu", 5) == 0) {
stream_setup += 5;
if (*stream_setup == ';' || *stream_setup == '\0') {
- stream->stream_info[XINE_STREAM_INFO_IGNORE_SPU] = 1;
+ _x_stream_info_set(stream, XINE_STREAM_INFO_IGNORE_SPU, 1);
} else {
printf("xine: error while parsing mrl\n");
stream->err = XINE_ERROR_MALFORMED_MRL;
@@ -711,7 +723,7 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
memcpy(volume, tmp, strlen(tmp));
volume[strlen(tmp)] = '\0';
}
- mrl_unescape(volume);
+ __mrl_unescape(volume);
xine_set_param(stream, XINE_PARAM_AUDIO_VOLUME, atoi(volume));
free(volume);
} else {
@@ -736,7 +748,7 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
memcpy(compression, tmp, strlen(tmp));
compression[strlen(tmp)] = '\0';
}
- mrl_unescape(compression);
+ __mrl_unescape(compression);
xine_set_param(stream, XINE_PARAM_AUDIO_COMPR_LEVEL, atoi(compression));
free(compression);
} else {
@@ -761,7 +773,7 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
memcpy(subtitle_mrl, tmp, strlen(tmp));
subtitle_mrl[strlen(tmp)] = '\0';
}
- mrl_unescape(subtitle_mrl);
+ __mrl_unescape(subtitle_mrl);
stream->slave = xine_stream_new (stream->xine, NULL, stream->video_out );
stream->slave_affection = XINE_MASTER_SLAVE_PLAY | XINE_MASTER_SLAVE_STOP;
if( xine_open( stream->slave, subtitle_mrl ) ) {
@@ -796,7 +808,7 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
memcpy(config_entry, tmp, strlen(tmp));
config_entry[strlen(tmp)] = '\0';
}
- mrl_unescape(config_entry);
+ __mrl_unescape(config_entry);
retval = _x_config_change_opt(stream->xine->config, config_entry);
if (retval <= 0) {
if (retval == 0) {
@@ -839,8 +851,8 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
}
lprintf ("demux and input plugin found\n");
- stream->meta_info[XINE_META_INFO_SYSTEMLAYER]
- = strdup (stream->demux_plugin->demux_class->get_identifier(stream->demux_plugin->demux_class));
+ _x_meta_info_set(stream, XINE_META_INFO_SYSTEMLAYER,
+ (stream->demux_plugin->demux_class->get_identifier(stream->demux_plugin->demux_class)));
}
xine_log (stream->xine, XINE_LOG_MSG,
@@ -854,8 +866,8 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
/* assume handled for now. we will only know for sure after trying
* to init decoders (which should happen when headers are sent)
*/
- stream->stream_info[XINE_STREAM_INFO_VIDEO_HANDLED] = 1;
- stream->stream_info[XINE_STREAM_INFO_AUDIO_HANDLED] = 1;
+ _x_stream_info_set(stream, XINE_STREAM_INFO_VIDEO_HANDLED, 1);
+ _x_stream_info_set(stream, XINE_STREAM_INFO_AUDIO_HANDLED, 1);
/*
* send and decode headers
@@ -902,7 +914,7 @@ int xine_open (xine_stream_t *stream, const char *mrl) {
lprintf ("open MRL:%s\n", mrl);
- ret = xine_open_internal (stream, mrl);
+ ret = __open_internal (stream, mrl);
pthread_mutex_unlock (&stream->frontend_lock);
@@ -910,7 +922,7 @@ int xine_open (xine_stream_t *stream, const char *mrl) {
}
-static int xine_play_internal (xine_stream_t *stream, int start_pos, int start_time) {
+static int __play_internal (xine_stream_t *stream, int start_pos, int start_time) {
double share ;
off_t pos, len;
@@ -931,7 +943,7 @@ static int xine_play_internal (xine_stream_t *stream, int start_pos, int start_t
/* set normal speed */
if (stream->xine->clock->speed != XINE_SPEED_NORMAL)
- _x_set_speed_internal (stream, XINE_SPEED_NORMAL);
+ __set_speed_internal (stream, XINE_SPEED_NORMAL);
/* discard audio/video buffers to get engine going and take the lock faster */
if (stream->audio_out)
@@ -947,7 +959,7 @@ static int xine_play_internal (xine_stream_t *stream, int start_pos, int start_t
* the engine is not paused.
*/
if (stream->xine->clock->speed != XINE_SPEED_NORMAL)
- _x_set_speed_internal (stream, XINE_SPEED_NORMAL);
+ __set_speed_internal (stream, XINE_SPEED_NORMAL);
/*
* start/seek demux
@@ -1017,7 +1029,7 @@ static int xine_play_internal (xine_stream_t *stream, int start_pos, int start_t
}
pthread_mutex_unlock (&stream->first_frame_lock);
- xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "xine_play_internal ...done\n");
+ xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "__play_internal ...done\n");
return 1;
}
@@ -1028,7 +1040,7 @@ int xine_play (xine_stream_t *stream, int start_pos, int start_time) {
pthread_mutex_lock (&stream->frontend_lock);
- ret = xine_play_internal (stream, start_pos, start_time);
+ ret = __play_internal (stream, start_pos, start_time);
if( stream->slave && (stream->slave_affection & XINE_MASTER_SLAVE_PLAY) )
xine_play (stream->slave, start_pos, start_time);
@@ -1086,6 +1098,8 @@ void xine_dispose (xine_stream_t *stream) {
stream->osd_renderer->close( stream->osd_renderer );
stream->video_fifo->dispose (stream->video_fifo);
+ pthread_mutex_destroy (&stream->info_mutex);
+ pthread_mutex_destroy (&stream->meta_mutex);
pthread_mutex_destroy (&stream->frontend_lock);
pthread_mutex_destroy (&stream->counter_lock);
pthread_mutex_destroy (&stream->event_queues_lock);
@@ -1226,13 +1240,13 @@ int xine_engine_get_param(xine_t *this, int param) {
return -1;
}
-static void config_demux_strategy_cb (void *this_gen, xine_cfg_entry_t *entry) {
+static void __config_demux_strategy_cb (void *this_gen, xine_cfg_entry_t *entry) {
xine_t *this = (xine_t *)this_gen;
this->demux_strategy = entry->num_value;
}
-static void config_save_cb (void *this_gen, xine_cfg_entry_t *entry) {
+static void __config_save_cb (void *this_gen, xine_cfg_entry_t *entry) {
xine_t *this = (xine_t *)this_gen;
char *homedir_trail_slash = strcat(strdup(xine_get_homedir()), "/");
@@ -1284,7 +1298,7 @@ void xine_init (xine_t *this) {
demux_strategies,
_("Media format detection strategy"),
NULL,
- 10, config_demux_strategy_cb, this);
+ 10, __config_demux_strategy_cb, this);
/*
* save directory
@@ -1294,7 +1308,7 @@ void xine_init (xine_t *this) {
"misc.save_dir", "",
_("Path for saving streams"),
_("Streams will be saved only into this directory"),
- XINE_CONFIG_SECURITY, config_save_cb, this);
+ XINE_CONFIG_SECURITY, __config_save_cb, this);
/*
* keep track of all opened streams
@@ -1335,7 +1349,7 @@ void _x_select_spu_channel (xine_stream_t *stream, int channel) {
pthread_mutex_unlock (&stream->frontend_lock);
}
-static int xine_get_current_position (xine_stream_t *stream) {
+static int __get_current_position (xine_stream_t *stream) {
off_t len;
double share;
@@ -1349,7 +1363,7 @@ static int xine_get_current_position (xine_stream_t *stream) {
}
if ( (!stream->video_decoder_plugin && !stream->audio_decoder_plugin) ) {
- if( stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] )
+ if( _x_stream_info_get(stream, XINE_STREAM_INFO_HAS_VIDEO) )
_x_extra_info_merge( stream->current_extra_info, stream->video_decoder_extra_info );
else
_x_extra_info_merge( stream->current_extra_info, stream->audio_decoder_extra_info );
@@ -1400,7 +1414,7 @@ void _x_set_speed (xine_stream_t *stream, int speed) {
speed = XINE_SPEED_FAST_4;
xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "set_speed %d\n", speed);
- _x_set_speed_internal (stream, speed);
+ __set_speed_internal (stream, speed);
pthread_mutex_unlock (&stream->frontend_lock);
}
@@ -1410,7 +1424,7 @@ void _x_set_speed (xine_stream_t *stream, int speed) {
* time measurement / seek
*/
-static int xine_get_stream_length (xine_stream_t *stream) {
+static int __get_stream_length (xine_stream_t *stream) {
/* pthread_mutex_lock( &stream->demux_lock ); */
@@ -1429,7 +1443,7 @@ static int xine_get_stream_length (xine_stream_t *stream) {
int xine_get_pos_length (xine_stream_t *stream, int *pos_stream,
int *pos_time, int *length_time) {
- int pos = xine_get_current_position (stream); /* force updating extra_info */
+ int pos = __get_current_position (stream); /* force updating extra_info */
if (pos == -1)
return 0;
@@ -1442,7 +1456,7 @@ int xine_get_pos_length (xine_stream_t *stream, int *pos_stream,
pthread_mutex_unlock( &stream->current_extra_info_lock );
}
if (length_time)
- *length_time = xine_get_stream_length (stream);
+ *length_time = __get_stream_length (stream);
return 1;
}
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index 304c7baec..de12bafc7 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.66 2003/11/16 15:41:15 mroi Exp $
+ * $Id: xine_interface.c,v 1.67 2003/11/16 23:33:49 f1rmb Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -166,8 +166,7 @@ int xine_config_register_bool (xine_t *self,
* and return status
*/
-static int xine_config_get_current_entry (xine_t *this,
- xine_cfg_entry_t *entry) {
+static int __config_get_current_entry (xine_t *this, xine_cfg_entry_t *entry) {
config_values_t *config = this->config;
@@ -206,7 +205,7 @@ int xine_config_get_first_entry (xine_t *this, xine_cfg_entry_t *entry) {
/* do not hand out unclaimed entries */
while (config->cur && config->cur->type == CONFIG_TYPE_UNKNOWN)
config->cur = config->cur->next;
- result = xine_config_get_current_entry (this, entry);
+ result = __config_get_current_entry (this, entry);
pthread_mutex_unlock(&config->config_lock);
return result;
@@ -232,7 +231,7 @@ int xine_config_get_next_entry (xine_t *this, xine_cfg_entry_t *entry) {
do {
config->cur = config->cur->next;
} while (config->cur && config->cur->type == CONFIG_TYPE_UNKNOWN);
- result = xine_config_get_current_entry (this, entry);
+ result = __config_get_current_entry (this, entry);
pthread_mutex_unlock(&config->config_lock);
return result;
@@ -253,7 +252,7 @@ int xine_config_lookup_entry (xine_t *this, const char *key,
/* do not hand out unclaimed entries */
if (config->cur && config->cur->type == CONFIG_TYPE_UNKNOWN)
config->cur = NULL;
- result = xine_config_get_current_entry (this, entry);
+ result = __config_get_current_entry (this, entry);
pthread_mutex_unlock(&config->config_lock);
return result;
@@ -305,13 +304,15 @@ void xine_config_reset (xine_t *this) {
config->last = NULL;
pthread_mutex_unlock(&config->config_lock);
}
-
+
+#ifndef XINE_DISABLE_DEPRECATED_FEATURES
int xine_gui_send_vo_data (xine_stream_t *stream,
int type, void *data) {
return stream->video_driver->gui_data_exchange (stream->video_driver,
type, data);
}
+#endif
int xine_port_send_gui_data (xine_video_port_t *vo,
int type, void *data) {
@@ -413,15 +414,15 @@ void xine_set_param (xine_stream_t *stream, int param, int value) {
break;
case XINE_PARAM_IGNORE_VIDEO:
- stream->stream_info[XINE_STREAM_INFO_IGNORE_VIDEO] = value;
+ _x_stream_info_set(stream, XINE_STREAM_INFO_IGNORE_VIDEO, value);
break;
case XINE_PARAM_IGNORE_AUDIO:
- stream->stream_info[XINE_STREAM_INFO_IGNORE_AUDIO] = value;
+ _x_stream_info_set(stream, XINE_STREAM_INFO_IGNORE_AUDIO, value);
break;
case XINE_PARAM_IGNORE_SPU:
- stream->stream_info[XINE_STREAM_INFO_IGNORE_SPU] = value;
+ _x_stream_info_set(stream, XINE_STREAM_INFO_IGNORE_SPU, value);
break;
case XINE_PARAM_METRONOM_PREBUFFER:
@@ -442,7 +443,7 @@ void xine_set_param (xine_stream_t *stream, int param, int value) {
}
}
-int xine_get_param (xine_stream_t *stream, int param) {
+int xine_get_param (xine_stream_t *stream, int param) {
switch (param) {
case XINE_PARAM_SPEED:
@@ -502,7 +503,7 @@ int xine_get_param (xine_stream_t *stream, int param) {
case XINE_PARAM_VERBOSITY:
return stream->xine->verbosity;
-
+
case XINE_PARAM_VO_HUE:
case XINE_PARAM_VO_SATURATION:
case XINE_PARAM_VO_CONTRAST:
@@ -516,13 +517,13 @@ int xine_get_param (xine_stream_t *stream, int param) {
return stream->video_out->get_property(stream->video_out, param);
case XINE_PARAM_IGNORE_VIDEO:
- return stream->stream_info[XINE_STREAM_INFO_IGNORE_VIDEO];
+ return _x_stream_info_get_public(stream, XINE_STREAM_INFO_IGNORE_VIDEO);
case XINE_PARAM_IGNORE_AUDIO:
- return stream->stream_info[XINE_STREAM_INFO_IGNORE_AUDIO];
+ return _x_stream_info_get_public(stream, XINE_STREAM_INFO_IGNORE_AUDIO);
case XINE_PARAM_IGNORE_SPU:
- return stream->stream_info[XINE_STREAM_INFO_IGNORE_SPU];
+ return _x_stream_info_get_public(stream, XINE_STREAM_INFO_IGNORE_SPU);
case XINE_PARAM_METRONOM_PREBUFFER:
return stream->metronom->get_option(stream->metronom, METRONOM_PREBUFFER);
@@ -577,7 +578,7 @@ uint32_t xine_get_stream_info (xine_stream_t *stream, int info) {
case XINE_STREAM_INFO_IGNORE_AUDIO:
case XINE_STREAM_INFO_IGNORE_SPU:
case XINE_STREAM_INFO_VIDEO_HAS_STILL:
- return stream->stream_info[info];
+ return _x_stream_info_get_public(stream, info);
case XINE_STREAM_INFO_MAX_AUDIO_CHANNEL:
return stream->audio_track_map_entries;
@@ -586,15 +587,13 @@ uint32_t xine_get_stream_info (xine_stream_t *stream, int info) {
return stream->spu_track_map_entries;
default:
- printf ("xine_interface: error, unknown stream info (%d) requested\n",
- info);
+ fprintf (stderr, "xine_interface: error, unknown stream info (%d) requested\n", info);
}
return 0;
}
const char *xine_get_meta_info (xine_stream_t *stream, int info) {
-
- return stream->meta_info[info];
+ return _x_meta_info_get_public(stream, info);
}
xine_osd_t *xine_osd_new(xine_stream_t *stream, int x, int y, int width, int height) {
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 800180a17..95a41398c 100644
--- a/src/xine-engine/xine_internal.h
+++ b/src/xine-engine/xine_internal.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: xine_internal.h,v 1.148 2003/11/15 20:43:12 mroi Exp $
+ * $Id: xine_internal.h,v 1.149 2003/11/16 23:33:49 f1rmb Exp $
*
*/
@@ -220,8 +220,13 @@ struct xine_stream_s {
pthread_mutex_t frontend_lock;
/* stream meta information */
+ /* NEVER access directly, use helpers (see info_helper.c) */
+ pthread_mutex_t info_mutex;
+ int stream_info_public[XINE_STREAM_INFO_MAX];
int stream_info[XINE_STREAM_INFO_MAX];
- char *meta_info [XINE_STREAM_INFO_MAX];
+ pthread_mutex_t meta_mutex;
+ char *meta_info_public[XINE_STREAM_INFO_MAX];
+ char *meta_info[XINE_STREAM_INFO_MAX];
/* seeking slowdown */
int first_frame_flag;