diff options
author | Mike Melanson <mike@multimedia.cx> | 2002-11-01 03:36:24 +0000 |
---|---|---|
committer | Mike Melanson <mike@multimedia.cx> | 2002-11-01 03:36:24 +0000 |
commit | 2eab203a28f7f3ee7f851fa5b4b98d5c9537e4d9 (patch) | |
tree | 1efc4cd0b992269a029ec6a7c6760d16d26bb674 /src/demuxers/demux_wc3movie.c | |
parent | 244b2cd15d09de53613243386b274a474284e2d2 (diff) | |
download | xine-lib-2eab203a28f7f3ee7f851fa5b4b98d5c9537e4d9.tar.gz xine-lib-2eab203a28f7f3ee7f851fa5b4b98d5c9537e4d9.tar.bz2 |
move file signature validation to open_file() functions
CVS patchset: 3121
CVS date: 2002/11/01 03:36:24
Diffstat (limited to 'src/demuxers/demux_wc3movie.c')
-rw-r--r-- | src/demuxers/demux_wc3movie.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c index 8b938350b..7d3f070c1 100644 --- a/src/demuxers/demux_wc3movie.c +++ b/src/demuxers/demux_wc3movie.c @@ -22,7 +22,7 @@ * For more information on the MVE file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_wc3movie.c,v 1.22 2002/10/31 02:22:58 tmmm Exp $ + * $Id: demux_wc3movie.c,v 1.23 2002/11/01 03:36:24 tmmm Exp $ */ #ifdef HAVE_CONFIG_H @@ -381,11 +381,21 @@ static int open_mve_file(demux_mve_t *this) { int i, j; unsigned char r, g, b; int temp; + unsigned char header[16]; /* these are the frame dimensions unless others are found */ this->video_width = WC3_USUAL_WIDTH; this->video_height = WC3_USUAL_HEIGHT; + this->input->seek(this->input, 0, SEEK_SET); + if (this->input->read(this->input, header, 16) != 16) + return 0; + + if ((BE_32(&header[0]) != FORM_TAG) || + (BE_32(&header[8]) != MOVE_TAG) || + (BE_32(&header[12]) != PC_TAG)) + return 0; + /* load the number of palettes, the only interesting piece of information * in the _PC_ chunk; take it for granted that it will always appear at * position 0x1C */ @@ -651,7 +661,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_mve_t *this; - unsigned char header[16]; if (! (input->get_capabilities(input) & INPUT_CAP_SEEKABLE)) { printf(_("demux_mve.c: input not seekable, can not handle!\n")); @@ -676,17 +685,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str case METHOD_BY_CONTENT: - input->seek(input, 0, SEEK_SET); - if (input->read(input, header, 16) != 16) - return DEMUX_CANNOT_HANDLE; - - if ((BE_32(&header[0]) != FORM_TAG) || - (BE_32(&header[8]) != MOVE_TAG) || - (BE_32(&header[12]) != PC_TAG)) { - free (this); - return NULL; - } - if (!open_mve_file(this)) { free (this); return NULL; |