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