summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2003-02-22 01:11:54 +0000
committerMike Melanson <mike@multimedia.cx>2003-02-22 01:11:54 +0000
commitade7755be117831c410d2e5b7b3d181509aca9e8 (patch)
tree22f12c43c9c84f7eae2dddcc6fa61d1f9f826317
parent1c7b0b96cfdca540ca8519aaad5263856ae30318 (diff)
downloadxine-lib-ade7755be117831c410d2e5b7b3d181509aca9e8.tar.gz
xine-lib-ade7755be117831c410d2e5b7b3d181509aca9e8.tar.bz2
Id CIN demuxer now works on top of non-seekable input
CVS patchset: 4237 CVS date: 2003/02/22 01:11:54
-rw-r--r--src/demuxers/demux_idcin.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c
index 3ed9b3a70..fcaaf4318 100644
--- a/src/demuxers/demux_idcin.c
+++ b/src/demuxers/demux_idcin.c
@@ -63,7 +63,7 @@
* - if any bytes exceed 63, do not shift the bytes at all before
* transmitting them to the video decoder
*
- * $Id: demux_idcin.c,v 1.37 2003/01/25 03:04:15 tmmm Exp $
+ * $Id: demux_idcin.c,v 1.38 2003/02/22 01:11:54 tmmm Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -299,11 +299,20 @@ static int demux_idcin_send_chunk(demux_plugin_t *this_gen) {
static int open_idcin_file(demux_idcin_t *this) {
unsigned char header[IDCIN_HEADER_SIZE];
+ unsigned char preview[MAX_PREVIEW_SIZE];
- this->input->seek(this->input, 0, SEEK_SET);
- if (this->input->read(this->input, header, IDCIN_HEADER_SIZE) !=
- IDCIN_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, header, IDCIN_HEADER_SIZE) !=
+ IDCIN_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, IDCIN_HEADER_SIZE);
+ }
/*
* This is what you could call a "probabilistic" file check: Id CIN
@@ -350,6 +359,14 @@ static int open_idcin_file(demux_idcin_t *this) {
this->audio_channels,
this->audio_bytes_per_sample * 8);
+ /* 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) {
+ if (this->input->read(this->input, header, IDCIN_HEADER_SIZE) !=
+ IDCIN_HEADER_SIZE)
+ return 0;
+ }
+
/* read the Huffman table */
if (this->input->read(this->input, this->huffman_table,
HUFFMAN_TABLE_SIZE) != HUFFMAN_TABLE_SIZE)
@@ -492,11 +509,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_idcin_t *this;
- if (! (input->get_capabilities(input) & INPUT_CAP_SEEKABLE)) {
- printf(_("demux_idcin.c: input not seekable, can not handle!\n"));
- return NULL;
- }
-
this = xine_xmalloc (sizeof (demux_idcin_t));
this->stream = stream;
this->input = input;