summaryrefslogtreecommitdiff
path: root/src/xine-engine/xine.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine/xine.c')
-rw-r--r--src/xine-engine/xine.c116
1 files changed, 69 insertions, 47 deletions
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 0c7725a0d..6ecea0236 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.93 2001/12/24 00:45:03 guenter Exp $
+ * $Id: xine.c,v 1.94 2001/12/27 14:30:30 f1rmb Exp $
*
* top-level xine functions
*
@@ -56,6 +56,26 @@
#include "xineutils.h"
#include "compat.h"
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_MSG, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_MSG, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_MSG, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_MSG, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
void * xine_notify_stream_finished_thread (void * this_gen) {
xine_t *this = this_gen;
xine_event_t event;
@@ -84,8 +104,8 @@ void xine_notify_stream_finished (xine_t *this) {
*/
if ((err = pthread_create (&finished_thread,
NULL, xine_notify_stream_finished_thread, this)) != 0) {
- fprintf (stderr, "xine_notify_stream_finished: can't create new thread (%s)\n",
- strerror(err));
+ LOG_MSG_STDERR(this, _("xine_notify_stream_finished: can't create new thread (%s)\n"),
+ strerror(err));
exit (1);
}
}
@@ -126,12 +146,12 @@ void xine_stop_internal (xine_t *this) {
pthread_mutex_lock (&this->xine_lock);
- printf ("xine_stop\n");
+ LOG_MSG(this, _("xine_stop\n"));
xine_internal_osd (this, "}", this->metronom->get_current_time (this->metronom), 30000);
if (this->status == XINE_STOP) {
- printf ("xine_stop ignored\n");
+ LOG_MSG(this, _("xine_stop ignored\n"));
pthread_mutex_unlock (&this->xine_lock);
return;
}
@@ -144,7 +164,7 @@ void xine_stop_internal (xine_t *this) {
this->audio_out->audio_paused = 0;
this->status = XINE_STOP;
- printf ("xine_stop: stopping demuxer\n");
+ LOG_MSG(this, _("xine_stop: stopping demuxer\n"));
if(this->cur_demuxer_plugin) {
this->cur_demuxer_plugin->stop (this->cur_demuxer_plugin);
@@ -161,7 +181,7 @@ void xine_stop_internal (xine_t *this) {
*/
}
- printf ("xine_stop: done\n");
+ LOG_MSG(this, _("xine_stop: done\n"));
pthread_mutex_unlock (&this->xine_lock);
}
@@ -192,8 +212,8 @@ static int try_demux_with_stages(xine_t *this, const char *MRL,
stages[2] = -1;
if(stages[0] == -1) {
- fprintf(stderr, "%s(%d) wrong first stage = %d !!\n",
- __XINE_FUNCTION__, __LINE__, stage1);
+ LOG_MSG_STDERR(this, _("%s(%d) wrong first stage = %d !!\n"),
+ __XINE_FUNCTION__, __LINE__, stage1);
return 0;
}
@@ -255,12 +275,8 @@ int xine_play (xine_t *this, char *mrl,
off_t pos, len;
int i;
- printf ("xine_play: xine open %s, start pos = %d, start time = %d (sec)\n",
- mrl, start_pos, start_time);
-
- xine_log (this, XINE_LOG_MSG,
- "xine_play: xine open %s, start pos = %d, start time = %d (sec)\n",
- mrl, start_pos, start_time);
+ LOG_MSG(this, _("xine_play: xine open %s, start pos = %d, start time = %d (sec)\n"),
+ mrl, start_pos, start_time);
pthread_mutex_lock (&this->xine_lock);
@@ -304,7 +320,7 @@ int xine_play (xine_t *this, char *mrl,
}
if (!this->cur_input_plugin) {
- printf ("xine: cannot find input plugin for this MRL\n");
+ LOG_MSG(this, _("xine: cannot find input plugin for this MRL\n"));
this->cur_demuxer_plugin = NULL;
this->err = XINE_ERROR_NO_INPUT_PLUGIN;
pthread_mutex_unlock (&this->xine_lock);
@@ -312,28 +328,21 @@ int xine_play (xine_t *this, char *mrl,
return 0;
}
- xine_log (this, XINE_LOG_MSG,
- "xine: using input plugin >%s< for this MRL (%s).\n",
- this->cur_input_plugin->get_identifier(this->cur_input_plugin), mrl);
- printf ("xine: using input plugin >%s< for this MRL (%s).\n",
- this->cur_input_plugin->get_identifier(this->cur_input_plugin), mrl);
+ LOG_MSG(this, _("xine: using input plugin >%s< for this MRL (%s).\n"),
+ this->cur_input_plugin->get_identifier(this->cur_input_plugin), mrl);
/*
* find demuxer plugin
*/
if (!find_demuxer(this, mrl)) {
- printf ("xine: couldn't find demuxer for >%s<\n", mrl);
+ LOG_MSG(this, _("xine: couldn't find demuxer for >%s<\n"), mrl);
this->err = XINE_ERROR_NO_DEMUXER_PLUGIN;
pthread_mutex_unlock (&this->xine_lock);
return 0;
}
- xine_log (this, XINE_LOG_MSG,
- "xine: using demuxer plugin >%s< for this MRL.\n",
- this->cur_demuxer_plugin->get_identifier());
-
- printf ("xine: using demuxer plugin >%s< for this MRL.\n",
+ LOG_MSG(this, _("xine: using demuxer plugin >%s< for this MRL.\n"),
this->cur_demuxer_plugin->get_identifier());
/*
@@ -353,7 +362,7 @@ int xine_play (xine_t *this, char *mrl,
pos, start_time);
if (this->cur_demuxer_plugin->get_status(this->cur_demuxer_plugin) != DEMUX_OK) {
- printf("xine_play: demuxer failed to start\n");
+ LOG_MSG(this, _("xine_play: demuxer failed to start\n"));
this->cur_input_plugin->close(this->cur_input_plugin);
@@ -402,17 +411,17 @@ void xine_exit (xine_t *this) {
xine_stop(this);
- printf ("xine_exit: shutdown audio\n");
+ LOG_MSG(this, _("xine_exit: shutdown audio\n"));
audio_decoder_shutdown (this);
- printf ("xine_exit: shutdown video\n");
+ LOG_MSG(this, _("xine_exit: shutdown video\n"));
video_decoder_shutdown (this);
this->status = XINE_QUIT;
- printf ("xine_exit: bye!\n");
+ LOG_MSG(this, _("xine_exit: bye!\n"));
xine_profiler_print_results ();
@@ -427,21 +436,25 @@ xine_t *xine_init (vo_driver_t *vo,
"extension", NULL};
int i;
- printf("xine_init entered\n");
+ /* init log buffers */
+ for (i = 0; i < XINE_LOG_NUM; i++)
+ this->log_buffers[i] = new_scratch_buffer (25);
+
+#ifdef ENABLE_NLS
+ bindtextdomain("xine-lib", XINE_LOCALEDIR);
+#endif
+ LOG_MSG(this, _("xine_init entered\n"));
+
this->err = XINE_ERROR_NONE;
this->config = config;
+
/* probe for optimized memcpy or config setting */
xine_probe_fast_memcpy(config);
/* initialize aligned mem allocator */
xine_init_mem_aligned();
- /* init log buffers */
-
- for (i=0; i<XINE_LOG_NUM; i++)
- this->log_buffers[i] = new_scratch_buffer (25);
-
/*
* init locks
*/
@@ -462,7 +475,7 @@ xine_t *xine_init (vo_driver_t *vo,
* create a metronom
*/
- this->metronom = metronom_init (ao != NULL);
+ this->metronom = metronom_init (ao != NULL, (void *)this);
/*
* load input and demuxer plugins
@@ -504,7 +517,7 @@ xine_t *xine_init (vo_driver_t *vo,
this->audio_out = ao_new_instance (ao, this->metronom, config);
audio_decoder_init (this);
- printf("xine_init returning\n");
+ LOG_MSG(this, _("xine_init returning\n"));
return this;
}
@@ -545,7 +558,7 @@ int xine_get_current_position (xine_t *this) {
pthread_mutex_lock (&this->xine_lock);
if (!this->cur_input_plugin) {
- printf ("xine: xine_get_current_position: no input source\n");
+ LOG_MSG(this, _("xine: xine_get_current_position: no input source\n"));
pthread_mutex_unlock (&this->xine_lock);
return 0;
}
@@ -666,7 +679,7 @@ void xine_set_speed (xine_t *this, int speed) {
nanosleep (&tenth_sec, NULL);
- printf ("xine: set_speed %d\n", speed);
+ LOG_MSG(this, _("xine: set_speed %d\n"), speed);
this->metronom->set_speed (this->metronom, speed);
@@ -819,13 +832,22 @@ osd_renderer_t *xine_get_osd_renderer (xine_t *this) {
/*
* log functions
*/
-const char **xine_get_log_names(void) {
- static const char *log_sections[XINE_LOG_NUM + 1] = {
- "messages", /* XINE_LOG_MSG */
- "codecs", /* XINE_LOG_CODEC */
- NULL
- };
+unsigned int xine_get_log_section_count(void) {
+ return XINE_LOG_NUM;
+}
+const char **xine_get_log_names(void) {
+ static const char *log_sections[XINE_LOG_NUM + 1];
+
+ log_sections[XINE_LOG_MSG] = _("messages"); /* XINE_LOG_MSG */
+ log_sections[XINE_LOG_INPUT] = _("inputs"); /* XINE_LOG_INPUT */
+ log_sections[XINE_LOG_DEMUX] = _("demuxers"); /* XINE_LOG_DEMUX */
+ log_sections[XINE_LOG_CODEC] = _("codecs"); /* XINE_LOG_CODEC */
+ log_sections[XINE_LOG_VIDEO] = _("video"); /* XINE_LOG_VIDEO */
+ log_sections[XINE_LOG_METRONOM] = _("metronom"); /* XINE_LOG_METRONOM */
+ log_sections[XINE_LOG_PLUGIN] = _("plugin"); /* XINE_LOG_PLUGIN */
+ log_sections[XINE_LOG_NUM] = NULL;
+
return log_sections;
}