summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_realaudio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/demux_realaudio.c')
-rw-r--r--src/demuxers/demux_realaudio.c62
1 files changed, 29 insertions, 33 deletions
diff --git a/src/demuxers/demux_realaudio.c b/src/demuxers/demux_realaudio.c
index 0f1e5671c..c8a32fc18 100644
--- a/src/demuxers/demux_realaudio.c
+++ b/src/demuxers/demux_realaudio.c
@@ -19,7 +19,7 @@
*
* RealAudio File Demuxer by Mike Melanson (melanson@pcisys.net)
*
- * $Id: demux_realaudio.c,v 1.17 2003/03/07 12:51:48 guenter Exp $
+ * $Id: demux_realaudio.c,v 1.18 2003/03/31 19:31:56 tmmm Exp $
*
*/
@@ -85,18 +85,33 @@ 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 */
- 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;
+ 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 ((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);
+ }
+
/* load the audio header */
if (this->input->read(this->input, audio_header, RA_AUDIO_HEADER_SIZE) !=
RA_AUDIO_HEADER_SIZE)
@@ -219,6 +234,15 @@ static int demux_ra_seek (demux_plugin_t *this_gen,
demux_ra_t *this = (demux_ra_t *) this_gen;
+ this->seek_flag = 1;
+ this->status = DEMUX_OK;
+ xine_demux_flush_engine (this->stream);
+
+ /* if input is non-seekable, do not proceed with the rest of this
+ * seek function */
+ if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) == 0)
+ return this->status;
+
/* check the boundary offsets */
if (start_pos <= 0)
this->input->seek(this->input, this->data_start, SEEK_SET);
@@ -238,16 +262,6 @@ static int demux_ra_seek (demux_plugin_t *this_gen,
this->input->seek(this->input, start_pos, SEEK_SET);
}
- this->seek_flag = 1;
- this->status = DEMUX_OK;
- xine_demux_flush_engine (this->stream);
-
- /* if thread is not running, initialize demuxer */
- if( !this->stream->demux_thread_running ) {
-
- this->status = DEMUX_OK;
- }
-
return this->status;
}
@@ -290,12 +304,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_ra_t *this;
- if (! (input->get_capabilities(input) & INPUT_CAP_SEEKABLE)) {
- if (stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- printf(_("demux_ra.c: input not seekable, can not handle!\n"));
- return NULL;
- }
-
this = xine_xmalloc (sizeof (demux_ra_t));
this->stream = stream;
this->input = input;
@@ -402,15 +410,3 @@ void *demux_realaudio_init_plugin (xine_t *xine, void *data) {
return this;
}
-
-/*
- * exported plugin catalog entry
- */
-
-#if 0
-plugin_info_t xine_plugin_info[] = {
- /* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 20, "realaudio", XINE_VERSION_CODE, NULL, demux_realaudio_init_plugin },
- { PLUGIN_NONE, 0, "", 0, NULL, NULL }
-};
-#endif