summaryrefslogtreecommitdiff
path: root/src/demuxers
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers')
-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
11 files changed, 534 insertions, 272 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",