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