summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/audio_out/audio_alsa_out.c8
-rw-r--r--src/demuxers/demux_slave.c17
-rw-r--r--src/dxr3/video_out_dxr3.c15
-rw-r--r--src/input/input_pvr.c24
-rw-r--r--src/post/audio/stretch.c4
-rw-r--r--src/post/audio/upmix.c4
-rw-r--r--src/post/audio/upmix_mono.c4
-rw-r--r--src/post/deinterlace/xine_plugin.c4
-rw-r--r--src/post/goom/xine_goom.c4
-rw-r--r--src/post/mosaico/mosaico.c4
-rw-r--r--src/post/mosaico/switch.c4
-rw-r--r--src/post/planar/boxblur.c4
-rw-r--r--src/post/planar/denoise3d.c4
-rw-r--r--src/post/planar/eq.c4
-rw-r--r--src/post/planar/expand.c2
-rwxr-xr-xsrc/post/planar/pp.c4
-rw-r--r--src/post/planar/unsharp.c4
-rw-r--r--src/post/visualizations/fftgraph.c4
-rw-r--r--src/post/visualizations/fftscope.c4
-rw-r--r--src/post/visualizations/fooviz.c4
-rw-r--r--src/post/visualizations/oscope.c4
-rw-r--r--src/video_out/video_out_xv.c13
-rw-r--r--src/xine-engine/audio_out.c53
-rw-r--r--src/xine-engine/broadcaster.c38
-rw-r--r--src/xine-engine/events.c55
-rw-r--r--src/xine-engine/load_plugins.c356
-rw-r--r--src/xine-engine/plugin_catalog.h7
-rw-r--r--src/xine-engine/post.c25
-rw-r--r--src/xine-engine/video_out.c67
-rw-r--r--src/xine-engine/xine.c31
-rw-r--r--src/xine-engine/xine_interface.c20
-rw-r--r--src/xine-engine/xine_internal.h3
-rw-r--r--src/xine-utils/list.c445
-rw-r--r--src/xine-utils/list.h14
34 files changed, 714 insertions, 543 deletions
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c
index c0a9e9ba0..837e824d4 100644
--- a/src/audio_out/audio_alsa_out.c
+++ b/src/audio_out/audio_alsa_out.c
@@ -26,7 +26,7 @@
* (c) 2001 James Courtier-Dutton <James@superbug.demon.co.uk>
*
*
- * $Id: audio_alsa_out.c,v 1.157 2006/01/25 17:40:59 miguelfreitas Exp $
+ * $Id: audio_alsa_out.c,v 1.158 2006/01/27 07:46:09 tmattern Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -223,6 +223,7 @@ static void *ao_alsa_handle_event_thread(void *data) {
xine_event_t event;
xine_audio_level_data_t data;
xine_stream_t *stream;
+ xine_list_iterator_t ite;
this->mixer.right_vol = right_vol;
this->mixer.left_vol = left_vol;
@@ -242,8 +243,9 @@ static void *ao_alsa_handle_event_thread(void *data) {
event.data_length = sizeof(data);
pthread_mutex_lock(&this->class->xine->streams_lock);
- for(stream = xine_list_first_content(this->class->xine->streams);
- stream; stream = xine_list_next_content(this->class->xine->streams)) {
+ for(ite = xine_list_front(this->class->xine->streams);
+ ite; ite = xine_list_next(this->class->xine->streams, ite)) {
+ stream = xine_list_get_value(this->class->xine->streams, ite);
event.stream = stream;
xine_event_send(stream, &event);
}
diff --git a/src/demuxers/demux_slave.c b/src/demuxers/demux_slave.c
index b37909c20..05852902e 100644
--- a/src/demuxers/demux_slave.c
+++ b/src/demuxers/demux_slave.c
@@ -21,7 +21,7 @@
*/
/*
- * $Id: demux_slave.c,v 1.15 2005/11/28 12:24:57 valtri Exp $
+ * $Id: demux_slave.c,v 1.16 2006/01/27 07:46:12 tmattern Exp $
*
* demuxer for slave "protocol"
* master xine must be started with XINE_PARAM_BROADCASTER_PORT set, that is,
@@ -222,7 +222,7 @@ static int demux_slave_next (demux_slave_t *this) {
if( size ) {
this->decoder_info_ptr[i] = malloc(size);
- xine_list_append_content(this->dec_infos, this->decoder_info_ptr[i]);
+ xine_list_push_back(this->dec_infos, this->decoder_info_ptr[i]);
}
n = this->scratch_used - (p-this->scratch);
@@ -300,18 +300,15 @@ static int demux_slave_seek (demux_plugin_t *this_gen, off_t start_pos, int star
static void demux_slave_dispose (demux_plugin_t *this_gen) {
demux_slave_t *this = (demux_slave_t *) this_gen;
void *data;
+ xine_list_iterator_t ite;
/* free all decoder information */
- data = xine_list_first_content (this->dec_infos);
- while (data) {
+ while (ite = xine_list_front(this->dec_infos)) {
+ data = xine_list_get_value(this->dec_infos, ite);
free(data);
- xine_list_delete_current (this->dec_infos);
- if( this->dec_infos->cur )
- data = this->dec_infos->cur->content;
- else
- data = NULL;
+ xine_list_remove (this->dec_infos, ite);
}
- xine_list_free(this->dec_infos);
+ xine_list_delete(this->dec_infos);
free (this);
}
diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c
index 676722f14..ab5b51366 100644
--- a/src/dxr3/video_out_dxr3.c
+++ b/src/dxr3/video_out_dxr3.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_dxr3.c,v 1.111 2005/09/25 00:44:04 miguelfreitas Exp $
+ * $Id: video_out_dxr3.c,v 1.112 2006/01/27 07:46:12 tmattern Exp $
*/
/* mpeg1 encoding video out plugin for the dxr3.
@@ -221,6 +221,7 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v
int encoder, confnum;
static char *available_encoders[SUPPORTED_ENCODER_COUNT + 2];
plugin_node_t *node;
+
#ifdef HAVE_X11
static char *videoout_modes[] = { "letterboxed tv", "widescreen tv",
"letterboxed overlay", "widescreen overlay", NULL };
@@ -228,7 +229,9 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v
static char *videoout_modes[] = { "letterboxed tv", "widescreen tv", NULL };
#endif
static char *tv_modes[] = { "ntsc", "pal", "pal60" , "default", NULL };
-
+ int list_id, list_size;
+ xine_sarray_t *plugin_list;
+
if (class->instance) return NULL;
this = (dxr3_driver_t *)xine_xmalloc(sizeof(dxr3_driver_t));
@@ -298,8 +301,11 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v
#endif
/* check, if ffmpeg plugin is available by looking through plugin
* catalog; catalog mutex is already locked here, since this is open_plugin() */
- for (node = xine_list_first_content(class->xine->plugin_catalog->plugin_lists[PLUGIN_VIDEO_DECODER - 1]); node;
- node = xine_list_next_content(class->xine->plugin_catalog->plugin_lists[PLUGIN_VIDEO_DECODER - 1]))
+ node = NULL;
+ plugin_list = class->xine->plugin_catalog->plugin_lists[PLUGIN_VIDEO_DECODER - 1];
+ list_size = xine_sarray_size(plugin_list);
+ for (list_id = 0; list_id < list_size; list_id++) {
+ node = xine_sarray_get (plugin_list, list_id);
if (strcasecmp(node->info->id, "ffmpegvideo") == 0) {
available_encoders[encoder++] = "libavcodec";
#if LOG_VID
@@ -307,6 +313,7 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v
#endif
break;
}
+ }
#ifdef HAVE_LIBFAME
available_encoders[encoder++] = "fame";
#if LOG_VID
diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c
index 5fd44a0c0..78e4f931a 100644
--- a/src/input/input_pvr.c
+++ b/src/input/input_pvr.c
@@ -38,7 +38,7 @@
* usage:
* xine pvr:/<prefix_to_tmp_files>\!<prefix_to_saved_files>\!<max_page_age>
*
- * $Id: input_pvr.c,v 1.57 2005/11/28 12:24:57 valtri Exp $
+ * $Id: input_pvr.c,v 1.58 2006/01/27 07:46:12 tmattern Exp $
*/
/**************************************************************************
@@ -934,7 +934,7 @@ static void pvr_finish_recording (pvr_input_plugin_t *this) {
show->base_name = save_base;
show->id = ++this->saved_id;
show->pages = this->rec_page - this->save_page + 1;
- xine_list_append_content (this->saved_shows, show);
+ xine_list_push_back (this->saved_shows, show);
lprintf("sending event with base name [%s]\n", show->base_name);
@@ -1098,11 +1098,13 @@ static void pvr_event_handler (pvr_input_plugin_t *this) {
char *src_filename;
char *dst_filename;
saved_show_t *show;
+ xine_list_iterator_t ite;
pthread_mutex_lock(&this->lock);
- show = xine_list_first_content (this->saved_shows);
- while (show) {
+ ite = xine_list_front (this->saved_shows);
+ while (ite) {
+ show = xine_list_get_value(this->saved_shows, ite);
if( show->id == save_data->id ) {
int i;
@@ -1117,12 +1119,12 @@ static void pvr_event_handler (pvr_input_plugin_t *this) {
free(dst_filename);
free(src_filename);
}
- xine_list_delete_current (this->saved_shows);
+ xine_list_remove (this->saved_shows, ite);
free (show->base_name);
free (show);
break;
}
- show = xine_list_next_content (this->saved_shows);
+ ite = xine_list_next (this->saved_shows, ite);
}
pthread_mutex_unlock(&this->lock);
@@ -1331,6 +1333,7 @@ static void pvr_plugin_dispose (input_plugin_t *this_gen ) {
pvr_input_plugin_t *this = (pvr_input_plugin_t *) this_gen;
void *p;
saved_show_t *show;
+ xine_list_iterator_t ite;
if( this->pvr_running ) {
lprintf("finishing pvr thread\n");
@@ -1366,13 +1369,14 @@ static void pvr_plugin_dispose (input_plugin_t *this_gen ) {
if (this->save_prefix)
free (this->save_prefix);
- show = xine_list_first_content (this->saved_shows);
- while (show) {
+ ite = xine_list_front (this->saved_shows);
+ while (ite) {
+ show = xine_list_get_value(this->saved_shows, ite);
free (show->base_name);
free (show);
- show = xine_list_next_content (this->saved_shows);
+ ite = xine_list_next (this->saved_shows, ite);
}
- xine_list_free(this->saved_shows);
+ xine_list_delete(this->saved_shows);
free (this);
}
diff --git a/src/post/audio/stretch.c b/src/post/audio/stretch.c
index f5b7fd4de..a1e921e03 100644
--- a/src/post/audio/stretch.c
+++ b/src/post/audio/stretch.c
@@ -19,7 +19,7 @@
*
* Time stretch by a given factor, optionally preserving pitch
*
- * $Id: stretch.c,v 1.7 2005/07/16 17:00:50 miguelfreitas Exp $
+ * $Id: stretch.c,v 1.8 2006/01/27 07:46:12 tmattern Exp $
*
*/
@@ -647,7 +647,7 @@ static post_plugin_t *stretch_open_plugin(post_class_t *class_gen, int inputs,
input_api->name = "parameters";
input_api->type = XINE_POST_DATA_PARAMETERS;
input_api->data = &post_api;
- xine_list_append_content(this->post.input, input_api);
+ xine_list_push_back(this->post.input, input_api);
this->post.xine_post.audio_input[0] = &port->new_port;
diff --git a/src/post/audio/upmix.c b/src/post/audio/upmix.c
index 7910479aa..76c9afe58 100644
--- a/src/post/audio/upmix.c
+++ b/src/post/audio/upmix.c
@@ -23,7 +23,7 @@
* It simply creates output channels to match the speaker arrangement.
* E.g. Converts Stereo into Surround 5.1
*
- * $Id: upmix.c,v 1.16 2004/07/27 17:59:58 mroi Exp $
+ * $Id: upmix.c,v 1.17 2006/01/27 07:46:12 tmattern Exp $
*
*/
@@ -408,7 +408,7 @@ static post_plugin_t *upmix_open_plugin(post_class_t *class_gen, int inputs,
input_api->name = "parameters";
input_api->type = XINE_POST_DATA_PARAMETERS;
input_api->data = &post_api;
- xine_list_append_content(this->post.input, input_api);
+ xine_list_push_back(this->post.input, input_api);
this->post.xine_post.audio_input[0] = &port->new_port;
diff --git a/src/post/audio/upmix_mono.c b/src/post/audio/upmix_mono.c
index 62b40e18c..ddb52b018 100644
--- a/src/post/audio/upmix_mono.c
+++ b/src/post/audio/upmix_mono.c
@@ -22,7 +22,7 @@
* This is an up-mix audio filter post plugin.
* It simply converts Mono into Stereo.
*
- * $Id: upmix_mono.c,v 1.4 2005/12/12 15:44:02 valtri Exp $
+ * $Id: upmix_mono.c,v 1.5 2006/01/27 07:46:12 tmattern Exp $
*
*/
@@ -324,7 +324,7 @@ static post_plugin_t *upmix_mono_open_plugin(post_class_t *class_gen, int inputs
input_api->name = "parameters";
input_api->type = XINE_POST_DATA_PARAMETERS;
input_api->data = &post_api;
- xine_list_append_content(this->post.input, input_api);
+ xine_list_push_back(this->post.input, input_api);
this->post.xine_post.audio_input[0] = &port->new_port;
this->post.dispose = upmix_mono_dispose;
diff --git a/src/post/deinterlace/xine_plugin.c b/src/post/deinterlace/xine_plugin.c
index 67de0a06c..425ceefe5 100644
--- a/src/post/deinterlace/xine_plugin.c
+++ b/src/post/deinterlace/xine_plugin.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_plugin.c,v 1.47 2006/01/26 12:40:51 miguelfreitas Exp $
+ * $Id: xine_plugin.c,v 1.48 2006/01/27 07:46:12 tmattern Exp $
*
* advanced video deinterlacer plugin
* Jun/2003 by Miguel Freitas
@@ -412,7 +412,7 @@ static post_plugin_t *deinterlace_open_plugin(post_class_t *class_gen, int input
input_api->name = "parameters";
input_api->type = XINE_POST_DATA_PARAMETERS;
input_api->data = &post_api;
- xine_list_append_content(this->post.input, input_api);
+ xine_list_push_back(this->post.input, input_api);
input->xine_in.name = "video";
output->xine_out.name = "deinterlaced video";
diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c
index e4e091b1e..887283e26 100644
--- a/src/post/goom/xine_goom.c
+++ b/src/post/goom/xine_goom.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_goom.c,v 1.58 2005/07/19 18:10:31 miguelfreitas Exp $
+ * $Id: xine_goom.c,v 1.59 2006/01/27 07:46:13 tmattern Exp $
*
* GOOM post plugin.
*
@@ -297,7 +297,7 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs,
outputv->xine_out.data = (xine_video_port_t **)&this->vo_port;
outputv->xine_out.rewire = goom_rewire_video;
outputv->post = &this->post;
- xine_list_append_content(this->post.output, outputv);
+ xine_list_push_back(this->post.output, outputv);
this->post.xine_post.audio_input[0] = &port->new_port;
diff --git a/src/post/mosaico/mosaico.c b/src/post/mosaico/mosaico.c
index 67b9e3e5d..bcb63de5d 100644
--- a/src/post/mosaico/mosaico.c
+++ b/src/post/mosaico/mosaico.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: mosaico.c,v 1.24 2004/05/29 14:45:26 mroi Exp $
+ * $Id: mosaico.c,v 1.25 2006/01/27 07:46:13 tmattern Exp $
*/
/*
@@ -197,7 +197,7 @@ static post_plugin_t *mosaico_open_plugin(post_class_t *class_gen, int inputs,
input_api->name = "parameters";
input_api->type = XINE_POST_DATA_PARAMETERS;
input_api->data = &post_api;
- xine_list_append_content(this->post.input, input_api);
+ xine_list_push_back(this->post.input, input_api);
this->post.dispose = mosaico_dispose;
diff --git a/src/post/mosaico/switch.c b/src/post/mosaico/switch.c
index e63275d06..58b2bf806 100644
--- a/src/post/mosaico/switch.c
+++ b/src/post/mosaico/switch.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: switch.c,v 1.14 2004/05/29 14:45:26 mroi Exp $
+ * $Id: switch.c,v 1.15 2006/01/27 07:46:13 tmattern Exp $
*/
/*
@@ -163,7 +163,7 @@ static post_plugin_t *switch_open_plugin(post_class_t *class_gen, int inputs,
input_api->name = "parameters";
input_api->type = XINE_POST_DATA_PARAMETERS;
input_api->data = &post_api;
- xine_list_append_content(this->post.input, input_api);
+ xine_list_push_back(this->post.input, input_api);
this->post.dispose = switch_dispose;
diff --git a/src/post/planar/boxblur.c b/src/post/planar/boxblur.c
index 34117915f..1644d2046 100644
--- a/src/post/planar/boxblur.c
+++ b/src/post/planar/boxblur.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: boxblur.c,v 1.13 2004/04/17 19:54:32 mroi Exp $
+ * $Id: boxblur.c,v 1.14 2006/01/27 07:46:14 tmattern Exp $
*
* mplayer's boxblur
* Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at>
@@ -184,7 +184,7 @@ static post_plugin_t *boxblur_open_plugin(post_class_t *class_gen, int inputs,
input_api->name = "parameters";
input_api->type = XINE_POST_DATA_PARAMETERS;
input_api->data = &post_api;
- xine_list_append_content(this->post.input, input_api);
+ xine_list_push_back(this->post.input, input_api);
input->xine_in.name = "video";
output->xine_out.name = "boxblured video";
diff --git a/src/post/planar/denoise3d.c b/src/post/planar/denoise3d.c
index 3f69468e8..370ab4e23 100644
--- a/src/post/planar/denoise3d.c
+++ b/src/post/planar/denoise3d.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: denoise3d.c,v 1.13 2004/04/17 19:54:32 mroi Exp $
+ * $Id: denoise3d.c,v 1.14 2006/01/27 07:46:14 tmattern Exp $
*
* mplayer's denoise3d
* Copyright (C) 2003 Daniel Moreno <comac@comac.darktech.org>
@@ -225,7 +225,7 @@ static post_plugin_t *denoise3d_open_plugin(post_class_t *class_gen, int inputs,
input_api->name = "parameters";
input_api->type = XINE_POST_DATA_PARAMETERS;
input_api->data = &post_api;
- xine_list_append_content(this->post.input, input_api);
+ xine_list_push_back(this->post.input, input_api);
input->xine_in.name = "video";
output->xine_out.name = "denoise3d video";
diff --git a/src/post/planar/eq.c b/src/post/planar/eq.c
index e28a71192..7d38c83e8 100644
--- a/src/post/planar/eq.c
+++ b/src/post/planar/eq.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: eq.c,v 1.12 2004/04/17 19:54:32 mroi Exp $
+ * $Id: eq.c,v 1.13 2006/01/27 07:46:14 tmattern Exp $
*
* mplayer's eq (soft video equalizer)
* Copyright (C) Richard Felker
@@ -282,7 +282,7 @@ static post_plugin_t *eq_open_plugin(post_class_t *class_gen, int inputs,
input_api->name = "parameters";
input_api->type = XINE_POST_DATA_PARAMETERS;
input_api->data = &post_api;
- xine_list_append_content(this->post.input, input_api);
+ xine_list_push_back(this->post.input, input_api);
input->xine_in.name = "video";
output->xine_out.name = "eqd video";
diff --git a/src/post/planar/expand.c b/src/post/planar/expand.c
index 5326e055c..a2d89aa22 100644
--- a/src/post/planar/expand.c
+++ b/src/post/planar/expand.c
@@ -162,7 +162,7 @@ static post_plugin_t *expand_open_plugin(post_class_t *class_gen, int inputs,
input_param->name = "parameters";
input_param->type = XINE_POST_DATA_PARAMETERS;
input_param->data = &post_api;
- xine_list_append_content(this->post.input, input_param);
+ xine_list_push_back(this->post.input, input_param);
input->xine_in.name = "video";
output->xine_out.name = "expanded video";
diff --git a/src/post/planar/pp.c b/src/post/planar/pp.c
index a162f3fae..c66e40459 100755
--- a/src/post/planar/pp.c
+++ b/src/post/planar/pp.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: pp.c,v 1.8 2005/01/15 17:04:48 mroi Exp $
+ * $Id: pp.c,v 1.9 2006/01/27 07:46:14 tmattern Exp $
*
* plugin for ffmpeg libpostprocess
*/
@@ -211,7 +211,7 @@ static post_plugin_t *pp_open_plugin(post_class_t *class_gen, int inputs,
input_api->name = "parameters";
input_api->type = XINE_POST_DATA_PARAMETERS;
input_api->data = &post_api;
- xine_list_append_content(this->post.input, input_api);
+ xine_list_push_back(this->post.input, input_api);
input->xine_in.name = "video";
output->xine_out.name = "pped video";
diff --git a/src/post/planar/unsharp.c b/src/post/planar/unsharp.c
index 0e9fc8b08..161104a64 100644
--- a/src/post/planar/unsharp.c
+++ b/src/post/planar/unsharp.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: unsharp.c,v 1.17 2005/02/13 13:14:43 valtri Exp $
+ * $Id: unsharp.c,v 1.18 2006/01/27 07:46:14 tmattern Exp $
*
* mplayer's unsharp
* Copyright (C) 2002 Rémi Guyomarch <rguyom@pobox.com>
@@ -320,7 +320,7 @@ static post_plugin_t *unsharp_open_plugin(post_class_t *class_gen, int inputs,
input_api->name = "parameters";
input_api->type = XINE_POST_DATA_PARAMETERS;
input_api->data = &post_api;
- xine_list_append_content(this->post.input, input_api);
+ xine_list_push_back(this->post.input, input_api);
input->xine_in.name = "video";
output->xine_out.name = "unsharped video";
diff --git a/src/post/visualizations/fftgraph.c b/src/post/visualizations/fftgraph.c
index 7ac5d74ac..f9f8f0d4a 100644
--- a/src/post/visualizations/fftgraph.c
+++ b/src/post/visualizations/fftgraph.c
@@ -20,7 +20,7 @@
* FftGraph Visualization Post Plugin For xine
* by Thibaut Mattern (tmattern@noos.fr)
*
- * $Id: fftgraph.c,v 1.13 2004/12/13 19:05:01 miguelfreitas Exp $
+ * $Id: fftgraph.c,v 1.14 2006/01/27 07:46:14 tmattern Exp $
*
*/
@@ -438,7 +438,7 @@ static post_plugin_t *fftgraph_open_plugin(post_class_t *class_gen, int inputs,
outputv->xine_out.data = (xine_video_port_t **)&this->vo_port;
outputv->xine_out.rewire = fftgraph_rewire_video;
outputv->post = &this->post;
- xine_list_append_content(this->post.output, outputv);
+ xine_list_push_back(this->post.output, outputv);
this->post.xine_post.audio_input[0] = &port->new_port;
diff --git a/src/post/visualizations/fftscope.c b/src/post/visualizations/fftscope.c
index 02b92bf31..8448f3a65 100644
--- a/src/post/visualizations/fftscope.c
+++ b/src/post/visualizations/fftscope.c
@@ -22,7 +22,7 @@
*
* FFT code by Steve Haehnichen, originally licensed under GPL v1
*
- * $Id: fftscope.c,v 1.28 2004/12/13 19:05:13 miguelfreitas Exp $
+ * $Id: fftscope.c,v 1.29 2006/01/27 07:46:14 tmattern Exp $
*
*/
@@ -459,7 +459,7 @@ static post_plugin_t *fftscope_open_plugin(post_class_t *class_gen, int inputs,
outputv->xine_out.data = (xine_video_port_t **)&this->vo_port;
outputv->xine_out.rewire = fftscope_rewire_video;
outputv->post = &this->post;
- xine_list_append_content(this->post.output, outputv);
+ xine_list_push_back(this->post.output, outputv);
this->post.xine_post.audio_input[0] = &port->new_port;
diff --git a/src/post/visualizations/fooviz.c b/src/post/visualizations/fooviz.c
index 08fa83c4f..b2c4361c8 100644
--- a/src/post/visualizations/fooviz.c
+++ b/src/post/visualizations/fooviz.c
@@ -23,7 +23,7 @@
* process. It simply paints the screen a solid color and rotates through
* colors on each iteration.
*
- * $Id: fooviz.c,v 1.23 2004/05/29 14:45:26 mroi Exp $
+ * $Id: fooviz.c,v 1.24 2006/01/27 07:46:14 tmattern Exp $
*
*/
@@ -270,7 +270,7 @@ static post_plugin_t *fooviz_open_plugin(post_class_t *class_gen, int inputs,
outputv->xine_out.data = (xine_video_port_t **)&this->vo_port;
outputv->xine_out.rewire = fooviz_rewire_video;
outputv->post = &this->post;
- xine_list_append_content(this->post.output, outputv);
+ xine_list_push_back(this->post.output, outputv);
this->post.xine_post.audio_input[0] = &port->new_port;
diff --git a/src/post/visualizations/oscope.c b/src/post/visualizations/oscope.c
index 93041e393..68ae0e054 100644
--- a/src/post/visualizations/oscope.c
+++ b/src/post/visualizations/oscope.c
@@ -20,7 +20,7 @@
* Basic Oscilloscope Visualization Post Plugin For xine
* by Mike Melanson (melanson@pcisys.net)
*
- * $Id: oscope.c,v 1.19 2004/05/29 14:45:26 mroi Exp $
+ * $Id: oscope.c,v 1.20 2006/01/27 07:46:14 tmattern Exp $
*
*/
@@ -341,7 +341,7 @@ static post_plugin_t *oscope_open_plugin(post_class_t *class_gen, int inputs,
outputv->xine_out.data = (xine_video_port_t **)&this->vo_port;
outputv->xine_out.rewire = oscope_rewire_video;
outputv->post = &this->post;
- xine_list_append_content(this->post.output, outputv);
+ xine_list_push_back(this->post.output, outputv);
this->post.xine_post.audio_input[0] = &port->new_port;
diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c
index 116d4dae4..ec698d95c 100644
--- a/src/video_out/video_out_xv.c
+++ b/src/video_out/video_out_xv.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_xv.c,v 1.214 2005/09/25 00:44:04 miguelfreitas Exp $
+ * $Id: video_out_xv.c,v 1.215 2006/01/27 07:46:15 tmattern Exp $
*
* video_out_xv.c, X11 video extension interface for xine
*
@@ -1025,15 +1025,16 @@ static void xv_store_port_attribute(xv_driver_t *this, char *name) {
XvGetPortAttribute (this->display, this->xv_port, atom, &attr->value);
XUnlockDisplay(this->display);
- xine_list_append_content (this->port_attributes, attr);
+ xine_list_push_back (this->port_attributes, attr);
}
static void xv_restore_port_attributes(xv_driver_t *this) {
Atom atom;
- xv_portattribute_t *attr;
+ xine_list_iterator_t ite;
- while ((attr = xine_list_first_content(this->port_attributes)) != NULL) {
- xine_list_delete_current (this->port_attributes);
+ while ((ite = xine_list_front(this->port_attributes)) != NULL) {
+ xv_portattribute_t *attr = xine_list_get_value(this->port_attributes, ite);
+ xine_list_remove (this->port_attributes, ite);
XLockDisplay(this->display);
atom = XInternAtom (this->display, attr->name, False);
@@ -1048,7 +1049,7 @@ static void xv_restore_port_attributes(xv_driver_t *this) {
XSync(this->display, False);
XUnlockDisplay(this->display);
- xine_list_free( this->port_attributes );
+ xine_list_delete( this->port_attributes );
}
static void xv_dispose (vo_driver_t *this_gen) {
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index d7567994c..a3e8e70be 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.194 2005/10/30 02:18:35 miguelfreitas Exp $
+ * $Id: audio_out.c,v 1.195 2006/01/27 07:46:15 tmattern Exp $
*
* 22-8-2001 James imported some useful AC3 sections from the previous alsa driver.
* (c) 2001 Andy Lo A Foe <andy@alsaplayer.org>
@@ -1049,12 +1049,15 @@ static void *ao_loop (void *this_gen) {
pthread_mutex_unlock( &this->driver_lock );
if (in_buf && in_buf->num_frames) {
+ xine_list_iterator_t ite;
+
xprintf(this->xine, XINE_VERBOSITY_LOG,
_("audio_out: delay calculation impossible with an unavailable audio device\n"));
pthread_mutex_lock(&this->streams_lock);
- for (stream = xine_list_first_content(this->streams);
- stream; stream = xine_list_next_content(this->streams)) {
+ for (ite = xine_list_front(this->streams);
+ ite; ite = xine_list_next(this->streams, ite)) {
+ stream = xine_list_get_value (this->streams, ite);
if( !stream->emergency_brake ) {
stream->emergency_brake = 1;
_x_message (stream, XINE_MSG_AUDIO_OUT_UNAVAILABLE, NULL);
@@ -1134,11 +1137,12 @@ static void *ao_loop (void *this_gen) {
cur_time > (last_sync_time + SYNC_TIME_INVERVAL) &&
bufs_since_sync >= SYNC_BUF_INTERVAL &&
!this->resample_sync_method ) {
- xine_stream_t *stream;
+ xine_list_iterator_t *ite;
lprintf ("audio_loop: ADJ_VPTS\n");
pthread_mutex_lock(&this->streams_lock);
- for (stream = xine_list_first_content(this->streams); stream;
- stream = xine_list_next_content(this->streams)) {
+ for (ite = xine_list_front(this->streams); ite;
+ ite = xine_list_next(this->streams, ite)) {
+ xine_stream_t *stream = xine_list_get_value(this->streams, ite);
if (stream == XINE_ANON_STREAM) continue;
stream->metronom->set_option(stream->metronom, METRONOM_ADJ_VPTS_OFFSET,
-gap/SYNC_GAP_RATE );
@@ -1230,11 +1234,13 @@ int xine_get_next_audio_frame (xine_audio_port_t *this_gen,
lprintf ("get_next_audio_frame\n");
while (!in_buf || !stream) {
- stream = xine_list_first_content(this->streams);
- if (!stream) {
+ xine_list_iterator_t ite = xine_list_front (this->streams);
+
+ if (!ite) {
xine_usec_sleep (5000);
continue;
}
+ stream = xine_list_get_value(this->streams, ite);
/* FIXME: ugly, use conditions and locks instead? */
@@ -1445,7 +1451,7 @@ static int ao_open(xine_audio_port_t *this_gen, xine_stream_t *stream,
}
pthread_mutex_lock(&this->streams_lock);
- xine_list_append_content(this->streams, stream);
+ xine_list_push_back(this->streams, stream);
pthread_mutex_unlock(&this->streams_lock);
return this->output.rate;
@@ -1512,23 +1518,25 @@ static void ao_put_buffer (xine_audio_port_t *this_gen,
static void ao_close(xine_audio_port_t *this_gen, xine_stream_t *stream) {
aos_t *this = (aos_t *) this_gen;
- xine_stream_t *cur;
+ xine_list_iterator_t ite;
xprintf (this->xine, XINE_VERBOSITY_DEBUG, "ao_close\n");
/* unregister stream */
pthread_mutex_lock(&this->streams_lock);
- for (cur = xine_list_first_content(this->streams); cur;
- cur = xine_list_next_content(this->streams))
+ for (ite = xine_list_front(this->streams); ite;
+ ite = xine_list_next(this->streams, ite)) {
+ xine_stream_t *cur = xine_list_get_value(this->streams, ite);
if (cur == stream) {
- xine_list_delete_current(this->streams);
+ xine_list_remove(this->streams, ite);
break;
}
- cur = xine_list_first_content(this->streams);
+ }
+ ite = xine_list_front(this->streams);
pthread_mutex_unlock(&this->streams_lock);
/* close driver if no streams left */
- if (!cur && !this->grab_only && !stream->gapless_switch) {
+ if (!ite && !this->grab_only && !stream->gapless_switch) {
xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_out: no streams left, closing driver\n");
if (this->audio_loop_running) {
@@ -1584,7 +1592,7 @@ static void ao_exit(xine_audio_port_t *this_gen) {
pthread_mutex_destroy(&this->driver_lock);
pthread_mutex_destroy(&this->driver_action_lock);
pthread_mutex_destroy(&this->streams_lock);
- xine_list_free(this->streams);
+ xine_list_delete(this->streams);
free (this->frame_buf[0]->mem);
free (this->frame_buf[0]->extra_info);
@@ -1659,7 +1667,6 @@ static uint32_t ao_get_capabilities (xine_audio_port_t *this_gen) {
static int ao_get_property (xine_audio_port_t *this_gen, int property) {
aos_t *this = (aos_t *) this_gen;
- xine_stream_t *cur;
int ret;
switch (property) {
@@ -1672,11 +1679,8 @@ static int ao_get_property (xine_audio_port_t *this_gen, int property) {
break;
case AO_PROP_NUM_STREAMS:
- ret = 0;
pthread_mutex_lock(&this->streams_lock);
- for (cur = xine_list_first_content(this->streams); cur;
- cur = xine_list_next_content(this->streams))
- ret++;
+ ret = xine_list_size(this->streams);
pthread_mutex_unlock(&this->streams_lock);
break;
@@ -1912,10 +1916,12 @@ static int ao_status (xine_audio_port_t *this_gen, xine_stream_t *stream,
aos_t *this = (aos_t *) this_gen;
xine_stream_t *cur;
int ret = 0;
+ xine_list_iterator_t ite;
pthread_mutex_lock(&this->streams_lock);
- for (cur = xine_list_first_content(this->streams); cur;
- cur = xine_list_next_content(this->streams))
+ for (ite = xine_list_front(this->streams); ite;
+ ite = xine_list_next(this->streams, ite)) {
+ cur = xine_list_get_value(this->streams, ite);
if (cur == stream || !stream) {
*bits = this->input.bits;
*rate = this->input.rate;
@@ -1923,6 +1929,7 @@ static int ao_status (xine_audio_port_t *this_gen, xine_stream_t *stream,
ret = !!stream; /* return false for a NULL stream, true otherwise */
break;
}
+ }
pthread_mutex_unlock(&this->streams_lock);
return ret;
diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c
index 59c6ba6c4..68168a80c 100644
--- a/src/xine-engine/broadcaster.c
+++ b/src/xine-engine/broadcaster.c
@@ -19,7 +19,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: broadcaster.c,v 1.8 2004/07/22 14:25:05 mroi Exp $
+ * $Id: broadcaster.c,v 1.9 2006/01/27 07:46:15 tmattern Exp $
*
* broadcaster.c - xine network broadcaster
*
@@ -156,10 +156,14 @@ static int sock_string_write(xine_t *xine, int socket, char *msg, ...) {
* it sends data to every connected client (slaves).
*/
static void broadcaster_data_write(broadcaster_t *this, char *buf, int len) {
- int *psock;
+ xine_list_iterator_t ite;
- psock = xine_list_first_content (this->connections);
- while (psock) {
+ ite = xine_list_front (this->connections);
+ while (ite) {
+
+ int *psock = xine_list_get_value(this->connections, ite);
+
+ ite = xine_list_next(this->connections, ite);
/* in case of failure remove from list */
if( sock_data_write(this->stream->xine, *psock, buf, len) < 0 ) {
@@ -167,13 +171,9 @@ static void broadcaster_data_write(broadcaster_t *this, char *buf, int len) {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: closing socket %d\n", *psock);
close(*psock);
free(psock);
- if( this->connections->cur->next )
- psock = this->connections->cur->next->content;
- else
- psock = NULL;
- xine_list_delete_current (this->connections);
- } else
- psock = xine_list_next_content (this->connections);
+
+ xine_list_remove (this->connections, xine_list_prev(this->connections, ite));
+ }
}
}
@@ -227,7 +227,7 @@ static void *manager_loop (void *this_gen) {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"broadcaster: new connection socket %d\n", *psock);
- xine_list_append_content(this->connections, psock);
+ xine_list_push_back(this->connections, psock);
}
}
}
@@ -343,20 +343,16 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port)
void _x_close_broadcaster(broadcaster_t *this)
{
- int *psock;
+ xine_list_iterator_t ite;
- psock = xine_list_first_content (this->connections);
- while (psock) {
+ while ( (ite = xine_list_front(this->connections)) ) {
+ int *psock = xine_list_get_value(this->connections, ite);
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: closing socket %d\n", *psock);
close(*psock);
free(psock);
- xine_list_delete_current (this->connections);
- if( this->connections->cur )
- psock = this->connections->cur->content;
- else
- psock = NULL;
+ xine_list_remove (this->connections, ite);
}
- xine_list_free(this->connections);
+ xine_list_delete(this->connections);
this->running = 0;
close(this->msock);
diff --git a/src/xine-engine/events.c b/src/xine-engine/events.c
index ef399b5c6..ed2858b91 100644
--- a/src/xine-engine/events.c
+++ b/src/xine-engine/events.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: events.c,v 1.28 2005/09/19 16:14:02 valtri Exp $
+ * $Id: events.c,v 1.29 2006/01/27 07:46:15 tmattern Exp $
*
* Event handling functions
*
@@ -34,12 +34,13 @@
xine_event_t *xine_event_get (xine_event_queue_t *queue) {
xine_event_t *event;
+ xine_list_iterator_t ite;
pthread_mutex_lock (&queue->lock);
-
- event = (xine_event_t *) xine_list_first_content (queue->events);
+ ite = xine_list_front (queue->events);
+ event = xine_list_get_value (queue->events, ite);
if (event)
- xine_list_delete_current (queue->events);
+ xine_list_remove (queue->events, ite);
pthread_mutex_unlock (&queue->lock);
@@ -49,14 +50,17 @@ xine_event_t *xine_event_get (xine_event_queue_t *queue) {
xine_event_t *xine_event_wait (xine_event_queue_t *queue) {
xine_event_t *event;
+ xine_list_iterator_t ite;
pthread_mutex_lock (&queue->lock);
- while (!(event = (xine_event_t *) xine_list_first_content (queue->events))) {
+ while ( !(ite = xine_list_front (queue->events)) ) {
pthread_cond_wait (&queue->new_event, &queue->lock);
}
- xine_list_delete_current (queue->events);
+ event = xine_list_get_value (queue->events, ite);
+
+ xine_list_remove (queue->events, ite);
pthread_mutex_unlock (&queue->lock);
@@ -70,16 +74,17 @@ void xine_event_free (xine_event_t *event) {
void xine_event_send (xine_stream_t *stream, const xine_event_t *event) {
- xine_event_queue_t *queue;
+ xine_list_iterator_t ite;
pthread_mutex_lock (&stream->event_queues_lock);
- queue = (xine_event_queue_t *)xine_list_first_content (stream->event_queues);
+ ite = xine_list_front (stream->event_queues);
- while (queue) {
-
+ while (ite) {
+ xine_event_queue_t *queue;
xine_event_t *cevent;
+ queue = xine_list_get_value(stream->event_queues, ite);
cevent = malloc (sizeof (xine_event_t));
cevent->type = event->type;
cevent->stream = stream;
@@ -93,11 +98,11 @@ void xine_event_send (xine_stream_t *stream, const xine_event_t *event) {
gettimeofday (&cevent->tv, NULL);
pthread_mutex_lock (&queue->lock);
- xine_list_append_content (queue->events, cevent);
+ xine_list_push_back (queue->events, cevent);
pthread_cond_signal (&queue->new_event);
pthread_mutex_unlock (&queue->lock);
- queue=(xine_event_queue_t *)xine_list_next_content (stream->event_queues);
+ ite = xine_list_next (stream->event_queues, ite);
}
pthread_mutex_unlock (&stream->event_queues_lock);
@@ -119,7 +124,7 @@ xine_event_queue_t *xine_event_new_queue (xine_stream_t *stream) {
queue->callback_running = 0;
pthread_mutex_lock (&stream->event_queues_lock);
- xine_list_append_content (stream->event_queues, queue);
+ xine_list_push_back (stream->event_queues, queue);
pthread_mutex_unlock (&stream->event_queues_lock);
return queue;
@@ -127,17 +132,21 @@ xine_event_queue_t *xine_event_new_queue (xine_stream_t *stream) {
void xine_event_dispose_queue (xine_event_queue_t *queue) {
- xine_stream_t *stream = queue->stream;
- xine_event_t *event;
- xine_event_t *qevent;
- xine_event_queue_t *q;
+ xine_stream_t *stream = queue->stream;
+ xine_event_t *event;
+ xine_event_t *qevent;
+ xine_event_queue_t *q;
+ xine_list_iterator_t ite;
pthread_mutex_lock (&stream->event_queues_lock);
- q = (xine_event_queue_t *) xine_list_first_content (stream->event_queues);
+ ite = xine_list_front (stream->event_queues);
+ q = xine_list_get_value (stream->event_queues, ite);
- while (q && (q != queue))
- q = (xine_event_queue_t *) xine_list_next_content (stream->event_queues);
+ while (ite && (q != queue)) {
+ ite = xine_list_next (stream->event_queues, ite);
+ q = xine_list_get_value (stream->event_queues, ite);
+ }
if (!q) {
xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "events: tried to dispose queue which is not in list\n");
@@ -146,7 +155,7 @@ void xine_event_dispose_queue (xine_event_queue_t *queue) {
return;
}
- xine_list_delete_current (stream->event_queues);
+ xine_list_remove (stream->event_queues, ite);
pthread_mutex_unlock (&stream->event_queues_lock);
/*
@@ -161,7 +170,7 @@ void xine_event_dispose_queue (xine_event_queue_t *queue) {
gettimeofday (&qevent->tv, NULL);
pthread_mutex_lock (&queue->lock);
- xine_list_append_content (queue->events, qevent);
+ xine_list_push_back (queue->events, qevent);
pthread_cond_signal (&queue->new_event);
pthread_mutex_unlock (&queue->lock);
@@ -212,7 +221,7 @@ static void *listener_loop (void *queue_gen) {
xine_event_free (event);
pthread_mutex_lock (&queue->lock);
- if (xine_list_is_empty (queue->events)) {
+ if (xine_list_empty (queue->events)) {
pthread_cond_signal (&queue->events_processed);
}
pthread_mutex_unlock (&queue->lock);
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index f7f243938..19df1b662 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.217 2005/11/28 12:25:21 valtri Exp $
+ * $Id: load_plugins.c,v 1.218 2006/01/27 07:46:15 tmattern Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -106,17 +106,16 @@ static int plugin_iface_versions[] = {
POST_PLUGIN_IFACE_VERSION
};
-static void _build_list_typed_plugins(plugin_catalog_t **catalog, xine_list_t *type) {
+static void _build_list_typed_plugins(plugin_catalog_t **catalog, xine_sarray_t *type) {
plugin_node_t *node;
- int i = 0;
-
- node = xine_list_first_content (type);
- while (node) {
- (*catalog)->ids[i] = node->info->id;
- i++;
- node = xine_list_next_content (type);
+ int list_id, list_size;
+
+ list_size = xine_sarray_size (type);
+ for (list_id = 0; list_id < list_size; list_id++) {
+ node = xine_sarray_get(type, list_id);
+ (*catalog)->ids[list_id] = node->info->id;
}
- (*catalog)->ids[i] = NULL;
+ (*catalog)->ids[list_id] = NULL;
}
static void inc_file_ref(plugin_file_t *file) {
@@ -164,10 +163,10 @@ static int get_decoder_priority(xine_t *this, plugin_node_t *node) {
}
static void map_decoder_list (xine_t *this,
- xine_list_t *decoder_list,
+ xine_sarray_t *decoder_list,
plugin_node_t *decoder_map[DECODER_MAX][PLUGINS_PER_TYPE]) {
int i;
- plugin_node_t *node;
+ int list_id, list_size;
/* init */
for (i = 0; i < DECODER_MAX; i++) {
@@ -177,9 +176,10 @@ static void map_decoder_list (xine_t *this,
/*
* map decoders
*/
- node = xine_list_first_content (decoder_list);
- while (node) {
+ list_size = xine_sarray_size(decoder_list);
+ for (list_id = 0; list_id < list_size; list_id++) {
+ plugin_node_t *node = xine_sarray_get(decoder_list, list_id);
uint32_t *type = ((decoder_info_t *)node->info->special_info)->supported_types;
int priority = get_decoder_priority(this, node);
@@ -209,8 +209,6 @@ static void map_decoder_list (xine_t *this,
type++;
}
-
- node = xine_list_next_content (decoder_list);
}
}
@@ -238,11 +236,12 @@ static void _decoder_priority_cb(void *data, xine_cfg_entry_t *cfg) {
static plugin_info_t *_get_cached_info (xine_t *this,
char *filename, off_t filesize, time_t filemtime,
plugin_info_t *previous_info) {
- plugin_node_t *node;
- xine_list_t *list = this->plugin_catalog->cache_list;
+ xine_sarray_t *list = this->plugin_catalog->cache_list;
+ int list_id, list_size;
- node = xine_list_first_content (list);
- while (node) {
+ list_size = xine_sarray_size (list);
+ for (list_id = 0; list_id < list_size; list_id++) {
+ plugin_node_t *node = xine_sarray_get (list, list_id);
if( !previous_info &&
node->file->filesize == filesize &&
node->file->filemtime == filemtime &&
@@ -255,7 +254,6 @@ static plugin_info_t *_get_cached_info (xine_t *this,
if( node->info == previous_info )
previous_info = NULL;
- node = xine_list_next_content (list);
}
return NULL;
}
@@ -276,13 +274,13 @@ static plugin_file_t *_insert_file (xine_t *this,
entry->ref = 0;
entry->no_unload = 0;
- xine_list_append_content (list, entry);
+ xine_list_push_back (list, entry);
return entry;
}
static void _insert_node (xine_t *this,
- xine_list_t *list,
+ xine_sarray_t *list,
plugin_file_t *file,
plugin_info_t *info,
int api_version){
@@ -296,7 +294,6 @@ static void _insert_node (xine_t *this,
demuxer_info_t *demux_new, *demux_old;
input_info_t *input_new, *input_old;
uint32_t *types;
- int priority = 0;
char key[80];
char desc[100];
int i;
@@ -318,13 +315,14 @@ static void _insert_node (xine_t *this,
entry->plugin_class = NULL;
entry->file = file;
entry->ref = 0;
+ entry->priority = 0; /* default priority */
switch (info->type & PLUGIN_TYPE_MASK){
case PLUGIN_VIDEO_OUT:
vo_old = info->special_info;
vo_new = xine_xmalloc(sizeof(vo_info_t));
- priority = vo_new->priority = vo_old->priority;
+ entry->priority = vo_new->priority = vo_old->priority;
vo_new->visual_type = vo_old->visual_type;
entry->info->special_info = vo_new;
break;
@@ -332,7 +330,7 @@ static void _insert_node (xine_t *this,
case PLUGIN_AUDIO_OUT:
ao_old = info->special_info;
ao_new = xine_xmalloc(sizeof(ao_info_t));
- priority = ao_new->priority = ao_old->priority;
+ entry->priority = ao_new->priority = ao_old->priority;
entry->info->special_info = ao_new;
break;
@@ -358,7 +356,7 @@ static void _insert_node (xine_t *this,
types[i] = decoder_old->supported_types[i];
}
decoder_new->supported_types = types;
- priority = decoder_new->priority = decoder_old->priority;
+ entry->priority = decoder_new->priority = decoder_old->priority;
snprintf(key, sizeof(key), "engine.decoder_priorities.%s", info->id);
snprintf(desc, sizeof(desc), _("priority for %s decoder"), info->id);
@@ -396,14 +394,14 @@ static void _insert_node (xine_t *this,
demux_new = xine_xmalloc(sizeof(demuxer_info_t));
if (demux_old) {
- priority = demux_new->priority = demux_old->priority;
+ entry->priority = demux_new->priority = demux_old->priority;
lprintf("demux: %s, priority: %d\n", info->id, priority);
} else {
xprintf(this, XINE_VERBOSITY_LOG,
_("load_plugins: demuxer plugin %s does not provide a priority,"
" xine-lib will use the default priority.\n"),
info->id);
- priority = demux_new->priority = 0;
+ entry->priority = demux_new->priority = 0;
}
entry->info->special_info = demux_new;
break;
@@ -413,14 +411,14 @@ static void _insert_node (xine_t *this,
input_new = xine_xmalloc(sizeof(input_info_t));
if (input_old) {
- priority = input_new->priority = input_old->priority;
+ entry->priority = input_new->priority = input_old->priority;
lprintf("input: %s, priority: %d\n", info->id, priority);
} else {
xprintf(this, XINE_VERBOSITY_LOG,
_("load_plugins: input plugin %s does not provide a priority,"
" xine-lib will use the default priority.\n"),
info->id);
- priority = input_new->priority = 0;
+ entry->priority = input_new->priority = 0;
}
entry->info->special_info = input_new;
break;
@@ -430,10 +428,23 @@ static void _insert_node (xine_t *this,
file->no_unload = 1;
}
- xine_list_append_priority_content (list, entry, priority);
+ xine_sarray_add(list, entry);
}
+static int _plugin_node_comparator(void *a, void *b) {
+ plugin_node_t *node_a = (plugin_node_t *)a;
+ plugin_node_t *node_b = (plugin_node_t *)b;
+
+ if (node_a->priority < node_b->priority) {
+ return -1;
+ } else if (node_a->priority == node_b->priority) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
static plugin_catalog_t *_new_catalog(void){
plugin_catalog_t *catalog;
@@ -442,10 +453,10 @@ static plugin_catalog_t *_new_catalog(void){
catalog = xine_xmalloc(sizeof(plugin_catalog_t));
for (i = 0; i < PLUGIN_TYPE_MAX; i++) {
- catalog->plugin_lists[i] = xine_list_new();
+ catalog->plugin_lists[i] = xine_sarray_new(0, _plugin_node_comparator);
}
- catalog->cache_list = xine_list_new();
+ catalog->cache_list = xine_sarray_new(0, _plugin_node_comparator);
catalog->file_list = xine_list_new();
pthread_mutex_init (&catalog->lock, NULL);
@@ -456,7 +467,7 @@ static void _register_plugins_internal(xine_t *this, plugin_file_t *file, plugin
_x_assert(this);
_x_assert(info);
- while ( info && info->type != PLUGIN_NONE ){
+ while ( info && info->type != PLUGIN_NONE ) {
if (file)
xine_log (this, XINE_LOG_PLUGIN,
@@ -739,27 +750,29 @@ static void _dispose_plugin_class(plugin_node_t *node) {
* load input+demuxer plugins
* load plugins that asked to be initialized
*/
-static void _load_required_plugins(xine_t *this, xine_list_t *list) {
+static void _load_required_plugins(xine_t *this, xine_sarray_t *list) {
- plugin_node_t *node;
+ int list_id = 0;
+ int list_size;
- node = xine_list_first_content (list);
- while (node) {
+ list_size = xine_sarray_size(list);
+ while (list_id < list_size) {
+ plugin_node_t *node = xine_sarray_get(list, list_id);
- if( (node->info->type & PLUGIN_MUST_PRELOAD) && !node->plugin_class ) {
+ if( (node->info->type & PLUGIN_MUST_PRELOAD) && !node->plugin_class ) {
lprintf("preload plugin %s from %s\n", node->info->id, node->file->filename);
if (! _load_plugin_class (this, node, NULL)) {
/* in case of failure remove from list */
- xine_list_delete_current (list);
- node = list->cur ? list->cur->content : NULL;
+ xine_sarray_remove(list, list_id);
+ list_size = xine_sarray_size(list);
} else
- node = xine_list_next_content (list);
- } else
- node = xine_list_next_content (list);
+ list_id++;
+ } else
+ list_id++;
}
}
@@ -776,7 +789,7 @@ static void load_required_plugins(xine_t *this) {
/*
* save plugin list information to file (cached catalog)
*/
-static void save_plugin_list(FILE *fp, xine_list_t *plugins) {
+static void save_plugin_list(FILE *fp, xine_sarray_t *list) {
plugin_node_t *node;
plugin_file_t *file;
@@ -788,9 +801,12 @@ static void save_plugin_list(FILE *fp, xine_list_t *plugins) {
post_info_t *post_info;
int i;
+ int list_id = 0;
+ int list_size;
- node = xine_list_first_content (plugins);
- while (node) {
+ list_size = xine_sarray_size (list);
+ while (list_id < list_size) {
+ node = xine_sarray_get(list, list_id);
file = node->file;
fprintf(fp, "[%s]\n", file->filename );
@@ -843,14 +859,14 @@ static void save_plugin_list(FILE *fp, xine_list_t *plugins) {
}
fprintf(fp, "\n");
- node = xine_list_next_content (plugins);
+ list_id++;
}
}
/*
* load plugin list information from file (cached catalog)
*/
-static void load_plugin_list(FILE *fp, xine_list_t *plugins) {
+static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) {
plugin_node_t *node;
plugin_file_t *file;
@@ -884,7 +900,7 @@ static void load_plugin_list(FILE *fp, xine_list_t *plugins) {
*value = (char) 0;
if( node ) {
- xine_list_append_content (plugins, node);
+ xine_sarray_add (plugins, node);
}
node = xine_xmalloc(sizeof(plugin_node_t));
file = xine_xmalloc(sizeof(plugin_file_t));
@@ -1003,7 +1019,7 @@ static void load_plugin_list(FILE *fp, xine_list_t *plugins) {
}
if( node ) {
- xine_list_append_content (plugins, node);
+ xine_sarray_add (plugins, node);
}
}
@@ -1139,11 +1155,13 @@ input_plugin_t *_x_find_input_plugin (xine_stream_t *stream, const char *mrl) {
plugin_catalog_t *catalog = xine->plugin_catalog;
plugin_node_t *node;
input_plugin_t *plugin = NULL;
+ int list_id, list_size;
pthread_mutex_lock (&catalog->lock);
- node = xine_list_first_content (catalog->plugin_lists[PLUGIN_INPUT - 1]);
- while (node) {
+ list_size = xine_sarray_size(catalog->plugin_lists[PLUGIN_INPUT - 1]);
+ for (list_id = 0; list_id < list_size; list_id++) {
+ node = xine_sarray_get (catalog->plugin_lists[PLUGIN_INPUT - 1], list_id);
if (node->plugin_class || _load_plugin_class(xine, node, NULL)) {
if ((plugin = ((input_class_t *)node->plugin_class)->get_instance(node->plugin_class, stream, mrl))) {
@@ -1151,9 +1169,7 @@ input_plugin_t *_x_find_input_plugin (xine_stream_t *stream, const char *mrl) {
plugin->node = node;
break;
}
- }
-
- node = xine_list_next_content (stream->xine->plugin_catalog->plugin_lists[PLUGIN_INPUT - 1]);
+ }
}
pthread_mutex_unlock (&catalog->lock);
@@ -1194,16 +1210,17 @@ static demux_plugin_t *probe_demux (xine_stream_t *stream, int method1, int meth
i = 0;
while (methods[i] != -1 && !plugin) {
-
- plugin_node_t *node;
+ int list_id, list_size;
stream->content_detection_method = methods[i];
pthread_mutex_lock (&catalog->lock);
- node = xine_list_first_content (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
+ list_size = xine_sarray_size(catalog->plugin_lists[PLUGIN_DEMUX - 1]);
+ for(list_id = 0; list_id < list_size; list_id++) {
+ plugin_node_t *node;
- while (node) {
+ node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id);
xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "load_plugins: probing demux '%s'\n", node->info->id);
@@ -1214,8 +1231,6 @@ static demux_plugin_t *probe_demux (xine_stream_t *stream, int method1, int meth
break;
}
}
-
- node = xine_list_next_content (stream->xine->plugin_catalog->plugin_lists[PLUGIN_DEMUX - 1]);
}
pthread_mutex_unlock (&catalog->lock);
@@ -1256,12 +1271,17 @@ demux_plugin_t *_x_find_demux_plugin_by_name(xine_stream_t *stream, const char *
plugin_catalog_t *catalog = stream->xine->plugin_catalog;
plugin_node_t *node;
demux_plugin_t *plugin = NULL;
+ int list_id, list_size;
pthread_mutex_lock(&catalog->lock);
- node = xine_list_first_content(catalog->plugin_lists[PLUGIN_DEMUX - 1]);
+
stream->content_detection_method = METHOD_EXPLICIT;
- while (node) {
+ list_size = xine_sarray_size(catalog->plugin_lists[PLUGIN_DEMUX - 1]);
+ for (list_id = 0; list_id < list_size; list_id++) {
+
+ node = xine_sarray_get(catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id);
+
if (strcasecmp(node->info->id, name) == 0) {
if (node->plugin_class || _load_plugin_class(stream->xine, node, NULL)) {
if ((plugin = ((demux_class_t *)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) {
@@ -1271,7 +1291,6 @@ demux_plugin_t *_x_find_demux_plugin_by_name(xine_stream_t *stream, const char *
}
}
}
- node = xine_list_next_content(catalog->plugin_lists[PLUGIN_DEMUX - 1]);
}
pthread_mutex_unlock(&catalog->lock);
@@ -1302,16 +1321,17 @@ demux_plugin_t *_x_find_demux_plugin_last_probe(xine_stream_t *stream, const cha
i = 0;
while (methods[i] != -1 && !plugin) {
-
- plugin_node_t *node;
+ int list_id, list_size;
stream->content_detection_method = methods[i];
pthread_mutex_lock (&catalog->lock);
- node = xine_list_first_content (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
+ list_size = xine_sarray_size(catalog->plugin_lists[PLUGIN_DEMUX - 1]);
+ for (list_id = 0; list_id < list_size; list_id++) {
+ plugin_node_t *node;
- while (node) {
+ node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id);
lprintf ("probing demux '%s'\n", node->info->id);
@@ -1330,8 +1350,6 @@ demux_plugin_t *_x_find_demux_plugin_last_probe(xine_stream_t *stream, const cha
}
}
}
-
- node = xine_list_next_content (stream->xine->plugin_catalog->plugin_lists[PLUGIN_DEMUX - 1]);
}
pthread_mutex_unlock (&catalog->lock);
@@ -1378,16 +1396,19 @@ const char *const *xine_get_autoplay_input_plugin_ids(xine_t *this) {
plugin_catalog_t *catalog;
plugin_node_t *node;
+ int list_id, list_size;
catalog = this->plugin_catalog;
pthread_mutex_lock (&catalog->lock);
catalog->ids[0] = NULL;
- node = xine_list_first_content (catalog->plugin_lists[PLUGIN_INPUT - 1]);
- while (node) {
+
+ list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_INPUT - 1]);
+ for (list_id = 0; list_id < list_size; list_id++) {
input_class_t *ic;
+ node = xine_sarray_get(catalog->plugin_lists[PLUGIN_INPUT - 1], list_id);
if (node->plugin_class || _load_plugin_class(this, node, NULL)) {
ic = (input_class_t *) node->plugin_class;
@@ -1402,7 +1423,6 @@ const char *const *xine_get_autoplay_input_plugin_ids(xine_t *this) {
catalog->ids[i] = node->info->id;
}
}
- node = xine_list_next_content (catalog->plugin_lists[PLUGIN_INPUT - 1]);
}
pthread_mutex_unlock (&catalog->lock);
@@ -1415,16 +1435,19 @@ const char *const *xine_get_browsable_input_plugin_ids(xine_t *this) {
plugin_catalog_t *catalog;
plugin_node_t *node;
+ int list_id, list_size;
catalog = this->plugin_catalog;
pthread_mutex_lock (&catalog->lock);
catalog->ids[0] = NULL;
- node = xine_list_first_content (catalog->plugin_lists[PLUGIN_INPUT - 1]);
- while (node) {
+ list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_INPUT - 1]);
+
+ for (list_id = 0; list_id < list_size; list_id++) {
input_class_t *ic;
+ node = xine_sarray_get(catalog->plugin_lists[PLUGIN_INPUT - 1], list_id);
if (node->plugin_class || _load_plugin_class(this, node, NULL)) {
ic = (input_class_t *) node->plugin_class;
@@ -1439,7 +1462,6 @@ const char *const *xine_get_browsable_input_plugin_ids(xine_t *this) {
catalog->ids[i] = node->info->id;
}
}
- node = xine_list_next_content (catalog->plugin_lists[PLUGIN_INPUT - 1]);
}
pthread_mutex_unlock (&catalog->lock);
@@ -1477,6 +1499,7 @@ vo_driver_t *_x_load_video_output_plugin(xine_t *this,
vo_driver_t *driver;
vo_info_t *vo_info;
plugin_catalog_t *catalog = this->plugin_catalog;
+ int list_id, list_size;
driver = NULL;
@@ -1485,8 +1508,10 @@ vo_driver_t *_x_load_video_output_plugin(xine_t *this,
pthread_mutex_lock (&catalog->lock);
- node = xine_list_first_content (catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1]);
- while (node) {
+ list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1]);
+ for (list_id = 0; list_id < list_size; list_id++) {
+
+ node = xine_sarray_get (catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1], list_id);
vo_info = node->info->special_info;
if (vo_info->visual_type == visual_type) {
@@ -1506,8 +1531,6 @@ vo_driver_t *_x_load_video_output_plugin(xine_t *this,
}
}
}
-
- node = xine_list_next_content (catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1]);
}
pthread_mutex_unlock (&catalog->lock);
@@ -1542,21 +1565,23 @@ xine_video_port_t *xine_new_framegrab_video_port (xine_t *this) {
vo_info_t *vo_info;
plugin_catalog_t *catalog = this->plugin_catalog;
char *id;
+ int list_id, list_size;
driver = NULL;
id = "none";
pthread_mutex_lock (&catalog->lock);
- node = xine_list_first_content (catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1]);
- while (node) {
+ list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1]);
+ for (list_id = 0; list_id < list_size; list_id++) {
+
+ node = xine_sarray_get (catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1], list_id);
vo_info = node->info->special_info;
if (!strcasecmp (node->info->id, id)) {
driver = _load_video_driver (this, node, NULL);
break;
}
- node = xine_list_next_content (catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1]);
}
pthread_mutex_unlock (&catalog->lock);
@@ -1621,6 +1646,7 @@ xine_audio_port_t *xine_open_audio_driver (xine_t *this, const char *id,
xine_audio_port_t *port;
ao_info_t *ao_info;
plugin_catalog_t *catalog = this->plugin_catalog;
+ int list_id, list_size;
if (id && !strcasecmp(id, "auto") )
id = NULL;
@@ -1629,8 +1655,10 @@ xine_audio_port_t *xine_open_audio_driver (xine_t *this, const char *id,
driver = NULL;
- node = xine_list_first_content (this->plugin_catalog->plugin_lists[PLUGIN_AUDIO_OUT - 1]);
- while (node) {
+ list_size = xine_sarray_size (this->plugin_catalog->plugin_lists[PLUGIN_AUDIO_OUT - 1]);
+ for (list_id = 0; list_id < list_size; list_id++) {
+
+ node = xine_sarray_get (this->plugin_catalog->plugin_lists[PLUGIN_AUDIO_OUT - 1], list_id);
ao_info = node->info->special_info;
@@ -1645,8 +1673,6 @@ xine_audio_port_t *xine_open_audio_driver (xine_t *this, const char *id,
break;
}
}
-
- node = xine_list_next_content (this->plugin_catalog->plugin_lists[PLUGIN_AUDIO_OUT - 1]);
}
pthread_mutex_unlock (&catalog->lock);
@@ -1697,13 +1723,16 @@ void xine_close_video_driver (xine_t *this, xine_video_port_t *vo_port) {
char **xine_get_autoplay_mrls (xine_t *this, const char *plugin_id,
int *num_mrls) {
- plugin_catalog_t *catalog;
- plugin_node_t *node;
+ plugin_catalog_t *catalog;
+ plugin_node_t *node;
+ int list_id, list_size;
catalog = this->plugin_catalog;
- node = xine_list_first_content (catalog->plugin_lists[PLUGIN_INPUT - 1]);
- while (node) {
+ list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_INPUT - 1]);
+ for (list_id = 0; list_id < list_size; list_id++) {
+
+ node = xine_sarray_get (catalog->plugin_lists[PLUGIN_INPUT - 1], list_id);
if (!strcasecmp (node->info->id, plugin_id)) {
input_class_t *ic;
@@ -1718,7 +1747,6 @@ char **xine_get_autoplay_mrls (xine_t *this, const char *plugin_id,
return ic->get_autoplay_list (ic, num_mrls);
}
}
- node = xine_list_next_content (catalog->plugin_lists[PLUGIN_INPUT - 1]);
}
return NULL;
}
@@ -1731,11 +1759,14 @@ xine_mrl_t **xine_get_browse_mrls (xine_t *this, const char *plugin_id,
plugin_catalog_t *catalog;
plugin_node_t *node;
+ int list_id, list_size;
catalog = this->plugin_catalog;
- node = xine_list_first_content (catalog->plugin_lists[PLUGIN_INPUT - 1]);
- while (node) {
+ list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_INPUT - 1]);
+ for (list_id = 0; list_id < list_size; list_id++) {
+
+ node = xine_sarray_get (catalog->plugin_lists[PLUGIN_INPUT - 1], list_id);
if (!strcasecmp (node->info->id, plugin_id)) {
input_class_t *ic;
@@ -1750,7 +1781,6 @@ xine_mrl_t **xine_get_browse_mrls (xine_t *this, const char *plugin_id,
return ic->get_dir (ic, start_mrl, num_mrls);
}
}
- node = xine_list_next_content (catalog->plugin_lists[PLUGIN_INPUT - 1]);
}
return NULL;
}
@@ -1911,12 +1941,16 @@ static void _display_file_plugin_list (xine_list_t *list, plugin_file_t *file) {
}
#endif
-static void _unload_unref_plugins(xine_t *this, xine_list_t *list) {
+static void _unload_unref_plugins(xine_t *this, xine_sarray_t *list) {
plugin_node_t *node;
+ int list_id, list_size;
+
+ list_size = xine_sarray_size (list);
+ for (list_id = 0; list_id < list_size; list_id++) {
+
+ node = xine_sarray_get (list, list_id);
- node = xine_list_first_content(list);
- while (node) {
if (node->ref == 0) {
plugin_file_t *file = node->file;
@@ -1936,7 +1970,6 @@ static void _unload_unref_plugins(xine_t *this, xine_list_t *list) {
file->lib_handle = NULL;
}
}
- node = xine_list_next_content(list);
}
}
@@ -2105,15 +2138,17 @@ const char *const *xine_list_post_plugins_typed(xine_t *xine, int type) {
plugin_catalog_t *catalog = xine->plugin_catalog;
plugin_node_t *node;
int i;
+ int list_id, list_size;
pthread_mutex_lock (&catalog->lock);
i = 0;
- node = xine_list_first_content (catalog->plugin_lists[PLUGIN_POST - 1]);
- while (node) {
+ list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_POST - 1]);
+
+ for (list_id = 0; list_id < list_size; list_id++) {
+ node = xine_sarray_get (catalog->plugin_lists[PLUGIN_POST - 1], list_id);
if (((post_info_t *)node->info->special_info)->type == type)
catalog->ids[i++] = node->info->id;
- node = xine_list_next_content (catalog->plugin_lists[PLUGIN_POST - 1]);
}
catalog->ids[i] = NULL;
@@ -2124,8 +2159,11 @@ const char *const *xine_list_post_plugins_typed(xine_t *xine, int type) {
#define GET_PLUGIN_DESC(NAME,TYPE,CATITEM) \
const char *xine_get_##NAME##_plugin_description (xine_t *this, const char *plugin_id) { \
plugin_catalog_t *catalog = this->plugin_catalog; \
- plugin_node_t *node = xine_list_first_content (catalog->plugin_lists[CATITEM - 1]); \
- while (node) { \
+ plugin_node_t *node; \
+ int list_id, list_size; \
+ list_size = xine_sarray_size (catalog->plugin_lists[CATITEM - 1]); \
+ for (list_id = 0; list_id < list_size; list_id++) { \
+ node = xine_sarray_get (catalog->plugin_lists[CATITEM - 1], list_id); \
if (!strcasecmp (node->info->id, plugin_id)) { \
TYPE##_class_t *ic = (TYPE##_class_t *) node->plugin_class; \
if (!ic) { \
@@ -2136,7 +2174,6 @@ const char *const *xine_list_post_plugins_typed(xine_t *xine, int type) {
} \
return ic->get_description(ic); \
} \
- node = xine_list_next_content (catalog->plugin_lists[CATITEM - 1]); \
} \
return NULL; \
}
@@ -2156,14 +2193,17 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs,
plugin_catalog_t *catalog = xine->plugin_catalog;
plugin_node_t *node;
post_plugin_t *post = NULL;
+ int list_id, list_size;
if( !name )
return NULL;
pthread_mutex_lock(&catalog->lock);
- node = xine_list_first_content(catalog->plugin_lists[PLUGIN_POST - 1]);
- while (node) {
+ list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_POST - 1]);
+
+ for (list_id = 0; list_id < list_size; list_id++) {
+ node = xine_sarray_get (catalog->plugin_lists[PLUGIN_POST - 1], list_id);
if (strcmp(node->info->id, name) == 0) {
@@ -2179,6 +2219,7 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs,
if (post) {
xine_post_in_t *input;
xine_post_out_t *output;
+ xine_list_iterator_t ite;
int i;
post->running_ticket = xine->port_ticket;
@@ -2188,32 +2229,36 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs,
/* init the lists of announced connections */
i = 0;
- input = xine_list_first_content(post->input);
- while (input) {
+ ite = xine_list_front(post->input);
+ while (ite) {
+ input = xine_list_get_value (post->input, ite);
i++;
- input = xine_list_next_content(post->input);
+ ite = xine_list_next (post->input, ite);
}
post->input_ids = malloc(sizeof(char *) * (i + 1));
i = 0;
- input = xine_list_first_content(post->input);
- while (input) {
+ ite = xine_list_front (post->input);
+ while (ite) {
+ input = xine_list_get_value (post->input, ite);
post->input_ids[i++] = input->name;
- input = xine_list_next_content(post->input);
+ ite = xine_list_next (post->input, ite);
}
post->input_ids[i] = NULL;
i = 0;
- output = xine_list_first_content(post->output);
- while (output) {
+ ite = xine_list_front (post->output);
+ while (ite) {
+ output = xine_list_get_value (post->output, ite);
i++;
- output = xine_list_next_content(post->output);
+ ite = xine_list_next (post->output, ite);
}
post->output_ids = malloc(sizeof(char *) * (i + 1));
i = 0;
- output = xine_list_first_content(post->output);
- while (output) {
+ ite = xine_list_front (post->output);
+ while (ite) {
+ output = xine_list_get_value (post->output, ite);
post->output_ids[i++] = output->name;
- output = xine_list_next_content(post->output);
+ ite = xine_list_next (post->output, ite);
}
post->output_ids[i] = NULL;
@@ -2227,8 +2272,6 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs,
break;
}
}
-
- node = xine_list_next_content(catalog->plugin_lists[PLUGIN_POST - 1]);
}
pthread_mutex_unlock(&catalog->lock);
@@ -2258,17 +2301,19 @@ char *xine_get_file_extensions (xine_t *self) {
int len, pos;
plugin_node_t *node;
char *str;
+ int list_id, list_size;
pthread_mutex_lock (&catalog->lock);
/* calc length of output */
len = 0;
- node = xine_list_first_content (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
- while (node) {
+ list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
+ for (list_id = 0; list_id < list_size; list_id++) {
demux_class_t *cls;
char *exts;
+ node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id);
if (node->plugin_class || _load_plugin_class(self, node, NULL)) {
cls = (demux_class_t *)node->plugin_class;
@@ -2276,19 +2321,19 @@ char *xine_get_file_extensions (xine_t *self) {
if((exts = cls->get_extensions(cls)) && strlen(exts))
len += strlen(exts) + 1;
}
- node = xine_list_next_content (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
}
/* create output */
str = malloc (len); /* '\0' space is already counted in the previous loop */
pos = 0;
- node = xine_list_first_content (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
- while (node) {
+ list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
+ for (list_id = 0; list_id < list_size; list_id++) {
demux_class_t *cls;
char *e;
int l;
+ node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id);
if (node->plugin_class || _load_plugin_class(self, node, NULL)) {
cls = (demux_class_t *)node->plugin_class;
@@ -2306,7 +2351,6 @@ char *xine_get_file_extensions (xine_t *self) {
}
}
}
- node = xine_list_next_content (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
}
str[pos] = 0;
@@ -2325,16 +2369,20 @@ char *xine_get_mime_types (xine_t *self) {
int len, pos;
plugin_node_t *node;
char *str;
+ int list_id, list_size;
pthread_mutex_lock (&catalog->lock);
/* calc length of output */
- len = 0; node = xine_list_first_content (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
- while (node) {
+ len = 0;
+ list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
+
+ for (list_id = 0; list_id < list_size; list_id++) {
demux_class_t *cls;
char *s;
+ node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id);
if (node->plugin_class || _load_plugin_class(self, node, NULL)) {
cls = (demux_class_t *)node->plugin_class;
@@ -2343,7 +2391,6 @@ char *xine_get_mime_types (xine_t *self) {
if (s)
len += strlen(s);
}
- node = xine_list_next_content (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
}
/* create output */
@@ -2351,12 +2398,14 @@ char *xine_get_mime_types (xine_t *self) {
str = malloc (len+1);
pos = 0;
- node = xine_list_first_content (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
- while (node) {
+ list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
+
+ for (list_id = 0; list_id < list_size; list_id++) {
demux_class_t *cls;
char *s;
int l;
+ node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id);
if (node->plugin_class || _load_plugin_class(self, node, NULL)) {
cls = (demux_class_t *)node->plugin_class;
@@ -2369,7 +2418,6 @@ char *xine_get_mime_types (xine_t *self) {
pos += l;
}
}
- node = xine_list_next_content (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
}
str[pos] = 0;
@@ -2391,6 +2439,7 @@ char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type) {
char *id = NULL;
char *mime_arg, *mime_demux;
char *s;
+ int list_id, list_size;
/* create a copy and convert to lower case */
mime_arg = strdup(mime_type);
@@ -2399,10 +2448,12 @@ char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type) {
pthread_mutex_lock (&catalog->lock);
- node = xine_list_first_content (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
- while (node && !id) {
+ list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
+
+ for (list_id = 0; (list_id < list_size) && !id; list_id++) {
demux_class_t *cls;
+ node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id);
if (node->plugin_class || _load_plugin_class(self, node, NULL)) {
cls = (demux_class_t *)node->plugin_class;
@@ -2420,7 +2471,6 @@ char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type) {
free(mime_demux);
}
}
- node = xine_list_next_content (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
}
pthread_mutex_unlock (&catalog->lock);
@@ -2431,21 +2481,23 @@ char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type) {
}
-static void dispose_plugin_list (xine_list_t *list) {
+static void dispose_plugin_list (xine_sarray_t *list) {
- plugin_node_t *node;
+ plugin_node_t *node;
decoder_info_t *decoder_info;
+ int list_id, list_size;
- if(list) {
+ if (list) {
- node = xine_list_first_content (list);
- while (node) {
+ list_size = xine_sarray_size (list);
+
+ for (list_id = 0; list_id < list_size; list_id++) {
+ node = xine_sarray_get (list, list_id);
if (node->ref == 0)
_dispose_plugin_class(node);
else {
lprintf("node \"%s\" still referenced %d time(s)\n", node->info->id, node->ref);
- node = xine_list_next_content (list);
continue;
}
@@ -2467,24 +2519,24 @@ static void dispose_plugin_list (xine_list_t *list) {
free (node->info->id);
free (node->info);
free (node);
-
- node = xine_list_next_content (list);
}
- xine_list_free(list);
+ xine_sarray_delete(list);
}
}
static void dispose_plugin_file_list (xine_list_t *list) {
- plugin_file_t *file;
+ plugin_file_t *file;
+ xine_list_iterator_t ite;
- file = xine_list_first_content (list);
- while (file) {
+ ite = xine_list_front (list);
+ while (ite) {
+ file = xine_list_get_value (list, ite);
free (file->filename);
free (file);
- file = xine_list_next_content (list);
+ ite = xine_list_next (list, ite);
}
- xine_list_free(list);
+ xine_list_delete (list);
}
diff --git a/src/xine-engine/plugin_catalog.h b/src/xine-engine/plugin_catalog.h
index e7b212f78..027dd082a 100644
--- a/src/xine-engine/plugin_catalog.h
+++ b/src/xine-engine/plugin_catalog.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: plugin_catalog.h,v 1.19 2005/04/10 09:31:17 tmattern Exp $
+ * $Id: plugin_catalog.h,v 1.20 2006/01/27 07:46:15 tmattern Exp $
*
* xine-internal header: Definitions for plugin lists
*
@@ -58,12 +58,13 @@ typedef struct {
plugin_info_t *info;
void *plugin_class;
int ref; /* count intances of plugins */
+ int priority;
} plugin_node_t ;
struct plugin_catalog_s {
- xine_list_t *plugin_lists[PLUGIN_TYPE_MAX];
+ xine_sarray_t *plugin_lists[PLUGIN_TYPE_MAX];
- xine_list_t *cache_list;
+ xine_sarray_t *cache_list;
xine_list_t *file_list;
plugin_node_t *audio_decoder_map[DECODER_MAX][PLUGINS_PER_TYPE];
diff --git a/src/xine-engine/post.c b/src/xine-engine/post.c
index 93737d714..6ae96e982 100644
--- a/src/xine-engine/post.c
+++ b/src/xine-engine/post.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: post.c,v 1.31 2005/07/17 20:22:24 jstembridge Exp $
+ * $Id: post.c,v 1.32 2006/01/27 07:46:15 tmattern Exp $
*/
/*
@@ -243,7 +243,7 @@ post_video_port_t *_x_post_intercept_video_port(post_plugin_t *post, xine_video_
(*input)->xine_in.type = XINE_POST_DATA_VIDEO;
(*input)->xine_in.data = &port->new_port;
(*input)->post = post;
- xine_list_append_content(post->input, *input);
+ xine_list_push_back(post->input, *input);
}
if (output) {
@@ -255,7 +255,7 @@ post_video_port_t *_x_post_intercept_video_port(post_plugin_t *post, xine_video_
(*output)->xine_out.rewire = post_video_rewire;
(*output)->post = post;
(*output)->user_data = port;
- xine_list_append_content(post->output, *output);
+ xine_list_push_back(post->output, *output);
}
return port;
@@ -725,7 +725,7 @@ post_audio_port_t *_x_post_intercept_audio_port(post_plugin_t *post, xine_audio_
(*input)->xine_in.type = XINE_POST_DATA_AUDIO;
(*input)->xine_in.data = &port->new_port;
(*input)->post = post;
- xine_list_append_content(post->input, *input);
+ xine_list_push_back(post->input, *input);
}
if (output) {
@@ -737,7 +737,7 @@ post_audio_port_t *_x_post_intercept_audio_port(post_plugin_t *post, xine_audio_
(*output)->xine_out.rewire = post_audio_rewire;
(*output)->post = post;
(*output)->user_data = port;
- xine_list_append_content(post->output, *output);
+ xine_list_push_back(post->output, *output);
}
return port;
@@ -790,6 +790,7 @@ int _x_post_dispose(post_plugin_t *this) {
if (!in_use) {
xine_post_in_t *input;
xine_post_out_t *output;
+ xine_list_iterator_t ite;
/* we can really dispose it */
@@ -799,8 +800,9 @@ int _x_post_dispose(post_plugin_t *this) {
free(this->input_ids);
free(this->output_ids);
- for (input = xine_list_first_content(this->input); input;
- input = xine_list_next_content(this->input)) {
+ for (ite = xine_list_front(this->input); ite;
+ ite = xine_list_next(this->input, ite)) {
+ input = xine_list_get_value(this->input, ite);
switch (input->type) {
case XINE_POST_DATA_VIDEO:
{
@@ -832,8 +834,9 @@ int _x_post_dispose(post_plugin_t *this) {
break;
}
}
- for (output = xine_list_first_content(this->output); output;
- output = xine_list_next_content(this->output)) {
+ for (ite = xine_list_front(this->output); ite;
+ ite = xine_list_next(this->output, ite)) {
+ output = xine_list_get_value(this->output, ite);
switch (output->type) {
case XINE_POST_DATA_VIDEO:
if (output->rewire == post_video_rewire)
@@ -848,8 +851,8 @@ int _x_post_dispose(post_plugin_t *this) {
}
}
- xine_list_free(this->input);
- xine_list_free(this->output);
+ xine_list_delete(this->input);
+ xine_list_delete(this->output);
/* since the plugin loader does not know, when the plugin gets disposed,
* we have to handle the reference counter here */
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index 2c19daee9..603bd5b39 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.222 2005/11/14 23:48:19 miguelfreitas Exp $
+ * $Id: video_out.c,v 1.223 2006/01/27 07:46:15 tmattern Exp $
*
* frame allocation / queuing / scheduling / output functions
*/
@@ -502,6 +502,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) {
if (!img->bad_frame) {
int img_already_locked = 0;
+ xine_list_iterator_t ite;
/* add cropping requested by frontend */
img->crop_left += this->crop_left;
@@ -543,8 +544,9 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) {
*/
img->is_first = 0;
pthread_mutex_lock(&this->streams_lock);
- for (stream = xine_list_first_content(this->streams); stream;
- stream = xine_list_next_content(this->streams)) {
+ for (ite = xine_list_front(this->streams); ite;
+ ite = xine_list_next(this->streams, ite)) {
+ stream = xine_list_get_value(this->streams, ite);
if (stream == XINE_ANON_STREAM) continue;
pthread_mutex_lock (&stream->first_frame_lock);
if (stream->first_frame_flag == 2) {
@@ -583,6 +585,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) {
if ((this->num_frames_delivered % 200) == 0 && this->num_frames_delivered) {
int send_event;
+ xine_list_iterator_t ite;
if( (100 * this->num_frames_skipped / this->num_frames_delivered) >
this->warn_skipped_threshold ||
@@ -600,8 +603,9 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) {
this->warn_threshold_event_sent += send_event;
pthread_mutex_lock(&this->streams_lock);
- for (stream = xine_list_first_content(this->streams); stream;
- stream = xine_list_next_content(this->streams)) {
+ for (ite = xine_list_front(this->streams); ite;
+ ite = xine_list_next(this->streams, ite)) {
+ stream = xine_list_get_value(this->streams, ite);
if (stream == XINE_ANON_STREAM) continue;
_x_stream_info_set(stream, XINE_STREAM_INFO_SKIPPED_FRAMES,
1000 * this->num_frames_skipped / this->num_frames_delivered);
@@ -967,6 +971,7 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts,
static void overlay_and_display_frame (vos_t *this,
vo_frame_t *img, int64_t vpts) {
xine_stream_t *stream;
+ xine_list_iterator_t ite;
lprintf ("displaying image with vpts = %" PRId64 "\n", img->vpts);
@@ -1006,8 +1011,9 @@ static void overlay_and_display_frame (vos_t *this,
*/
if( this->last_frame->is_first ) {
pthread_mutex_lock(&this->streams_lock);
- for (stream = xine_list_first_content(this->streams); stream;
- stream = xine_list_next_content(this->streams)) {
+ for (ite = xine_list_front(this->streams); ite;
+ ite = xine_list_next(this->streams, ite)) {
+ stream = xine_list_get_value(this->streams, ite);
if (stream == XINE_ANON_STREAM) continue;
pthread_mutex_lock (&stream->first_frame_lock);
if (stream->first_frame_flag) {
@@ -1149,11 +1155,12 @@ static void *video_out_loop (void *this_gen) {
diff = vpts - this->last_delivery_pts;
if (diff > 30000 && !this->display_img_buf_queue->first) {
- xine_stream_t *stream;
+ xine_list_iterator_t ite;
pthread_mutex_lock(&this->streams_lock);
- for (stream = xine_list_first_content(this->streams); stream;
- stream = xine_list_next_content(this->streams)) {
+ for (ite = xine_list_front(this->streams); ite;
+ ite = xine_list_next(this->streams, ite)) {
+ xine_stream_t *stream = xine_list_get_value(this->streams, ite);
if (stream == XINE_ANON_STREAM) continue;
if (stream->video_decoder_plugin && stream->video_fifo) {
buf_element_t *buf;
@@ -1255,12 +1262,12 @@ int xine_get_next_video_frame (xine_video_port_t *this_gen,
xine_stream_t *stream = NULL;
while (!img || !stream) {
- stream = xine_list_first_content(this->streams);
+ xine_list_iterator_t ite = xine_list_front(this->streams);
+ stream = xine_list_get_value(this->streams, ite);
if (!stream) {
xine_usec_sleep (5000);
continue;
}
-
/* FIXME: ugly, use conditions and locks instead? */
@@ -1327,14 +1334,14 @@ static void vo_open (xine_video_port_t *this_gen, xine_stream_t *stream) {
/* enable overlays if our new stream might want to show some */
this->overlay_enabled = 1;
pthread_mutex_lock(&this->streams_lock);
- xine_list_append_content(this->streams, stream);
+ xine_list_push_back(this->streams, stream);
pthread_mutex_unlock(&this->streams_lock);
}
static void vo_close (xine_video_port_t *this_gen, xine_stream_t *stream) {
vos_t *this = (vos_t *) this_gen;
- xine_stream_t *cur;
+ xine_list_iterator_t ite;
/* this will make sure all hide events were processed */
if (this->overlay_source)
@@ -1344,19 +1351,20 @@ static void vo_close (xine_video_port_t *this_gen, xine_stream_t *stream) {
/* unregister stream */
pthread_mutex_lock(&this->streams_lock);
- for (cur = xine_list_first_content(this->streams); cur;
- cur = xine_list_next_content(this->streams))
+ for (ite = xine_list_front(this->streams); ite;
+ ite = xine_list_next(this->streams, ite)) {
+ xine_stream_t *cur = xine_list_get_value(this->streams, ite);
if (cur == stream) {
- xine_list_delete_current(this->streams);
+ xine_list_remove(this->streams, ite);
break;
}
+ }
pthread_mutex_unlock(&this->streams_lock);
}
static int vo_get_property (xine_video_port_t *this_gen, int property) {
vos_t *this = (vos_t *) this_gen;
- xine_stream_t *cur;
int ret;
switch (property) {
@@ -1369,11 +1377,8 @@ static int vo_get_property (xine_video_port_t *this_gen, int property) {
break;
case VO_PROP_NUM_STREAMS:
- ret = 0;
pthread_mutex_lock(&this->streams_lock);
- for (cur = xine_list_first_content(this->streams); cur;
- cur = xine_list_next_content(this->streams))
- ret++;
+ ret = xine_list_size(this->streams);
pthread_mutex_unlock(&this->streams_lock);
break;
@@ -1524,12 +1529,13 @@ static int vo_status (xine_video_port_t *this_gen, xine_stream_t *stream,
int *width, int *height, int64_t *img_duration) {
vos_t *this = (vos_t *) this_gen;
- xine_stream_t *cur;
+ xine_list_iterator_t ite;
int ret = 0;
pthread_mutex_lock(&this->streams_lock);
- for (cur = xine_list_first_content(this->streams); cur;
- cur = xine_list_next_content(this->streams))
+ for (ite = xine_list_front(this->streams); ite;
+ ite = xine_list_next(this->streams, ite)) {
+ xine_stream_t *cur = xine_list_get_value(this->streams, ite);
if (cur == stream || !stream) {
*width = this->current_width;
*height = this->current_height;
@@ -1537,6 +1543,7 @@ static int vo_status (xine_video_port_t *this_gen, xine_stream_t *stream,
ret = !!stream; /* return false for a NULL stream, true otherwise */
break;
}
+ }
pthread_mutex_unlock(&this->streams_lock);
return ret;
@@ -1584,7 +1591,7 @@ static void vo_exit (xine_video_port_t *this_gen) {
this->overlay_source->dispose (this->overlay_source);
}
- xine_list_free(this->streams);
+ xine_list_delete(this->streams);
pthread_mutex_destroy(&this->streams_lock);
free (this->free_img_buf_queue);
@@ -1615,10 +1622,12 @@ static void vo_enable_overlay (xine_video_port_t *this_gen, int overlay_enabled)
this->overlay_enabled = 1;
} else {
/* ... but we only actually DISable, if all associated streams have SPU off */
- xine_stream_t *stream;
+ xine_list_iterator_t ite;
+
pthread_mutex_lock(&this->streams_lock);
- for (stream = xine_list_first_content(this->streams) ; stream ;
- stream = xine_list_next_content(this->streams)) {
+ for (ite = xine_list_front(this->streams); ite;
+ ite = xine_list_next(this->streams, ite)) {
+ xine_stream_t *stream = xine_list_get_value(this->streams, ite);
if (stream == XINE_ANON_STREAM || stream->spu_channel_user > -2) {
pthread_mutex_unlock(&this->streams_lock);
return;
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 9bc0aa6b2..b97ae7157 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.320 2006/01/26 12:13:23 miguelfreitas Exp $
+ * $Id: xine.c,v 1.321 2006/01/27 07:46:16 tmattern Exp $
*/
/*
@@ -594,7 +594,7 @@ xine_stream_t *xine_stream_new (xine_t *this,
* register stream
*/
- xine_list_append_content (this->streams, stream);
+ xine_list_push_back (this->streams, stream);
pthread_mutex_unlock (&this->streams_lock);
@@ -630,13 +630,14 @@ static void mrl_unescape(char *mrl) {
void _x_flush_events_queues (xine_stream_t *stream) {
- xine_event_queue_t *queue;
+ xine_list_iterator_t ite;
pthread_mutex_lock (&stream->event_queues_lock);
/* No events queue? */
- for (queue = xine_list_first_content (stream->event_queues);
- queue; queue = xine_list_next_content (stream->event_queues)) {
+ for (ite = xine_list_front (stream->event_queues);
+ ite; ite = xine_list_next (stream->event_queues, ite)) {
+ xine_event_queue_t *queue = xine_list_get_value(stream->event_queues, ite);
pthread_mutex_lock (&queue->lock);
pthread_mutex_unlock (&stream->event_queues_lock);
@@ -646,7 +647,7 @@ void _x_flush_events_queues (xine_stream_t *stream) {
* currently executing their callback functions.
*/
if (queue->listener_thread != NULL && !queue->callback_running) {
- while (!xine_list_is_empty (queue->events)) {
+ while (!xine_list_empty (queue->events)) {
pthread_cond_wait (&queue->events_processed, &queue->lock);
}
}
@@ -1258,7 +1259,7 @@ int xine_eject (xine_stream_t *stream) {
void xine_dispose_internal (xine_stream_t *stream) {
- xine_stream_t *s;
+ xine_list_iterator_t *ite;
lprintf("stream: %p\n", stream);
pthread_mutex_destroy (&stream->info_mutex);
@@ -1275,12 +1276,9 @@ void xine_dispose_internal (xine_stream_t *stream) {
stream->metronom->exit (stream->metronom);
pthread_mutex_lock(&stream->xine->streams_lock);
- for (s = xine_list_first_content(stream->xine->streams);
- s; s = xine_list_next_content(stream->xine->streams)) {
- if (s == stream) {
- xine_list_delete_current (stream->xine->streams);
- break;
- }
+ ite = xine_list_find(stream->xine->streams, stream);
+ if (ite) {
+ xine_list_remove(stream->xine->streams, ite);
}
pthread_mutex_unlock(&stream->xine->streams_lock);
@@ -1336,7 +1334,7 @@ void xine_exit (xine_t *this) {
_x_dispose_plugins (this);
if(this->streams) {
- xine_list_free(this->streams);
+ xine_list_delete(this->streams);
pthread_mutex_destroy(&this->streams_lock);
}
@@ -1463,13 +1461,16 @@ static void config_save_cb (void *this_gen, xine_cfg_entry_t *entry) {
strcmp(entry->str_value, xine_get_homedir()) == 0 ||
strcmp(entry->str_value, homedir_trail_slash) == 0)) {
xine_stream_t *stream;
+ xine_list_iterator_t ite;
xine_log(this, XINE_LOG_MSG,
_("xine: The specified save_dir \"%s\" might be a security risk.\n"), entry->str_value);
pthread_mutex_lock(&this->streams_lock);
- if ((stream = (xine_stream_t *)xine_list_first_content(this->streams)))
+ if ( (ite = xine_list_front(this->streams)) ) {
+ stream = xine_list_get_value(this->streams, ite);
_x_message(stream, XINE_MSG_SECURITY, _("The specified save_dir might be a security risk."), NULL);
+ }
pthread_mutex_unlock(&this->streams_lock);
}
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index 18c86349b..9a785c9b3 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.91 2005/10/30 02:18:35 miguelfreitas Exp $
+ * $Id: xine_interface.c,v 1.92 2006/01/27 07:46:16 tmattern Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -813,26 +813,28 @@ const char *const *xine_post_list_outputs(xine_post_t *this_gen) {
xine_post_in_t *xine_post_input(xine_post_t *this_gen, const char *name) {
post_plugin_t *this = (post_plugin_t *)this_gen;
- xine_post_in_t *input;
+ xine_list_iterator_t ite;
- input = xine_list_first_content(this->input);
- while (input) {
+ ite = xine_list_front(this->input);
+ while (ite) {
+ xine_post_in_t *input = xine_list_get_value(this->input, ite);
if (strcmp(input->name, name) == 0)
return input;
- input = xine_list_next_content(this->input);
+ ite = xine_list_next(this->input, ite);
}
return NULL;
}
xine_post_out_t *xine_post_output(xine_post_t *this_gen, const char *name) {
post_plugin_t *this = (post_plugin_t *)this_gen;
- xine_post_out_t *output;
+ xine_list_iterator_t ite;
- output = xine_list_first_content(this->output);
- while (output) {
+ ite = xine_list_front(this->output);
+ while (ite) {
+ xine_post_out_t *output = xine_list_get_value(this->output, ite);
if (strcmp(output->name, name) == 0)
return output;
- output = xine_list_next_content(this->output);
+ ite = xine_list_next(this->output, ite);
}
return NULL;
}
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index b3cb7d65c..0fc083569 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.170 2006/01/26 12:13:23 miguelfreitas Exp $
+ * $Id: xine_internal.h,v 1.171 2006/01/27 07:46:16 tmattern Exp $
*
*/
@@ -264,6 +264,7 @@ struct xine_stream_s {
audio_decoder_t *audio_decoder_plugin;
int audio_decoder_streamtype;
extra_info_t *audio_decoder_extra_info;
+
uint32_t audio_track_map[50];
int audio_track_map_entries;
uint32_t audio_type;
diff --git a/src/xine-utils/list.c b/src/xine-utils/list.c
index bd44a6abf..88de77fda 100644
--- a/src/xine-utils/list.c
+++ b/src/xine-utils/list.c
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2000-2003 the xine project
+ * Copyright (C) 2000-2006 the xine project
*
- * This file is part of xine, a unix video player.
+ * This file is part of xine, a free video player.
*
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,235 +17,310 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: list.c,v 1.9 2004/12/20 21:38:24 mroi Exp $
+ * $Id: list.c,v 1.10 2006/01/27 07:46:16 tmattern Exp $
*
*/
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <stdio.h>
#include <stdlib.h>
-#include <inttypes.h>
-
-#include "xineutils.h"
-
-/*
- * create a new, empty list
+#include "list.h"
+
+#define MIN_CHUNK_SIZE 32
+#define MAX_CHUNK_SIZE 65536
+
+/* list element struct */
+typedef struct xine_list_elem_s xine_list_elem_t;
+struct xine_list_elem_s {
+ xine_list_elem_t *prev;
+ xine_list_elem_t *next;
+ void *value;
+};
+
+/* chunk of list elements */
+typedef struct xine_list_chunk_s xine_list_chunk_t;
+struct xine_list_chunk_s {
+ xine_list_chunk_t *next_chunk; /* singly linked list of chunks */
+
+ xine_list_elem_t *elem_array; /* the allocated elements */
+ int chunk_size; /* element count in the chunk */
+ int current_elem_id; /* next free elem in the chunk */
+};
+
+/* list struct */
+struct xine_list_s {
+ /* list of chunks */
+ xine_list_chunk_t *chunk_list;
+ size_t chunk_list_size;
+ xine_list_chunk_t *last_chunk;
+
+ /* list elements */
+ xine_list_elem_t *elem_list_front;
+ xine_list_elem_t *elem_list_back;
+ size_t elem_list_size;
+
+ /* list of free elements */
+ xine_list_elem_t *free_elem_list;
+ size_t free_elem_list_size;
+};
+
+/* Allocates a new chunk of n elements
+ * One malloc call is used to allocate the struct and the elements.
*/
-xine_list_t *xine_list_new (void) {
- xine_list_t *list;
+static xine_list_chunk_t *xine_list_alloc_chunk(size_t size) {
+ xine_list_chunk_t *new_chunk;
+ size_t chunk_mem_size;;
- list = (xine_list_t *) xine_xmalloc(sizeof(xine_list_t));
+ chunk_mem_size = sizeof(xine_list_chunk_t);
+ chunk_mem_size += sizeof(xine_list_elem_t) * size;
- list->first=NULL;
- list->last =NULL;
- list->cur =NULL;
+ new_chunk = (xine_list_chunk_t *)malloc(chunk_mem_size);
+ new_chunk->elem_array = (xine_list_elem_t*)(new_chunk + 1);
+ new_chunk->next_chunk = NULL;
+ new_chunk->current_elem_id = 0;
+ new_chunk->chunk_size = size;
- return list;
+ return new_chunk;
}
-/*
- * dispose a list (and only the list, contents have to be managed separately)
- * TODO: this is easy to fix by using "content destructors"
- */
-void xine_list_free(xine_list_t *l) {
- xine_node_t *node;
+/* Delete a chunk */
+static void xine_list_delete_chunk(xine_list_chunk_t *chunk) {
+ free(chunk);
+}
- if (!l) {
- fprintf(stderr, "%s(): No list.\n", __XINE_FUNCTION__);
- return;
- }
-
- if(!l->first) {
- return;
+/* Get a new element either from the free list either from the current chunk.
+ Allocate a new chunk if needed */
+static xine_list_elem_t *xine_list_alloc_elem(xine_list_t *list) {
+ xine_list_elem_t *new_elem;
+
+ /* check the free list */
+ if (list->free_elem_list_size > 0) {
+ new_elem = list->free_elem_list;
+ list->free_elem_list = list->free_elem_list->next;
+ list->free_elem_list_size--;
+ } else {
+ /* check current chunk */
+ if (list->last_chunk->current_elem_id < list->last_chunk->chunk_size) {
+ /* take the next elem in the chunk */
+ new_elem = &list->last_chunk->elem_array[list->last_chunk->current_elem_id];
+ list->last_chunk->current_elem_id++;
+ } else {
+ /* a new chunk is needed */
+ xine_list_chunk_t *new_chunk;
+ int chunk_size;
+
+ chunk_size = list->last_chunk->chunk_size * 2;
+ if (chunk_size > MAX_CHUNK_SIZE)
+ chunk_size = MAX_CHUNK_SIZE;
+
+ new_chunk = xine_list_alloc_chunk(chunk_size);
+
+ list->last_chunk->next_chunk = new_chunk;
+ list->last_chunk = new_chunk;
+ list->chunk_list_size++;
+
+ new_elem = &new_chunk->elem_array[0];
+ new_chunk->current_elem_id++;
+ }
}
+ return new_elem;
+}
+
+/* Push the elem into the free list */
+static void xine_list_recycle_elem(xine_list_t *list, xine_list_elem_t *elem) {
+ elem->next = list->free_elem_list;
+ elem->prev = NULL;
+
+ list->free_elem_list = elem;
+ list->free_elem_list_size++;
+}
- node = l->first;
-
- while(node) {
- xine_node_t *n = node;
-
- /* TODO: support for content destructors */
- node = n->next;
- free(n);
+/* List constructor */
+xine_list_t *xine_list_new() {
+ xine_list_t *new_list;
+
+ new_list = (xine_list_t*)malloc(sizeof(xine_list_t));
+ new_list->chunk_list = xine_list_alloc_chunk(MIN_CHUNK_SIZE);
+ new_list->chunk_list_size = 1;
+ new_list->last_chunk = new_list->chunk_list;
+ new_list->free_elem_list = NULL;
+ new_list->free_elem_list_size = 0;
+ new_list->elem_list_front = NULL;
+ new_list->elem_list_back = NULL;
+ new_list->elem_list_size = 0;
+
+ return new_list;
+}
+
+void xine_list_delete(xine_list_t *list) {
+ /* Delete each chunk */
+ xine_list_chunk_t *current_chunk = list->chunk_list;
+
+ while (current_chunk) {
+ xine_list_chunk_t *next_chunk = current_chunk->next_chunk;
+
+ xine_list_delete_chunk(current_chunk);
+ current_chunk = next_chunk;
}
-
- free(l);
+ free(list);
}
-void *xine_list_first_content (xine_list_t *l) {
+unsigned int xine_list_size(xine_list_t *list) {
+ return list->elem_list_size;
+}
- l->cur = l->first;
+unsigned int xine_list_empty(xine_list_t *list) {
+ return (list->elem_list_size == 0);
+}
- if (l->first)
- return l->first->content;
- else
- return NULL;
+xine_list_iterator_t xine_list_front(xine_list_t *list) {
+ return list->elem_list_front;
}
-void *xine_list_next_content (xine_list_t *l) {
- if (l->cur) {
+xine_list_iterator_t xine_list_back(xine_list_t *list) {
+ return list->elem_list_back;
+}
- if (l->cur->next) {
- l->cur = l->cur->next;
- return l->cur->content;
- }
- else
- return NULL;
-
- }
- else {
- fprintf(stderr,"%s() WARNING: passed end of list\n", __XINE_FUNCTION__);
- return NULL;
- }
+void xine_list_push_back(xine_list_t *list, void *value) {
+ xine_list_elem_t *new_elem;
+
+ new_elem = xine_list_alloc_elem(list);
+ new_elem->value = value;
+
+ if (list->elem_list_back) {
+ new_elem->next = NULL;
+ new_elem->prev = list->elem_list_back;
+ list->elem_list_back->next = new_elem;
+ list->elem_list_back = new_elem;
+ } else {
+ /* first elem in the list */
+ list->elem_list_front = list->elem_list_back = new_elem;
+ new_elem->next = NULL;
+ new_elem->prev = NULL;
+ }
+ list->elem_list_size++;
}
-int xine_list_is_empty (xine_list_t *l) {
+void xine_list_push_front(xine_list_t *list, void *value) {
+ xine_list_elem_t *new_elem;
+
+ new_elem = xine_list_alloc_elem(list);
+ new_elem->value = value;
+
+ if (list->elem_list_front) {
+ new_elem->next = list->elem_list_front;
+ new_elem->prev = NULL;
+ list->elem_list_front->prev = new_elem;
+ list->elem_list_front = new_elem;
+ } else {
+ /* first elem in the list */
+ list->elem_list_front = list->elem_list_back = new_elem;
+ new_elem->next = NULL;
+ new_elem->prev = NULL;
+ }
+ list->elem_list_size++;
+}
- if (l == NULL){
- fprintf(stderr, "%s(): list is NULL\n", __XINE_FUNCTION__);
- return -1;
+void xine_list_clear(xine_list_t *list) {
+ xine_list_elem_t *elem = list->elem_list_front;
+ while (elem) {
+ xine_list_elem_t *elem_next = elem->next;
+ xine_list_recycle_elem(list, elem);
+ elem = elem_next;
}
- return (l->first == NULL);
+
+ list->elem_list_front = NULL;
+ list->elem_list_back = NULL;
+ list->elem_list_size = 0;
}
-void *xine_list_last_content (xine_list_t *l) {
+xine_list_iterator_t xine_list_next(xine_list_t *list, xine_list_iterator_t ite) {
+ xine_list_elem_t *elem = (xine_list_elem_t*)ite;
- if (l->last) {
- l->cur = l->last;
- return l->last->content;
- }
- else {
- fprintf(stderr, "xine_list: wanted last of empty list\n");
- return NULL;
- }
+ if (ite == NULL)
+ return list->elem_list_front;
+ else
+ return (xine_list_iterator_t)elem->next;
}
-void *xine_list_prev_content (xine_list_t *l) {
+xine_list_iterator_t xine_list_prev(xine_list_t *list, xine_list_iterator_t ite) {
+ xine_list_elem_t *elem = (xine_list_elem_t*)ite;
- if (l->cur) {
- if (l->cur->prev) {
- l->cur = l->cur->prev;
- return l->cur->content;
- }
- else
- return NULL;
- }
- else {
- fprintf(stderr, "xine_list: passed begin of list\n");
- return NULL;
- }
-}
-
-void xine_list_append_priority_content (xine_list_t *l, void *content, int priority) {
- xine_node_t *node;
-
- node = (xine_node_t *) xine_xmalloc(sizeof(xine_node_t));
- node->content = content;
- node->priority = priority;
-
- if (l->first) {
- xine_node_t *cur;
-
- cur = l->first;
-
- while(1) {
- if( priority > cur->priority ) {
- node->next = cur;
- node->prev = cur->prev;
-
- if( node->prev )
- node->prev->next = node;
- else
- l->first = node;
- cur->prev = node;
-
- l->cur = node;
- break;
- }
-
- if( !cur->next ) {
- node->next = NULL;
- node->prev = cur;
- cur->next = node;
-
- l->cur = node;
- l->last = node;
- break;
- }
-
- cur = cur->next;
- }
- }
- else {
- l->first = l->last = l->cur = node;
- node->prev = node->next = NULL;
- }
+ if (ite == NULL)
+ return list->elem_list_back;
+ else
+ return (xine_list_iterator_t)elem->prev;
+}
+
+void *xine_list_get_value(xine_list_t *list, xine_list_iterator_t ite) {
+ xine_list_elem_t *elem = (xine_list_elem_t*)ite;
+
+ return elem->value;
}
+void xine_list_remove(xine_list_t *list, xine_list_iterator_t position) {
+ xine_list_elem_t *elem = (xine_list_elem_t*)position;
-void xine_list_append_content (xine_list_t *l, void *content) {
- xine_node_t *node;
+ if (elem) {
+ xine_list_elem_t *prev = elem->prev;
+ xine_list_elem_t *next = elem->next;
- node = (xine_node_t *) xine_xmalloc(sizeof(xine_node_t));
- node->content = content;
+ if (prev)
+ prev->next = next;
+ else
+ list->elem_list_front = next;
- if (l->last) {
- node->next = NULL;
- node->prev = l->last;
- l->last->next = node;
- l->last = node;
- l->cur = node;
- }
- else {
- l->first = l->last = l->cur = node;
- node->prev = node->next = NULL;
+ if (next)
+ next->prev = prev;
+ else
+ list->elem_list_back = prev;
+
+ xine_list_recycle_elem(list, elem);
+ list->elem_list_size--;
}
}
-void xine_list_insert_content (xine_list_t *l, void *content) {
- xine_node_t *nodecur, *nodenext, *nodenew;
-
- if(l->cur->next) {
- nodenew = (xine_node_t *) xine_xmalloc(sizeof(xine_node_t));
-
- nodenew->content = content;
- nodecur = l->cur;
- nodenext = l->cur->next;
- nodecur->next = nodenew;
- nodenext->prev = nodenew;
- nodenew->prev = nodecur;
- nodenew->next = nodenext;
- l->cur = nodenew;
- }
- else { /* current is last, append to the list */
- xine_list_append_content(l, content);
+xine_list_iterator_t xine_list_insert(xine_list_t *list,
+ xine_list_iterator_t position,
+ void *value) {
+ xine_list_elem_t *elem = (xine_list_elem_t*)position;
+ xine_list_iterator_t new_position = NULL;
+
+ if (elem == NULL) {
+ /* insert at the end */
+ xine_list_push_back(list, value);
+ new_position = list->elem_list_back;
+ } else {
+ if (elem->prev == NULL) {
+ /* insert at the beginning */
+ xine_list_push_front(list, value);
+ new_position = list->elem_list_front;
+ } else {
+ xine_list_elem_t *new_elem = xine_list_alloc_elem(list);
+ xine_list_elem_t *prev = elem->prev;
+
+ new_elem->next = elem;
+ new_elem->prev = prev;
+ new_elem->value = value;
+
+ elem->prev = new_elem;
+ prev->next = new_elem;
+
+ new_position = (xine_list_iterator_t)elem;
+ }
}
-
+ return new_position;
}
-void xine_list_delete_current (xine_list_t *l) {
- xine_node_t *node_cur;
+xine_list_iterator_t xine_list_find(xine_list_t *list, void *value) {
- node_cur = l->cur;
+ xine_list_elem_t *elem;
- if(node_cur->prev) {
- node_cur->prev->next = node_cur->next;
- }
- else { /* First entry */
- l->first = node_cur->next;
- }
-
- if(node_cur->next) {
- node_cur->next->prev = node_cur->prev;
- l->cur = node_cur->next;
+ for (elem = list->elem_list_front; elem; elem = elem->next) {
+ if (elem->value == value)
+ break;
}
- else { /* last entry in the list */
- l->last = node_cur->prev;
- l->cur = node_cur->prev;
- }
-
- /* TODO: support content destructors */
- free(node_cur);
+ return elem;
}
diff --git a/src/xine-utils/list.h b/src/xine-utils/list.h
index 388de88cc..57f131642 100644
--- a/src/xine-utils/list.h
+++ b/src/xine-utils/list.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: list.h,v 1.1 2006/01/16 08:04:44 tmattern Exp $
+ * $Id: list.h,v 1.2 2006/01/27 07:46:16 tmattern Exp $
*
* Doubly-linked linked list.
*
@@ -87,16 +87,20 @@ xine_list_iterator_t xine_list_front(xine_list_t *list);
/* Returns an iterator that references the last element of the list */
xine_list_iterator_t xine_list_back(xine_list_t *list);
+/* Perform a linear search of a given value, and returns an iterator that
+ references this value or NULL if not found */
+xine_list_iterator_t xine_list_find(xine_list_t *list, void *value);
+
/* Increments the iterator's value, so it specifies the next element in the list
or NULL at the end of the list */
-xine_list_iterator_t xine_list_iterator_next(xine_list_iterator_t ite);
+xine_list_iterator_t xine_list_next(xine_list_t *list, xine_list_iterator_t ite);
/* Increments the iterator's value, so it specifies the previous element in the list
or NULL at the beginning of the list */
-xine_list_iterator_t xine_list_iterator_prev(xine_list_iterator_t ite);
+xine_list_iterator_t xine_list_prev(xine_list_t *list, xine_list_iterator_t ite);
-/* Returns the element at the position specified by the iterator */
-void *xine_list_iterator_value(xine_list_iterator_t ite);
+/* Returns the value at the position specified by the iterator */
+void *xine_list_get_value(xine_list_t *list, xine_list_iterator_t ite);
#endif