summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_asf.c91
-rw-r--r--src/demuxers/demux_avi.c71
-rw-r--r--src/demuxers/demux_cda.c36
-rw-r--r--src/demuxers/demux_elem.c38
-rw-r--r--src/demuxers/demux_mpeg.c51
-rw-r--r--src/demuxers/demux_mpeg_block.c61
-rw-r--r--src/demuxers/demux_mpgaudio.c43
-rw-r--r--src/demuxers/demux_ogg.c49
-rw-r--r--src/demuxers/demux_pes.c45
-rw-r--r--src/demuxers/demux_qt.c74
-rw-r--r--src/demuxers/demux_ts.c247
-rw-r--r--src/input/input_cda.c89
-rw-r--r--src/input/input_dvd.c102
-rw-r--r--src/input/input_file.c72
-rw-r--r--src/input/input_http.c103
-rw-r--r--src/input/input_net.c57
-rw-r--r--src/input/input_rtp.c72
-rw-r--r--src/input/input_stdin_fifo.c40
-rw-r--r--src/input/input_vcd.c103
-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
28 files changed, 1247 insertions, 617 deletions
diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c
index 29d3ec0f5..e4e7cca48 100644
--- a/src/demuxers/demux_asf.c
+++ b/src/demuxers/demux_asf.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: demux_asf.c,v 1.16 2001/11/30 00:53:51 f1rmb Exp $
+ * $Id: demux_asf.c,v 1.17 2001/12/27 14:30:29 f1rmb Exp $
*
* demultiplexer for asf streams
*
@@ -58,6 +58,26 @@
#define VALID_ENDS "asf,wmv"
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
typedef struct {
int num;
int seq;
@@ -77,6 +97,8 @@ typedef struct {
typedef struct demux_asf_s {
demux_plugin_t demux_plugin;
+ xine_t *xine;
+
config_values_t *config;
fifo_buffer_t *audio_fifo;
@@ -213,7 +235,7 @@ static uint8_t get_byte (demux_asf_t *this) {
/* printf ("%02x ", buf); */
if (i != 1) {
- printf ("demux_asf: end of data\n");
+ LOG_MSG(this->xine, _("demux_asf: end of data\n"));
this->status = DEMUX_FINISHED;
}
@@ -230,7 +252,7 @@ static uint16_t get_le16 (demux_asf_t *this) {
/* printf (" [%02x %02x] ", buf[0], buf[1]); */
if (i != 2) {
- printf ("demux_asf: end of data\n");
+ LOG_MSG(this->xine, _("demux_asf: end of data\n"));
this->status = DEMUX_FINISHED;
}
@@ -247,7 +269,7 @@ static uint32_t get_le32 (demux_asf_t *this) {
/* printf ("%02x %02x %02x %02x ", buf[0], buf[1], buf[2], buf[3]); */
if (i != 4) {
- printf ("demux_asf: end of data\n");
+ LOG_MSG(this->xine, _("demux_asf: end of data\n"));
this->status = DEMUX_FINISHED;
}
@@ -262,7 +284,7 @@ static uint64_t get_le64 (demux_asf_t *this) {
i = this->input->read (this->input, buf, 8);
if (i != 8) {
- printf ("demux_asf: end of data\n");
+ LOG_MSG(this->xine, _("demux_asf: end of data\n"));
this->status = DEMUX_FINISHED;
}
@@ -315,11 +337,11 @@ static void asf_send_audio_header (demux_asf_t *this, int stream_id) {
formattag_to_buf_audio ( wavex->wFormatTag );
if ( !this->streams[this->num_streams].buf_type ) {
- printf ("demux_asf: unknown audio type 0x%x\n", wavex->wFormatTag);
+ LOG_MSG(this->xine, _("demux_asf: unknown audio type 0x%x\n"), wavex->wFormatTag);
this->streams[this->num_streams].buf_type = BUF_CONTROL_NOP;
}
else
- printf ("demux_asf: audio format : %s (wFormatTag 0x%x)\n",
+ LOG_MSG(this->xine, _("demux_asf: audio format : %s (wFormatTag 0x%x)\n"),
buf_audio_name(this->streams[this->num_streams].buf_type),
wavex->wFormatTag);
@@ -339,7 +361,7 @@ static void asf_send_audio_header (demux_asf_t *this, int stream_id) {
buf->content = buf->mem;
memcpy (buf->content, this->wavex, this->wavex_size);
- printf ("demux_asf: wavex header is %d bytes long\n", this->wavex_size);
+ LOG_MSG(this->xine, _("demux_asf: wavex header is %d bytes long\n"), this->wavex_size);
buf->size = this->wavex_size;
buf->type = this->streams[this->num_streams].buf_type;
@@ -366,7 +388,7 @@ static void asf_send_video_header (demux_asf_t *this, int stream_id) {
fourcc_to_buf_video((void*)&bih->biCompression);
if( !this->streams[this->num_streams].buf_type ) {
- printf ("demux_asf: unknown video format %.4s\n",
+ LOG_MSG(this->xine, _("demux_asf: unknown video format %.4s\n"),
(char*)&bih->biCompression);
this->status = DEMUX_FINISHED;
@@ -382,8 +404,8 @@ static void asf_send_video_header (demux_asf_t *this, int stream_id) {
/*
printf ("demux_asf: video format : %.4s\n", (char*)&bih->biCompression);
*/
- printf ("demux_asf: video format : %s\n",
- buf_video_name(this->streams[this->num_streams].buf_type));
+ LOG_MSG(this->xine, _("demux_asf: video format : %s\n"),
+ buf_video_name(this->streams[this->num_streams].buf_type));
buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
buf->content = buf->mem;
@@ -406,7 +428,7 @@ static int asf_read_header (demux_asf_t *this) {
get_guid(this, &g);
if (memcmp(&g, &asf_header, sizeof(GUID))) {
- printf ("demux_asf: file doesn't start with an asf header\n");
+ LOG_MSG(this->xine, _("demux_asf: file doesn't start with an asf header\n"));
return 0;
}
get_le64(this);
@@ -439,7 +461,7 @@ static int asf_read_header (demux_asf_t *this) {
} else
this->rate = 0;
- printf ("demux_asf: stream length is %d sec, rate is %d bytes/sec\n",
+ LOG_MSG(this->xine, _("demux_asf: stream length is %d sec, rate is %d bytes/sec\n"),
this->length, this->rate);
start_time = get_le32(this); /* start timestamp in 1/1000 s*/
@@ -490,8 +512,8 @@ static int asf_read_header (demux_asf_t *this) {
this->reorder_w=(buffer[2]<<8)|buffer[1];
this->reorder_b=(buffer[4]<<8)|buffer[3];
this->reorder_w/=this->reorder_b;
- printf("demux_asf: audio conceal interleave detected (%d x %d x %d)\n",
- this->reorder_w, this->reorder_h, this->reorder_b );
+ LOG_MSG(this->xine, _("demux_asf: audio conceal interleave detected (%d x %d x %d)\n"),
+ this->reorder_w, this->reorder_h, this->reorder_b );
} else {
this->reorder_b=this->reorder_h=this->reorder_w=1;
}
@@ -587,7 +609,7 @@ static int asf_get_packet(demux_asf_t *this) {
if (this->packet_flags & 0x40) {
get_le16(this);
- printf("demux_asf: absolute size ignored\n");
+ LOG_MSG(this->xine, _("demux_asf: absolute size ignored\n"));
hdr_size += 2;
}
@@ -618,12 +640,12 @@ static int asf_get_packet(demux_asf_t *this) {
return 1;
}
-static void hexdump (unsigned char *data, int len) {
+static void hexdump (unsigned char *data, int len, xine_t *xine) {
int i;
for (i=0; i<len; i++)
- printf ("%02x ", data[i]);
- printf ("\n");
+ LOG_MSG(xine, "%02x ", data[i]);
+ LOG_MSG(xine, "\n");
}
@@ -783,8 +805,9 @@ static void asf_send_buffer_defrag (demux_asf_t *this, asf_stream_t *stream,
stream->timestamp = timestamp;
}
- if( stream->frag_offset + frag_len > DEFRAG_BUFSIZE )
- printf("demux_asf: buffer overflow on defrag!\n");
+ if( stream->frag_offset + frag_len > DEFRAG_BUFSIZE ) {
+ LOG_MSG(this->xine, _("demux_asf: buffer overflow on defrag!\n"));
+ }
else {
this->input->read (this->input, &stream->buffer[stream->frag_offset], frag_len);
stream->frag_offset += frag_len;
@@ -792,7 +815,7 @@ static void asf_send_buffer_defrag (demux_asf_t *this, asf_stream_t *stream,
/*
printf ("demux_asf: read %d bytes :", frag_len);
- hexdump (buf->content, frag_len);
+ hexdump (buf->content, frag_len, this->xine);
*/
}
@@ -814,7 +837,7 @@ static void asf_read_packet(demux_asf_t *this) {
this->input->seek (this->input, this->packet_size_left, SEEK_CUR);
if (!asf_get_packet(this)) {
- printf ("demux_asf: get_packet failed\n");
+ LOG_MSG(this->xine, _("demux_asf: get_packet failed\n"));
this->status = DEMUX_FINISHED;
return ;
}
@@ -848,7 +871,7 @@ static void asf_read_packet(demux_asf_t *this) {
this->packet_size_left -= 4;
break;
default:
- printf("demux_asf: unknow segtype %x\n",this->segtype);
+ LOG_MSG(this->xine, _("demux_asf: unknow segtype %x\n"), this->segtype);
frag_offset = get_le32(this);
this->packet_size_left -= 4;
break;
@@ -1027,7 +1050,7 @@ static void demux_asf_stop (demux_plugin_t *this_gen) {
void *p;
if (this->status != DEMUX_OK) {
- printf ("demux_asf: stop...ignored\n");
+ LOG_MSG(this->xine, _("demux_asf: stop...ignored\n"));
return;
}
@@ -1113,10 +1136,10 @@ static void demux_asf_start (demux_plugin_t *this_gen,
return;
}
- printf ("demux_asf: title : %s\n", this->title);
- printf ("demux_asf: author : %s\n", this->author);
- printf ("demux_asf: copyright : %s\n", this->copyright);
- printf ("demux_asf: comment : %s\n", this->comment);
+ LOG_MSG(this->xine, _("demux_asf: title : %s\n"), this->title);
+ LOG_MSG(this->xine, _("demux_asf: author : %s\n"), this->author);
+ LOG_MSG(this->xine, _("demux_asf: copyright : %s\n"), this->copyright);
+ LOG_MSG(this->xine, _("demux_asf: comment : %s\n"), this->comment);
/*
* seek to start position
@@ -1144,7 +1167,7 @@ static void demux_asf_start (demux_plugin_t *this_gen,
if ((err = pthread_create (&this->thread,
NULL, demux_asf_loop, this)) != 0) {
- fprintf (stderr, "demux_asf: can't create new thread (%s)\n",
+ LOG_MSG_STDERR(this->xine, _("demux_asf: can't create new thread (%s)\n"),
strerror(err));
exit (1);
}
@@ -1218,15 +1241,17 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_asf_t *this;
if (iface != 6) {
- printf( "demux_asf: plugin doesn't support plugin API version %d.\n"
- "demux_asf: this means there's a version mismatch between xine and this "
- "demux_asf: demuxer plugin.\nInstalling current demux plugins should help.\n",
+ LOG_MSG(xine,
+ _("demux_asf: plugin doesn't support plugin API version %d.\n"
+ " this means there's a version mismatch between xine and this "
+ " demuxer plugin.\nInstalling current demux plugins should help.\n"),
iface);
return NULL;
}
this = xine_xmalloc (sizeof (demux_asf_t));
this->config = xine->config;
+ this->xine = xine;
(void*) this->config->register_string(this->config,
"mrl.ends_asf", VALID_ENDS,
diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c
index 6203a81b3..bde7f9809 100644
--- a/src/demuxers/demux_avi.c
+++ b/src/demuxers/demux_avi.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: demux_avi.c,v 1.58 2001/12/09 19:32:11 guenter Exp $
+ * $Id: demux_avi.c,v 1.59 2001/12/27 14:30:29 f1rmb Exp $
*
* demultiplexer for avi streams
*
@@ -48,6 +48,26 @@
#define VALID_ENDS "avi"
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
/* The following variable indicates the kind of error */
typedef struct
@@ -109,6 +129,8 @@ typedef struct
typedef struct demux_avi_s {
demux_plugin_t demux_plugin;
+ xine_t *xine;
+
config_values_t *config;
fifo_buffer_t *audio_fifo;
@@ -484,7 +506,7 @@ static avi_t *AVI_init(demux_avi_t *this) {
AVI->n_idx = 0;
i=0;
- printf ("demux_avi: reconstructing index");
+ LOG_MSG(this->xine, _("demux_avi: reconstructing index"));
while(1) {
if( this->input->read(this->input, data,8) != 8 )
@@ -493,7 +515,7 @@ static avi_t *AVI_init(demux_avi_t *this) {
i++;
if (i>1000) {
- printf (".");
+ LOG_MSG(this->xine, ".");
i = 0; fflush (stdout);
}
@@ -515,7 +537,7 @@ static avi_t *AVI_init(demux_avi_t *this) {
this->input->seek(this->input, PAD_EVEN(n), SEEK_CUR);
}
- printf ("done\n");
+ LOG_MSG(this->xine, _("done\n"));
idx_type = 1;
}
@@ -821,7 +843,7 @@ static void *demux_avi_loop (void *this_gen) {
}
}
- printf ("demux_avi: demux loop finished.\n");
+ LOG_MSG(this->xine, _("demux_avi: demux loop finished.\n"));
pthread_exit(NULL);
@@ -835,7 +857,7 @@ static void demux_avi_stop (demux_plugin_t *this_gen) {
void *p;
if (this->status != DEMUX_OK) {
- printf ("demux_avi: stop...ignored\n");
+ LOG_MSG(this->xine, _("demux_avi: stop...ignored\n"));
return;
}
@@ -893,19 +915,19 @@ static void demux_avi_start (demux_plugin_t *this_gen,
this->status = DEMUX_OK;
- printf ("demux_avi: video format = %s, audio format = 0x%lx\n",
+ LOG_MSG(this->xine, _("demux_avi: video format = %s, audio format = 0x%lx\n"),
this->avi->compressor, this->avi->a_fmt);
this->no_audio = 0;
this->avi->audio_type = formattag_to_buf_audio (this->avi->a_fmt);
if( !this->avi->audio_type ) {
- printf ("demux_avi: unknown audio type 0x%lx\n", this->avi->a_fmt);
+ LOG_MSG(this->xine, _("demux_avi: unknown audio type 0x%lx\n"), this->avi->a_fmt);
this->no_audio = 1;
this->avi->audio_type = BUF_CONTROL_NOP;
}
else
- printf ("demux_avi: audio type %s (wFormatTag 0x%x)\n",
+ LOG_MSG(this->xine, _("demux_avi: audio type %s (wFormatTag 0x%x)\n"),
buf_audio_name(this->avi->audio_type),
(int)this->avi->a_fmt);
@@ -923,7 +945,7 @@ static void demux_avi_start (demux_plugin_t *this_gen,
if (this->avi->video_posf>this->avi->video_frames) {
this->status = DEMUX_FINISHED;
- printf ("demux_avi: video seek to start failed\n");
+ LOG_MSG(this->xine, _("demux_avi: video seek to start failed\n"));
return;
}
}
@@ -940,7 +962,7 @@ static void demux_avi_start (demux_plugin_t *this_gen,
if (this->avi->video_posf>this->avi->video_frames) {
this->status = DEMUX_FINISHED;
- printf ("demux_avi: video seek to start failed\n");
+ LOG_MSG(this->xine, _("demux_avi: video seek to start failed\n"));
return;
}
}
@@ -957,7 +979,7 @@ static void demux_avi_start (demux_plugin_t *this_gen,
if (this->avi->audio_posc>this->avi->audio_chunks) {
this->status = DEMUX_FINISHED;
- printf ("demux_avi: audio seek to start failed\n");
+ LOG_MSG(this->xine, _("demux_avi: audio seek to start failed\n"));
return;
}
}
@@ -988,14 +1010,14 @@ static void demux_avi_start (demux_plugin_t *this_gen,
this->avi->video_type = fourcc_to_buf_video((void*)&this->avi->bih.biCompression);
if ( !this->avi->video_type ) {
- printf ("demux_avi: unknown avi format %.4s\n",
+ LOG_MSG(this->xine, _("demux_avi: unknown avi format %.4s\n"),
(char*)&this->avi->bih.biCompression);
this->status = DEMUX_FINISHED;
return;
}
buf->type = this->avi->video_type;
- printf ("demux_avi: video codec >%s<\n",buf_video_name(buf->type));
+ LOG_MSG(this->xine, _("demux_avi: video codec >%s<\n"), buf_video_name(buf->type));
this->video_fifo->put (this->video_fifo, buf);
@@ -1032,14 +1054,14 @@ static void demux_avi_start (demux_plugin_t *this_gen,
this->have_spu = 1;
- printf ("demux_avi: text subtitle file available\n");
+ LOG_MSG(this->xine, _("demux_avi: text subtitle file available\n"));
} else
this->have_spu = 0;
if ((err = pthread_create (&this->thread, NULL, demux_avi_loop, this)) != 0) {
- fprintf (stderr, "demux_avi: can't create new thread (%s)\n",
- strerror(err));
+ LOG_MSG_STDERR(this->xine, _("demux_avi: can't create new thread (%s)\n"),
+ strerror(err));
exit (1);
}
}
@@ -1070,13 +1092,13 @@ static int demux_avi_open(demux_plugin_t *this_gen,
if (this->avi) {
- printf ("demux_avi: %ld frames\n", this->avi->video_frames);
+ LOG_MSG(this->xine, _("demux_avi: %ld frames\n"), this->avi->video_frames);
strncpy(this->last_mrl, input->get_mrl (input), 1024);
return DEMUX_CAN_HANDLE;
} else
- printf ("demux_avi: AVI_init failed (AVI_errno: %d)\n",this->AVI_errno);
+ LOG_MSG(this->xine, _("demux_avi: AVI_init failed (AVI_errno: %d)\n"), this->AVI_errno);
return DEMUX_CANNOT_HANDLE;
}
@@ -1113,7 +1135,8 @@ static int demux_avi_open(demux_plugin_t *this_gen,
strncpy(this->last_mrl, input->get_mrl (input), 1024);
return DEMUX_CAN_HANDLE;
} else {
- printf ("demux_avi: AVI_init failed (AVI_errno: %d)\n",this->AVI_errno);
+ LOG_MSG(this->xine, _("demux_avi: AVI_init failed (AVI_errno: %d)\n"),
+ this->AVI_errno);
return DEMUX_CANNOT_HANDLE;
}
}
@@ -1156,15 +1179,17 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_avi_t *this;
if (iface != 6) {
- printf( "demux_avi: this plugin doesn't support plugin API version %d.\n"
- "demux_avi: this means there's a version mismatch between xine and this "
- "demux_avi: demuxer plugin.\nInstalling current demuxer plugins should help.\n",
+ LOG_MSG(xine,
+ _("demux_avi: this plugin doesn't support plugin API version %d.\n"
+ "demux_avi: this means there's a version mismatch between xine and this "
+ "demux_avi: demuxer plugin.\nInstalling current demuxer plugins should help.\n"),
iface);
return NULL;
}
this = xine_xmalloc (sizeof (demux_avi_t));
this->config = xine->config;
+ this->xine = xine;
(void*) this->config->register_string(this->config,
"mrl.ends_avi", VALID_ENDS,
diff --git a/src/demuxers/demux_cda.c b/src/demuxers/demux_cda.c
index cf6589a6a..1f3438460 100644
--- a/src/demuxers/demux_cda.c
+++ b/src/demuxers/demux_cda.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: demux_cda.c,v 1.3 2001/12/10 23:40:29 f1rmb Exp $
+ * $Id: demux_cda.c,v 1.4 2001/12/27 14:30:29 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -36,12 +36,34 @@
#include "compat.h"
#include "demux.h"
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
#define DEMUX_CDA_IFACE_VERSION 3
typedef struct {
demux_plugin_t demux_plugin;
+ xine_t *xine;
+
config_values_t *config;
fifo_buffer_t *video_fifo;
@@ -131,7 +153,7 @@ static void demux_cda_stop (demux_plugin_t *this_gen) {
void *p;
if (this->status != DEMUX_OK) {
- printf ("demux_cda: stop...ignored\n");
+ LOG_MSG(this->xine, _("demux_cda: stop...ignored\n"));
return;
}
@@ -206,7 +228,7 @@ static void demux_cda_start (demux_plugin_t *this_gen,
if ((err = pthread_create (&this->thread,
NULL, demux_cda_loop, this)) != 0) {
- fprintf (stderr, "demux_cda: can't create new thread (%s)\n", strerror(err));
+ LOG_MSG_STDERR(this->xine, _("demux_cda: can't create new thread (%s)\n"), strerror(err));
exit(1);
}
}
@@ -281,15 +303,17 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_cda_t *this;
if (iface != 6) {
- printf( "demux_cda: plugin doesn't support plugin API version %d.\n"
- "demux_cda: this means there's a version mismatch between xine and this "
- "demux_cda: demuxer plugin.\nInstalling current demux plugins should help.\n",
+ LOG_MSG(xine,
+ _("demux_cda: plugin doesn't support plugin API version %d.\n"
+ " this means there's a version mismatch between xine and this "
+ " demuxer plugin.\nInstalling current demux plugins should help.\n"),
iface);
return NULL;
}
this = (demux_cda_t *) xine_xmalloc(sizeof(demux_cda_t));
this->config = xine->config;
+ this->xine = xine;
this->demux_plugin.interface_version = DEMUX_CDA_IFACE_VERSION;
this->demux_plugin.open = demux_cda_open;
diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c
index eb3bccec7..572c2ca15 100644
--- a/src/demuxers/demux_elem.c
+++ b/src/demuxers/demux_elem.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: demux_elem.c,v 1.30 2001/11/30 00:53:51 f1rmb Exp $
+ * $Id: demux_elem.c,v 1.31 2001/12/27 14:30:29 f1rmb Exp $
*
* demultiplexer for elementary mpeg streams
*
@@ -45,10 +45,32 @@
#define VALID_ENDS ".mpv"
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
typedef struct {
demux_plugin_t demux_plugin;
+ xine_t *xine;
+
config_values_t *config;
fifo_buffer_t *video_fifo;
@@ -225,8 +247,8 @@ static void demux_mpeg_elem_start (demux_plugin_t *this_gen,
if ((err = pthread_create (&this->thread,
NULL, demux_mpeg_elem_loop, this)) != 0) {
- fprintf (stderr, "demux_elem: can't create new thread (%s)\n",
- strerror(err));
+ LOG_MSG_STDERR(this->xine, _("demux_elem: can't create new thread (%s)\n"),
+ strerror(err));
exit (1);
}
}
@@ -337,15 +359,17 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpeg_elem_t *this;
if (iface != 6) {
- printf( "demux_elem: plugin doesn't support plugin API version %d.\n"
- "demux_elem: this means there's a version mismatch between xine and this "
- "demux_elem: demuxer plugin.\nInstalling current demux plugins should help.\n",
+ LOG_MSG(xine,
+ _("demux_elem: plugin doesn't support plugin API version %d.\n"
+ " this means there's a version mismatch between xine and this "
+ " demuxer plugin.\nInstalling current demux plugins should help.\n"),
iface);
return NULL;
}
-
+
this = malloc (sizeof (demux_mpeg_elem_t));
this->config = xine->config;
+ this->xine = xine;
(void*) this->config->register_string(this->config,
"mrl.ends_elem", VALID_ENDS,
diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c
index 61e2176dc..4a9859621 100644
--- a/src/demuxers/demux_mpeg.c
+++ b/src/demuxers/demux_mpeg.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: demux_mpeg.c,v 1.46 2001/11/30 00:53:51 f1rmb Exp $
+ * $Id: demux_mpeg.c,v 1.47 2001/12/27 14:30:29 f1rmb Exp $
*
* demultiplexer for mpeg 1/2 program streams
* reads streams of variable blocksizes
@@ -45,11 +45,33 @@
#define VALID_MRLS "stdin,fifo"
#define VALID_ENDS "mpg,mpeg,mpe"
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
#define NUM_PREVIEW_BUFFERS 150
typedef struct demux_mpeg_s {
demux_plugin_t demux_plugin;
+
+ xine_t *xine;
config_values_t *config;
@@ -104,9 +126,8 @@ static uint32_t read_bytes (demux_mpeg_t *this, int n) {
res = (buf[2]<<8) | buf[3] | (buf[1]<<16) | (buf[0] << 24);
break;
default:
- fprintf (stderr,
- "How how - something wrong in wonderland demux:read_bytes (%d)\n",
- n);
+ LOG_MSG_STDERR(this->xine,
+ _("How how - something wrong in wonderland demux:read_bytes (%d)\n"), n);
exit (1);
}
@@ -643,7 +664,7 @@ static void *demux_mpeg_loop (void *this_gen) {
}
}
- printf ("demux loop finished (status: %d, buf:%x)\n",
+ LOG_MSG(this->xine, _("demux loop finished (status: %d, buf:%x)\n"),
this->status, w);
pthread_exit(NULL);
@@ -657,7 +678,7 @@ static void demux_mpeg_stop (demux_plugin_t *this_gen) {
buf_element_t *buf;
void *p;
- printf ("demux_mpeg: stop...\n");
+ LOG_MSG(this->xine, _("demux_mpeg: stop...\n"));
if (this->status != DEMUX_OK) {
@@ -760,8 +781,8 @@ static void demux_mpeg_start (demux_plugin_t *this_gen,
if ((err = pthread_create (&this->thread,
NULL, demux_mpeg_loop, this)) != 0) {
- fprintf (stderr, "demux_mpeg: can't create new thread (%s)\n",
- strerror(err));
+ LOG_MSG_STDERR(this->xine, _("demux_mpeg: can't create new thread (%s)\n"),
+ strerror(err));
exit (1);
}
}
@@ -849,7 +870,7 @@ static int demux_mpeg_open(demux_plugin_t *this_gen,
return DEMUX_CANNOT_HANDLE;
}
- fprintf(stderr, "You should specify mpeg(mpeg1/mpeg2) stream type.\n");
+ LOG_MSG_STDERR(this->xine, _("You should specify mpeg(mpeg1/mpeg2) stream type.\n"));
return DEMUX_CANNOT_HANDLE;
}
}
@@ -913,15 +934,17 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpeg_t *this;
if (iface != 6) {
- printf( "demux_mpeg: plugin doesn't support plugin API version %d.\n"
- "demux_mpeg: this means there's a version mismatch between xine and this "
- "demux_mpeg: demuxer plugin.\nInstalling current demux plugins should help.\n",
+ LOG_MSG(xine,
+ _("demux_mpeg: plugin doesn't support plugin API version %d.\n"
+ " this means there's a version mismatch between xine and this "
+ " demuxer plugin.\nInstalling current demux plugins should help.\n"),
iface);
return NULL;
}
-
- this = xine_xmalloc (sizeof (demux_mpeg_t));
+
+ this = xine_xmalloc (sizeof (demux_mpeg_t));
this->config = xine->config;
+ this->xine = xine;
/* Calling register_string() configure valid mrls in configfile */
(void*) this->config->register_string(this->config, "mrl.mrls_mpeg", VALID_MRLS,
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c
index 61993bf28..39611f8d3 100644
--- a/src/demuxers/demux_mpeg_block.c
+++ b/src/demuxers/demux_mpeg_block.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: demux_mpeg_block.c,v 1.68 2001/12/24 00:45:03 guenter Exp $
+ * $Id: demux_mpeg_block.c,v 1.69 2001/12/27 14:30:30 f1rmb Exp $
*
* demultiplexer for mpeg 1/2 program streams
*
@@ -45,12 +45,33 @@
#define VALID_MRLS "dvd,stdin,fifo"
#define VALID_ENDS "vob"
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
#define NUM_PREVIEW_BUFFERS 250
typedef struct demux_mpeg_block_s {
demux_plugin_t demux_plugin;
xine_t *xine;
+
config_values_t *config;
fifo_buffer_t *audio_fifo;
@@ -92,7 +113,7 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m
if (buf==NULL) {
xine_next_mrl_event_t event;
- printf ("demux_mpeg_block: read_block failed\n");
+ LOG_MSG(this->xine, _("demux_mpeg_block: read_block failed\n"));
/*
* check if seamless branching is possible
@@ -106,12 +127,12 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m
char *next_mrl = event.mrl;
- printf ("demux_mpeg_block: checking if we can branch to %s\n", next_mrl);
+ LOG_MSG(this->xine, _("demux_mpeg_block: checking if we can branch to %s\n"), next_mrl);
if (next_mrl && this->input->is_branch_possible
&& this->input->is_branch_possible (this->input, next_mrl)) {
- printf ("demux_mpeg_block: branching\n");
+ LOG_MSG(this->xine, _("demux_mpeg_block: branching\n"));
this->input->close (this->input);
this->input->open (this->input, next_mrl);
@@ -241,13 +262,13 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m
/* we should now have a PES packet here */
if (p[0] || p[1] || (p[2] != 1)) {
- printf ("demux_mpeg_block: error! %02x %02x %02x (should be 0x000001) \n",
+ LOG_MSG(this->xine, _("demux_mpeg_block: error! %02x %02x %02x (should be 0x000001) \n"),
p[0], p[1], p[2]);
buf->free_buffer (buf);
this->warned++;
if (this->warned > 5) {
- printf ("demux_mpeg_block: too many errors, stopping playback. Maybe this stream is scrambled?\n");
+ LOG_MSG(this->xine, _("demux_mpeg_block: too many errors, stopping playback. Maybe this stream is scrambled?\n"));
this->status = DEMUX_FINISHED;
}
@@ -342,7 +363,7 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m
} else { /* mpeg 2 */
/* check PES scrambling_control */
if (((p[6] & 0x30) != 0) && !this->warned) {
- printf("demux_mpeg_block: warning: pes header indicates that this stream may be encrypted (encryption mode %d)\n", (p[6] & 0x30) >> 4);
+ LOG_MSG(this->xine, _("demux_mpeg_block: warning: pes header indicates that this stream may be encrypted (encryption mode %d)\n"), (p[6] & 0x30) >> 4);
this->warned = 1;
}
@@ -456,8 +477,8 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m
switch ((p[5]>>6) & 3) {
case 3: /* illegal, use 16-bits? */
default:
- printf("illegal lpcm sample format (%d), assume 16-bit samples\n",
- (p[5]>>6) & 3 );
+ LOG_MSG(this->xine, _("illegal lpcm sample format (%d), assume 16-bit samples\n"),
+ (p[5]>>6) & 3 );
case 0: bits_per_sample = 16; break;
case 1: bits_per_sample = 20; break;
case 2: bits_per_sample = 24; break;
@@ -619,7 +640,8 @@ static int demux_mpeg_block_estimate_rate (demux_mpeg_block_t *this) {
/* we should now have a PES packet here */
if (p[0] || p[1] || (p[2] != 1)) {
- printf ("demux_mpeg_block: error %02x %02x %02x (should be 0x000001) \n",p[0],p[1],p[2]);
+ LOG_MSG(this->xine, _("demux_mpeg_block: error %02x %02x %02x (should be 0x000001) \n"),
+ p[0], p[1], p[2]);
buf->free_buffer (buf);
return rate;
}
@@ -719,7 +741,7 @@ static void demux_mpeg_block_stop (demux_plugin_t *this_gen) {
void *p;
if (this->status != DEMUX_OK) {
- printf ("demux_mpeg_block: stop...ignored\n");
+ LOG_MSG(this->xine, _("demux_mpeg_block: stop...ignored\n"));
return;
}
@@ -838,8 +860,8 @@ static void demux_mpeg_block_start (demux_plugin_t *this_gen,
if ((err = pthread_create (&this->thread,
NULL, demux_mpeg_block_loop, this)) != 0) {
- fprintf (stderr, "demux_mpeg_block: can't create new thread (%s)\n",
- strerror(err));
+ LOG_MSG_STDERR(this->xine, _("demux_mpeg_block: can't create new thread (%s)\n"),
+ strerror(err));
exit (1);
}
}
@@ -855,11 +877,11 @@ static void demux_mpeg_block_accept_input (demux_mpeg_block_t *this,
strncpy (this->cur_mrl, input->get_mrl(input), 256);
- printf ("demux_mpeg_block: mrl %s is new, will estimated bitrate\n",
+ LOG_MSG(this->xine, _("demux_mpeg_block: mrl %s is new, will estimated bitrate\n"),
this->cur_mrl);
} else
- printf ("demux_mpeg_block: mrl %s is known, estimated bitrate: %d\n",
+ LOG_MSG(this->xine, _("demux_mpeg_block: mrl %s is known, estimated bitrate: %d\n"),
this->cur_mrl, this->rate * 50 * 8);
}
@@ -1014,16 +1036,17 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpeg_block_t *this;
if (iface != 6) {
- printf( "demux_mpeg_block: plugin doesn't support plugin API version %d.\n"
- "demux_mpeg_block: this means there's a version mismatch between xine and this "
- "demux_mpeg_block: demuxer plugin.\nInstalling current demux plugins should help.\n",
+ LOG_MSG(xine,
+ _("demux_mpeg_block: plugin doesn't support plugin API version %d.\n"
+ " this means there's a version mismatch between xine and this "
+ " demuxer plugin.\nInstalling current demux plugins should help.\n"),
iface);
return NULL;
}
this = xine_xmalloc (sizeof (demux_mpeg_block_t));
- this->xine = xine;
this->config = xine->config;
+ this->xine = xine;
/* Calling register_string() configure valid mrls in configfile */
(void*) this->config->register_string(this->config, "mrl.mrls_mpeg_block", VALID_MRLS,
diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c
index 7e0546358..c6199d19e 100644
--- a/src/demuxers/demux_mpgaudio.c
+++ b/src/demuxers/demux_mpgaudio.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: demux_mpgaudio.c,v 1.30 2001/11/30 00:53:51 f1rmb Exp $
+ * $Id: demux_mpgaudio.c,v 1.31 2001/12/27 14:30:30 f1rmb Exp $
*
* demultiplexer for mpeg audio (i.e. mp3) streams
*
@@ -43,10 +43,32 @@
#define VALID_ENDS "mp3,mp2,mpa,mpega"
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
typedef struct {
demux_plugin_t demux_plugin;
+ xine_t *xine;
+
config_values_t *config;
fifo_buffer_t *audio_fifo;
@@ -151,7 +173,7 @@ static void mpg123_decode_header(demux_mpgaudio_t *this,unsigned long newhead)
tpf /= freqs[sampling_frequency] << lsf;
bitrate = (double) framesize / tpf;
- printf("mpgaudio: bitrate = %.2fkbps\n", bitrate/1024.0*8.0 );
+ LOG_MSG(this->xine, _("mpgaudio: bitrate = %.2fkbps\n"), bitrate/1024.0*8.0 );
this->stream_length = (int)(this->input->get_length(this->input) / bitrate);
}
@@ -238,7 +260,7 @@ static void demux_mpgaudio_stop (demux_plugin_t *this_gen) {
void *p;
if (this->status != DEMUX_OK) {
- printf ("demux_mpgaudio_block: stop...ignored\n");
+ LOG_MSG(this->xine, _("demux_mpgaudio_block: stop...ignored\n"));
return;
}
@@ -342,8 +364,8 @@ static void demux_mpgaudio_start (demux_plugin_t *this_gen,
if ((err = pthread_create (&this->thread,
NULL, demux_mpgaudio_loop, this)) != 0) {
- fprintf (stderr, "demux_mpgaudio: can't create new thread (%s)\n",
- strerror(err));
+ LOG_MSG_STDERR(this->xine, _("demux_mpgaudio: can't create new thread (%s)\n"),
+ strerror(err));
exit (1);
}
}
@@ -440,15 +462,17 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpgaudio_t *this;
if (iface != 6) {
- printf( "demux_mpeg: plugin doesn't support plugin API version %d.\n"
- "demux_mpeg: this means there's a version mismatch between xine and this "
- "demux_mpeg: demuxer plugin.\nInstalling current demux plugins should help.\n",
+ LOG_MSG(xine,
+ _("demux_mpeg: plugin doesn't support plugin API version %d.\n"
+ " this means there's a version mismatch between xine and this "
+ " demuxer plugin.\nInstalling current demux plugins should help.\n"),
iface);
return NULL;
}
-
+
this = malloc (sizeof (demux_mpgaudio_t));
this->config = xine->config;
+ this->xine = xine;
(void*) this->config->register_string(this->config,
"mrl.ends_mgaudio", VALID_ENDS,
@@ -467,4 +491,3 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
return &this->demux_plugin;
}
-
diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c
index 250cace76..4338c127e 100644
--- a/src/demuxers/demux_ogg.c
+++ b/src/demuxers/demux_ogg.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: demux_ogg.c,v 1.11 2001/11/30 00:53:51 f1rmb Exp $
+ * $Id: demux_ogg.c,v 1.12 2001/12/27 14:30:30 f1rmb Exp $
*
* demultiplexer for ogg streams
*
@@ -46,9 +46,31 @@
#define VALID_ENDS "ogg"
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
typedef struct demux_ogg_s {
demux_plugin_t demux_plugin;
+ xine_t *xine;
+
config_values_t *config;
fifo_buffer_t *audio_fifo;
@@ -102,9 +124,8 @@ static void demux_ogg_send_package (demux_ogg_t *this, int is_content) {
cur_serno = ogg_page_serialno (&this->og);
if (ogg_page_bos(&this->og)) {
- printf("demux_ogg: beginning of stream\n");
- printf("demux_ogg: serial number %d\n",
- ogg_page_serialno (&this->og));
+ LOG_MSG(this->xine, _("demux_ogg: beginning of stream\ndemux_ogg: serial number %d\n"),
+ ogg_page_serialno (&this->og));
}
for (i = 0; i<this->num_streams; i++) {
@@ -119,7 +140,7 @@ static void demux_ogg_send_package (demux_ogg_t *this, int is_content) {
stream_num = this->num_streams;
this->buf_types[stream_num] = 0;
- printf("demux_ogg: found a new stream, serialnumber %d\n", cur_serno);
+ LOG_MSG(this->xine, _("demux_ogg: found a new stream, serialnumber %d\n"), cur_serno);
this->num_streams++;
}
@@ -135,7 +156,7 @@ static void demux_ogg_send_package (demux_ogg_t *this, int is_content) {
if (!strncmp (&op.packet[1], "vorbis", 6)) {
this->buf_types[stream_num] = BUF_AUDIO_VORBIS;
} else {
- printf ("demux_ogg: unknown streamtype, signature: >%.8s<\n",
+ LOG_MSG(this->xine, _("demux_ogg: unknown streamtype, signature: >%.8s<\n"),
op.packet);
this->buf_types[stream_num] = BUF_CONTROL_NOP;
}
@@ -234,7 +255,7 @@ static void demux_ogg_stop (demux_plugin_t *this_gen) {
void *p;
if (this->status != DEMUX_OK) {
- printf ("demux_ogg: stop...ignored\n");
+ LOG_MSG(this->xine, _("demux_ogg: stop...ignored\n"));
return;
}
@@ -336,8 +357,8 @@ static void demux_ogg_start (demux_plugin_t *this_gen,
if ((err = pthread_create (&this->thread,
NULL, demux_ogg_loop, this)) != 0) {
- fprintf (stderr, "demux_ogg: can't create new thread (%s)\n",
- strerror(err));
+ LOG_MSG_STDERR(this->xine, _("demux_ogg: can't create new thread (%s)\n"),
+ strerror(err));
exit (1);
}
}
@@ -409,15 +430,17 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_ogg_t *this;
if (iface != 6) {
- printf( "demux_ogg: plugin doesn't support plugin API version %d.\n"
- "demux_ogg: this means there's a version mismatch between xine and this "
- "demux_ogg: demuxer plugin.\nInstalling current demux plugins should help.\n",
+ LOG_MSG(xine,
+ _("demux_ogg: plugin doesn't support plugin API version %d.\n"
+ " this means there's a version mismatch between xine and this "
+ " demuxer plugin.\nInstalling current demux plugins should help.\n"),
iface);
return NULL;
}
-
+
this = xine_xmalloc (sizeof (demux_ogg_t));
this->config = xine->config;
+ this->xine = xine;
(void*) this->config->register_string(this->config,
"mrl.ends_ogg", VALID_ENDS,
diff --git a/src/demuxers/demux_pes.c b/src/demuxers/demux_pes.c
index 88065aa0a..d65f10fd3 100644
--- a/src/demuxers/demux_pes.c
+++ b/src/demuxers/demux_pes.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: demux_pes.c,v 1.15 2001/11/30 00:53:51 f1rmb Exp $
+ * $Id: demux_pes.c,v 1.16 2001/12/27 14:30:30 f1rmb Exp $
*
* demultiplexer for mpeg 2 PES (Packetized Elementary Streams)
* reads streams of variable blocksizes
@@ -46,10 +46,32 @@
#define VALID_MRLS "fifo,stdin"
#define VALID_ENDS "vdr"
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
typedef struct demux_pes_s {
demux_plugin_t demux_plugin;
+ xine_t *xine;
+
config_values_t *config;
fifo_buffer_t *audio_fifo;
@@ -100,9 +122,8 @@ static uint32_t read_bytes (demux_pes_t *this, int n) {
res = (buf[2]<<8) | buf[3] | (buf[1]<<16) | (buf[0] << 24);
break;
default:
- fprintf (stderr,
- "How how - something wrong in wonderland demux:read_bytes (%d)\n",
- n);
+ LOG_MSG_STDERR(this->xine,
+ _("How how - something wrong in wonderland demux:read_bytes (%d)\n"), n);
exit (1);
}
@@ -325,7 +346,7 @@ static void *demux_pes_loop (void *this_gen) {
}
}
- printf ("demux loop finished (status: %d, buf:%x)\n",
+ LOG_MSG(this->xine, _("demux loop finished (status: %d, buf:%x)\n"),
this->status, w);
pthread_exit(NULL);
@@ -339,7 +360,7 @@ static void demux_pes_stop (demux_plugin_t *this_gen) {
buf_element_t *buf;
void *p;
- printf ("demux_pes: stop...\n");
+ LOG_MSG(this->xine, _("demux_pes: stop...\n"));
if (this->status != DEMUX_OK) {
@@ -435,8 +456,8 @@ static void demux_pes_start (demux_plugin_t *this_gen,
if ((err = pthread_create (&this->thread,
NULL, demux_pes_loop, this)) != 0) {
- fprintf (stderr, "demux_pes: can't create new thread (%s)\n",
- strerror(err));
+ LOG_MSG_STDERR(this->xine, _("demux_pes: can't create new thread (%s)\n"),
+ strerror(err));
exit (1);
}
}
@@ -565,15 +586,17 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_pes_t *this;
if (iface != 6) {
- printf( "demux_pes: plugin doesn't support plugin API version %d.\n"
- "demux_pes: this means there's a version mismatch between xine and this "
- "demux_pes: demuxer plugin.\nInstalling current demux plugins should help.\n",
+ LOG_MSG(xine,
+ _("demux_pes: plugin doesn't support plugin API version %d.\n"
+ " this means there's a version mismatch between xine and this "
+ " demuxer plugin.\nInstalling current demux plugins should help.\n"),
iface);
return NULL;
}
this = xine_xmalloc (sizeof (demux_pes_t));
this->config = xine->config;
+ this->xine = xine;
(void*) this->config->register_string(this->config, "mrl.mrls_pes", VALID_MRLS,
"valid mrls for pes demuxer",
diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c
index 769dfad3d..0dadf936b 100644
--- a/src/demuxers/demux_qt.c
+++ b/src/demuxers/demux_qt.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: demux_qt.c,v 1.16 2001/11/30 00:53:51 f1rmb Exp $
+ * $Id: demux_qt.c,v 1.17 2001/12/27 14:30:30 f1rmb Exp $
*
* demultiplexer for quicktime streams, based on:
*
@@ -56,6 +56,26 @@
#define VALID_ENDS "mov"
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
/* OpenQuicktime Codec Parameter Types */
#define QUICKTIME_UNKNOWN_PARAMETER -1
#define QUICKTIME_STRING_PARAMETER 0
@@ -516,6 +536,8 @@ typedef struct quicktime_struc {
typedef struct demux_qt_s {
demux_plugin_t demux_plugin;
+ xine_t *xine;
+
config_values_t *config;
fifo_buffer_t *audio_fifo;
@@ -3138,7 +3160,7 @@ static int quicktime_moov_delete(quicktime_moov_t *moov)
#define QT_zlib 0x7A6C6962
static int quicktime_read_moov(quicktime_t *file, quicktime_moov_t *moov,
- quicktime_atom_t *parent_atom) {
+ quicktime_atom_t *parent_atom, xine_t *xine) {
/* mandatory mvhd */
quicktime_atom_t leaf_atom;
@@ -3174,7 +3196,7 @@ static int quicktime_read_moov(quicktime_t *file, quicktime_moov_t *moov,
zlibfourcc = quicktime_atom_read_size((char *)&zlibfourcc);
if(zlibfourcc != QT_zlib)
- printf("Header not compressed with zlib\n");
+ LOG_MSG(xine, _("Header not compressed with zlib\n"));
if(compressed_atom.size - 4 > 0) {
offset = file->ftell_position + compressed_atom.size - 4;
@@ -3195,7 +3217,7 @@ static int quicktime_read_moov(quicktime_t *file, quicktime_moov_t *moov,
/* Allocate buffer for compressed header */
cmov_buf = (unsigned char *)malloc( cmov_sz );
if (cmov_buf == 0) {
- fprintf(stderr, "QT cmov: malloc err 0");
+ LOG_MSG_STDERR(xine, _("QT cmov: malloc err 0"));
exit(1);
}
/* Read in compressed header */
@@ -3203,7 +3225,7 @@ static int quicktime_read_moov(quicktime_t *file, quicktime_moov_t *moov,
tlen = file->quicktime_read_data(file, (char*)cmov_buf, cmov_sz);
if (tlen != 1) {
- fprintf(stderr,"QT cmov: read err tlen %llu\n", tlen);
+ LOG_MSG_STDERR(xine, _("QT cmov: read err tlen %llu\n"), tlen);
free(cmov_buf);
return 0;
}
@@ -3212,7 +3234,7 @@ static int quicktime_read_moov(quicktime_t *file, quicktime_moov_t *moov,
moov_sz += 16; /* slop?? */
moov_buf = (unsigned char *)malloc( moov_sz );
if (moov_buf == 0) {
- fprintf(stderr,"QT cmov: malloc err moov_sz %u\n", moov_sz);
+ LOG_MSG_STDERR(xine, _("QT cmov: malloc err moov_sz %u\n"), moov_sz);
exit(1);
}
@@ -3226,12 +3248,12 @@ static int quicktime_read_moov(quicktime_t *file, quicktime_moov_t *moov,
zret = inflateInit(&zstrm);
if (zret != Z_OK) {
- fprintf(stderr,"QT cmov: inflateInit err %d\n",zret);
+ LOG_MSG_STDERR(xine, _("QT cmov: inflateInit err %d\n"), zret);
break;
}
zret = inflate(&zstrm, Z_NO_FLUSH);
if ((zret != Z_OK) && (zret != Z_STREAM_END)) {
- fprintf(stderr,"QT cmov inflate: ERR %d\n",zret);
+ LOG_MSG_STDERR(xine, _("QT cmov inflate: ERR %d\n"), zret);
break;
} else {
FILE *DecOut;
@@ -3750,14 +3772,14 @@ static void quicktime_mdat_delete(quicktime_mdat_t *mdat)
{
}
-static void quicktime_read_mdat(quicktime_t *file, quicktime_mdat_t *mdat, quicktime_atom_t *parent_atom)
+static void quicktime_read_mdat(quicktime_t *file, quicktime_mdat_t *mdat, quicktime_atom_t *parent_atom, xine_t *xine)
{
mdat->atom.size = parent_atom->size;
mdat->atom.start = parent_atom->start;
quicktime_atom_skip(file, parent_atom);
}
-static int quicktime_read_info(quicktime_t *file) {
+static int quicktime_read_info(quicktime_t *file, xine_t *xine) {
int result = 0, found_moov = 0;
int i, track;
@@ -3777,10 +3799,10 @@ static int quicktime_read_info(quicktime_t *file) {
if(!result) {
if(quicktime_atom_is(&leaf_atom, "mdat")) {
- quicktime_read_mdat(file, &(file->mdat), &leaf_atom);
+ quicktime_read_mdat(file, &(file->mdat), &leaf_atom, xine);
found_mdat = 1;
} else if(quicktime_atom_is(&leaf_atom, "moov")) {
- quicktime_read_moov(file, &(file->moov), &leaf_atom);
+ quicktime_read_moov(file, &(file->moov), &leaf_atom, xine);
found_moov = 1;
} else {
quicktime_atom_skip(file, &leaf_atom);
@@ -3917,7 +3939,7 @@ static void quicktime_close(quicktime_t *file)
free(file);
}
-static quicktime_t* quicktime_open(input_plugin_t *input)
+static quicktime_t* quicktime_open(input_plugin_t *input, xine_t *xine)
{
quicktime_t *new_file = calloc(1, sizeof(quicktime_t));
@@ -3938,9 +3960,9 @@ static quicktime_t* quicktime_open(input_plugin_t *input)
/* Get length. */
new_file->total_length = get_file_length(new_file);
- if(quicktime_read_info(new_file)) {
+ if(quicktime_read_info(new_file, xine)) {
quicktime_close(new_file);
- printf("demux_qt: quicktime_open: error in header\n");
+ LOG_MSG(xine, _("demux_qt: quicktime_open: error in header\n"));
new_file = 0;
}
@@ -4109,7 +4131,7 @@ static void demux_qt_stop (demux_plugin_t *this_gen) {
void *p;
if (this->status != DEMUX_OK) {
- printf ("demux_qt: stop...ignored\n");
+ LOG_MSG(this->xine, _("demux_qt: stop...ignored\n"));
return;
}
@@ -4170,11 +4192,11 @@ static int demux_qt_detect_compressors (demux_qt_t *this) {
}
if (!this->video_type ) {
- printf ("demux_qt: unknown video codec >%s<\n",video);
+ LOG_MSG(this->xine, _("demux_qt: unknown video codec >%s<\n"), video);
return 0;
}
- printf ("demux_qt: video codec >%s<\n",buf_video_name(this->video_type));
+ LOG_MSG(this->xine, _("demux_qt: video codec >%s<\n"), buf_video_name(this->video_type));
this->wavex.nChannels = quicktime_track_channels (this->qt, 0);
@@ -4195,7 +4217,7 @@ static int demux_qt_detect_compressors (demux_qt_t *this) {
} else if (!strncasecmp (audio, ".mp3", 4)) {
this->audio_type = BUF_AUDIO_MPEG;
} else {
- printf ("demux_qt: unknown audio codec >%s<\n",
+ LOG_MSG(this->xine, _("demux_qt: unknown audio codec >%s<\n"),
audio);
this->audio_type = BUF_CONTROL_NOP;
}
@@ -4220,14 +4242,14 @@ static void demux_qt_start (demux_plugin_t *this_gen,
* init quicktime parser
*/
- this->qt = quicktime_open (this->input);
+ this->qt = quicktime_open (this->input, this->xine);
if (!this->qt) {
this->status = DEMUX_FINISHED;
return;
}
- printf ("demux_qt: video codec %s (%f fps), audio codec %s (%ld Hz, %d bits)\n",
+ LOG_MSG(this->xine, _("demux_qt: video codec %s (%f fps), audio codec %s (%ld Hz, %d bits)\n"),
quicktime_video_compressor (this->qt,0),
quicktime_frame_rate (this->qt,0),
quicktime_audio_compressor (this->qt,0),
@@ -4306,7 +4328,7 @@ static void demux_qt_start (demux_plugin_t *this_gen,
this->status = DEMUX_OK ;
if ((err = pthread_create (&this->thread, NULL, demux_qt_loop, this)) != 0) {
- fprintf (stderr, "demux_qt: can't create new thread (%s)\n", strerror(err));
+ LOG_MSG_STDERR(this->xine, _("demux_qt: can't create new thread (%s)\n"), strerror(err));
exit (1);
}
}
@@ -4394,15 +4416,17 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_qt_t *this;
if (iface != 6) {
- printf( "demux_qt: plugin doesn't support plugin API version %d.\n"
- "demux_qt: this means there's a version mismatch between xine and this "
- "demux_qt: demuxer plugin.\nInstalling current demux plugins should help.\n",
+ LOG_MSG(xine,
+ _("demux_qt: plugin doesn't support plugin API version %d.\n"
+ " this means there's a version mismatch between xine and this "
+ " demuxer plugin.\nInstalling current demux plugins should help.\n"),
iface);
return NULL;
}
this = xine_xmalloc (sizeof (demux_qt_t));
this->config = xine->config;
+ this->xine = xine;
(void*) this->config->register_string(this->config,
"mrl.ends_qt", VALID_ENDS,
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index f27049d7b..9ae4f1525 100644
--- a/src/demuxers/demux_ts.c
+++ b/src/demuxers/demux_ts.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: demux_ts.c,v 1.31 2001/12/09 00:59:23 guenter Exp $
+ * $Id: demux_ts.c,v 1.32 2001/12/27 14:30:30 f1rmb Exp $
*
* Demultiplexer for MPEG2 Transport Streams.
*
@@ -71,6 +71,26 @@
#define VALID_MRLS "fifo,stdin"
#define VALID_ENDS "m2t,ts,trp"
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_DEMUX, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_DEMUX, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
/*
#define TS_LOG
*/
@@ -122,6 +142,8 @@ typedef struct {
* The first field must be the "base class" for the plugin!
*/
demux_plugin_t plugin;
+
+ xine_t *xine;
config_values_t *config;
@@ -212,7 +234,7 @@ static void demux_ts_parse_pat (demux_ts *this, unsigned char *original_pkt,
* indicator set.
*/
if (!pus) {
- printf ("demux_ts: demux error! PAT without payload unit start\n");
+ LOG_MSG(this->xine, _("demux_ts: demux error! PAT without payload unit start\n"));
return;
}
@@ -221,7 +243,7 @@ static void demux_ts_parse_pat (demux_ts *this, unsigned char *original_pkt,
*/
pkt += pkt[4];
if (pkt - original_pkt > PKT_SIZE) {
- printf ("demux_ts: demux error! PAT with invalid pointer\n");
+ LOG_MSG(this->xine, _("demux_ts: demux error! PAT with invalid pointer\n"));
return;
}
table_id = (unsigned int)pkt[5] ;
@@ -238,22 +260,22 @@ static void demux_ts_parse_pat (demux_ts *this, unsigned char *original_pkt,
crc32 |= (uint32_t)pkt[7+section_length] ;
#ifdef TS_LOG
- xprintf (VERBOSE|DEMUX,"PAT table_id=%d\n",
- table_id);
- xprintf (VERBOSE|DEMUX,"\tsection_syntax=%d\n",
- section_syntax_indicator);
- xprintf (VERBOSE|DEMUX,"\tsection_length=%d\n",
- section_length);
- xprintf (VERBOSE|DEMUX,"\ttransport_stream_id=0x%04x\n",
- transport_stream_id);
- xprintf (VERBOSE|DEMUX,"\tversion_number=%d\n",
- version_number);
- xprintf (VERBOSE|DEMUX,"\tcurrent_next_indicator=%d\n",
- current_next_indicator);
- xprintf (VERBOSE|DEMUX,"\tsection_number=%d\n",
- section_number);
- xprintf (VERBOSE|DEMUX,"\tlast_section_number=%d\n",
- last_section_number);
+ printf ("PAT table_id=%d\n",
+ table_id);
+ printf ("\tsection_syntax=%d\n",
+ section_syntax_indicator);
+ printf ("\tsection_length=%d\n",
+ section_length);
+ printf ("\ttransport_stream_id=0x%04x\n",
+ transport_stream_id);
+ printf ("\tversion_number=%d\n",
+ version_number);
+ printf ("\tcurrent_next_indicator=%d\n",
+ current_next_indicator);
+ printf ("\tsection_number=%d\n",
+ section_number);
+ printf ("\tlast_section_number=%d\n",
+ last_section_number);
#endif
if (!(current_next_indicator)) {
@@ -263,12 +285,12 @@ static void demux_ts_parse_pat (demux_ts *this, unsigned char *original_pkt,
return;
}
if (pkt - original_pkt > BODY_SIZE - 1 - 3 - (int)section_length) {
- printf ("demux_ts: demux error! PAT with invalid section length\n");
+ LOG_MSG(this->xine, _("demux_ts: demux error! PAT with invalid section length\n"));
return;
}
if ((section_number) || (last_section_number)) {
- printf ("demux_ts: demux error! PAT with invalid section %02x of %02x\n",
- section_number, last_section_number);
+ LOG_MSG(this->xine, _("demux_ts: demux error! PAT with invalid section %02x of %02x\n"),
+ section_number, last_section_number);
return;
}
@@ -277,8 +299,7 @@ static void demux_ts_parse_pat (demux_ts *this, unsigned char *original_pkt,
*/
calc_crc32 = demux_ts_compute_crc32(this, pkt+5, section_length+3-4, 0xffffffff);
if (crc32 != calc_crc32) {
- printf("demux_ts: demux error! PAT with invalid CRC32: packet_crc32=0x%08x calc_crc32=0x%08x\n",
- crc32,calc_crc32);
+ LOG_MSG(this->xine, _("demux_ts: demux error! PAT with invalid CRC32: packet_crc32=0x%08x calc_crc32=0x%08x\n"), crc32,calc_crc32);
return;
}
@@ -308,7 +329,7 @@ static void demux_ts_parse_pat (demux_ts *this, unsigned char *original_pkt,
program_count = 0;
while ((this->program_number[program_count] != INVALID_PROGRAM) ) {
#ifdef TS_LOG
- xprintf(VERBOSE|DEMUX, "PAT acquiring count=%d programNumber=0x%04x pmtPid=0x%04x\n",
+ printf("PAT acquiring count=%d programNumber=0x%04x pmtPid=0x%04x\n",
program_count,
this->program_number[program_count],
this->pmt_pid[program_count]);
@@ -318,7 +339,8 @@ static void demux_ts_parse_pat (demux_ts *this, unsigned char *original_pkt,
}
}
-static int demux_ts_parse_pes_header (demux_ts_media *m, uint8_t *buf, int packet_len) {
+static int demux_ts_parse_pes_header (demux_ts_media *m,
+ uint8_t *buf, int packet_len, xine_t *xine) {
unsigned char *p;
uint32_t header_len;
@@ -330,7 +352,7 @@ static int demux_ts_parse_pes_header (demux_ts_media *m, uint8_t *buf, int packe
/* we should have a PES packet here */
if (p[0] || p[1] || (p[2] != 1)) {
- printf ("demux_ts: error %02x %02x %02x (should be 0x000001) \n",p[0],p[1],p[2]);
+ LOG_MSG(xine, _("demux_ts: error %02x %02x %02x (should be 0x000001) \n"), p[0], p[1], p[2]);
return 0 ;
}
@@ -342,8 +364,8 @@ static int demux_ts_parse_pes_header (demux_ts_media *m, uint8_t *buf, int packe
return 0;
#ifdef TS_LOG
- xprintf(VERBOSE|DEMUX, "packet stream id = %02x len = %d\n",
- stream_id, packet_len);
+ printf("packet stream id = %02x len = %d\n",
+ stream_id, packet_len);
#endif
if (p[7] & 0x80) { /* PTS avail */
@@ -438,7 +460,7 @@ static int demux_ts_parse_pes_header (demux_ts_media *m, uint8_t *buf, int packe
} else {
#ifdef TS_LOG
- xprintf(VERBOSE | DEMUX, "unknown packet, id = %x\n",stream_id);
+ printf("unknown packet, id = %x\n",stream_id);
#endif
}
@@ -466,7 +488,7 @@ static void demux_ts_buffer_pes(demux_ts *this, unsigned char *ts,
demux_ts_media *m = &this->media[mediaIndex];
if (!m->fifo) {
- printf ("fifo unavailable (%d)\n", mediaIndex);
+ LOG_MSG(this->xine, _("fifo unavailable (%d)\n"), mediaIndex);
return; /* To avoid segfault if video out or audio out plugin not loaded */
@@ -478,7 +500,7 @@ static void demux_ts_buffer_pes(demux_ts *this, unsigned char *ts,
*/
if (m->counter != INVALID_CC) {
if ((m->counter & 0x0f) != cc) {
- printf("demux_ts: dropped input packet cc = %d expected = %d\n", cc, m->counter);
+ LOG_MSG(this->xine, _("demux_ts: dropped input packet cc = %d expected = %d\n"), cc, m->counter);
}
}
@@ -490,13 +512,13 @@ static void demux_ts_buffer_pes(demux_ts *this, unsigned char *ts,
/* new PES packet */
if (ts[0] || ts[1] || ts[2] != 1) {
- fprintf(stderr, "PUS set but no PES header (corrupt stream?)\n");
+ LOG_MSG_STDERR(this->xine, _("PUS set but no PES header (corrupt stream?)\n"));
return;
}
- if (!demux_ts_parse_pes_header(m, ts, len)) {
+ if (!demux_ts_parse_pes_header(m, ts, len, this->xine)) {
m->broken_pes = 1;
- printf ("demux_ts: broken pes encountered\n");
+ LOG_MSG(this->xine, _("demux_ts: broken pes encountered\n"));
} else {
m->broken_pes = 0;
buf = m->fifo->buffer_pool_alloc(m->fifo);
@@ -585,7 +607,9 @@ static void demux_ts_parse_pmt(demux_ts *this,
uint32_t last_section_number;
uint32_t crc32;
uint32_t calc_crc32;
+#ifdef TS_LOG
uint32_t i;
+#endif
unsigned int programInfoLength;
unsigned int codedLength;
unsigned int mediaIndex;
@@ -597,7 +621,7 @@ static void demux_ts_parse_pmt(demux_ts *this,
* indicator set.
*/
if (!pus) {
- fprintf (stderr, "demux error! PMT without payload unit start\n");
+ LOG_MSG_STDERR(this->xine, _("demux error! PMT without payload unit start\n"));
return;
}
@@ -606,7 +630,7 @@ static void demux_ts_parse_pmt(demux_ts *this,
*/
pkt += pkt[4];
if (pkt - originalPkt > PKT_SIZE) {
- fprintf (stderr, "demux error! PMT with invalid pointer\n");
+ LOG_MSG_STDERR(this->xine, _("demux error! PMT with invalid pointer\n"));
return;
}
table_id = (unsigned int)pkt[5] ;
@@ -623,22 +647,22 @@ static void demux_ts_parse_pmt(demux_ts *this,
crc32 |= (uint32_t)pkt[7+section_length] ;
#ifdef TS_LOG
- xprintf (VERBOSE|DEMUX,"PMT table_id=%d\n",
- table_id);
- xprintf (VERBOSE|DEMUX,"\tsection_syntax_indicator=%d\n",
- section_syntax_indicator);
- xprintf (VERBOSE|DEMUX,"\tsection_length=%d\n",
- section_length);
- xprintf (VERBOSE|DEMUX,"\tprogram_number=0x%04x\n",
- program_number);
- xprintf (VERBOSE|DEMUX,"\tversion_number=%d\n",
- version_number);
- xprintf (VERBOSE|DEMUX,"\tcurrent_next_indicator=%d\n",
- current_next_indicator);
- xprintf (VERBOSE|DEMUX,"\tsection_number=%d\n",
- section_number);
- xprintf (VERBOSE|DEMUX,"\tlast_section_number=%d\n",
- last_section_number);
+ printf ("PMT table_id=%d\n",
+ table_id);
+ printf ("\tsection_syntax_indicator=%d\n",
+ section_syntax_indicator);
+ printf ("\tsection_length=%d\n",
+ section_length);
+ printf ("\tprogram_number=0x%04x\n",
+ program_number);
+ printf ("\tversion_number=%d\n",
+ version_number);
+ printf ("\tcurrent_next_indicator=%d\n",
+ current_next_indicator);
+ printf ("\tsection_number=%d\n",
+ section_number);
+ printf ("\tlast_section_number=%d\n",
+ last_section_number);
#endif
if (!(current_next_indicator)) {
@@ -648,12 +672,12 @@ static void demux_ts_parse_pmt(demux_ts *this,
return;
}
if (pkt - originalPkt > BODY_SIZE - 1 - 3 - (int)section_length) {
- fprintf (stderr, "demux error! PMT with invalid section length\n");
+ LOG_MSG_STDERR(this->xine, _("demux error! PMT with invalid section length\n"));
return;
}
if ((section_number) || (last_section_number)) {
- fprintf (stderr, "demux error! PMT with invalid section %02x of %02x\n",
- section_number, last_section_number);
+ LOG_MSG_STDERR(this->xine, _("demux error! PMT with invalid section %02x of %02x\n"),
+ section_number, last_section_number);
return;
}
@@ -662,8 +686,7 @@ static void demux_ts_parse_pmt(demux_ts *this,
*/
calc_crc32 = demux_ts_compute_crc32(this, pkt+5, section_length+3-4, 0xffffffff);
if (crc32 != calc_crc32) {
- printf("demux_ts: demux error! PMT with invalid CRC32: packet_crc32=0x%08x calc_crc32=0x%08x\n",
- crc32,calc_crc32);
+ LOG_MSG(this->xine, _("demux_ts: demux error! PMT with invalid CRC32: packet_crc32=0x%08x calc_crc32=0x%08x\n"), crc32,calc_crc32);
return;
}
/*
@@ -675,7 +698,7 @@ static void demux_ts_parse_pmt(demux_ts *this,
stream = &pkt[17] + programInfoLength;
codedLength = 13 + programInfoLength;
if (codedLength > section_length) {
- fprintf (stderr, "demux error! PMT with inconsistent progInfo length\n");
+ LOG_MSG_STDERR(this->xine, _("demux error! PMT with inconsistent progInfo length\n"));
return;
}
section_length -= codedLength;
@@ -691,7 +714,7 @@ static void demux_ts_parse_pmt(demux_ts *this,
streamInfoLength = (((unsigned int)stream[3] & 0xf) << 8) | stream[4];
codedLength = 5 + streamInfoLength;
if (codedLength > section_length) {
- fprintf (stderr, "demux error! PMT with inconsistent streamInfo length\n");
+ LOG_MSG_STDERR(this->xine, _("demux error! PMT with inconsistent streamInfo length\n"));
return;
}
@@ -704,7 +727,7 @@ static void demux_ts_parse_pmt(demux_ts *this,
case ISO_13818_VIDEO:
if (this->videoPid == INVALID_PID) {
#ifdef TS_LOG
- xprintf(VERBOSE|DEMUX, "PMT video pid 0x%04x\n", pid);
+ printf("PMT video pid 0x%04x\n", pid);
#endif
demux_ts_pes_new(this, mediaIndex, pid, this->fifoVideo);
}
@@ -715,7 +738,7 @@ static void demux_ts_parse_pmt(demux_ts *this,
case ISO_13818_AUDIO:
if (this->audioPid == INVALID_PID) {
#ifdef TS_LOG
- xprintf(VERBOSE|DEMUX, "PMT audio pid 0x%04x\n", pid);
+ printf("PMT audio pid 0x%04x\n", pid);
#endif
demux_ts_pes_new(this, mediaIndex, pid, this->fifoAudio);
}
@@ -725,21 +748,21 @@ static void demux_ts_parse_pmt(demux_ts *this,
case ISO_13818_PRIVATE:
#ifdef TS_LOG
for(i=0;i<20;i++) {
- xprintf(VERBOSE|DEMUX, "%02x ", stream[i]);
+ printf("%02x ", stream[i]);
}
- xprintf(VERBOSE|DEMUX, "\n");
+ printf("\n");
#endif
break;
case PRIVATE_A52:
#ifdef TS_LOG
for(i=0;i<20;i++) {
- xprintf(VERBOSE|DEMUX, "%02x ", stream[i]);
+ printf("%02x ", stream[i]);
}
- xprintf(VERBOSE|DEMUX, "\n");
+ printf("\n");
#endif
if (this->audioPid == INVALID_PID) {
#ifdef TS_LOG
- xprintf(VERBOSE|DEMUX, "PMT audio pid 0x%04x\n", pid);
+ printf("PMT audio pid 0x%04x\n", pid);
#endif
demux_ts_pes_new(this, mediaIndex, pid, this->fifoAudio);
}
@@ -748,12 +771,12 @@ static void demux_ts_parse_pmt(demux_ts *this,
break;
default:
#ifdef TS_LOG
- xprintf(VERBOSE|DEMUX, "PMT stream_type unknown 0x%02x pid 0x%04x\n", stream[0], pid);
+ printf("PMT stream_type unknown 0x%02x pid 0x%04x\n", stream[0], pid);
for(i=0;i<20;i++) {
- xprintf(VERBOSE|DEMUX, "%02x ", stream[i]);
+ printf("%02x ", stream[i]);
}
- xprintf(VERBOSE|DEMUX, "\n");
+ printf("\n");
#endif
break;
@@ -772,16 +795,16 @@ static void demux_ts_parse_pmt(demux_ts *this,
#ifdef TS_LOG
if (this->pcrPid == INVALID_PID) {
- xprintf(VERBOSE|DEMUX, "PMT pcr pid 0x%04x\n", pid);
+ printf("PMT pcr pid 0x%04x\n", pid);
} else {
- xprintf(VERBOSE|DEMUX, "PMT pcr pid changed 0x%04x\n", pid);
+ printf("PMT pcr pid changed 0x%04x\n", pid);
}
#endif
this->pcrPid = pid;
}
}
-void correct_for_sync(demux_ts *this,uint8_t *buf) {
+void correct_for_sync(demux_ts *this, uint8_t *buf) {
int32_t n, read_length;
if((buf[0] == SYNC_BYTE) && (buf[PKT_SIZE] == SYNC_BYTE) &&
(buf[PKT_SIZE*2] == SYNC_BYTE) && (buf[PKT_SIZE*3] == SYNC_BYTE)) {
@@ -796,7 +819,7 @@ void correct_for_sync(demux_ts *this,uint8_t *buf) {
return;
}
}
- printf("RE-Sync failed\n"); /* Sync up here */
+ LOG_MSG(this->xine, _("RE-Sync failed\n")); /* Sync up here */
return;
}
@@ -852,19 +875,19 @@ static uint32_t demux_ts_adaptation_field_parse( uint8_t *data, uint32_t adaptat
adaptation_field_extension_flag = (data[0] & 0x01);
#ifdef TS_LOG
- xprintf(VERBOSE|DEMUX, "ADAPTATION FIELD length=%d\n",
- adaptation_field_length);
+ printf("ADAPTATION FIELD length=%d\n",
+ adaptation_field_length);
if(discontinuity_indicator) {
- xprintf(VERBOSE|DEMUX, "\tDiscontinuity indicator=%d\n",
- discontinuity_indicator);
+ printf("\tDiscontinuity indicator=%d\n",
+ discontinuity_indicator);
}
if(random_access_indicator) {
- xprintf(VERBOSE|DEMUX, "\tRandom_access indicator=%d\n",
- random_access_indicator);
+ printf("\tRandom_access indicator=%d\n",
+ random_access_indicator);
}
if(elementary_stream_priority_indicator) {
- xprintf(VERBOSE|DEMUX, "\tElementary_stream_priority_indicator=%d\n",
- elementary_stream_priority_indicator);
+ printf("\tElementary_stream_priority_indicator=%d\n",
+ elementary_stream_priority_indicator);
}
#endif
if(PCR_flag) {
@@ -875,8 +898,8 @@ static uint32_t demux_ts_adaptation_field_parse( uint8_t *data, uint32_t adaptat
PCR |= (data[offset+4] >> 7) & 0x01;
EPCR = ((data[offset+4] & 0x1) << 8) | data[offset+5];
#ifdef TS_LOG
- xprintf(VERBOSE|DEMUX, "\tPCR=%u, EPCR=%u\n",
- PCR,EPCR);
+ printf("\tPCR=%u, EPCR=%u\n",
+ PCR,EPCR);
#endif
offset+=6;
}
@@ -888,23 +911,23 @@ static uint32_t demux_ts_adaptation_field_parse( uint8_t *data, uint32_t adaptat
OPCR |= (data[offset+4] >> 7) & 0x01;
EOPCR = ((data[offset+4] & 0x1) << 8) | data[offset+5];
#ifdef TS_LOG
- xprintf(VERBOSE|DEMUX, "\tOPCR=%u,EOPCR=%u\n",
- OPCR,EOPCR);
+ printf("\tOPCR=%u,EOPCR=%u\n",
+ OPCR,EOPCR);
#endif
offset+=6;
}
#ifdef TS_LOG
if(slicing_point_flag) {
- xprintf(VERBOSE|DEMUX, "\tslicing_point_flag=%d\n",
- slicing_point_flag);
+ printf("\tslicing_point_flag=%d\n",
+ slicing_point_flag);
}
if(transport_private_data_flag) {
- xprintf(VERBOSE|DEMUX, "\ttransport_private_data_flag=%d\n",
- transport_private_data_flag);
+ printf("\ttransport_private_data_flag=%d\n",
+ transport_private_data_flag);
}
if(adaptation_field_extension_flag) {
- xprintf(VERBOSE|DEMUX, "\tadaptation_field_extension_flag=%d\n",
- adaptation_field_extension_flag);
+ printf("\tadaptation_field_extension_flag=%d\n",
+ adaptation_field_extension_flag);
}
#endif
return PCR;
@@ -944,11 +967,11 @@ static void demux_ts_parse_packet (demux_ts *this) {
* Discard packets that are obviously bad.
*/
if (sync_byte != 0x47) {
- fprintf (stderr, "demux error! invalid ts sync byte %02x\n",originalPkt[0]);
+ LOG_MSG_STDERR(this->xine, _("demux error! invalid ts sync byte %02x\n"), originalPkt[0]);
return;
}
if (transport_error_indicator) {
- fprintf (stderr, "demux error! transport error\n");
+ LOG_MSG_STDERR(this->xine, _("demux error! transport error\n"));
return;
}
@@ -972,7 +995,7 @@ static void demux_ts_parse_packet (demux_ts *this) {
if (data_len > PKT_SIZE) {
- printf ("demux_ts: demux error! invalid payload size %d\n",data_len);
+ LOG_MSG(this->xine, _("demux_ts: demux error! invalid payload size %d\n"), data_len);
} else {
@@ -981,14 +1004,14 @@ static void demux_ts_parse_packet (demux_ts *this) {
*/
if (pid == this->videoPid ) {
#ifdef TS_LOG
- xprintf(VERBOSE|DEMUX, "Video pid = 0x%04x\n",pid);
+ printf("Video pid = 0x%04x\n",pid);
#endif
demux_ts_buffer_pes (this, originalPkt+data_offset, this->videoMedia,
payload_unit_start_indicator, continuity_counter, data_len);
return;
} else if (pid == this->audioPid) {
#ifdef TS_LOG
- xprintf(VERBOSE|DEMUX, "Audio pid = 0x%04x\n",pid);
+ printf("Audio pid = 0x%04x\n",pid);
#endif
demux_ts_buffer_pes (this, originalPkt+data_offset, this->audioMedia,
payload_unit_start_indicator, continuity_counter, data_len);
@@ -998,7 +1021,7 @@ static void demux_ts_parse_packet (demux_ts *this) {
return;
} else if (pid == 0x1fff) {
#ifdef TS_LOG
- xprintf(VERBOSE|DEMUX,"Null Packet\n");
+ printf("Null Packet\n");
#endif
return;
}
@@ -1007,9 +1030,9 @@ static void demux_ts_parse_packet (demux_ts *this) {
while ((this->program_number[program_count] != INVALID_PROGRAM) ) {
if ( pid == this->pmt_pid[program_count] ) {
#ifdef TS_LOG
- xprintf(VERBOSE|DEMUX,"PMT prog 0x%04x pid 0x%04x\n",
- this->program_number[program_count],
- this->pmt_pid[program_count]);
+ printf("PMT prog 0x%04x pid 0x%04x\n",
+ this->program_number[program_count],
+ this->pmt_pid[program_count]);
#endif
demux_ts_parse_pmt (this, originalPkt, originalPkt+data_offset-4, payload_unit_start_indicator);
return;
@@ -1034,7 +1057,7 @@ static void *demux_ts_loop(void *gen_this) {
} while (this->status == DEMUX_OK) ;
#ifdef TS_LOG
- xprintf(VERBOSE|DEMUX, "demux loop finished (status: %d)\n", this->status);
+ printf("demux loop finished (status: %d)\n", this->status);
#endif
this->status = DEMUX_FINISHED;
@@ -1115,7 +1138,7 @@ static int demux_ts_open(demux_plugin_t *this_gen, input_plugin_t *input,
media = strstr(mrl, "://");
if (media) {
- fprintf (stderr, "demux %u ts_open! \n", __LINE__);
+ LOG_MSG_STDERR(this->xine, _("demux %u ts_open!\n"), __LINE__);
while((m = xine_strsep(&valid_mrls, ",")) != NULL) {
while(*m == ' ' || *m == '\t') m++;
@@ -1137,7 +1160,7 @@ static int demux_ts_open(demux_plugin_t *this_gen, input_plugin_t *input,
ending = strrchr(mrl, '.');
if (ending) {
#ifdef TS_LOG
- printf("demux_ts_open: ending %s of %s\n", ending, mrl);
+ LOG_MSG(this->xine, "demux_ts_open: ending %s of %s\n", ending, mrl);
#endif
xine_strdupa(valid_ends, (this->config->register_string(this->config,
@@ -1206,7 +1229,7 @@ static void demux_ts_start(demux_plugin_t *this_gen,
* Now start demuxing.
*/
if ((err = pthread_create(&this->thread, NULL, demux_ts_loop, this)) != 0) {
- fprintf(stderr, "demux_ts: can't create new thread (%s)\n", strerror(err));
+ LOG_MSG_STDERR(this->xine, _("demux_ts: can't create new thread (%s)\n"), strerror(err));
exit (1);
}
}
@@ -1217,7 +1240,7 @@ static void demux_ts_stop(demux_plugin_t *this_gen)
buf_element_t *buf;
void *p;
- printf ("demux_ts: stop...\n");
+ LOG_MSG(this->xine, _("demux_ts: stop...\n"));
if (this->status != DEMUX_OK) {
@@ -1263,18 +1286,20 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
int i;
if (iface != 6) {
- printf("demux_ts: plugin doesn't support plugin API version %d.\n"
- "demux_ts: this means there's a version mismatch between xine and this "
- "demux_ts: demuxer plugin.\nInstalling current demux plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("demux_ts: plugin doesn't support plugin API version %d.\n"
+ " this means there's a version mismatch between xine and this "
+ " demuxer plugin.\nInstalling current demux plugins should help.\n"),
+ iface);
return NULL;
}
-
+
/*
* Initialise the generic plugin.
*/
this = xine_xmalloc(sizeof(*this));
this->config = xine->config;
+ this->xine = xine;
(void*) this->config->register_string(this->config, "mrl.mrls_ts", VALID_MRLS,
"valid mrls for ts demuxer",
diff --git a/src/input/input_cda.c b/src/input/input_cda.c
index e11413ea4..1ac7de2d4 100644
--- a/src/input/input_cda.c
+++ b/src/input/input_cda.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: input_cda.c,v 1.12 2001/12/14 21:03:03 f1rmb Exp $
+ * $Id: input_cda.c,v 1.13 2001/12/27 14:30:30 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -69,6 +69,8 @@
#include "xineutils.h"
#include "input_plugin.h"
+extern int errno;
+
/*
#define DEBUG_DISC
#define DEBUG_POS
@@ -83,6 +85,26 @@
#define _LEAVE_FUNC()
#endif
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
#if defined(__sun)
#define CDROM "/vol/dev/aliases/cdrom0"
#else
@@ -115,6 +137,7 @@ typedef struct {
} trackinfo_t;
typedef struct {
+ xine_t *xine;
int fd;
char *device_name;
int cur_track;
@@ -435,7 +458,7 @@ static int _cda_load_cached_cddb_infos(cda_input_plugin_t *this) {
sprintf(cdir, "%s/%s", cdir, discid);
if((fd = fopen(cdir, "r")) == NULL) {
- fprintf(stderr, "input_cda: fopen(%s) failed: %s\n", cdir, strerror(errno));
+ LOG_MSG_STDERR(this->xine, _("input_cda: fopen(%s) failed: %s\n"), cdir, strerror(errno));
closedir(dir);
return 0;
}
@@ -493,7 +516,7 @@ static void _cda_save_cached_cddb_infos(cda_input_plugin_t *this, char *filecont
sprintf(cfile, "%s/%08lx", this->cddb.cache_dir, this->cda->disc_id);
if((fd = fopen(cfile, "w")) == NULL) {
- fprintf(stderr, "input_cda: fopen(%s) failed: %s\n", cfile, strerror(errno));
+ LOG_MSG(this->xine, _("input_cda: fopen(%s) failed: %s\n"), cfile, strerror(errno));
return;
}
else {
@@ -583,12 +606,12 @@ static void _cda_cddb_retrieve(cda_input_plugin_t *this) {
this->cddb.fd = _cda_cddb_socket_open(this);
if(this->cddb.fd >= 0) {
- printf("input_cda: server '%s:%d' successfuly connected.\n",
+ LOG_MSG(this->xine, _("input_cda: server '%s:%d' successfuly connected.\n"),
this->cddb.server, this->cddb.port);
}
else {
- printf("input_cda: opening server '%s:%d' failed: %s\n",
+ LOG_MSG(this->xine, _("input_cda: opening server '%s:%d' failed: %s\n"),
this->cddb.server, this->cddb.port, strerror(errno));
this->cda->have_cddb_info = 0;
return;
@@ -757,7 +780,7 @@ static int _cda_is_cd_changed(cdainfo_t *cda) {
return -1;
if((err = ioctl(cda->fd, CDROM_MEDIA_CHANGED, cd_changed)) < 0) {
- fprintf(stderr, "input_cda: ioctl(CDROM_MEDIA_CHANGED) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(this->xine, _("input_cda: ioctl(CDROM_MEDIA_CHANGED) failed: %s.\n"), strerror(errno));
return -1;
}
@@ -824,7 +847,7 @@ static int _cda_get_status_cd(cdainfo_t *cda) {
if(ioctl(cda->fd, CDROMSUBCHNL, &sc) < 0) {
#endif
- fprintf(stderr, "input_cda: ioctl(CDROMSUBCHNL) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMSUBCHNL) failed: %s.\n"), strerror(errno));
return 0;
}
@@ -959,25 +982,25 @@ static int _cda_play_chunk_cd(cdainfo_t *cda, int start, int end) {
#ifdef CDIOCSTART
if(ioctl(cda->fd, CDIOCSTART) < 0) {
- fprintf(stderr, "input_cda: ioctl(CDIOCSTART) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDIOCSTART) failed: %s.\n"), strerror(errno));
return 0;
}
#endif
#ifdef CDROMSTART
if (ioctl(cda->fd, CDROMSTART)) {
- fprintf(stderr, "input_cda: ioctl(CDROMSTART) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMSTART) failed: %s.\n"), strerror(errno));
return 0;
}
#endif
#ifdef CDIOCPLAYMSF
if(ioctl(cda->fd, CDIOCPLAYMSF, (char *)&cdmsf) < 0) {
- fprintf(stderr, "input_cda: ioctl(CDIOCPLAYMSF) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDIOCPLAYMSF) failed: %s.\n"), strerror(errno));
return 0;
}
#endif
#ifdef CDROMPLAYMSF
if(ioctl(cda->fd, CDROMPLAYMSF, &msf)) {
- fprintf(stderr, "input_cda: ioctl(CDROMPLAYMSF) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMPLAYMSF) failed: %s.\n"), strerror(errno));
return 0;
}
#endif
@@ -998,10 +1021,10 @@ static int _cda_open_cd(cdainfo_t *cda) {
if((cda->fd = open(cda->device_name, O_RDONLY)) < 0) {
#endif
if(errno == EACCES) {
- fprintf(stderr, "input_cda: No rights to open %s.\n", cda->device_name);
+ LOG_MSG_STDERR(cda->xine, _("input_cda: No rights to open %s.\n"), cda->device_name);
}
else if(errno != ENXIO) {
- fprintf(stderr, "input_cda: open(%s) failed: %s.\n", cda->device_name, strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: open(%s) failed: %s.\n"), cda->device_name, strerror(errno));
}
return 0;
@@ -1095,33 +1118,33 @@ static int _cda_eject_cd(cdainfo_t *cda) {
switch(status) {
case CDS_TRAY_OPEN:
if((err = ioctl(cda->fd, CDROMCLOSETRAY)) != 0) {
- fprintf(stderr, "input_cda: ioctl(CDROMCLOSETRAY) failed: %s\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMCLOSETRAY) failed: %s\n"), strerror(errno));
}
break;
case CDS_DISC_OK:
if((err = ioctl(cda->fd, CDROMEJECT)) != 0) {
- fprintf(stderr, "input_cda: ioctl(CDROMEJECT) failed: %s\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMEJECT) failed: %s\n"), strerror(errno));
}
break;
}
}
else {
- fprintf(stderr, "input_cda: ioctl(CDROM_DRIVE_STATUS) failed: %s\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROM_DRIVE_STATUS) failed: %s\n"), strerror(errno));
_cda_close_cd(cda);
return 0;
}
#elif defined (__FreeBSD__)
if(ioctl(cda->fd, CDIOCALLOW) == -1) {
- fprintf(stderr, "input_cda: ioctl(CDROMALLOW) failed: %s\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMALLOW) failed: %s\n"), strerror(errno));
}
else {
if(ioctl(cda->fd, CDIOCEJECT) == -1) {
- fprintf(stderr, "input_cda: ioctl(CDROMEJECT) failed: %s\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMEJECT) failed: %s\n"), strerror(errno));
}
}
#elif defined (__sun)
if((err = ioctl(cda->fd, CDROMEJECT)) != 0) {
- fprintf(stderr, "input_cda: ioctl(CDROMEJECT) failed: %s\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMEJECT) failed: %s\n"), strerror(errno));
}
#endif
@@ -1152,7 +1175,7 @@ static int _cda_read_toc_cd(cdainfo_t *cda) {
#ifdef CDIOREADTOCHEADER
if(ioctl(cda->fd, CDIOREADTOCHEADER, (char *)&cdth) < 0) {
- fprintf(stderr, "input_cda: ioctl(CDIOREADTOCHEADER) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDIOREADTOCHEADER) failed: %s.\n"), strerror(errno));
return 0;
}
@@ -1160,7 +1183,7 @@ static int _cda_read_toc_cd(cdainfo_t *cda) {
#endif
#ifdef CDROMREADTOCHDR
if(ioctl(cda->fd, CDROMREADTOCHDR, &hdr) < 0) {
- fprintf(stderr, "input_cda: ioctl(CDROMREADTOCHDR) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMREADTOCHDR) failed: %s.\n"), strerror(errno));
return 0;
}
@@ -1197,7 +1220,7 @@ static int _cda_read_toc_cd(cdainfo_t *cda) {
cdte.data_len = sizeof(toc_buffer);
if(ioctl(cda->fd, CDIOREADTOCENTRYS, (char *)&cdte) < 0) {
- fprintf(stderr, "input_cda: ioctl(CDIOREADTOCENTRYS) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDIOREADTOCENTRYS) failed: %s.\n"), strerror(errno));
return 0;
}
@@ -1220,7 +1243,7 @@ static int _cda_read_toc_cd(cdainfo_t *cda) {
entry.cdte_format = CDROM_MSF;
if(ioctl(cda->fd, CDROMREADTOCENTRY, &entry)) {
- fprintf(stderr, "input_cda: ioctl(CDROMREADTOCENTRY) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMREADTOCENTRY) failed: %s.\n"), strerror(errno));
return 0;
}
cda->track[i].track = i + 1;
@@ -1402,13 +1425,13 @@ static int cda_plugin_open (input_plugin_t *this_gen, char *mrl) {
filename = (char *) &mrl[6];
if(sscanf(filename, "%d", &this->cda->cur_track) != 1) {
- fprintf(stderr, "input_cda: malformed MRL. Use cda://<track #>\n");
+ LOG_MSG_STDERR(this->xine, _("input_cda: malformed MRL. Use cda://<track #>\n"));
_cda_free_cda(this->cda);
return 0;
}
if((!this->cda->cur_track) || (this->cda->cur_track > this->cda->num_tracks)) {
- fprintf(stderr, "input_cda: invalid track %d (valid range: 1 .. %d)\n",
+ LOG_MSG_STDERR(this->xine, _("input_cda: invalid track %d (valid range: 1 .. %d)\n"),
this->cda->cur_track, this->cda->num_tracks - 1);
_cda_free_cda(this->cda);
return 0;
@@ -1491,7 +1514,7 @@ static off_t cda_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin
break;
default:
- fprintf (stderr, "input_cda: error seek to origin %d not implemented!\n",
+ LOG_MSG_STDERR(this->xine, _("input_cda: error seek to origin %d not implemented!\n"),
origin);
return 0;
}
@@ -1604,7 +1627,7 @@ static void cda_plugin_stop (input_plugin_t *this_gen) {
static char *cda_plugin_get_description (input_plugin_t *this_gen) {
_ENTER_FUNC();
_LEAVE_FUNC();
- return "cd audio plugin as shipped with xine";
+ return _("cd audio plugin as shipped with xine");
}
/*
@@ -1778,11 +1801,12 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
_ENTER_FUNC();
if (iface != 5) {
- printf("cda input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("cda input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
@@ -1819,6 +1843,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->mrl = NULL;
this->cda = (cdainfo_t *) xine_xmalloc(sizeof(cdainfo_t));
+ this->cda->xine = xine;
this->cda->cur_track = -1;
this->cda->cur_pos = -1;
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c
index ddd20e73b..2edd6992f 100644
--- a/src/input/input_dvd.c
+++ b/src/input/input_dvd.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: input_dvd.c,v 1.40 2001/12/16 13:38:42 miguelfreitas Exp $
+ * $Id: input_dvd.c,v 1.41 2001/12/27 14:30:30 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -52,6 +52,28 @@
#include "dvd_udf.h"
#include "read_cache.h"
+extern int errno;
+
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
#if defined(__sun)
#define RDVD "/vol/dev/aliases/cdrom0"
#define DVD RDVD
@@ -63,6 +85,8 @@
typedef struct {
input_plugin_t input_plugin;
+
+ xine_t *xine;
char *mrl;
config_values_t *config;
@@ -118,7 +142,7 @@ static int openDrive (dvd_input_plugin_t *this) {
this->dvd_fd = open(this->device, O_RDONLY /* | O_NONBLOCK */ );
if (this->dvd_fd < 0) {
- printf ("input_dvd: unable to open dvd drive (%s): %s\n",
+ LOG_MSG(this->xine, _("input_dvd: unable to open dvd drive (%s): %s\n"),
this->device, strerror(errno));
return -1;
}
@@ -215,11 +239,11 @@ dvd_read_copyright(int fd, dvd_struct *s)
memset(buf, 0, sizeof(buf));
if (ioctl(fd, USCSICMD, &sc)) {
- perror("USCSICMD dvd_read_copyright");
+ LOG_MSG(this->xine, _("USCSICMD dvd_read_copyright: %s"), strerror(errno));
return -1;
}
if (sc.uscsi_status) {
- fprintf(stderr, "bad status: READ DVD STRUCTURE (copyright)\n");
+ LOG_MSG_STDERR(this->xine, _("bad status: READ DVD STRUCTURE (copyright)\n"));
return -1;
}
@@ -273,7 +297,7 @@ static int openDVDFile (dvd_input_plugin_t *this,
int encrypted=0;
if (openDrive(this) < 0) {
- printf ("input_dvd: cannot open dvd drive >%s<\n", this->device);
+ LOG_MSG(this->xine, _("input_dvd: cannot open dvd drive >%s<\n"), this->device);
return 0;
}
@@ -284,7 +308,7 @@ static int openDVDFile (dvd_input_plugin_t *this,
dvd.copyright.type = DVD_STRUCT_COPYRIGHT;
dvd.copyright.layer_num = 0;
if (ioctl (this->dvd_fd, DVD_READ_STRUCT, &dvd) < 0) {
- printf ("input_dvd: Could not read Copyright Structure\n");
+ LOG_MSG(this->xine, _("input_dvd: Could not read Copyright Structure\n"));
return 0;
}
encrypted = (dvd.copyright.cpst != 0) ;
@@ -297,7 +321,7 @@ static int openDVDFile (dvd_input_plugin_t *this,
dvd.layer_num = 0;
if (ioctl(this->dvd_fd, DVDIOCREADSTRUCTURE, &dvd) < 0) {
- printf ("input_dvd: Could not read Copyright Structure\n");
+ LOG_MSG(this->xine, _("input_dvd: Could not read Copyright Structure\n"));
return 0;
}
@@ -310,23 +334,24 @@ static int openDVDFile (dvd_input_plugin_t *this,
dvd.copyright.type = DVD_STRUCT_COPYRIGHT;
dvd.copyright.layer_num = 0;
if (dvd_read_copyright(this->raw_fd, &dvd) < 0)
- printf ("input_dvd: Could not read Copyright Structure.\n"
- " Assuming disk is not encrypted.\n");
+ LOG_MSG(this->xine, _("input_dvd: Could not read Copyright Structure.\n"
+ " Assuming disk is not encrypted.\n"));
else
encrypted = (dvd.copyright.cpst != 0);
}
#endif
if( encrypted ) {
- printf("\ninput_dvd: Sorry, xine doesn't play encrypted DVDs. The legal status of CSS\n"
- " decryption is unclear and we will not provide such code.\n\n");
+ LOG_MSG(this->xine,
+ _("\ninput_dvd: Sorry, xine doesn't play encrypted DVDs. The legal status of CSS\n"
+ " decryption is unclear and we will not provide such code.\n\n"));
return 0;
}
snprintf (str, sizeof(str), "/VIDEO_TS/%s", filename);
if (!(lbnum = UDFFindFile(this->dvd_fd, str, size))) {
- printf ("input_dvd: cannot open file >%s<\n", filename);
+ LOG_MSG(this->xine, _("input_dvd: cannot open file >%s<\n"), filename);
closeDrive (this);
@@ -371,7 +396,7 @@ static int dvd_plugin_open (input_plugin_t *this_gen, char *mrl) {
this->file_lbcur = this->file_lbstart;
if (!this->file_lbstart) {
- printf ("input_dvd: Unable to find >%s< on dvd.\n", filename);
+ LOG_MSG(this->xine, _("input_dvd: Unable to find >%s< on dvd.\n"), filename);
return 0;
}
@@ -406,7 +431,7 @@ static off_t dvd_plugin_read (input_plugin_t *this_gen,
if (nlen != DVD_VIDEO_LB_LEN) {
- printf ("input_dvd: error read: %Ld bytes is not a sector!\n",
+ LOG_MSG(this->xine, _("input_dvd: error read: %Ld bytes is not a sector!\n"),
nlen);
return 0;
@@ -422,12 +447,14 @@ static off_t dvd_plugin_read (input_plugin_t *this_gen,
this->file_size_left -= DVD_VIDEO_LB_LEN;
return DVD_VIDEO_LB_LEN;
- } else if (bytes_read < 0)
- printf ("input_dvd: read error in input_dvd plugin (%s)\n",
+ } else if (bytes_read < 0) {
+ LOG_MSG(this->xine, _("input_dvd: read error in input_dvd plugin (%s)\n"),
strerror (errno));
- else
- printf ("input_dvd: short read in input_dvd (%d != %d)\n",
+ }
+ else {
+ LOG_MSG(this->xine, _("input_dvd: short read in input_dvd (%d != %d)\n"),
bytes_read, DVD_VIDEO_LB_LEN);
+ }
return 0;
}
@@ -443,8 +470,9 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen,
* at STAGE_BY_CONTENT probe stage
*/
if(nlen != DVD_VIDEO_LB_LEN)
- printf ("input_dvd: error in input_dvd plugin read: %Ld bytes "
- "is not a sector!\n", nlen);
+ LOG_MSG(this->xine,
+ _("input_dvd: error in input_dvd plugin read: %Ld bytes "
+ "is not a sector!\n"), nlen);
return NULL;
}
@@ -455,7 +483,7 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen,
buf->type = BUF_DEMUX_BLOCK;
} else {
- printf ("input_dvd: read error in input_dvd plugin\n");
+ LOG_MSG(this->xine, _("input_dvd: read error in input_dvd plugin\n"));
}
@@ -488,7 +516,7 @@ static off_t dvd_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin
break;
default:
- printf ("input_dvd: seek: %d is an unknown origin\n", origin);
+ LOG_MSG(this->xine, _("input_dvd: seek: %d is an unknown origin\n"), origin);
}
return lseek (this->raw_fd,
@@ -529,19 +557,19 @@ static int dvd_plugin_eject_media (input_plugin_t *this_gen) {
switch(status) {
case CDS_TRAY_OPEN:
if((ret = ioctl(fd, CDROMCLOSETRAY)) != 0) {
- printf ("input_dvd: CDROMCLOSETRAY failed: %s\n",
+ LOG_MSG(this->xine, _("input_dvd: CDROMCLOSETRAY failed: %s\n"),
strerror(errno));
}
break;
case CDS_DISC_OK:
if((ret = ioctl(fd, CDROMEJECT)) != 0) {
- printf ("input_dvd: CDROMEJECT failed: %s\n", strerror(errno));
+ LOG_MSG(this->xine, _("input_dvd: CDROMEJECT failed: %s\n"), strerror(errno));
}
break;
}
}
else {
- printf ("input_dvd: CDROM_DRIVE_STATUS failed: %s\n",
+ LOG_MSG(this->xine, _("input_dvd: CDROM_DRIVE_STATUS failed: %s\n"),
strerror(errno));
close(fd);
return 0;
@@ -552,15 +580,15 @@ static int dvd_plugin_eject_media (input_plugin_t *this_gen) {
# if defined (__sun)
status = 0;
if ((ret = ioctl(fd, CDROMEJECT)) != 0) {
- printf("input_dvd: CDROMEJECT failed: %s\n", strerror(errno));
+ LOG_MSG(this->xine, _("input_dvd: CDROMEJECT failed: %s\n"), strerror(errno));
}
# else
if (ioctl(fd, CDIOCALLOW) == -1) {
- perror("ioctl(cdromallow)");
+ LOG_MSG(this->xine, _("ioctl(cdromallow): %s"), strerror(errno));
} else {
if (ioctl(fd, CDIOCEJECT) == -1) {
- perror("ioctl(cdromeject)");
+ LOG_MSG(this->xine, _("ioctl(cdromeject): %s"), strerror(errno));
}
}
# endif
@@ -587,7 +615,7 @@ static void dvd_plugin_stop (input_plugin_t *this_gen) {
static char *dvd_plugin_get_description (input_plugin_t *this_gen) {
- return "dvd device input plugin as shipped with xine";
+ return _("dvd device input plugin as shipped with xine");
}
@@ -661,7 +689,7 @@ static mrl_t **dvd_plugin_get_dir (input_plugin_t *this_gen,
}
else {
- printf ("input_dvd: unable to open dvd drive (%s): %s\n",
+ LOG_MSG(this->xine, _("input_dvd: unable to open dvd drive (%s): %s\n"),
this->device, strerror(errno));
return NULL;
}
@@ -721,7 +749,7 @@ static char **dvd_plugin_get_autoplay_list (input_plugin_t *this_gen,
close (fd);
} else {
- printf ("input_dvd: unable to open dvd drive (%s): %s\n",
+ LOG_MSG(this->xine, _("input_dvd: unable to open dvd drive (%s): %s\n"),
this->device, strerror(errno));
*nFiles = 0;
return NULL;
@@ -766,16 +794,18 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
int i;
if (iface != 5) {
- printf("dvd input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("dvd input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
this = (dvd_input_plugin_t *) xine_xmalloc (sizeof (dvd_input_plugin_t));
config = xine->config;
+ this->xine = xine;
for (i = 0; i < MAX_DIR_ENTRIES; i++) {
this->filelist[i] = (char *) xine_xmalloc(sizeof(char *) * 256);
diff --git a/src/input/input_file.c b/src/input/input_file.c
index 2003cd546..d06833df0 100644
--- a/src/input/input_file.c
+++ b/src/input/input_file.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: input_file.c,v 1.35 2001/12/14 21:03:03 f1rmb Exp $
+ * $Id: input_file.c,v 1.36 2001/12/27 14:30:30 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -43,6 +43,26 @@ extern int errno;
#define MAXFILES 65535
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
#ifndef S_ISLNK
#define S_ISLNK(mode) 0
#endif
@@ -67,6 +87,8 @@ extern int errno;
typedef struct {
input_plugin_t input_plugin;
+
+ xine_t *xine;
int fh;
int show_hidden_files;
@@ -175,7 +197,7 @@ static int _sortfiles_default(const mrl_t *s1, const mrl_t *s2) {
/*
* Return the type (OR'ed) of the given file *fully named*
*/
-static uint32_t get_file_type(char *filepathname, char *origin) {
+static uint32_t get_file_type(char *filepathname, char *origin, xine_t *xine) {
struct stat pstat;
int mode;
uint32_t file_type = 0;
@@ -184,7 +206,7 @@ static uint32_t get_file_type(char *filepathname, char *origin) {
if((lstat(filepathname, &pstat)) < 0) {
sprintf(buf, "%s/%s", origin, filepathname);
if((lstat(buf, &pstat)) < 0) {
- printf("lstat failed for %s{%s}\n", filepathname, origin);
+ LOG_MSG(xine, _("lstat failed for %s{%s}\n"), filepathname, origin);
file_type |= mrl_unknown;
return file_type;
}
@@ -267,7 +289,7 @@ static int file_plugin_open (input_plugin_t *this_gen, char *mrl) {
*subtitle = 0;
subtitle++;
- printf ("input_file: trying to open subtitle file '%s'\n",
+ LOG_MSG(this->xine, _("input_file: trying to open subtitle file '%s'\n"),
subtitle);
this->sub = fopen (subtitle, "r");
@@ -325,7 +347,7 @@ static buf_element_t *file_plugin_read_block (input_plugin_t *this_gen, fifo_buf
num_bytes = read (this->fh, buf->mem + total_bytes, todo-total_bytes);
if (num_bytes <= 0) {
if (num_bytes < 0)
- fprintf (stderr, "input_file: read error (%s)\n", strerror (errno));
+ LOG_MSG_STDERR(this->xine, _("input_file: read error (%s)\n"), strerror(errno));
buf->free_buffer (buf);
buf = NULL;
break;
@@ -469,7 +491,7 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
sprintf(dir_files[num_dir_files].mrl, "%s%s",
current_dir_slashed, pdirent->d_name);
dir_files[num_dir_files].link = NULL;
- dir_files[num_dir_files].type = get_file_type(fullfilename, current_dir);
+ dir_files[num_dir_files].type = get_file_type(fullfilename, current_dir, this->xine);
dir_files[num_dir_files].size = get_file_size(fullfilename, current_dir);
/* The file is a link, follow it */
@@ -481,13 +503,13 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX);
if(linksize < 0) {
- fprintf(stderr, "%s(%d): readlink() failed: %s\n",
- __XINE_FUNCTION__, __LINE__, strerror(errno));
+ LOG_MSG_STDERR(this->xine, _("%s(%d): readlink() failed: %s\n"),
+ __XINE_FUNCTION__, __LINE__, strerror(errno));
}
else {
dir_files[num_dir_files].link = (char *) xine_xmalloc(linksize + 1);
strncpy(dir_files[num_dir_files].link, linkbuf, linksize);
- dir_files[num_dir_files].type |= get_file_type(dir_files[num_dir_files].link, current_dir);
+ dir_files[num_dir_files].type |= get_file_type(dir_files[num_dir_files].link, current_dir, this->xine);
}
}
@@ -508,7 +530,7 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
sprintf(hide_files[num_hide_files].mrl, "%s%s",
current_dir_slashed, pdirent->d_name);
hide_files[num_hide_files].link = NULL;
- hide_files[num_hide_files].type = get_file_type(fullfilename, current_dir);
+ hide_files[num_hide_files].type = get_file_type(fullfilename, current_dir, this->xine);
hide_files[num_hide_files].size = get_file_size(fullfilename, current_dir);
/* The file is a link, follow it */
@@ -520,14 +542,14 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX);
if(linksize < 0) {
- fprintf(stderr, "%s(%d): readlink() failed: %s\n",
- __XINE_FUNCTION__, __LINE__, strerror(errno));
+ LOG_MSG_STDERR(this->xine, _("%s(%d): readlink() failed: %s\n"),
+ __XINE_FUNCTION__, __LINE__, strerror(errno));
}
else {
hide_files[num_hide_files].link = (char *)
xine_xmalloc(linksize + 1);
strncpy(hide_files[num_hide_files].link, linkbuf, linksize);
- hide_files[num_hide_files].type |= get_file_type(hide_files[num_hide_files].link, current_dir);
+ hide_files[num_hide_files].type |= get_file_type(hide_files[num_hide_files].link, current_dir, this->xine);
}
}
@@ -544,7 +566,7 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
sprintf(norm_files[num_norm_files].mrl, "%s%s",
current_dir_slashed, pdirent->d_name);
norm_files[num_norm_files].link = NULL;
- norm_files[num_norm_files].type = get_file_type(fullfilename, current_dir);
+ norm_files[num_norm_files].type = get_file_type(fullfilename, current_dir, this->xine);
norm_files[num_norm_files].size = get_file_size(fullfilename, current_dir);
/* The file is a link, follow it */
@@ -556,14 +578,14 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX);
if(linksize < 0) {
- fprintf(stderr, "%s(%d): readlink() failed: %s\n",
- __XINE_FUNCTION__, __LINE__, strerror(errno));
+ LOG_MSG_STDERR(this->xine, _("%s(%d): readlink() failed: %s\n"),
+ __XINE_FUNCTION__, __LINE__, strerror(errno));
}
else {
norm_files[num_norm_files].link = (char *)
xine_xmalloc(linksize + 1);
strncpy(norm_files[num_norm_files].link, linkbuf, linksize);
- norm_files[num_norm_files].type |= get_file_type(norm_files[num_norm_files].link, current_dir);
+ norm_files[num_norm_files].type |= get_file_type(norm_files[num_norm_files].link, current_dir, this->xine);
}
}
@@ -744,7 +766,7 @@ static void file_plugin_stop (input_plugin_t *this_gen) {
*
*/
static char *file_plugin_get_description (input_plugin_t *this_gen) {
- return "plain file input plugin as shipped with xine";
+ return _("plain file input plugin as shipped with xine");
}
/*
@@ -762,7 +784,7 @@ static int file_plugin_get_optional_data (input_plugin_t *this_gen,
file_input_plugin_t *this = (file_input_plugin_t *) this_gen;
- printf ("input_file: get optional data, type %08x, sub %p\n",
+ LOG_MSG(this->xine, _("input_file: get optional data, type %08x, sub %p\n"),
data_type, this->sub);
@@ -791,16 +813,18 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
config_values_t *config;
if (iface != 5) {
- printf("file input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("file input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
this = (file_input_plugin_t *) xine_xmalloc (sizeof (file_input_plugin_t));
config = xine->config;
+ this->xine = xine;
this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION;
this->input_plugin.get_capabilities = file_plugin_get_capabilities;
diff --git a/src/input/input_http.c b/src/input/input_http.c
index 406d9e41d..cb5cfae38 100644
--- a/src/input/input_http.c
+++ b/src/input/input_http.c
@@ -40,12 +40,36 @@
#include "xineutils.h"
#include "input_plugin.h"
+extern int errno;
+
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
#define BUFSIZE 1024
#define DEFAULT_HTTP_PORT 80
typedef struct {
input_plugin_t input_plugin;
+
+ xine_t *xine;
int fh;
char *mrl;
@@ -74,7 +98,7 @@ typedef struct {
} http_input_plugin_t;
-static int http_plugin_host_connect_attempt(struct in_addr ia, int port) {
+static int http_plugin_host_connect_attempt(struct in_addr ia, int port, xine_t *xine) {
int s;
struct sockaddr_in sin;
@@ -82,7 +106,7 @@ static int http_plugin_host_connect_attempt(struct in_addr ia, int port) {
s=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s==-1) {
- printf ("input_http: failed to open socket\n");
+ LOG_MSG(xine, _("input_http: failed to open socket\n"));
return -1;
}
@@ -91,7 +115,7 @@ static int http_plugin_host_connect_attempt(struct in_addr ia, int port) {
sin.sin_port = htons(port);
if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) {
- printf ("input_http: cannot connect to host\n");
+ LOG_MSG(xine, _("input_http: cannot connect to host\n"));
close(s);
return -1;
}
@@ -99,26 +123,26 @@ static int http_plugin_host_connect_attempt(struct in_addr ia, int port) {
return s;
}
-static int http_plugin_host_connect(const char *host, int port) {
+static int http_plugin_host_connect(const char *host, int port, xine_t *xine) {
struct hostent *h;
int i;
int s;
h=gethostbyname(host);
if (h==NULL) {
- printf ("input_http: unable to resolve >%s<\n", host);
+ LOG_MSG(xine, _("input_http: unable to resolve >%s<\n"), host);
return -1;
}
for(i=0; h->h_addr_list[i]; i++) {
struct in_addr ia;
memcpy(&ia, h->h_addr_list[i], 4);
- s=http_plugin_host_connect_attempt(ia, port);
+ s=http_plugin_host_connect_attempt(ia, port, xine);
if(s != -1)
return s;
}
- printf ("http: unable to connect to >%s<\n", host);
+ LOG_MSG(xine, _("http: unable to connect to >%s<\n"), host);
return -1;
}
@@ -312,16 +336,23 @@ static int http_plugin_open (input_plugin_t *this_gen, char *mrl) {
if (http_plugin_basicauth (this->user, this->password, this->auth, BUFSIZE))
return 0;
- printf ("input_http: opening >/%s< on host >%s<", this->filename, this->host);
- if(proxy != NULL)
- printf (" via proxy >%s<", this->proxyhost);
-
- printf ("\n");
+ {
+ char buf[256];
+
+ sprintf(buf, _("input_http: opening >/%s< on host >%s<"), this->filename, this->host);
+
+ if(proxy != NULL)
+ sprintf(buf, _("%s via proxy >%s<"), buf, this->proxyhost);
+
+ sprintf(buf, "%s\n", buf);
+
+ LOG_MSG(this->xine, buf);
+ }
if (proxy != NULL)
- this->fh = http_plugin_host_connect (this->proxyhost, this->proxyport);
+ this->fh = http_plugin_host_connect (this->proxyhost, this->proxyport, this->xine);
else
- this->fh = http_plugin_host_connect (this->host, this->port);
+ this->fh = http_plugin_host_connect (this->host, this->port, this->xine);
this->curpos = 0;
@@ -383,10 +414,10 @@ static int http_plugin_open (input_plugin_t *this_gen, char *mrl) {
switch (errno) {
case EAGAIN:
- printf ("input_http: EAGAIN\n");
+ LOG_MSG(this->xine, _("input_http: EAGAIN\n"));
continue;
default:
- printf ("input_http: read error\n");
+ LOG_MSG(this->xine, _("input_http: read error\n"));
return 0;
}
}
@@ -403,7 +434,7 @@ static int http_plugin_open (input_plugin_t *this_gen, char *mrl) {
linenum++;
- printf ("input_http: answer: >%s<\n", this->buf);
+ LOG_MSG(this->xine, _("input_http: answer: >%s<\n"), this->buf);
if (linenum == 1)
{
@@ -411,20 +442,20 @@ static int http_plugin_open (input_plugin_t *this_gen, char *mrl) {
char httpstatus[BUFSIZE];
if (sscanf(this->buf, "HTTP/%d.%d %d %[^\015\012]", &httpver, &httpsub,
- &httpcode, httpstatus) != 4)
+ &httpcode, httpstatus) != 4)
{
- printf ("input_http: invalid http answer\n");
+ LOG_MSG(this->xine, _("input_http: invalid http answer\n"));
return 0;
}
if (httpcode >= 300 && httpcode < 400) {
- printf ("input_http: 3xx redirection not implemented: >%d %s<\n",
- httpcode, httpstatus);
+ LOG_MSG(this->xine, _("input_http: 3xx redirection not implemented: >%d %s<\n"),
+ httpcode, httpstatus);
return 0;
}
if (httpcode < 200 || httpcode >= 300) {
- printf ("input_http: http status not 2xx: >%d %s<\n", httpcode,
- httpstatus);
+ LOG_MSG(this->xine, _("input_http: http status not 2xx: >%d %s<\n"),
+ httpcode, httpstatus);
return 0;
}
} else {
@@ -432,14 +463,14 @@ static int http_plugin_open (input_plugin_t *this_gen, char *mrl) {
off_t contentlength;
if (sscanf(this->buf, "Content-Length: %Ld", &contentlength) == 1) {
- printf ("input_http: content length = %Ld bytes\n", contentlength);
+ LOG_MSG(this->xine, _("input_http: content length = %Ld bytes\n"), contentlength);
this->contentlength = contentlength;
}
}
if (!strncasecmp(this->buf, "Location: ", 10))
{
- printf ("input_http: Location redirection not implemented\n");
+ LOG_MSG(this->xine, _("input_http: Location redirection not implemented\n"));
return 0;
}
}
@@ -452,7 +483,7 @@ static int http_plugin_open (input_plugin_t *this_gen, char *mrl) {
len ++;
}
- printf ("input_http: end of headers\n");
+ LOG_MSG(this->xine, _("input_http: end of headers\n"));
return 1;
}
@@ -472,10 +503,10 @@ static off_t http_plugin_read (input_plugin_t *this_gen,
switch (errno) {
case EAGAIN:
- printf ("input_http: EAGAIN\n");
+ LOG_MSG(this->xine, _("input_http: EAGAIN\n"));
continue;
default:
- printf ("input_http: read error\n");
+ LOG_MSG(this->xine, _("input_http: read error\n"));
return 0;
}
}
@@ -513,7 +544,7 @@ static buf_element_t *http_plugin_read_block (input_plugin_t *this_gen, fifo_buf
pthread_testcancel();
num_bytes = read (this->fh, buf->mem + total_bytes, todo-total_bytes);
if (num_bytes < 0) {
- printf ("input_http: read error (%s)\n", strerror (errno));
+ LOG_MSG(this->xine, _("input_http: read error (%s)\n"), strerror (errno));
buf->free_buffer (buf);
buf = NULL;
break;
@@ -570,7 +601,7 @@ static void http_plugin_stop (input_plugin_t *this_gen) {
}
static char *http_plugin_get_description (input_plugin_t *this_gen) {
- return "http network stream input plugin";
+ return _("http network stream input plugin");
}
static char *http_plugin_get_identifier (input_plugin_t *this_gen) {
@@ -595,16 +626,18 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
config_values_t *config;
if (iface != 5) {
- printf("http input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("http input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
this = (http_input_plugin_t *) xine_xmalloc(sizeof(http_input_plugin_t));
config = xine->config;
+ this->xine = xine;
this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION;
this->input_plugin.get_capabilities = http_plugin_get_capabilities;
diff --git a/src/input/input_net.c b/src/input/input_net.c
index fcf0914d9..682a4b784 100644
--- a/src/input/input_net.c
+++ b/src/input/input_net.c
@@ -41,15 +41,38 @@
#include "xineutils.h"
#include "input_plugin.h"
+extern int errno;
+
#if !defined(NDELAY) && defined(O_NDELAY)
#define FNDELAY O_NDELAY
#endif
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
#define NET_BS_LEN 2324
typedef struct {
input_plugin_t input_plugin;
+
+ xine_t *xine;
int fh;
char *mrl;
@@ -64,7 +87,7 @@ typedef struct {
/* **************************************************************** */
-static int host_connect_attempt(struct in_addr ia, int port) {
+static int host_connect_attempt(struct in_addr ia, int port, xine_t *xine) {
int s=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
struct sockaddr_in sin;
@@ -74,13 +97,13 @@ static int host_connect_attempt(struct in_addr ia, int port) {
if(s==-1)
{
- perror("socket");
+ LOG_MSG_STDERR(xine, _("socket(): %s\n"), strerror(errno));
return -1;
}
if(fcntl(s, F_SETFL, FNDELAY)==-1)
{
- perror("nonblocking");
+ LOG_MSG_STDERR(xine, _("fcntl(nonblocking): %s\n"), strerror(errno));
close(s);
return -1;
}
@@ -91,7 +114,7 @@ static int host_connect_attempt(struct in_addr ia, int port) {
if(connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS)
{
- perror("connect");
+ LOG_MSG_STDERR(xine, _("connect(): %s\n"), strerror(errno));
close(s);
return -1;
}
@@ -110,7 +133,7 @@ static int host_connect_attempt(struct in_addr ia, int port) {
return -1;
case -1:
/* Ermm.. ?? */
- perror("select");
+ LOG_MSG(xine, _("select(): %s\n"), strerror(errno));
close(s);
return -1;
}
@@ -118,7 +141,7 @@ static int host_connect_attempt(struct in_addr ia, int port) {
return s;
}
-static int host_connect(const char *host, int port) {
+static int host_connect(const char *host, int port, xine_t *xine) {
struct hostent *h;
int i;
int s;
@@ -126,7 +149,7 @@ static int host_connect(const char *host, int port) {
h=gethostbyname(host);
if(h==NULL)
{
- fprintf(stderr,"unable to resolve '%s'.\n", host);
+ LOG_MSG_STDERR(xine, _("unable to resolve '%s'.\n"), host);
return -1;
}
@@ -135,11 +158,11 @@ static int host_connect(const char *host, int port) {
{
struct in_addr ia;
memcpy(&ia, h->h_addr_list[i],4);
- s=host_connect_attempt(ia, port);
+ s = host_connect_attempt(ia, port, xine);
if(s != -1)
return s;
}
- fprintf(stderr, "unable to connect to '%s'.\n", host);
+ LOG_MSG_STDERR(xine, _("unable to connect to '%s'.\n"), host);
return -1;
}
/* **************************************************************** */
@@ -171,7 +194,7 @@ static int net_plugin_open (input_plugin_t *this_gen, char *mrl) {
sscanf(pptr,"%d", &port);
}
- this->fh = host_connect(filename, port);
+ this->fh = host_connect(filename, port, this->xine);
this->curpos = 0;
if (this->fh == -1) {
@@ -260,7 +283,7 @@ static void net_plugin_stop (input_plugin_t *this_gen) {
*
*/
static char *net_plugin_get_description (input_plugin_t *this_gen) {
- return "net input plugin as shipped with xine";
+ return _("net input plugin as shipped with xine");
}
/*
@@ -297,16 +320,18 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
config_values_t *config;
if (iface != 5) {
- printf("net input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("net input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
this = (net_input_plugin_t *) xine_xmalloc(sizeof(net_input_plugin_t));
config = xine->config;
+ this->xine = xine;
this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION;
this->input_plugin.get_capabilities = net_plugin_get_capabilities;
diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c
index 95ddc4363..9ca25cd0e 100644
--- a/src/input/input_rtp.c
+++ b/src/input/input_rtp.c
@@ -84,6 +84,28 @@
#include "xineutils.h"
#include "input_plugin.h"
+extern int errno;
+
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
#define RTP_BLOCKSIZE 2048
typedef struct _input_buffer {
@@ -96,6 +118,8 @@ typedef struct _input_buffer {
typedef struct {
input_plugin_t input_plugin;
+
+ xine_t *xine;
char *mrl;
config_values_t *config;
@@ -125,12 +149,12 @@ typedef struct {
/*
*
*/
-static int host_connect_attempt(struct in_addr ia, int port) {
+static int host_connect_attempt(struct in_addr ia, int port, xine_t *xine) {
int s=socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
struct sockaddr_in sin;
if(s==-1) {
- perror("socket");
+ LOG_MSG_STDERR(xine, _("socket(): %s.\n"), strerror(errno));
return -1;
}
@@ -140,7 +164,7 @@ static int host_connect_attempt(struct in_addr ia, int port) {
/* datagram socket */
if (bind(s, (struct sockaddr *)&sin, sizeof(sin))) {
- perror("bind failed");
+ LOG_MSG_STDERR(xine, _("bind(): %s.\n"), strerror(errno));
exit(1);
}
/* multicast ? */
@@ -158,7 +182,8 @@ static int host_connect_attempt(struct in_addr ia, int port) {
mreqn.imr_interface.s_addr = INADDR_ANY;
#endif
if (setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP,&mreqn,sizeof(mreqn))) {
- perror("setsockopt IP_ADD_MEMBERSHIP failed (multicast kernel?)");
+ LOG_MSG_STDERR(xine, _("setsockopt(IP_ADD_MEMBERSHIP) failed (multicast kernel?): %s.\n"),
+ strerror(errno));
exit(1);
}
}
@@ -169,7 +194,7 @@ static int host_connect_attempt(struct in_addr ia, int port) {
/*
*
*/
-static int host_connect(const char *host, int port) {
+static int host_connect(const char *host, int port, xine_t *xine) {
struct hostent *h;
int i;
int s;
@@ -177,7 +202,7 @@ static int host_connect(const char *host, int port) {
h=gethostbyname(host);
if(h==NULL)
{
- fprintf(stderr,"unable to resolve '%s'.\n", host);
+ LOG_MSG_STDERR(xine, _("unable to resolve '%s'.\n"), host);
return -1;
}
@@ -186,11 +211,11 @@ static int host_connect(const char *host, int port) {
{
struct in_addr ia;
memcpy(&ia, h->h_addr_list[i],4);
- s=host_connect_attempt(ia, port);
+ s = host_connect_attempt(ia, port, xine);
if(s != -1)
return s;
}
- fprintf(stderr, "unable to connect to '%s'.\n", host);
+ LOG_MSG_STDERR(xine, _("unable to connect to '%s'.\n"), host);
return -1;
}
@@ -213,7 +238,7 @@ static void * input_plugin_read_loop(void *arg) {
if (!(*this)->free_buffers) {
(*this)->input_eof = 1;
if (!warned) {
- printf("OUCH - ran out of buffers\n");
+ LOG_MSG((*this)->xine, _("OUCH - ran out of buffers\n"));
warned = 1;
}
pthread_cond_signal(&(*this)->buffer_notempty);
@@ -243,7 +268,8 @@ static void * input_plugin_read_loop(void *arg) {
/* For now - check whether we're dropping input */
if (++seq != *(unsigned short *)buf->buf) {
- printf("OUCH - dropped input packet %d %d\n", seq, *(unsigned short *)buf->buf);
+ LOG_MSG((*this)->xine, _("OUCH - dropped input packet %d %d\n"),
+ seq, *(unsigned short *)buf->buf);
seq = *(unsigned short *)buf->buf;
}
buf->buf[1] = buf->buf[0] = 0;
@@ -282,7 +308,7 @@ static int rtp_plugin_open (input_plugin_t *this_gen, char *mrl ) {
if(strncmp(filename, "//", 2)==0)
filename+=2;
- printf ("Opening >%s<\n", filename);
+ LOG_MSG(this->xine, _("Opening >%s<\n"), filename);
pptr=strrchr(filename, ':');
if(pptr)
@@ -293,7 +319,7 @@ static int rtp_plugin_open (input_plugin_t *this_gen, char *mrl ) {
if (this->fh != -1)
close(this->fh);
- this->fh = host_connect(filename, port);
+ this->fh = host_connect(filename, port, this->xine);
if (this->fh == -1) {
return 0;
@@ -310,8 +336,8 @@ static int rtp_plugin_open (input_plugin_t *this_gen, char *mrl ) {
pthread_attr_setdetachstate(&thread_attrs, PTHREAD_CREATE_DETACHED);
if ((err = pthread_create(&this->reader_thread, &thread_attrs,
input_plugin_read_loop, (void *)&this)) != 0) {
- fprintf (stderr, "input_rtp: can't create new thread (%s)\n",
- strerror(err));
+ LOG_MSG_STDERR(this->xine, _("input_rtp: can't create new thread (%s)\n"),
+ strerror(err));
exit (1);
}
pthread_attr_destroy(&thread_attrs);
@@ -421,7 +447,7 @@ static int rtp_plugin_eject_media (input_plugin_t *this_gen) {
*/
static char *rtp_plugin_get_description (input_plugin_t *this_gen) {
- return "rtp input plugin as shipped with xine";
+ return _("rtp input plugin as shipped with xine");
}
/*
@@ -460,27 +486,29 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
int bufn;
if (iface != 5) {
- printf("rtp input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("rtp input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
this = (rtp_input_plugin_t *) xine_xmalloc(sizeof(rtp_input_plugin_t));
config = xine->config;
+ this->xine = xine;
for (bufn = 0; bufn < N_BUFFERS; bufn++) {
input_buffer_t *buf = xine_xmalloc(sizeof(input_buffer_t));
if (!buf) {
- fprintf(stderr, "unable to allocate input buffer.\n");
+ LOG_MSG_STDERR(xine, _("unable to allocate input buffer.\n"));
exit(1);
}
buf->buf = xine_xmalloc(IBUFFER_SIZE);
if (!buf->buf) {
- fprintf(stderr, "unable to allocate input buffer.\n");
+ LOG_MSG_STDERR(xine, _("unable to allocate input buffer.\n"));
exit(1);
}
buf->next = this->free_buffers;
diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c
index 06b002b86..0db8e609e 100644
--- a/src/input/input_stdin_fifo.c
+++ b/src/input/input_stdin_fifo.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: input_stdin_fifo.c,v 1.17 2001/11/18 03:53:23 guenter Exp $
+ * $Id: input_stdin_fifo.c,v 1.18 2001/12/27 14:30:30 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -40,8 +40,32 @@
#include "xineutils.h"
#include "input_plugin.h"
+extern int errno;
+
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
typedef struct {
input_plugin_t input_plugin;
+
+ xine_t *xine;
int fh;
char *mrl;
@@ -225,7 +249,7 @@ static void stdin_plugin_stop(input_plugin_t *this_gen) {
*
*/
static char *stdin_plugin_get_description (input_plugin_t *this_gen) {
- return "stdin/fifo input plugin as shipped with xine";
+ return _("stdin/fifo input plugin as shipped with xine");
}
/*
@@ -253,16 +277,18 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
config_values_t *config;
if (iface != 5) {
- printf("rtp input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("stdin/fifo input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
this = (stdin_input_plugin_t *) xine_xmalloc(sizeof(stdin_input_plugin_t));
config = xine->config;
+ this->xine = xine;
this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION;
this->input_plugin.get_capabilities = stdin_plugin_get_capabilities;
diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c
index 99e685398..e86d8b57d 100644
--- a/src/input/input_vcd.c
+++ b/src/input/input_vcd.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: input_vcd.c,v 1.33 2001/12/10 12:56:54 f1rmb Exp $
+ * $Id: input_vcd.c,v 1.34 2001/12/27 14:30:30 f1rmb Exp $
*
*/
@@ -51,6 +51,28 @@
#include "xineutils.h"
#include "input_plugin.h"
+extern int errno;
+
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
#if defined(__sun)
#define CDROM "/vol/dev/aliases/cdrom0"
#else
@@ -79,6 +101,8 @@ typedef struct {
input_plugin_t input_plugin;
+ xine_t *xine;
+
char *mrl;
config_values_t *config;
@@ -130,7 +154,7 @@ static int input_vcd_read_toc (vcd_input_plugin_t *this) {
/* read TOC header */
if ( ioctl(this->fd, CDROMREADTOCHDR, &this->tochdr) == -1 ) {
- fprintf (stderr, "input_vcd : error in ioctl CDROMREADTOCHDR\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd : error in ioctl CDROMREADTOCHDR\n"));
return -1;
}
@@ -139,7 +163,8 @@ static int input_vcd_read_toc (vcd_input_plugin_t *this) {
this->tocent[i-1].cdte_track = i;
this->tocent[i-1].cdte_format = CDROM_MSF;
if ( ioctl(this->fd, CDROMREADTOCENTRY, &this->tocent[i-1]) == -1 ) {
- fprintf (stderr, "input_vcd: error in ioctl CDROMREADTOCENTRY for track %d\n", i);
+ LOG_MSG_STDERR(this->xine,
+ _("input_vcd: error in ioctl CDROMREADTOCENTRY for track %d\n"), i);
return -1;
}
}
@@ -150,7 +175,7 @@ static int input_vcd_read_toc (vcd_input_plugin_t *this) {
if (ioctl(this->fd, CDROMREADTOCENTRY,
&this->tocent[this->tochdr.cdth_trk1]) == -1 ) {
- fprintf (stderr, "input_vcd: error in ioctl CDROMREADTOCENTRY for lead-out\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: error in ioctl CDROMREADTOCENTRY for lead-out\n"));
return -1;
}
@@ -166,7 +191,7 @@ static int input_vcd_read_toc (vcd_input_plugin_t *this) {
/* read TOC header */
if ( ioctl(this->fd, CDIOREADTOCHEADER, &this->tochdr) == -1 ) {
- fprintf (stderr, "input_vcd : error in ioctl CDROMREADTOCHDR\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd : error in ioctl CDROMREADTOCHDR\n"));
return -1;
}
@@ -181,7 +206,7 @@ static int input_vcd_read_toc (vcd_input_plugin_t *this) {
te.data = this->tocent;
if ( ioctl(this->fd, CDIOREADTOCENTRYS, &te) == -1 ){
- fprintf (stderr, "input_vcd: error in ioctl CDROMREADTOCENTRY\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: error in ioctl CDROMREADTOCENTRY\n"));
return -1;
}
@@ -299,7 +324,7 @@ static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data)
return -1;
}
if (sc.uscsi_status) {
- fprintf(stderr, "scsi command failed with status %d\n", sc.uscsi_status);
+ LOG_MSG_STDERR(this->xine, _("scsi command failed with status %d\n"), sc.uscsi_status);
return -1;
}
}
@@ -340,14 +365,14 @@ static int vcd_plugin_open (input_plugin_t *this_gen, char *mrl) {
filename = (char *) &mrl[6];
if (sscanf (filename, "%d", &this->cur_track) != 1) {
- fprintf (stderr, "input_vcd: malformed MRL. Use vcd://<track #>\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: malformed MRL. Use vcd://<track #>\n"));
close (this->fd);
this->fd = -1;
return 0;
}
if (this->cur_track>=this->total_tracks) {
- fprintf (stderr, "input_vcd: invalid track %d (valid range: 0 .. %d)\n",
+ LOG_MSG_STDERR(this->xine, _("input_vcd: invalid track %d (valid range: 0 .. %d)\n"),
this->cur_track, this->total_tracks-1);
close (this->fd);
this->fd = -1;
@@ -362,7 +387,7 @@ static int vcd_plugin_open (input_plugin_t *this_gen, char *mrl) {
{
int bsize = 2352;
if (ioctl (this->fd, CDRIOCSETBLOCKSIZE, &bsize) == -1) {
- fprintf (stderr, "input_vcd: error in CDRIOCSETBLOCKSIZE %d\n", errno);
+ LOG_MSG_STDERR(this->xine, _("input_vcd: error in CDRIOCSETBLOCKSIZE %d\n"), errno);
return 0;
}
@@ -412,7 +437,7 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen,
memcpy (&data, &msf, sizeof (msf));
if (ioctl (this->fd, CDROMREADRAW, &data) == -1) {
- fprintf (stderr, "input_vcd: error in CDROMREADRAW\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: error in CDROMREADRAW\n"));
return 0;
}
@@ -447,11 +472,11 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen,
do {
if (lseek (this->fd, this->cur_sector * bsize, SEEK_SET) == -1) {
- fprintf (stderr, "input_vcd: seek error %d\n", errno);
+ LOG_MSG_STDERR(this->xine, _("input_vcd: seek error %d\n"), errno);
return 0;
}
if (read (this->fd, &data, bsize) == -1) {
- fprintf (stderr, "input_vcd: read error %d\n", errno);
+ LOG_MSG_STDERR(this->xine, _("input_vcd: read error %d\n"), errno);
return 0;
}
this->cur_sector++;
@@ -488,7 +513,7 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen,
lba = (this->cur_min * 60 + this->cur_sec) * 75L + this->cur_frame;
if (sun_vcd_read(this, lba, &data) < 0) {
- fprintf(stderr, "input_vcd: read data failed\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: read data failed\n"));
return 0;
}
@@ -549,7 +574,7 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen,
memcpy (&data, &msf, sizeof (msf));
if (ioctl (this->fd, CDROMREADRAW, &data) == -1) {
- fprintf (stderr, "input_vcd: error in CDROMREADRAW\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: error in CDROMREADRAW\n"));
return NULL;
}
@@ -589,11 +614,11 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen,
do {
if (lseek (this->fd, this->cur_sector * bsize, SEEK_SET) == -1) {
- fprintf (stderr, "input_vcd: seek error %d\n", errno);
+ LOG_MSG_STDERR(this->xine, _("input_vcd: seek error %d\n"), errno);
return NULL;
}
if (read (this->fd, &data, bsize) == -1) {
- fprintf (stderr, "input_vcd: read error %d\n", errno);
+ LOG_MSG_STDERR(this->xine, _("input_vcd: read error %d\n"), errno);
return NULL;
}
this->cur_sector++;
@@ -635,7 +660,7 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen,
lba = (this->cur_min * 60 + this->cur_sec) * 75L + this->cur_frame;
if (sun_vcd_read (this, lba, &data) < 0) {
- fprintf (stderr, "input_vcd: read data failed\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: read data failed\n"));
return NULL;
}
@@ -706,7 +731,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen,
break;
case SEEK_CUR:
if (offset)
- fprintf (stderr, "input_vcd: SEEK_CUR not implemented for offset != 0\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: SEEK_CUR not implemented for offset != 0\n"));
/*
printf ("input_vcd: current pos: %02d:%02d:%02d\n",
@@ -724,7 +749,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen,
break;
default:
- fprintf (stderr, "input_vcd: error seek to origin %d not implemented!\n",
+ LOG_MSG_STDERR(this->xine, _("input_vcd: error seek to origin %d not implemented!\n"),
origin);
return 0;
}
@@ -757,7 +782,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen,
case SEEK_CUR:
if (offset)
- fprintf (stderr, "input_vcd: SEEK_CUR not implemented for offset != 0\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: SEEK_CUR not implemented for offset != 0\n"));
sector_pos = this->cur_sector;
@@ -765,7 +790,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen,
break;
default:
- fprintf (stderr, "input_vcd: error seek to origin %d not implemented!\n",
+ LOG_MSG_STDERR(this->xine, _("input_vcd: error seek to origin %d not implemented!\n"),
origin);
return 0;
}
@@ -858,18 +883,18 @@ static int vcd_plugin_eject_media (input_plugin_t *this_gen) {
switch(status) {
case CDS_TRAY_OPEN:
if((ret = ioctl(this->fd, CDROMCLOSETRAY)) != 0) {
- printf ("input_vcd: CDROMCLOSETRAY failed: %s\n", strerror(errno));
+ LOG_MSG(this->xine, _("input_vcd: CDROMCLOSETRAY failed: %s\n"), strerror(errno));
}
break;
case CDS_DISC_OK:
if((ret = ioctl(this->fd, CDROMEJECT)) != 0) {
- printf ("input_vcd: CDROMEJECT failed: %s\n", strerror(errno));
+ LOG_MSG(this->xine, _("input_vcd: CDROMEJECT failed: %s\n"), strerror(errno));
}
break;
}
}
else {
- printf ("input_vcd: CDROM_DRIVE_STATUS failed: %s\n",
+ LOG_MSG(this->xine, _("input_vcd: CDROM_DRIVE_STATUS failed: %s\n"),
strerror(errno));
close(this->fd);
return 0;
@@ -905,7 +930,7 @@ static int vcd_plugin_eject_media (input_plugin_t *this_gen) {
if ((fd = open(this->device, O_RDONLY|O_NONBLOCK)) > -1) {
if ((ret = ioctl(fd, CDROMEJECT)) != 0) {
- printf ("input_vcd: CDROMEJECT failed: %s\n", strerror(errno));
+ LOG_MSG(this->xine, _("input_vcd: CDROMEJECT failed: %s\n"), strerror(errno));
}
close(fd);
}
@@ -935,7 +960,7 @@ static void vcd_plugin_stop (input_plugin_t *this_gen) {
*
*/
static char *vcd_plugin_get_description (input_plugin_t *this_gen) {
- return "plain file input plugin as shipped with xine";
+ return _("plain file input plugin as shipped with xine");
}
/*
@@ -963,8 +988,7 @@ static mrl_t **vcd_plugin_get_dir (input_plugin_t *this_gen,
this->fd = open (this->device, O_RDONLY);
if (this->fd == -1) {
- fprintf(stderr, "unable to open %s: ", this->device);
- perror ("");
+ LOG_MSG_STDERR(this->xine, _("unable to open %s: %s.\n"), this->device, strerror(errno));
return NULL;
}
@@ -972,7 +996,7 @@ static mrl_t **vcd_plugin_get_dir (input_plugin_t *this_gen,
close (this->fd);
this->fd = -1;
- printf ("vcd_read_toc failed\n");
+ LOG_MSG(this->xine, _("vcd_read_toc failed\n"));
return NULL;
}
@@ -1044,8 +1068,7 @@ static char **vcd_plugin_get_autoplay_list (input_plugin_t *this_gen,
this->fd = open (this->device, O_RDONLY);
if (this->fd == -1) {
- fprintf(stderr, "unable to open %s: ", this->device);
- perror ("");
+ LOG_MSG_STDERR(this->xine, _("unable to open %s: %s."), this->device, strerror(errno));
return NULL;
}
@@ -1053,7 +1076,7 @@ static char **vcd_plugin_get_autoplay_list (input_plugin_t *this_gen,
close (this->fd);
this->fd = -1;
- printf ("vcd_read_toc failed\n");
+ LOG_MSG(this->xine, _("vcd_read_toc failed\n"));
return NULL;
}
@@ -1108,17 +1131,19 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
int i;
if (iface != 5) {
- printf("vcd input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("vcd input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
this = (vcd_input_plugin_t *) xine_xmalloc(sizeof(vcd_input_plugin_t));
config = xine->config;
-
+ this->xine = xine;
+
for (i = 0; i < 100; i++) {
this->filelist[i] = (char *) xine_xmalloc(sizeof(char *) * 256);
}
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