diff options
author | Bastien Nocera <hadess@users.sourceforge.net> | 2004-05-10 11:24:28 +0000 |
---|---|---|
committer | Bastien Nocera <hadess@users.sourceforge.net> | 2004-05-10 11:24:28 +0000 |
commit | 0866d6198652125e8be97f5f6a003c9baf11548a (patch) | |
tree | c46a570b2b4f1f369eb9584db587ee22f18f2903 | |
parent | e4da3b029f96ca42390ef851e4366cbebafce7b0 (diff) | |
download | xine-lib-0866d6198652125e8be97f5f6a003c9baf11548a.tar.gz xine-lib-0866d6198652125e8be97f5f6a003c9baf11548a.tar.bz2 |
- remove dirty hack from the Program stream demuxer, and look deeper for a
header when using the Elementary stream demuxer
Hopefully that didn't break anything ;)
CVS patchset: 6513
CVS date: 2004/05/10 11:24:28
-rw-r--r-- | src/demuxers/demux_elem.c | 22 | ||||
-rw-r--r-- | src/demuxers/demux_mpeg.c | 4 |
2 files changed, 19 insertions, 7 deletions
diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c index 4c4d658e4..d9a740ba3 100644 --- a/src/demuxers/demux_elem.c +++ b/src/demuxers/demux_elem.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_elem.c,v 1.81 2004/01/12 17:35:14 miguelfreitas Exp $ + * $Id: demux_elem.c,v 1.82 2004/05/10 11:24:28 hadess Exp $ * * demultiplexer for elementary mpeg streams */ @@ -46,6 +46,7 @@ #include "demux.h" #define NUM_PREVIEW_BUFFERS 50 +#define SCRATCH_SIZE 256 typedef struct { demux_plugin_t demux_plugin; @@ -192,14 +193,25 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_CONTENT: { - uint8_t scratch[4]; + uint8_t scratch[SCRATCH_SIZE]; + int i, read, found; - if (_x_demux_read_header(input, scratch, 4) != 4) + read = _x_demux_read_header(input, scratch, SCRATCH_SIZE); + if (!read) return NULL; - lprintf ("%02x %02x %02x %02x\n", scratch[0], scratch[1], scratch[2], scratch[3]); + found = 0; + for (i = 0; i < read - 4; i++) { + lprintf ("%02x %02x %02x %02x\n", scratch[i], scratch[i+1], scratch[i+2], scratch[i+3]); - if (scratch[0] || scratch[1] || (scratch[2] != 0x01) || (scratch[3] != 0xb3)) + if (!scratch[i] && !scratch[i+1] && (scratch[i+2] == 0x01) && (scratch[i+3] == 0xb3)) { + found = 1; + lprintf ("found header at offset 0x%x\n", i); + break; + } + } + + if (found == 0) return NULL; lprintf ("input accepted.\n"); } diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c index 706b8b175..4584fbb34 100644 --- a/src/demuxers/demux_mpeg.c +++ b/src/demuxers/demux_mpeg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_mpeg.c,v 1.138 2004/04/30 11:40:07 hadess Exp $ + * $Id: demux_mpeg.c,v 1.139 2004/05/10 11:24:28 hadess Exp $ * * demultiplexer for mpeg 1/2 program streams * reads streams of variable blocksizes @@ -1178,7 +1178,7 @@ static char *get_identifier (demux_class_t *this_gen) { } static char *get_extensions (demux_class_t *this_gen) { - return "mpg mpeg mpe"; + return "mpg mpeg"; } static char *get_mimetypes (demux_class_t *this_gen) { |