summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-04-17 19:01:23 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-04-17 19:01:23 +0000
commit8f47c8446881b116b86721abb36af3bcb8159def (patch)
treea3a6977baa5a2bd810f13ba47bca8a9fe54f3167 /src
parent05e985d004bc397174a62d6f060b9742e9914087 (diff)
downloadxine-lib-8f47c8446881b116b86721abb36af3bcb8159def.tar.gz
xine-lib-8f47c8446881b116b86721abb36af3bcb8159def.tar.bz2
cleanup patch by Marco Z|hlke <M.Zuehlke@freenet.de>
CVS patchset: 4632 CVS date: 2003/04/17 19:01:23
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_rawdv.c20
-rw-r--r--src/demuxers/demux_real.c91
-rw-r--r--src/demuxers/demux_realaudio.c55
-rw-r--r--src/demuxers/demux_roq.c45
-rw-r--r--src/demuxers/demux_smjpeg.c47
-rw-r--r--src/demuxers/demux_snd.c56
-rw-r--r--src/demuxers/demux_str.c54
-rw-r--r--src/demuxers/demux_ts.c49
-rw-r--r--src/demuxers/demux_voc.c53
-rw-r--r--src/demuxers/demux_vox.c15
-rw-r--r--src/demuxers/demux_vqa.c60
-rw-r--r--src/demuxers/demux_wav.c53
-rw-r--r--src/demuxers/demux_wc3movie.c54
-rw-r--r--src/demuxers/demux_yuv4mpeg2.c68
-rw-r--r--src/xine-engine/demux.c46
-rw-r--r--src/xine-engine/load_plugins.c5
-rw-r--r--src/xine-engine/xine.c6
-rw-r--r--src/xine-engine/xine_internal.h4
18 files changed, 249 insertions, 532 deletions
diff --git a/src/demuxers/demux_rawdv.c b/src/demuxers/demux_rawdv.c
index d4a508d1d..9c12dc0a9 100644
--- a/src/demuxers/demux_rawdv.c
+++ b/src/demuxers/demux_rawdv.c
@@ -1,5 +1,5 @@
-/*
- * Copyright (C) 2000-2002 the xine project
+/*
+ * Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
@@ -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_rawdv.c,v 1.5 2003/03/07 00:44:53 miguelfreitas Exp $
+ * $Id: demux_rawdv.c,v 1.6 2003/04/17 19:01:26 miguelfreitas Exp $
*
* demultiplexer for raw dv streams
*
@@ -368,18 +368,12 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
- ending = strrchr(mrl, '.');
-
- if (!ending) {
- free (this);
- return NULL;
- }
-
- if (strncasecmp (ending, ".dv", 3) && strncasecmp (ending, ".dif", 4)) {
+ if (!xine_demux_check_extension (mrl, extensions)) {
free (this);
return NULL;
}
@@ -406,7 +400,7 @@ static char *get_identifier (demux_class_t *this_gen) {
}
static char *get_extensions (demux_class_t *this_gen) {
- return "dv";
+ return "dv dif";
}
static char *get_mimetypes (demux_class_t *this_gen) {
diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c
index df8aa7b62..88d0d377c 100644
--- a/src/demuxers/demux_real.c
+++ b/src/demuxers/demux_real.c
@@ -28,7 +28,7 @@
*
* Based on FFmpeg's libav/rm.c.
*
- * $Id: demux_real.c,v 1.48 2003/04/09 12:08:26 guenter Exp $
+ * $Id: demux_real.c,v 1.49 2003/04/17 19:01:26 miguelfreitas Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -1129,72 +1129,46 @@ static int real_check_stream_type(uint8_t *buf, int len)
}
static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *stream,
- input_plugin_t *input_gen) {
+ input_plugin_t *input) {
- input_plugin_t *input = (input_plugin_t *) input_gen;
demux_real_t *this;
- uint8_t buf[MAX_PREVIEW_SIZE+1];
- int len;
+ uint8_t buf[1024+1];
+ int len, stream_type=0;
switch (stream->content_detection_method) {
- case METHOD_BY_CONTENT:
- {
- if ((input->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) {
+ case METHOD_BY_CONTENT:{
- input->seek(input, 0, SEEK_SET);
-
- if ((len = input->read(input, buf, 1024))) {
+ if (!(len = xine_demux_read_header(input, buf, 1024)))
+ return NULL;
#ifdef LOG
- printf ("demux_real: input seekable, read 4 bytes: %02x %02x %02x %02x\n",
- buf[0], buf[1], buf[2], buf[3]);
+ printf ("demux_real: read 4 bytes: %02x %02x %02x %02x\n",
+ buf[0], buf[1], buf[2], buf[3]);
#endif
- if (!real_check_stream_type(buf,len))
- return NULL;
- } else
- return NULL;
-
- } else if ((len = input->get_optional_data (input, buf, INPUT_OPTIONAL_DATA_PREVIEW))) {
-
-#ifdef LOG
- printf ("demux_real: input provides preview, read 4 bytes: %02x %02x %02x %02x\n",
- buf[0], buf[1], buf[2], buf[3]);
-#endif
+ if (!(stream_type = real_check_stream_type(buf,len)))
+ return NULL;
+ }
- if (!real_check_stream_type(buf,len))
- return NULL;
- } else
- return NULL;
- }
-
#ifdef LOG
- printf ("demux_real: by content accepted.\n");
+ printf ("demux_real: by content accepted.\n");
#endif
break;
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
#ifdef LOG
- printf ("demux_real: by extension '%s'\n", mrl);
-#endif
-
- ending = strrchr(mrl, '.');
-
-#ifdef LOG
- printf ("demux_real: ending %s\n", ending);
+ printf ("demux_real: by extension '%s'\n", mrl);
#endif
- if (!ending)
- return NULL;
-
- if (strncasecmp (ending, ".rm", 3)
- && strncasecmp (ending, ".ram", 4))
+ if (!xine_demux_check_extension (mrl, extensions)) {
return NULL;
+ }
#ifdef LOG
printf ("demux_real: by extension accepted.\n");
@@ -1216,28 +1190,21 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->stream = stream;
this->input = input;
-
+
/* discover stream type */
- this->reference_mode = 0;
- if ((len = input->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) {
+ if(!stream_type)
+ if (len = xine_demux_read_header(this->input, buf, 1024))
+ stream_type = real_check_stream_type(buf,len);
- input->seek(input, 0, SEEK_SET);
+ if(stream_type == 2){
+ this->reference_mode = 1;
+#ifdef LOG
+ printf("demux_real: reference stream detected\n");
+#endif
+ }else
+ this->reference_mode = 0;
- if ( (len = input->read(input, buf, 1024)) > 0) {
- if (real_check_stream_type(buf,len) == 2)
- this->reference_mode = 1;
- }
- } else if ((len = input->get_optional_data (input, buf, INPUT_OPTIONAL_DATA_PREVIEW))) {
-
- if (real_check_stream_type(buf,len) == 2)
- this->reference_mode = 1;
- }
-
- if(this->reference_mode)
- printf("demux_real: reference stream detected\n");
-
-
this->demux_plugin.send_headers = demux_real_send_headers;
this->demux_plugin.send_chunk = demux_real_send_chunk;
this->demux_plugin.seek = demux_real_seek;
diff --git a/src/demuxers/demux_realaudio.c b/src/demuxers/demux_realaudio.c
index c8a32fc18..6d0115b97 100644
--- a/src/demuxers/demux_realaudio.c
+++ b/src/demuxers/demux_realaudio.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001-2002 the xine project
+ * Copyright (C) 2001-2003 the xine project
*
* This file is part of xine, a free video player.
*
@@ -19,7 +19,7 @@
*
* RealAudio File Demuxer by Mike Melanson (melanson@pcisys.net)
*
- * $Id: demux_realaudio.c,v 1.18 2003/03/31 19:31:56 tmmm Exp $
+ * $Id: demux_realaudio.c,v 1.19 2003/04/17 19:01:27 miguelfreitas Exp $
*
*/
@@ -85,32 +85,18 @@ static int open_ra_file(demux_ra_t *this) {
unsigned char file_header[RA_FILE_HEADER_SIZE];
unsigned char audio_header[RA_AUDIO_HEADER_SIZE];
- unsigned char preview[MAX_PREVIEW_SIZE];
/* check the signature */
- if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) {
- this->input->seek(this->input, 0, SEEK_SET);
- if (this->input->read(this->input, file_header, RA_FILE_HEADER_SIZE) !=
- RA_FILE_HEADER_SIZE)
- return 0;
- } else {
- this->input->get_optional_data(this->input, preview,
- INPUT_OPTIONAL_DATA_PREVIEW);
-
- /* copy over the header bytes for processing */
- memcpy(file_header, preview, RA_FILE_HEADER_SIZE);
- }
+ if (!xine_demux_read_header(this->input, file_header, RA_FILE_HEADER_SIZE))
+ return 0;
if ((file_header[0] != '.') ||
(file_header[1] != 'r') ||
(file_header[2] != 'a'))
return 0;
- /* file is qualified; if the input was not seekable, skip over the header
- * bytes in the stream */
- if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) == 0) {
- this->input->seek(this->input, RA_FILE_HEADER_SIZE, SEEK_SET);
- }
+ /* file is qualified; skip over the header bytes in the stream */
+ this->input->seek(this->input, RA_FILE_HEADER_SIZE, SEEK_SET);
/* load the audio header */
if (this->input->read(this->input, audio_header, RA_AUDIO_HEADER_SIZE) !=
@@ -324,42 +310,29 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
- case METHOD_BY_CONTENT:
- case METHOD_EXPLICIT:
-
- if (!open_ra_file(this)) {
- free (this);
- return NULL;
- }
-
- break;
-
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
- ending = strrchr(mrl, '.');
-
- if (!ending) {
+ if (!xine_demux_check_extension (mrl, extensions)) {
free (this);
return NULL;
}
+ }
+ /* falling through is intended */
- if (strncasecmp (ending, ".ra", 3)) {
- free (this);
- return NULL;
- }
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!open_ra_file(this)) {
free (this);
return NULL;
}
- }
-
break;
-
+
default:
free (this);
return NULL;
diff --git a/src/demuxers/demux_roq.c b/src/demuxers/demux_roq.c
index 4c6f45ec6..c03a66176 100644
--- a/src/demuxers/demux_roq.c
+++ b/src/demuxers/demux_roq.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2002 the xine project
+ * Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
@@ -21,7 +21,7 @@
* For more information regarding the RoQ file format, visit:
* http://www.csse.monash.edu.au/~timf/
*
- * $Id: demux_roq.c,v 1.37 2003/03/07 12:51:48 guenter Exp $
+ * $Id: demux_roq.c,v 1.38 2003/04/17 19:01:27 miguelfreitas Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -94,15 +94,17 @@ static int open_roq_file(demux_roq_t *this) {
unsigned int chunk_type;
unsigned int chunk_size;
- this->input->seek(this->input, 0, SEEK_SET);
- if (this->input->read(this->input, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
- RoQ_CHUNK_PREAMBLE_SIZE)
+ if (!xine_demux_read_header(this->input, preamble, RoQ_CHUNK_PREAMBLE_SIZE))
return 0;
/* check for the RoQ magic numbers */
if ((LE_16(&preamble[0]) != RoQ_MAGIC_NUMBER) ||
(LE_32(&preamble[2]) != 0xFFFFFFFF))
return 0;
+
+ /* file is qualified; skip over the header bytes in the stream */
+ this->input->seek(this->input, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_SET);
+
this->width = this->height = 0;
this->audio_channels = 0; /* assume no audio at first */
@@ -405,12 +407,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
input_plugin_t *input = (input_plugin_t *) input_gen;
demux_roq_t *this;
- if (! (input->get_capabilities(input) & INPUT_CAP_SEEKABLE)) {
- if (stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- printf(_("demux_roq.c: input not seekable, can not handle!\n"));
- return NULL;
- }
-
this = xine_xmalloc (sizeof (demux_roq_t));
this->stream = stream;
this->input = input;
@@ -431,40 +427,27 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
- case METHOD_BY_CONTENT:
- case METHOD_EXPLICIT:
-
- if (!open_roq_file(this)) {
- free (this);
- return NULL;
- }
-
- break;
-
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
- ending = strrchr(mrl, '.');
-
- if (!ending) {
+ if (!xine_demux_check_extension (mrl, extensions)) {
free (this);
return NULL;
}
+ }
+ /* falling through is intended */
- if (strncasecmp (ending, ".roq", 4)) {
- free (this);
- return NULL;
- }
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!open_roq_file(this)) {
free (this);
return NULL;
}
- }
-
break;
default:
diff --git a/src/demuxers/demux_smjpeg.c b/src/demuxers/demux_smjpeg.c
index 91b4ee131..c44b98708 100644
--- a/src/demuxers/demux_smjpeg.c
+++ b/src/demuxers/demux_smjpeg.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2002 the xine project
+ * Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
@@ -21,7 +21,7 @@
* For more information on the SMJPEG file format, visit:
* http://www.lokigames.com/development/smjpeg.php3
*
- * $Id: demux_smjpeg.c,v 1.37 2003/03/07 12:51:48 guenter Exp $
+ * $Id: demux_smjpeg.c,v 1.38 2003/04/17 19:01:27 miguelfreitas Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -113,13 +113,7 @@ static int open_smjpeg_file(demux_smjpeg_t *this) {
unsigned char signature[8];
unsigned char header_chunk[SMJPEG_HEADER_CHUNK_MAX_SIZE];
- /* initial state: no video and no audio (until headers found) */
- this->video_type = this->audio_type = 0;
- this->input_length = this->input->get_length (this->input);
-
- this->input->seek(this->input, 0, SEEK_SET);
- if (this->input->read(this->input, signature, SMJPEG_SIGNATURE_SIZE) !=
- SMJPEG_SIGNATURE_SIZE)
+ if (!xine_demux_read_header(this->input, signature, SMJPEG_SIGNATURE_SIZE))
return 0;
/* check for the SMJPEG signature */
@@ -133,11 +127,15 @@ static int open_smjpeg_file(demux_smjpeg_t *this) {
(signature[7] != 'G'))
return 0;
- /* jump over the version to the duration */
- this->input->seek(this->input, 4, SEEK_CUR);
+ /* file is qualified; jump over the header + version to the duration */
+ this->input->seek(this->input, SMJPEG_SIGNATURE_SIZE + 4, SEEK_SET);
if (this->input->read(this->input, header_chunk, 4) != 4)
return 0;
this->duration = BE_32(&header_chunk[0]);
+
+ /* initial state: no video and no audio (until headers found) */
+ this->video_type = this->audio_type = 0;
+ this->input_length = this->input->get_length (this->input);
/* traverse the header chunks until the HEND tag is found */
chunk_tag = 0;
@@ -439,40 +437,27 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
- case METHOD_BY_CONTENT:
- case METHOD_EXPLICIT:
-
- if (!open_smjpeg_file(this)) {
- free (this);
- return NULL;
- }
-
- break;
-
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
- ending = strrchr(mrl, '.');
-
- if (!ending) {
+ if (!xine_demux_check_extension (mrl, extensions)) {
free (this);
return NULL;
}
+ }
+ /* falling through is intended */
- if (strncasecmp (ending, ".mjpg", 5)) {
- free (this);
- return NULL;
- }
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!open_smjpeg_file(this)) {
free (this);
return NULL;
}
- }
-
break;
default:
diff --git a/src/demuxers/demux_snd.c b/src/demuxers/demux_snd.c
index 831ad542c..57b9a4557 100644
--- a/src/demuxers/demux_snd.c
+++ b/src/demuxers/demux_snd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001-2002 the xine project
+ * Copyright (C) 2001-2003 the xine project
*
* This file is part of xine, a free video player.
*
@@ -19,7 +19,7 @@
*
* SND/AU File Demuxer by Mike Melanson (melanson@pcisys.net)
*
- * $Id: demux_snd.c,v 1.28 2003/03/31 19:31:56 tmmm Exp $
+ * $Id: demux_snd.c,v 1.29 2003/04/17 19:01:28 miguelfreitas Exp $
*
*/
@@ -92,31 +92,17 @@ typedef struct {
static int open_snd_file(demux_snd_t *this) {
unsigned char header[SND_HEADER_SIZE];
- unsigned char preview[MAX_PREVIEW_SIZE];
unsigned int encoding;
- if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) {
- this->input->seek(this->input, 0, SEEK_SET);
- if (this->input->read(this->input, header, SND_HEADER_SIZE) !=
- SND_HEADER_SIZE)
- return 0;
- } else {
- this->input->get_optional_data(this->input, preview,
- INPUT_OPTIONAL_DATA_PREVIEW);
-
- /* copy over the header bytes for processing */
- memcpy(header, preview, SND_HEADER_SIZE);
- }
+ if (!xine_demux_read_header(this->input, header, SND_HEADER_SIZE))
+ return 0;
/* check the signature */
if (BE_32(&header[0]) != snd_TAG)
return 0;
- /* file is qualified; if the input was not seekable, skip over the header
- * bytes in the stream */
- if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) == 0) {
- this->input->seek(this->input, SND_HEADER_SIZE, SEEK_SET);
- }
+ /* file is qualified; skip over the header bytes in the stream */
+ this->input->seek(this->input, SND_HEADER_SIZE, SEEK_SET);
this->data_start = BE_32(&header[0x04]);
this->data_size = BE_32(&header[0x08]);
@@ -353,41 +339,27 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
- case METHOD_BY_CONTENT:
- case METHOD_EXPLICIT:
-
- if (!open_snd_file(this)) {
- free (this);
- return NULL;
- }
-
- break;
-
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
- ending = strrchr(mrl, '.');
-
- if (!ending) {
- free (this);
- return NULL;
- }
-
- if (strncasecmp (ending, ".snd", 4) ||
- strncasecmp (ending, ".au", 3)) {
+ if (!xine_demux_check_extension (mrl, extensions)) {
free (this);
return NULL;
}
+ }
+ /* falling through is intended */
+
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!open_snd_file(this)) {
free (this);
return NULL;
}
- }
-
break;
default:
diff --git a/src/demuxers/demux_str.c b/src/demuxers/demux_str.c
index 5591a0c6a..70c37a60c 100644
--- a/src/demuxers/demux_str.c
+++ b/src/demuxers/demux_str.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2002 the xine project
+ * Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
@@ -22,7 +22,7 @@
* This demuxer handles either raw STR files (which are just a concatenation
* of raw compact disc sectors) or STR files with RIFF headers.
*
- * $Id: demux_str.c,v 1.8 2003/04/02 03:20:42 tmmm Exp $
+ * $Id: demux_str.c,v 1.9 2003/04/17 19:01:30 miguelfreitas Exp $
*/
/* CD-XA format:
@@ -569,11 +569,6 @@ static int demux_str_get_optional_data(demux_plugin_t *this_gen,
return DEMUX_OPTIONAL_UNSUPPORTED;
}
-static char *get_extensions (demux_class_t *this_gen) {
- /* also .mov, but we don't want to hijack that extension */
- return "str iki ik2 dps dat xa xa1 xa2 xas xap";
-}
-
static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *stream,
input_plugin_t *input_gen) {
@@ -606,48 +601,26 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
- case METHOD_BY_CONTENT:
- case METHOD_EXPLICIT:
-
- if (!open_str_file(this)) {
- free (this);
- return NULL;
- }
- break;
-
case METHOD_BY_EXTENSION: {
- char *ending, *mrl, i, *extn;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
-
- ending = strrchr(mrl, '.');
-
- if (!ending) {
- free(this);
- return NULL;
- }
-
- /* find if any of the extensions match */
- extn = get_extensions((demux_class_t *) this);
- for (i = 0; *extn; extn++) {
- if (*extn == ' ') {
- if (ending[i+1] == '\0') break;
- }
- else {
- if (*extn == ending[i+1]) i++; else i = 0;
- }
- }
- if (ending[i+1] != '\0') {
+ extensions = class_gen->get_extensions (class_gen);
+
+ if (!xine_demux_check_extension (mrl, extensions)) {
free (this);
return NULL;
}
+ }
+ /* falling through is intended */
+
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!open_str_file(this)) {
free (this);
return NULL;
}
-
- }
break;
default:
@@ -668,6 +641,11 @@ static char *get_identifier (demux_class_t *this_gen) {
return "PSX STR";
}
+static char *get_extensions (demux_class_t *this_gen) {
+ /* also .mov, but we don't want to hijack that extension */
+ return "str iki ik2 dps dat xa xa1 xa2 xas xap";
+}
+
static char *get_mimetypes (demux_class_t *this_gen) {
return NULL;
}
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index 2f3721706..85304e283 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.80 2003/03/05 16:44:51 petli Exp $
+ * $Id: demux_ts.c,v 1.81 2003/04/17 19:01:31 miguelfreitas Exp $
*
* Demultiplexer for MPEG2 Transport Streams.
*
@@ -1825,27 +1825,11 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
switch (stream->content_detection_method) {
case METHOD_BY_CONTENT: {
- uint8_t buf[MAX_PREVIEW_SIZE];
- int got_sample;
+ uint8_t buf[2069];
int i, j;
int try_again, ts_detected;
- got_sample = 0;
-
- if ((input->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) {
- input->seek(input, 0, SEEK_SET);
-
- if (input->read(input, buf, 2069))
- got_sample = 1;
-
- } else if ((input->get_capabilities(input) & INPUT_CAP_PREVIEW) != 0) {
-
- input->get_optional_data (input, buf, INPUT_OPTIONAL_DATA_PREVIEW);
-
- got_sample = 1;
- }
-
- if (!got_sample)
+ if (!xine_demux_read_header(input, buf, 2069))
return NULL;
ts_detected = 0;
@@ -1874,30 +1858,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
break;
case METHOD_BY_EXTENSION: {
-
- char *mrl;
- char *ending;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
-
- /*
- * check extension
- */
-
- ending = strrchr (mrl, '.');
-
- if (ending) {
- if (!strncasecmp(ending, ".ts", 3) ||
- !strncasecmp(ending, ".m2t", 4) ||
- !strncasecmp(ending, ".trp", 4)) {
- break;
- }
- }
- /*
- * accept dvb streams
- */
+ /* check extension */
+ extensions = class_gen->get_extensions (class_gen);
+
+ if (xine_demux_check_extension (mrl, extensions))
+ break;
+ /* accept dvb streams */
if (!strncasecmp (mrl, "dvb://", 6))
break;
diff --git a/src/demuxers/demux_voc.c b/src/demuxers/demux_voc.c
index 76e19524c..e5f8e2ab7 100644
--- a/src/demuxers/demux_voc.c
+++ b/src/demuxers/demux_voc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001-2002 the xine project
+ * Copyright (C) 2001-2003 the xine project
*
* This file is part of xine, a free video player.
*
@@ -23,7 +23,7 @@
* It will only play that block if it is PCM data. More variations will be
* supported as they are encountered.
*
- * $Id: demux_voc.c,v 1.29 2003/03/31 19:31:58 tmmm Exp $
+ * $Id: demux_voc.c,v 1.30 2003/04/17 19:01:32 miguelfreitas Exp $
*
*/
@@ -96,31 +96,15 @@ static int open_voc_file(demux_voc_t *this) {
unsigned char preamble[BLOCK_PREAMBLE_SIZE];
off_t first_block_offset;
signed char sample_rate_divisor;
- unsigned char preview[MAX_PREVIEW_SIZE];
- if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) {
- this->input->seek(this->input, 0, SEEK_SET);
- if (this->input->read(this->input, header, VOC_HEADER_SIZE) !=
- VOC_HEADER_SIZE)
- return 0;
- } else {
- this->input->get_optional_data(this->input, preview,
- INPUT_OPTIONAL_DATA_PREVIEW);
-
- /* copy over the header bytes for processing */
- memcpy(header, preview, VOC_HEADER_SIZE);
- }
+ if (!xine_demux_read_header(this->input, header, VOC_HEADER_SIZE))
+ return 0;
/* check the signature */
if (strncmp(header, VOC_SIGNATURE, strlen(VOC_SIGNATURE)) != 0)
return 0;
- /* file is qualified; if the input was not seekable, skip over the header
- * bytes in the stream */
- if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) == 0) {
- this->input->seek(this->input, VOC_HEADER_SIZE, SEEK_SET);
- }
-
+ /* file is qualified */
first_block_offset = LE_16(&header[0x14]);
this->input->seek(this->input, first_block_offset, SEEK_SET);
@@ -351,40 +335,27 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
- case METHOD_BY_CONTENT:
- case METHOD_EXPLICIT:
-
- if (!open_voc_file(this)) {
- free (this);
- return NULL;
- }
-
- break;
-
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
- ending = strrchr(mrl, '.');
-
- if (!ending) {
+ if (!xine_demux_check_extension (mrl, extensions)) {
free (this);
return NULL;
}
+ }
+ /* falling through is intended */
- if (strncasecmp (ending, ".voc", 4)) {
- free (this);
- return NULL;
- }
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!open_voc_file(this)) {
free (this);
return NULL;
}
- }
-
break;
default:
diff --git a/src/demuxers/demux_vox.c b/src/demuxers/demux_vox.c
index f2bbc5b94..480ef3042 100644
--- a/src/demuxers/demux_vox.c
+++ b/src/demuxers/demux_vox.c
@@ -20,7 +20,7 @@
* VOX Demuxer by Mike Melanson (melanson@pcisys.net)
* This a demuxer for .vox files containing raw Dialogic ADPCM data.
*
- * $Id: demux_vox.c,v 1.3 2003/01/10 21:11:12 miguelfreitas Exp $
+ * $Id: demux_vox.c,v 1.4 2003/04/17 19:01:32 miguelfreitas Exp $
*
*/
@@ -224,22 +224,15 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
- ending = strrchr(mrl, '.');
-
- if (!ending) {
- free (this);
- return NULL;
- }
-
- if (strncasecmp (ending, ".vox", 4)) {
+ if (!xine_demux_check_extension (mrl, extensions)) {
free (this);
return NULL;
}
-
}
break;
diff --git a/src/demuxers/demux_vqa.c b/src/demuxers/demux_vqa.c
index 8447f2e37..7d2c8b636 100644
--- a/src/demuxers/demux_vqa.c
+++ b/src/demuxers/demux_vqa.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2002 the xine project
+ * Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
@@ -27,7 +27,7 @@
* block needs information from the previous audio block in order to be
* decoded, thus making random seeking difficult.
*
- * $Id: demux_vqa.c,v 1.27 2003/01/17 16:52:38 miguelfreitas Exp $
+ * $Id: demux_vqa.c,v 1.28 2003/04/17 19:01:32 miguelfreitas Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -111,14 +111,7 @@ static int open_vqa_file(demux_vqa_t *this) {
unsigned char scratch[12];
unsigned int chunk_size;
- /* get the actual filesize */
- if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) {
- this->filesize = this->input->get_length(this->input);
- this->input->seek(this->input, 0, SEEK_SET);
- } else
- this->filesize = 1;
-
- if (this->input->read(this->input, scratch, 12) != 12)
+ if (!xine_demux_read_header(this->input, scratch, 12))
return 0;
/* check for the VQA signatures */
@@ -126,8 +119,12 @@ static int open_vqa_file(demux_vqa_t *this) {
(BE_32(&scratch[8]) != WVQA_TAG))
return 0;
- /* skip to the start of the VQA header */
- this->input->seek(this->input, 8, SEEK_CUR);
+ /* file is qualified; skip to the start of the VQA header */
+ this->input->seek(this->input, 20, SEEK_SET);
+
+ /* get the actual filesize */
+ if ( !(this->filesize = this->input->get_length(this->input)) )
+ this->filesize = 1;
/* load the VQA header */
if (this->input->read(this->input, this->header, VQA_HEADER_SIZE)
@@ -357,13 +354,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
input_plugin_t *input = (input_plugin_t *) input_gen;
demux_vqa_t *this;
-/*
- if (! (input->get_capabilities(input) & INPUT_CAP_SEEKABLE)) {
- printf(_("demux_vqa.c: input not seekable, can not handle!\n"));
- return NULL;
- }
-*/
-
this = xine_xmalloc (sizeof (demux_vqa_t));
this->stream = stream;
this->input = input;
@@ -384,45 +374,27 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
- case METHOD_BY_CONTENT:
- case METHOD_EXPLICIT:
-
- if (!(this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE)) {
- free (this);
- return NULL;
- }
-
- if (!open_vqa_file(this)) {
- free (this);
- return NULL;
- }
-
- break;
-
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
- ending = strrchr(mrl, '.');
-
- if (!ending) {
+ if (!xine_demux_check_extension (mrl, extensions)) {
free (this);
return NULL;
}
+ }
+ /* falling through is intended */
- if (strncasecmp (ending, ".vqa", 4)) {
- free (this);
- return NULL;
- }
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!open_vqa_file(this)) {
free (this);
return NULL;
}
- }
-
break;
default:
diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c
index 6193a4b77..058c4052a 100644
--- a/src/demuxers/demux_wav.c
+++ b/src/demuxers/demux_wav.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001-2002 the xine project
+ * Copyright (C) 2001-2003 the xine project
*
* This file is part of xine, a free video player.
*
@@ -20,7 +20,7 @@
* MS WAV File Demuxer by Mike Melanson (melanson@pcisys.net)
* based on WAV specs that are available far and wide
*
- * $Id: demux_wav.c,v 1.40 2003/04/11 18:16:48 jcdutton Exp $
+ * $Id: demux_wav.c,v 1.41 2003/04/17 19:01:33 miguelfreitas Exp $
*
*/
@@ -90,21 +90,10 @@ static int open_wav_file(demux_wav_t *this) {
unsigned int chunk_tag;
unsigned int chunk_size;
unsigned char chunk_preamble[8];
- unsigned char preview[MAX_PREVIEW_SIZE];
/* check the signature */
- if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) {
- this->input->seek(this->input, 0, SEEK_SET);
- if (this->input->read(this->input, signature, WAV_SIGNATURE_SIZE) !=
- WAV_SIGNATURE_SIZE)
- return 0;
- } else {
- this->input->get_optional_data(this->input, preview,
- INPUT_OPTIONAL_DATA_PREVIEW);
-
- /* copy over the header bytes for processing */
- memcpy(signature, preview, WAV_SIGNATURE_SIZE);
- }
+ if (!xine_demux_read_header(this->input, signature, WAV_SIGNATURE_SIZE))
+ return 0;
if ((signature[0] != 'R') ||
(signature[1] != 'I') ||
@@ -120,11 +109,8 @@ static int open_wav_file(demux_wav_t *this) {
(signature[15] != ' '))
return 0;
- /* file is qualified; if the input was not seekable, skip over the header
- * bytes in the stream */
- if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) == 0) {
- this->input->seek(this->input, WAV_SIGNATURE_SIZE, SEEK_SET);
- }
+ /* file is qualified; skip over the header bytes in the stream */
+ this->input->seek(this->input, WAV_SIGNATURE_SIZE, SEEK_SET);
/* go after the format structure */
if (this->input->read(this->input,
@@ -380,40 +366,27 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
- case METHOD_BY_CONTENT:
- case METHOD_EXPLICIT:
-
- if (!open_wav_file(this)) {
- free (this);
- return NULL;
- }
-
- break;
-
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
- ending = strrchr(mrl, '.');
-
- if (!ending) {
+ if (!xine_demux_check_extension (mrl, extensions)) {
free (this);
return NULL;
}
+ }
+ /* falling through is intended */
- if (strncasecmp (ending, ".wav", 4)) {
- free (this);
- return NULL;
- }
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!open_wav_file(this)) {
free (this);
return NULL;
}
- }
-
break;
default:
diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c
index 115dbce56..f2290ac84 100644
--- a/src/demuxers/demux_wc3movie.c
+++ b/src/demuxers/demux_wc3movie.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2002 the xine project
+ * Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
@@ -22,7 +22,7 @@
* For more information on the MVE file format, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: demux_wc3movie.c,v 1.35 2003/02/22 14:06:48 esnel Exp $
+ * $Id: demux_wc3movie.c,v 1.36 2003/04/17 19:01:33 miguelfreitas Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -383,37 +383,22 @@ static int open_mve_file(demux_mve_t *this) {
unsigned char r, g, b;
int temp;
unsigned char header[WC3_HEADER_SIZE];
- unsigned char preview[MAX_PREVIEW_SIZE];
void *title;
/* these are the frame dimensions unless others are found */
this->video_width = WC3_USUAL_WIDTH;
this->video_height = WC3_USUAL_HEIGHT;
- if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) {
- this->input->seek(this->input, 0, SEEK_SET);
- if (this->input->read(this->input, header, WC3_HEADER_SIZE) !=
- WC3_HEADER_SIZE)
- return 0;
- } else {
- this->input->get_optional_data(this->input, preview,
- INPUT_OPTIONAL_DATA_PREVIEW);
-
- /* copy over the header bytes for processing */
- memcpy(header, preview, WC3_HEADER_SIZE);
- }
+ if (!xine_demux_read_header(this->input, header, WC3_HEADER_SIZE))
+ return 0;
if ((BE_32(&header[0]) != FORM_TAG) ||
(BE_32(&header[8]) != MOVE_TAG) ||
(BE_32(&header[12]) != PC_TAG))
return 0;
- /* file is qualified; if the input was not seekable, skip over the header
- * bytes in the stream */
- if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) == 0) {
- this->input->seek(this->input, WC3_HEADER_SIZE, SEEK_SET);
- }
-
+ /* file is qualified */
+
/* load the number of palettes, the only interesting piece of information
* in the _PC_ chunk; take it for granted that it will always appear at
* position 0x1C */
@@ -724,40 +709,27 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
- case METHOD_BY_CONTENT:
- case METHOD_EXPLICIT:
-
- if (!open_mve_file(this)) {
- free (this);
- return NULL;
- }
-
- break;
-
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
- ending = strrchr(mrl, '.');
-
- if (!ending) {
+ if (!xine_demux_check_extension (mrl, extensions)) {
free (this);
return NULL;
}
+ }
+ /* falling through is intended */
- if (strncasecmp (ending, ".mve", 4)) {
- free (this);
- return NULL;
- }
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!open_mve_file(this)) {
free (this);
return NULL;
}
- }
-
break;
default:
diff --git a/src/demuxers/demux_yuv4mpeg2.c b/src/demuxers/demux_yuv4mpeg2.c
index 1dec8ba3e..e72b260e7 100644
--- a/src/demuxers/demux_yuv4mpeg2.c
+++ b/src/demuxers/demux_yuv4mpeg2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2002 the xine project
+ * Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
@@ -22,7 +22,7 @@
* tools, visit:
* http://mjpeg.sourceforge.net/
*
- * $Id: demux_yuv4mpeg2.c,v 1.20 2003/04/02 03:20:43 tmmm Exp $
+ * $Id: demux_yuv4mpeg2.c,v 1.21 2003/04/17 19:01:33 miguelfreitas Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -92,28 +92,12 @@ typedef struct {
static int open_yuv4mpeg2_file(demux_yuv4mpeg2_t *this) {
unsigned char header[Y4M_HEADER_BYTES];
- unsigned char preview[MAX_PREVIEW_SIZE];
int i;
this->bih.biWidth = this->bih.biHeight = this->fps = this->data_start = 0;
- if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) {
-
- /* back to the start */
- this->input->seek(this->input, 0, SEEK_SET);
-
- /* read a chunk of bytes that should contain all the header info */
- if (this->input->read(this->input, header, Y4M_HEADER_BYTES) !=
- Y4M_HEADER_BYTES)
- return 0;
-
- } else {
- this->input->get_optional_data(this->input, preview,
- INPUT_OPTIONAL_DATA_PREVIEW);
-
- /* copy over the header bytes for processing */
- memcpy(header, preview, Y4M_HEADER_BYTES);
- }
+ if (!xine_demux_read_header(this->input, header, Y4M_HEADER_BYTES))
+ return 0;
/* check for the Y4M signature */
if (memcmp(header, Y4M_SIGNATURE, Y4M_SIGNATURE_SIZE) != 0)
@@ -163,7 +147,7 @@ static int open_yuv4mpeg2_file(demux_yuv4mpeg2_t *this) {
break;
this->data_start = i;
if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) {
- this->data_size = this->input->get_length(this->input) -
+ this->data_size = this->input->get_length(this->input) -
this->data_start;
}
@@ -172,17 +156,8 @@ static int open_yuv4mpeg2_file(demux_yuv4mpeg2_t *this) {
!this->fps || !this->data_start)
return 0;
- /* file is qualified; if the input was not seekable, read the header
- * bytes out of the stream */
- if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) == 0) {
-
- this->input->seek(this->input, this->data_start, SEEK_SET);
-
- } else {
-
- /* seek to first frame */
- this->input->seek(this->input, this->data_start, SEEK_SET);
- }
+ /* file is qualified; seek to first frame */
+ this->input->seek(this->input, this->data_start, SEEK_SET);
return 1;
}
@@ -210,7 +185,7 @@ static int demux_yuv4mpeg2_send_chunk(demux_plugin_t *this_gen) {
/* load and dispatch the raw frame */
bytes_remaining = this->frame_size;
- current_file_pos =
+ current_file_pos =
this->input->get_current_pos(this->input) - this->data_start;
pts = current_file_pos;
pts /= (this->frame_size + Y4M_FRAME_SIGNATURE_SIZE);
@@ -373,40 +348,27 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
- case METHOD_BY_CONTENT:
- case METHOD_EXPLICIT:
-
- if (!open_yuv4mpeg2_file(this)) {
- free (this);
- return NULL;
- }
-
- break;
-
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
- ending = strrchr(mrl, '.');
-
- if (!ending) {
+ if (!xine_demux_check_extension (mrl, extensions)) {
free (this);
return NULL;
}
+ }
+ /* falling through is intended */
- if (strncasecmp (ending, ".y4m", 4)) {
- free (this);
- return NULL;
- }
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!open_yuv4mpeg2_file(this)) {
free (this);
return NULL;
}
- }
-
break;
default:
diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c
index c1b78dcd8..8cafe9f78 100644
--- a/src/xine-engine/demux.c
+++ b/src/xine-engine/demux.c
@@ -149,7 +149,7 @@ void xine_demux_control_headers_done (xine_stream_t *stream) {
void xine_demux_control_start( xine_stream_t *stream ) {
buf_element_t *buf;
-
+
buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo);
buf->type = BUF_CONTROL_START;
stream->video_fifo->put (stream->video_fifo, buf);
@@ -332,6 +332,50 @@ int xine_demux_stop_thread (xine_stream_t *stream) {
return 0;
}
+int xine_demux_read_header( input_plugin_t *input, unsigned char *buffer, off_t size){
+ int read_size;
+ unsigned char *buf;
+
+ if (!input || !size || size > MAX_PREVIEW_SIZE)
+ return 0;
+
+ if (input->get_capabilities(input) & INPUT_CAP_SEEKABLE) {
+ input->seek(input, 0, SEEK_SET);
+ read_size = input->read(input, buffer, size);
+ if (read_size != size)
+ return 0;
+ input->seek(input, 0, SEEK_SET);
+ } else if (input->get_capabilities(input) & INPUT_CAP_PREVIEW) {
+ buf = xine_xmalloc(MAX_PREVIEW_SIZE);
+ read_size = input->get_optional_data(input, buf, INPUT_OPTIONAL_DATA_PREVIEW);
+ memcpy(buffer, buf, size);
+ free(buf);
+ } else {
+ return 0;
+ }
+ return read_size;
+}
+
+int xine_demux_check_extension (char *mrl, char *extensions){
+ char *last_dot, *e, *ext_copy, *ext_work;
+
+ ext_copy = strdup(extensions);
+ ext_work = ext_copy;
+
+ last_dot = strrchr (mrl, '.');
+ if (last_dot) {
+ last_dot++;
+ while ( ( e = xine_strsep(&ext_work, " ")) != NULL ) {
+ if (strcasecmp (last_dot, e) == 0) {
+ free(ext_copy);
+ return 1;
+ }
+ }
+ }
+ free(ext_copy);
+ return 0;
+}
+
/*
* read from socket/file descriptor checking demux_action_pending
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index 67832359b..cd96eb4b0 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.146 2003/04/13 16:08:26 tmattern Exp $
+ * $Id: load_plugins.c,v 1.147 2003/04/17 19:01:23 miguelfreitas Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -1157,6 +1157,9 @@ demux_plugin_t *find_demux_plugin_last_probe(xine_stream_t *stream, const char *
i++;
}
+ if( !last_demux )
+ return NULL;
+
stream->content_detection_method = METHOD_BY_CONTENT;
if ((plugin = ((demux_class_t *)last_demux->plugin_class)->open_plugin(last_demux->plugin_class, stream, input))) {
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 5281556b6..811a53888 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.242 2003/04/16 22:38:44 miguelfreitas Exp $
+ * $Id: xine.c,v 1.243 2003/04/17 19:01:24 miguelfreitas Exp $
*
* top-level xine functions
*
@@ -531,7 +531,7 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
if (!stream->input_plugin) {
xine_log (stream->xine, XINE_LOG_MSG,
- _("xine: cannot find input plugin for this MRL\n"));
+ _("xine: cannot find input plugin for MRL [%s]\n"),mrl);
stream->err = XINE_ERROR_NO_INPUT_PLUGIN;
return 0;
} else {
@@ -545,6 +545,8 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
}
if (!stream->input_plugin->open(stream->input_plugin)) {
+ xine_log (stream->xine, XINE_LOG_MSG,
+ _("xine: input plugin cannot open MRL [%s]\n"),mrl);
stream->input_plugin->dispose(stream->input_plugin);
stream->input_plugin = NULL;
stream->err = XINE_ERROR_INPUT_FAILED;
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 45291cea4..31bca19fa 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.134 2003/04/13 16:28:48 miguelfreitas Exp $
+ * $Id: xine_internal.h,v 1.135 2003/04/17 19:01:25 miguelfreitas Exp $
*
*/
@@ -306,6 +306,8 @@ void xine_demux_control_start (xine_stream_t *stream);
void xine_demux_control_end (xine_stream_t *stream, uint32_t flags);
int xine_demux_start_thread (xine_stream_t *stream);
int xine_demux_stop_thread (xine_stream_t *stream);
+int xine_demux_read_header (input_plugin_t *input, unsigned char *buffer, off_t size);
+int xine_demux_check_extension (char *mrl, char *extensions);
off_t xine_read_abort (xine_stream_t *stream, int fd, char *buf, off_t todo);