summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/Makefile.am10
-rw-r--r--src/xine-engine/load_plugins.c73
-rw-r--r--src/xine-engine/metronom.c87
-rw-r--r--src/xine-engine/metronom.h10
-rw-r--r--src/xine-engine/resample.c4
-rw-r--r--src/xine-engine/video_out.c50
-rw-r--r--src/xine-engine/xine.c116
-rw-r--r--src/xine-engine/xine_internal.h14
-rw-r--r--src/xine-engine/xineintl.h56
9 files changed, 286 insertions, 134 deletions
diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am
index e52733df0..e9628af2b 100644
--- a/src/xine-engine/Makefile.am
+++ b/src/xine-engine/Makefile.am
@@ -10,8 +10,9 @@ lib_LTLIBRARIES = libxine.la
libxine_la_SOURCES = xine.c metronom.c configfile.c buffer.c \
load_plugins.c video_decoder.c buffer_types.c \
audio_decoder.c video_out.c audio_out.c resample.c events.c lrb.c \
- video_overlay.c osd.c scratch.c
-libxine_la_LIBADD = $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) -lm -lz
+ video_overlay.c osd.c scratch.c locale.c
+libxine_la_DEPENDENCIES = @INTLLIBS@
+libxine_la_LIBADD = $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) @INTLLIBS@ -lm -lz
libxine_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
@@ -19,10 +20,13 @@ libxine_la_LDFLAGS = \
include_HEADERS = buffer.h metronom.h configfile.h \
audio_out.h resample.h video_out.h xine_internal.h spu_decoder.h \
- events.h lrb.h video_overlay.h osd.h scratch.h
+ events.h lrb.h video_overlay.h osd.h scratch.h xineintl.h
noinst_HEADERS = bswap.h
+@INCLUDED_INTL_TRUE@@INTLLIBS@:
+@INCLUDED_INTL_TRUE@ @cd $(top_builddir)/intl && $(MAKE) libintl.la
+
debug:
@$(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index 488911e6d..49f177af4 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.62 2001/12/21 23:34:07 f1rmb Exp $
+ * $Id: load_plugins.c,v 1.63 2001/12/27 14:30:30 f1rmb Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -51,6 +51,26 @@
#define LOAD_LOG
*/
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_PLUGIN, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_PLUGIN, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_PLUGIN, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_PLUGIN, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
/* transition code; between xine 0.9.7 and 0.9.8, the dxr3enc driver
* was integrated in the dxr3 driver and no longer exists as a seperate
* plugin. upgraded installs may have an old dxr3enc driver left in the
@@ -98,8 +118,8 @@ void load_demux_plugins (xine_t *this,
DIR *dir;
if(this == NULL || config == NULL) {
- printf("%s(%s@%d): parameter should be non null, exiting\n",
- __FILE__, __XINE_FUNCTION__, __LINE__);
+ LOG_MSG(this, _("%s(%s@%d): parameter should be non null, exiting\n"),
+ __FILE__, __XINE_FUNCTION__, __LINE__);
exit(1);
}
@@ -133,7 +153,7 @@ void load_demux_plugins (xine_t *this,
plugin_name = str;
if(!(plugin = dlopen (str, RTLD_LAZY))) {
- printf ("load_plugins: cannot open demux plugin %s:\n%s\n",
+ LOG_MSG(this, _("load_plugins: cannot open demux plugin %s:\n%s\n"),
str, dlerror());
} else {
@@ -147,15 +167,15 @@ void load_demux_plugins (xine_t *this,
if (dxp) {
this->demuxer_plugins[this->num_demuxer_plugins] = dxp;
- printf("load_plugins: demux plugin found : %s\n",
- this->demuxer_plugins[this->num_demuxer_plugins]->get_identifier());
+ LOG_MSG(this, _("load_plugins: demux plugin found : %s\n"),
+ this->demuxer_plugins[this->num_demuxer_plugins]->get_identifier());
this->num_demuxer_plugins++;
}
}
if(this->num_demuxer_plugins > DEMUXER_PLUGIN_MAX) {
- printf ("load_plugins: too many demux plugins installed, exiting.\n");
+ LOG_MSG(this, _("load_plugins: too many demux plugins installed, exiting.\n"));
exit(1);
}
}
@@ -291,8 +311,8 @@ void load_input_plugins (xine_t *this,
plugin_name = str;
if(!(plugin = dlopen (str, RTLD_LAZY))) {
- printf("load_plugins: cannot open input plugin %s:\n%s\n",
- str, dlerror());
+ LOG_MSG(this, _("load_plugins: cannot open input plugin %s:\n%s\n"),
+ str, dlerror());
} else {
void *(*initplug) (int, xine_t *);
@@ -303,19 +323,19 @@ void load_input_plugins (xine_t *this,
if (ip) {
this->input_plugins[this->num_input_plugins] = ip;
- printf("load_plugins: input plugin found : %s\n",
- this->input_plugins[this->num_input_plugins]->get_identifier(this->input_plugins[this->num_input_plugins]));
+ LOG_MSG(this, _("load_plugins: input plugin found : %s\n"),
+ this->input_plugins[this->num_input_plugins]->get_identifier(this->input_plugins[this->num_input_plugins]));
this->num_input_plugins++;
}
} else {
- printf ("load_plugins: %s is no valid input plugin (lacks init_input_plugin() function)\n", str);
+ LOG_MSG(this, _("load_plugins: %s is no valid input plugin (lacks init_input_plugin() function)\n"), str);
}
if(this->num_input_plugins > INPUT_PLUGIN_MAX) {
- fprintf(stderr, "%s(%d): too many input plugins installed, "
- "exiting.\n", __FILE__, __LINE__);
+ LOG_MSG_STDERR(this, _("%s(%d): too many input plugins installed, "
+ "exiting.\n"), __FILE__, __LINE__);
exit(1);
}
}
@@ -327,8 +347,8 @@ void load_input_plugins (xine_t *this,
remove_segv_handler();
if (this->num_input_plugins == 0) {
- fprintf (stderr, "load_plugins: no input plugins found in %s! - "
- "Did you install xine correctly??\n", XINE_PLUGINDIR);
+ LOG_MSG_STDERR(this, _("load_plugins: no input plugins found in %s! - "
+ "Did you install xine correctly??\n"), XINE_PLUGINDIR);
exit (1);
}
@@ -446,8 +466,8 @@ void load_decoder_plugins (xine_t *this,
if(this == NULL || config == NULL) {
- printf("%s(%s@%d): parameter should be non null, exiting\n",
- __FILE__, __XINE_FUNCTION__, __LINE__);
+ LOG_MSG(this, _("%s(%s@%d): parameter should be non null, exiting\n"),
+ __FILE__, __XINE_FUNCTION__, __LINE__);
exit(1);
}
@@ -506,7 +526,7 @@ void load_decoder_plugins (xine_t *this,
if(!(plugin = dlopen (str, RTLD_LAZY))) {
- printf ("load_plugins: failed to load plugin %s:\n%s\n",
+ LOG_MSG(this, _("load_plugins: failed to load plugin %s:\n%s\n"),
str, dlerror());
} else {
@@ -534,8 +554,8 @@ void load_decoder_plugins (xine_t *this,
spu_prio[streamtype] = plugin_prio;
}
- printf("spu decoder plugin found : %s\n",
- sdp->get_identifier());
+ LOG_MSG(this, _("spu decoder plugin found : %s\n"),
+ sdp->get_identifier());
}
}
}
@@ -562,8 +582,8 @@ void load_decoder_plugins (xine_t *this,
video_prio[streamtype] = plugin_prio;
}
- printf("video decoder plugin found : %s\n",
- vdp->get_identifier());
+ LOG_MSG(this, _("video decoder plugin found : %s\n"),
+ vdp->get_identifier());
}
}
@@ -586,8 +606,8 @@ void load_decoder_plugins (xine_t *this,
audio_prio[streamtype] = plugin_prio;
}
- printf("audio decoder plugin found : %s\n",
- adp->get_identifier());
+ LOG_MSG(this, _("audio decoder plugin found : %s\n"),
+ adp->get_identifier());
}
}
@@ -939,8 +959,7 @@ char **xine_list_audio_output_plugins(void) {
return plugin_ids;
}
-ao_driver_t *xine_load_audio_output_plugin(config_values_t *config,
- char *id) {
+ao_driver_t *xine_load_audio_output_plugin(config_values_t *config, char *id) {
DIR *dir;
ao_driver_t *aod = NULL;
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c
index 695b47cfa..6f801eb09 100644
--- a/src/xine-engine/metronom.c
+++ b/src/xine-engine/metronom.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: metronom.c,v 1.45 2001/12/25 14:39:01 miguelfreitas Exp $
+ * $Id: metronom.c,v 1.46 2001/12/27 14:30:30 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -49,6 +49,26 @@
#define MAX_SCR_PROVIDERS 10
#define PREBUFFER_PTS_OFFSET 30000
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log((xine_t*)xine, XINE_LOG_METRONOM, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log((xine_t*)xine, XINE_LOG_METRONOM, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log((xine_t*)xine, XINE_LOG_METRONOM, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log((xine_t*)xine, XINE_LOG_METRONOM, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
/*
#define METRONOM_LOG
*/
@@ -233,10 +253,10 @@ static void metronom_video_stream_start (metronom_t *this) {
pthread_mutex_lock (&this->lock);
- printf ("metronom: video stream start...\n");
+ LOG_MSG(this->xine, _("metronom: video stream start...\n"));
if (this->video_stream_running) {
- printf ("metronom: video stream start ignored\n");
+ LOG_MSG(this->xine, _("metronom: video stream start ignored\n"));
pthread_mutex_unlock (&this->lock);
return;
}
@@ -263,7 +283,7 @@ static void metronom_video_stream_start (metronom_t *this) {
if (this->have_audio) {
/*while (!this->audio_stream_running) {*/
if (!this->audio_stream_running) {
- printf ("metronom: waiting for audio to start...\n");
+ LOG_MSG(this->xine, _("metronom: waiting for audio to start...\n"));
pthread_cond_wait (&this->audio_started, &this->lock);
}
}
@@ -279,10 +299,10 @@ static void metronom_video_stream_end (metronom_t *this) {
pthread_mutex_lock (&this->lock);
- printf ("metronom: video stream end\n");
+ LOG_MSG(this->xine, _("metronom: video stream end\n"));
if (!this->video_stream_running) {
- printf ("metronom: video stream end ignored\n");
+ LOG_MSG(this->xine, _("metronom: video stream end ignored\n"));
pthread_mutex_unlock (&this->lock);
return;
}
@@ -292,7 +312,7 @@ static void metronom_video_stream_end (metronom_t *this) {
if (this->have_audio) {
/* while (this->audio_stream_running) { */
if (this->audio_stream_running) {
- printf ("metronom: waiting for audio to end...\n");
+ LOG_MSG(this->xine, _("metronom: waiting for audio to end...\n"));
pthread_cond_wait (&this->audio_ended, &this->lock);
}
}
@@ -306,10 +326,10 @@ static void metronom_audio_stream_start (metronom_t *this) {
pthread_mutex_lock (&this->lock);
- printf ("metronom: audio stream start...\n");
+ LOG_MSG(this->xine, _("metronom: audio stream start...\n"));
if (this->audio_stream_running) {
- printf ("metronom: audio stream start ignored\n");
+ LOG_MSG(this->xine, _("metronom: audio stream start ignored\n"));
pthread_mutex_unlock (&this->lock);
return;
}
@@ -334,7 +354,7 @@ static void metronom_audio_stream_start (metronom_t *this) {
/*while (!this->video_stream_running) { */
if (!this->video_stream_running) {
- printf ("metronom: waiting for video to start...\n");
+ LOG_MSG(this->xine, _("metronom: waiting for video to start...\n"));
pthread_cond_wait (&this->video_started, &this->lock);
}
@@ -342,7 +362,7 @@ static void metronom_audio_stream_start (metronom_t *this) {
pthread_mutex_unlock (&this->lock);
- printf ("metronom: audio stream start...done\n");
+ LOG_MSG(this->xine, _("metronom: audio stream start...done\n"));
metronom_start_clock (this, 0);
}
@@ -351,9 +371,9 @@ static void metronom_audio_stream_end (metronom_t *this) {
pthread_mutex_lock (&this->lock);
- printf ("metronom: audio stream end\n");
+ LOG_MSG(this->xine, _("metronom: audio stream end\n"));
if (!this->audio_stream_running) {
- printf ("metronom: audio stream end ignored\n");
+ LOG_MSG(this->xine, _("metronom: audio stream end ignored\n"));
pthread_mutex_unlock (&this->lock);
return;
}
@@ -362,7 +382,7 @@ static void metronom_audio_stream_end (metronom_t *this) {
/* while (this->video_stream_running) { */
if (this->video_stream_running) {
- printf ("metronom: waiting for video to end...\n");
+ LOG_MSG(this->xine, _("metronom: waiting for video to end...\n"));
pthread_cond_wait (&this->video_ended, &this->lock);
}
@@ -445,14 +465,14 @@ static void metronom_expect_video_discontinuity (metronom_t *this) {
this->video_discontinuity_count++;
pthread_cond_signal (&this->video_discontinuity_reached);
- printf ("metronom: video discontinuity #%d\n",
+ LOG_MSG(this->xine, _("metronom: video discontinuity #%d\n"),
this->video_discontinuity_count);
if( this->have_audio ) {
while ( this->audio_discontinuity_count <
this->video_discontinuity_count ) {
- printf ("metronom: waiting for audio discontinuity #%d\n",
+ LOG_MSG(this->xine, _("metronom: waiting for audio discontinuity #%d\n"),
this->video_discontinuity_count);
pthread_cond_wait (&this->audio_discontinuity_reached, &this->lock);
@@ -460,7 +480,7 @@ static void metronom_expect_video_discontinuity (metronom_t *this) {
if ( this->video_vpts < this->audio_vpts ) {
this->video_vpts = this->audio_vpts;
- printf("metronom: video vpts adjusted to %d\n", this->video_vpts);
+ LOG_MSG(this->xine, _("metronom: video vpts adjusted to %d\n"), this->video_vpts);
}
}
@@ -515,7 +535,7 @@ static uint32_t metronom_got_video_frame (metronom_t *this, uint32_t pts, uint32
vpts = pts + this->video_wrap_offset;
- printf ("metronom: video pts discontinuity/start, pts is %d, wrap_offset is %d, vpts is %d\n",
+ LOG_MSG(this->xine, _("metronom: video pts discontinuity/start, pts is %d, wrap_offset is %d, vpts is %d\n"),
pts, this->video_wrap_offset, vpts);
} else {
@@ -530,7 +550,7 @@ static uint32_t metronom_got_video_frame (metronom_t *this, uint32_t pts, uint32
if (this->wrap_diff_counter > MAX_NUM_WRAP_DIFF) {
- printf ("metronom: forcing video_wrap (%d) and audio wrap (%d)",
+ LOG_MSG(this->xine, _("metronom: forcing video_wrap (%d) and audio wrap (%d)"),
this->video_wrap_offset, this->audio_wrap_offset);
if (this->video_wrap_offset > this->audio_wrap_offset)
@@ -538,7 +558,7 @@ static uint32_t metronom_got_video_frame (metronom_t *this, uint32_t pts, uint32
else
this->video_wrap_offset = this->audio_wrap_offset;
- printf (" to %d\n", this->video_wrap_offset);
+ LOG_MSG(this->xine, _(" to %d\n"), this->video_wrap_offset);
this->wrap_diff_counter = 0;
}
@@ -602,7 +622,7 @@ static uint32_t metronom_got_video_frame (metronom_t *this, uint32_t pts, uint32
this->video_vpts = pts + this->video_wrap_offset;
- printf ("metronom: delta too big, setting vpts to %d\n",
+ LOG_MSG(this->xine, _("metronom: delta too big, setting vpts to %d\n"),
this->video_vpts);
@@ -645,20 +665,21 @@ static void metronom_expect_audio_discontinuity (metronom_t *this) {
this->audio_discontinuity_count++;
pthread_cond_signal (&this->audio_discontinuity_reached);
- printf ("metronom: audio discontinuity #%d\n",
+ LOG_MSG(this->xine, _("metronom: audio discontinuity #%d\n"),
this->audio_discontinuity_count);
while ( this->audio_discontinuity_count >
this->video_discontinuity_count ) {
- printf ("metronom: waiting for video_discontinuity #%d\n", this->audio_discontinuity_count);
+ LOG_MSG(this->xine, _("metronom: waiting for video_discontinuity #%d\n"),
+ this->audio_discontinuity_count);
pthread_cond_wait (&this->video_discontinuity_reached, &this->lock);
}
if ( this->audio_vpts < this->video_vpts ) {
this->audio_vpts = this->video_vpts;
- printf("metronom: audio vpts adjusted to %d\n", this->audio_vpts);
+ LOG_MSG(this->xine, _("metronom: audio vpts adjusted to %d\n"), this->audio_vpts);
}
/* this->num_audio_samples_guessed = 1; */
@@ -701,7 +722,7 @@ static uint32_t metronom_got_audio_samples (metronom_t *this, uint32_t pts,
vpts = pts + this->audio_wrap_offset;
- printf ("metronom: audio pts discontinuity/start, pts is %d, wrap_offset is %d, vpts is %d\n",
+ LOG_MSG(this->xine, _("metronom: audio pts discontinuity/start, pts is %d, wrap_offset is %d, vpts is %d\n"),
pts, this->audio_wrap_offset, vpts);
@@ -718,7 +739,7 @@ static uint32_t metronom_got_audio_samples (metronom_t *this, uint32_t pts,
if (this->wrap_diff_counter > MAX_NUM_WRAP_DIFF) {
- printf ("metronom: forcing video_wrap (%d) and audio wrap (%d)",
+ LOG_MSG(this->xine, _("metronom: forcing video_wrap (%d) and audio wrap (%d)"),
this->video_wrap_offset, this->audio_wrap_offset);
if (this->video_wrap_offset > this->audio_wrap_offset)
@@ -726,7 +747,7 @@ static uint32_t metronom_got_audio_samples (metronom_t *this, uint32_t pts,
else
this->video_wrap_offset = this->audio_wrap_offset;
- printf ("to %d\n", this->video_wrap_offset);
+ LOG_MSG(this->xine, _("to %d\n"), this->video_wrap_offset);
this->wrap_diff_counter = 0;
}
@@ -776,7 +797,7 @@ static void metronom_set_av_offset (metronom_t *this, int32_t pts) {
pthread_mutex_unlock (&this->lock);
- printf ("metronom: av_offset=%d pts\n", pts);
+ LOG_MSG(this->xine, _("metronom: av_offset=%d pts\n"), pts);
}
static int32_t metronom_get_av_offset (metronom_t *this) {
@@ -796,7 +817,7 @@ static scr_plugin_t* get_master_scr(metronom_t *this) {
}
}
if (select < 0) {
- printf("metronom: panic - no scr provider found!\n");
+ LOG_MSG(this->xine, _("metronom: panic - no scr provider found!\n"));
return NULL;
}
return this->scr_list[select];
@@ -847,11 +868,12 @@ static int metronom_sync_loop (metronom_t *this) {
}
-metronom_t * metronom_init (int have_audio) {
+metronom_t * metronom_init (int have_audio, void *xine) {
metronom_t *this = xine_xmalloc (sizeof (metronom_t));
int err;
+ this->xine = xine;
this->audio_stream_start = metronom_audio_stream_start;
this->audio_stream_end = metronom_audio_stream_end ;
this->video_stream_start = metronom_video_stream_start;
@@ -880,8 +902,8 @@ metronom_t * metronom_init (int have_audio) {
if ((err = pthread_create(&this->sync_thread, NULL,
(void*(*)(void*)) metronom_sync_loop, this)) != 0)
- printf("metronom: cannot create sync thread (%s)\n",
- strerror(err));
+ LOG_MSG(this->xine, _("metronom: cannot create sync thread (%s)\n"),
+ strerror(err));
pthread_mutex_init (&this->lock, NULL);
pthread_cond_init (&this->video_started, NULL);
@@ -896,4 +918,3 @@ metronom_t * metronom_init (int have_audio) {
return this;
}
-
diff --git a/src/xine-engine/metronom.h b/src/xine-engine/metronom.h
index 1fc00c240..18dd2ca8e 100644
--- a/src/xine-engine/metronom.h
+++ b/src/xine-engine/metronom.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: metronom.h,v 1.15 2001/12/22 20:16:49 miguelfreitas Exp $
+ * $Id: metronom.h,v 1.16 2001/12/27 14:30:30 f1rmb Exp $
*
* metronom: general pts => virtual calculation/assoc
*
@@ -57,6 +57,12 @@ typedef struct scr_plugin_s scr_plugin_t;
struct metronom_s {
/*
+ * Pointer to current xine object. We use a void pointer to avoid type declaration clash.
+ * Ugly but working.
+ */
+ void *xine;
+
+ /*
* this is called to tell metronom to prepare for a new video stream
* (video and audio decoder threads may be blocked at these functions
* to synchronize starting and stopping)
@@ -272,7 +278,7 @@ struct metronom_s {
int avg_frame_duration;
};
-metronom_t *metronom_init (int have_audio);
+metronom_t *metronom_init (int have_audio, void *xine);
/*
* SCR plugins
diff --git a/src/xine-engine/resample.c b/src/xine-engine/resample.c
index 8da9897a7..4b363735c 100644
--- a/src/xine-engine/resample.c
+++ b/src/xine-engine/resample.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: resample.c,v 1.1 2001/08/21 19:48:48 jcdutton Exp $
+ * $Id: resample.c,v 1.2 2001/12/27 14:30:30 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -278,5 +278,3 @@ void audio_out_resample_6channel(int16_t* input_samples, uint32_t in_samples,
output_samples[out_samples*6-2] = input_samples[in_samples*6-2];
output_samples[out_samples*6-1] = input_samples[in_samples*6-1];
}
-
-
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index 15c54ad7b..a32ce6f88 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.60 2001/12/24 16:31:57 hrm Exp $
+ * $Id: video_out.c,v 1.61 2001/12/27 14:30:30 f1rmb Exp $
*
*/
@@ -36,6 +36,26 @@
#include "xine_internal.h"
#include "xineutils.h"
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_VIDEO, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_VIDEO, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_VIDEO, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_VIDEO, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
/*
#define VIDEO_OUT_LOG
*/
@@ -186,7 +206,7 @@ static void *video_out_loop (void *this_gen) {
sigemptyset(&vo_mask);
sigaddset(&vo_mask, SIGALRM);
if (sigprocmask (SIG_UNBLOCK, &vo_mask, NULL)) {
- printf ("video_out: sigprocmask failed.\n");
+ LOG_MSG(this->xine, _("video_out: sigprocmask failed.\n"));
}
#if HAVE_SIGACTION
{
@@ -248,9 +268,9 @@ static void *video_out_loop (void *this_gen) {
absdiff = abs(diff);
if (diff >this->pts_per_half_frame) {
- printf ( "video_out : throwing away image with pts %d because "
- "it's too old (diff : %d > %d).\n",pts,diff,
- this->pts_per_half_frame);
+ LOG_MSG(this->xine, _("video_out : throwing away image with pts %d because "
+ "it's too old (diff : %d > %d).\n"),
+ pts, diff, this->pts_per_half_frame);
this->num_frames_discarded++;
@@ -387,7 +407,7 @@ static void *video_out_loop (void *this_gen) {
if (img && !img->next) {
if (img_backup) {
- printf("video_out : overwriting frame backup\n");
+ LOG_MSG(this->xine, _("video_out : overwriting frame backup\n"));
vo_append_to_img_buf_queue (this->free_img_buf_queue, img_backup);
}
@@ -491,15 +511,15 @@ static void vo_open (vo_instance_t *this) {
if((err = pthread_create (&this->video_thread,
&pth_attrs, video_out_loop, this)) != 0) {
- printf ("video_out : can't create thread (%s)\n", strerror(err));
+ LOG_MSG(this->xine, _("video_out : can't create thread (%s)\n"), strerror(err));
/* FIXME: how does this happen ? */
- printf ("video_out : sorry, this should not happen. please restart xine.\n");
+ LOG_MSG(this->xine, _("video_out : sorry, this should not happen. please restart xine.\n"));
exit(1);
}
else
- printf ("video_out : thread created\n");
+ LOG_MSG(this->xine, _("video_out : thread created\n"));
} else
- printf ("video_out : vo_open : warning! video thread already running\n");
+ LOG_MSG(this->xine, _("video_out : vo_open : warning! video thread already running\n"));
}
@@ -696,7 +716,7 @@ static int vo_frame_draw (vo_frame_t *img) {
#endif
if (img->display_locked) {
- printf ("video_out : ALERT! frame is already locked for displaying\n");
+ LOG_MSG(this->xine, _("video_out : ALERT! frame is already locked for displaying\n"));
return frames_to_skip;
}
@@ -709,7 +729,7 @@ static int vo_frame_draw (vo_frame_t *img) {
printf ("video_out : frame rejected, %d frames to skip\n", frames_to_skip);
#endif
- printf ("vo_frame_draw: rejected, %d frames to skip\n", frames_to_skip);
+ LOG_MSG(this->xine, _("vo_frame_draw: rejected, %d frames to skip\n"), frames_to_skip);
pthread_mutex_lock (&img->mutex);
img->display_locked = 0;
@@ -756,9 +776,9 @@ static int vo_frame_draw (vo_frame_t *img) {
*/
if (this->num_frames_delivered>199) {
- fprintf (stderr,
- "%d frames delivered, %d frames skipped, %d frames discarded\n",
- this->num_frames_delivered, this->num_frames_skipped, this->num_frames_discarded);
+ LOG_MSG_STDERR(this->xine,
+ _("%d frames delivered, %d frames skipped, %d frames discarded\n"),
+ this->num_frames_delivered, this->num_frames_skipped, this->num_frames_discarded);
this->num_frames_delivered = 0;
this->num_frames_discarded = 0;
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;
}
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 9421ed650..a4f960136 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.66 2001/12/24 00:45:03 guenter Exp $
+ * $Id: xine_internal.h,v 1.67 2001/12/27 14:30:30 f1rmb Exp $
*
*/
@@ -50,6 +50,7 @@ extern "C" {
#endif
#include "osd.h"
#include "scratch.h"
+#include "xineintl.h"
#define INPUT_PLUGIN_MAX 50
#define DEMUXER_PLUGIN_MAX 50
@@ -137,9 +138,14 @@ struct audio_decoder_s {
/*
* log output
*/
-#define XINE_LOG_MSG 0
-#define XINE_LOG_CODEC 1
-#define XINE_LOG_NUM 2 /* # of log buffers defined */
+#define XINE_LOG_MSG 0
+#define XINE_LOG_INPUT 1
+#define XINE_LOG_DEMUX 2
+#define XINE_LOG_CODEC 3
+#define XINE_LOG_VIDEO 4
+#define XINE_LOG_METRONOM 5
+#define XINE_LOG_PLUGIN 6
+#define XINE_LOG_NUM 7 /* # of log buffers defined */
typedef void (*xine_event_listener_t) (void *user_data, xine_event_t *);
diff --git a/src/xine-engine/xineintl.h b/src/xine-engine/xineintl.h
new file mode 100644
index 000000000..a2b1fcdd7
--- /dev/null
+++ b/src/xine-engine/xineintl.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine, a unix 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * $Id: xineintl.h,v 1.1 2001/12/27 14:30:30 f1rmb Exp $
+ *
+ */
+
+#ifndef HAVE_XINEINTL_H
+#define HAVE_XINEINTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <locale.h>
+
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# define _(String) dgettext ("xine-lib", String)
+# ifdef gettext_noop
+# define N_(String) gettext_noop (String)
+# else
+# define N_(String) (String)
+# endif
+#else
+/* Stubs that do something close enough. */
+# define textdomain(String) (String)
+# define gettext(String) (String)
+# define dgettext(Domain,Message) (Message)
+# define dcgettext(Domain,Message,Type) (Message)
+# define bindtextdomain(Domain,Directory) (Domain)
+# define _(String) (String)
+# define N_(String) (String)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif