summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_mpeg_block.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/demux_mpeg_block.c')
-rw-r--r--src/demuxers/demux_mpeg_block.c61
1 files changed, 42 insertions, 19 deletions
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,