summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2002-08-06 01:59:22 +0000
committerMike Melanson <mike@multimedia.cx>2002-08-06 01:59:22 +0000
commit32a599cf3361e3760369db7d1426bb1fb891fd64 (patch)
tree636afe4a7679293ecd393b87bcebfdfcb708c648
parent904efb846c489efac5776b10c5f939bd1e30b920 (diff)
downloadxine-lib-32a599cf3361e3760369db7d1426bb1fb891fd64.tar.gz
xine-lib-32a599cf3361e3760369db7d1426bb1fb891fd64.tar.bz2
make the MPEG-within-QT file detection a little smarter by not traversing
file chunks if the current file chunk does not look like a QT atom CVS patchset: 2399 CVS date: 2002/08/06 01:59:22
-rw-r--r--src/demuxers/demux_mpeg.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c
index 45bbf235f..06bf6a364 100644
--- a/src/demuxers/demux_mpeg.c
+++ b/src/demuxers/demux_mpeg.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_mpeg.c,v 1.69 2002/08/04 21:45:10 tmmm Exp $
+ * $Id: demux_mpeg.c,v 1.70 2002/08/06 01:59:22 tmmm Exp $
*
* demultiplexer for mpeg 1/2 program streams
* reads streams of variable blocksizes
@@ -95,7 +95,15 @@ typedef struct demux_mpeg_s {
( (long)(unsigned char)(ch3) | ( (long)(unsigned char)(ch2) << 8 ) | \
( (long)(unsigned char)(ch1) << 16 ) | ( (long)(unsigned char)(ch0) << 24 ) )
+/* these are the known top-level QT atoms */
+#define FREE_ATOM QT_ATOM('f', 'r', 'e', 'e')
+#define JUNK_ATOM QT_ATOM('j', 'u', 'n', 'k')
#define MDAT_ATOM QT_ATOM('m', 'd', 'a', 't')
+#define MOOV_ATOM QT_ATOM('m', 'o', 'o', 'v')
+#define PNOT_ATOM QT_ATOM('p', 'n', 'o', 't')
+#define SKIP_ATOM QT_ATOM('s', 'k', 'i', 'p')
+#define WIDE_ATOM QT_ATOM('w', 'i', 'd', 'e')
+
#define ATOM_PREAMBLE_SIZE 8
/*
@@ -140,6 +148,16 @@ static void find_mdat_atom(input_plugin_t *input, off_t *mdat_offset,
break;
}
+ /* make sure the atom checks out as some other top-level atom before
+ * proceeding */
+ if ((atom != FREE_ATOM) &&
+ (atom != JUNK_ATOM) &&
+ (atom != MOOV_ATOM) &&
+ (atom != PNOT_ATOM) &&
+ (atom != SKIP_ATOM) &&
+ (atom != WIDE_ATOM))
+ break;
+
/* 64-bit length special case */
if (atom_size == 1) {
if (input->read(input, atom_preamble, ATOM_PREAMBLE_SIZE) !=