summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/Makefile.am3
-rw-r--r--src/xine-engine/alphablend.c2
-rw-r--r--src/xine-engine/audio_out.c4
-rw-r--r--src/xine-engine/broadcaster.c6
-rw-r--r--src/xine-engine/configfile.c5
-rw-r--r--src/xine-engine/load_plugins.c26
-rw-r--r--src/xine-engine/load_plugins.h50
-rw-r--r--src/xine-engine/post.c2
-rw-r--r--src/xine-engine/vo_scale.c35
-rw-r--r--src/xine-engine/xine.c8
-rw-r--r--src/xine-engine/xine_interface.c2
11 files changed, 95 insertions, 48 deletions
diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am
index 9c0ef78eb..e4c57710a 100644
--- a/src/xine-engine/Makefile.am
+++ b/src/xine-engine/Makefile.am
@@ -25,7 +25,8 @@ libxine_la_SOURCES = xine.c metronom.c configfile.c buffer.c \
video_overlay.c osd.c spu.c scratch.c demux.c vo_scale.c \
xine_interface.c post.c broadcaster.c io_helper.c \
input_rip.c input_cache.c info_helper.c refcounter.c \
- alphablend.c
+ alphablend.c \
+ load_plugins.h
libxine_la_DEPENDENCIES = $(XINEUTILS_LIB) $(XDG_BASEDIR_DEPS) \
$(pthread_dep) $(LIBXINEPOSIX)
diff --git a/src/xine-engine/alphablend.c b/src/xine-engine/alphablend.c
index c47257273..41715decb 100644
--- a/src/xine-engine/alphablend.c
+++ b/src/xine-engine/alphablend.c
@@ -1959,7 +1959,7 @@ static int xx44_paletteIndex(xx44_palette_t *p, int color, uint32_t clut)
}
if (p->max_used == p->size -1) {
- printf("video_out: Warning! Out of xx44 palette colors!\n");
+ printf("video_out: Warning! Out of xx44 palette colours!\n");
return 1;
}
p->cluts[p->max_used] = clut;
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index 39e3cd1a4..5162c1883 100644
--- a/src/xine-engine/audio_out.c
+++ b/src/xine-engine/audio_out.c
@@ -2045,8 +2045,8 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver,
int i, err;
pthread_attr_t pth_attrs;
pthread_mutexattr_t attr;
- static const char* resample_modes[] = {"auto", "off", "on", NULL};
- static const char* av_sync_methods[] = {"metronom feedback", "resample", NULL};
+ static const char *const resample_modes[] = {"auto", "off", "on", NULL};
+ static const char *const av_sync_methods[] = {"metronom feedback", "resample", NULL};
this = xine_xmalloc (sizeof (aos_t)) ;
diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c
index 71d466c3a..2157f0550 100644
--- a/src/xine-engine/broadcaster.c
+++ b/src/xine-engine/broadcaster.c
@@ -136,7 +136,7 @@ static int sock_data_write(xine_t *xine, int socket, void *buf_gen, int len) {
}
static int XINE_FORMAT_PRINTF(3, 4)
-sock_string_write(xine_t *xine, int socket, char *msg, ...) {
+sock_string_write(xine_t *xine, int socket, const char *msg, ...) {
char buf[_BUFSIZ];
va_list args;
@@ -178,7 +178,7 @@ static void broadcaster_data_write(broadcaster_t *this, void *buf, int len) {
}
static void XINE_FORMAT_PRINTF(2, 3)
-broadcaster_string_write(broadcaster_t *this, char *msg, ...) {
+broadcaster_string_write(broadcaster_t *this, const char *msg, ...) {
char buf[_BUFSIZ];
va_list args;
@@ -248,7 +248,7 @@ static void *manager_loop (void *this_gen) {
/*
* receive xine buffers and send them through the broadcaster
*/
-static void send_buf (broadcaster_t *this, char *from, buf_element_t *buf) {
+static void send_buf (broadcaster_t *this, const char *from, buf_element_t *buf) {
int i;
/* ignore END buffers since they would stop the slavery */
diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c
index 8f3f9c684..3e3c0f7b5 100644
--- a/src/xine-engine/configfile.c
+++ b/src/xine-engine/configfile.c
@@ -347,7 +347,7 @@ static void config_remove(config_values_t *this, cfg_entry_t *entry, cfg_entry_t
prev->next = entry->next;
}
-static const char *config_xlate_internal (const char *key, const xine_config_entry_translation_t *trans)
+static char *config_xlate_internal (const char *key, const xine_config_entry_translation_t *trans)
{
--trans;
while ((++trans)->old_name)
@@ -1060,7 +1060,7 @@ void xine_config_save (xine_t *xine, const char *filename) {
if (!entry->key[0])
/* deleted key */
- continue;
+ goto next;
lprintf ("saving key '%s'\n", entry->key);
@@ -1130,6 +1130,7 @@ void xine_config_save (xine_t *xine, const char *filename) {
break;
}
+ next:
entry = entry->next;
}
pthread_mutex_unlock(&this->config_lock);
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index 7a6237b79..b179a135d 100644
--- a/src/xine-engine/load_plugins.c
+++ b/src/xine-engine/load_plugins.c
@@ -42,6 +42,8 @@
#include <basedir.h>
+#include "load_plugins.h"
+
#define LOG_MODULE "load_plugins"
#define LOG_VERBOSE
@@ -1022,15 +1024,16 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) {
vo_info->visual_type = i;
} else if( !strcmp("supported_types",line) && decoder_info ) {
char *s;
+ uint32_t *supported_types;
for( s = value, i = 0; s && sscanf(s," %lu",&lu) > 0; i++ ) {
s = strchr(s+1, ' ');
}
- decoder_info->supported_types = xine_xcalloc((i+1), sizeof(uint32_t));
- for( s = value, i = 0; s && sscanf(s," %lu",&lu) > 0; i++ ) {
- decoder_info->supported_types[i] = lu;
+ supported_types = xine_xcalloc((i+1), sizeof(uint32_t));
+ for( s = value, i = 0; s && sscanf(s," %"SCNu32,&supported_types[i]) > 0; i++ ) {
s = strchr(s+1, ' ');
}
+ decoder_info->supported_types = supported_types;
} else if( !strcmp("vo_priority",line) && vo_info ) {
sscanf(value," %d",&i);
vo_info->priority = i;
@@ -1253,12 +1256,11 @@ input_plugin_t *_x_find_input_plugin (xine_stream_t *stream, const char *mrl) {
void _x_free_input_plugin (xine_stream_t *stream, input_plugin_t *input) {
plugin_catalog_t *catalog = stream->xine->plugin_catalog;
- plugin_node_t *node = input->node;
input->dispose(input);
- if (node) {
+ if (input->node) {
pthread_mutex_lock(&catalog->lock);
- dec_node_ref(node);
+ dec_node_ref(input->node);
pthread_mutex_unlock(&catalog->lock);
}
}
@@ -1475,12 +1477,11 @@ demux_plugin_t *_x_find_demux_plugin_last_probe(xine_stream_t *stream, const cha
void _x_free_demux_plugin (xine_stream_t *stream, demux_plugin_t *demux) {
plugin_catalog_t *catalog = stream->xine->plugin_catalog;
- plugin_node_t *node = demux->node;
demux->dispose(demux);
- if (node) {
+ if (demux->node) {
pthread_mutex_lock(&catalog->lock);
- dec_node_ref(node);
+ dec_node_ref(demux->node);
pthread_mutex_unlock(&catalog->lock);
}
}
@@ -1658,7 +1659,7 @@ xine_video_port_t *xine_new_framegrab_video_port (xine_t *this) {
xine_video_port_t *port;
vo_info_t *vo_info;
plugin_catalog_t *catalog = this->plugin_catalog;
- char *id;
+ const char *id;
int list_id, list_size;
driver = NULL;
@@ -1970,13 +1971,12 @@ video_decoder_t *_x_get_video_decoder (xine_stream_t *stream, uint8_t stream_typ
void _x_free_video_decoder (xine_stream_t *stream, video_decoder_t *vd) {
plugin_catalog_t *catalog = stream->xine->plugin_catalog;
- plugin_node_t *node = vd->node;
vd->dispose (vd);
- if (node) {
+ if (vd->node) {
pthread_mutex_lock (&catalog->lock);
- dec_node_ref(node);
+ dec_node_ref(vd->node);
pthread_mutex_unlock (&catalog->lock);
}
}
diff --git a/src/xine-engine/load_plugins.h b/src/xine-engine/load_plugins.h
new file mode 100644
index 000000000..7e7d3cc93
--- /dev/null
+++ b/src/xine-engine/load_plugins.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2007 the xine project
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+/**
+ * @file
+ * @brief Internal functions related to the plugin catalog.
+ *
+ * @internal This code should not be used by plugins or frontends, it's only
+ * used by the xine-engine.
+ */
+
+#ifndef __LOAD_PLUGINS_H__
+#define __LOAD_PLUGINS_H__
+
+#include <xine.h>
+
+/*
+ * load plugins into catalog
+ *
+ * all input+demux plugins will be fully loaded+initialized
+ * decoder plugins are loaded on demand
+ * video/audio output plugins have special load/probe functions
+ */
+void _x_scan_plugins (xine_t *this);
+
+
+/*
+ * dispose all currently loaded plugins (shutdown)
+ */
+
+void _x_dispose_plugins (xine_t *this);
+
+#endif
diff --git a/src/xine-engine/post.c b/src/xine-engine/post.c
index e057ff99f..651bb10f3 100644
--- a/src/xine-engine/post.c
+++ b/src/xine-engine/post.c
@@ -891,7 +891,7 @@ int _x_post_dispose(post_plugin_t *this) {
/* since the plugin loader does not know, when the plugin gets disposed,
* we have to handle the reference counter here */
pthread_mutex_lock(&this->xine->plugin_catalog->lock);
- ((plugin_node_t *)this->node)->ref--;
+ this->node->ref--;
pthread_mutex_unlock(&this->xine->plugin_catalog->lock);
return 1;
diff --git a/src/xine-engine/vo_scale.c b/src/xine-engine/vo_scale.c
index 5da5ab26e..567b3984a 100644
--- a/src/xine-engine/vo_scale.c
+++ b/src/xine-engine/vo_scale.c
@@ -311,28 +311,21 @@ void _x_vo_scale_translate_gui2video(vo_scale_t *this,
*vid_y = y;
}
-/*
- * Returns description of a given ratio code
+/*/
+ * @brief Table for description of a given ratio code.
+ *
+ * @note changing the size of the elements of the array will break
+ * ABI, so please don't do that unless you absolutely can't continue
+ * with the current size.
*/
-
-char *_x_vo_scale_aspect_ratio_name(int a) {
-
- switch (a) {
- case XINE_VO_ASPECT_AUTO:
- return "auto";
- case XINE_VO_ASPECT_SQUARE:
- return "square";
- case XINE_VO_ASPECT_4_3:
- return "4:3";
- case XINE_VO_ASPECT_ANAMORPHIC:
- return "16:9";
- case XINE_VO_ASPECT_DVB:
- return "2:1";
- default:
- return "unknown";
- }
-}
-
+const char _x_vo_scale_aspect_ratio_name_table[][8] = {
+ "auto", /* XINE_VO_ASPECT_AUTO */
+ "square", /* XINE_VO_ASPECT_SQUARE */
+ "4:3", /* XINE_VO_ASPECT_4_3 */
+ "16:9", /* XINE_VO_ASPECT_ANAMORPHIC */
+ "2:1", /* XINE_VO_ASPECT_DVB */
+ "unknown" /* All the rest */
+};
/*
* config callbacks
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index ec2dc9170..3da311dfc 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.c
@@ -79,6 +79,8 @@
# include <winsock.h>
#endif /* WIN32 */
+#include "load_plugins.h"
+
static void mutex_cleanup (void *mutex) {
pthread_mutex_unlock ((pthread_mutex_t *) mutex);
@@ -591,7 +593,7 @@ static int stream_rewire_video(xine_post_out_t *output, void *data)
return 1;
}
-void xine_dispose_internal (xine_stream_t *stream);
+static void xine_dispose_internal (xine_stream_t *stream);
xine_stream_t *xine_stream_new (xine_t *this,
xine_audio_port_t *ao, xine_video_port_t *vo) {
@@ -820,7 +822,7 @@ void _x_flush_events_queues (xine_stream_t *stream) {
pthread_mutex_unlock (&stream->event_queues_lock);
}
-/*static*/ int open_internal (xine_stream_t *stream, const char *mrl) {
+static int open_internal (xine_stream_t *stream, const char *mrl) {
const char *stream_setup = NULL;
int no_cache = 0;
@@ -1445,7 +1447,7 @@ int xine_eject (xine_stream_t *stream) {
return status;
}
-void xine_dispose_internal (xine_stream_t *stream) {
+static void xine_dispose_internal (xine_stream_t *stream) {
xine_list_iterator_t *ite;
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index 32b8663a6..c731a936f 100644
--- a/src/xine-engine/xine_interface.c
+++ b/src/xine-engine/xine_interface.c
@@ -941,7 +941,7 @@ int _x_message(xine_stream_t *stream, int type, ...) {
va_list ap;
char *s, *params;
char *args[1025];
- static const char *std_explanation[] = {
+ static const char *const std_explanation[] = {
"",
N_("Warning:"),
N_("Unknown host:"),