diff options
| author | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2009-11-19 15:29:17 +0000 |
|---|---|---|
| committer | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2009-11-19 15:29:17 +0000 |
| commit | fd7db10fedd5d3b7952c4785bec11c2692090cfb (patch) | |
| tree | 3ce30d3b384bda54a89afca2ab1e5b96a666b834 /src/demuxers | |
| parent | ca2c9c30b5a0f0fcab1ffb52bd065e335ffd4afe (diff) | |
| parent | 1c0d093f3bfd5861550d9fbb23a998b0204b9bed (diff) | |
| download | xine-lib-fd7db10fedd5d3b7952c4785bec11c2692090cfb.tar.gz xine-lib-fd7db10fedd5d3b7952c4785bec11c2692090cfb.tar.bz2 | |
Merge from 1.1.
Diffstat (limited to 'src/demuxers')
| -rw-r--r-- | src/demuxers/demux_mpeg_block.c | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index d910894d6..4b7f77f18 100644 --- a/src/demuxers/demux_mpeg_block.c +++ b/src/demuxers/demux_mpeg_block.c @@ -75,8 +75,6 @@ typedef struct demux_mpeg_block_s { char cur_mrl[256]; - uint8_t *scratch; - int64_t nav_last_end_pts; int64_t nav_last_start_pts; int64_t last_pts[2]; @@ -1181,7 +1179,6 @@ static void demux_mpeg_block_dispose (demux_plugin_t *this_gen) { demux_mpeg_block_t *this = (demux_mpeg_block_t *) this_gen; - av_free (this->scratch); free (this); } @@ -1194,18 +1191,19 @@ static int demux_mpeg_block_get_status (demux_plugin_t *this_gen) { static int demux_mpeg_detect_blocksize(demux_mpeg_block_t *this, input_plugin_t *input) { + uint8_t scratch[4]; input->seek(input, 2048, SEEK_SET); - if (input->read(input, this->scratch, 4) != 4) + if (input->read(input, scratch, 4) != 4) return 0; - if (this->scratch[0] || this->scratch[1] - || (this->scratch[2] != 0x01) || (this->scratch[3] != 0xba)) { + if (scratch[0] || scratch[1] + || (scratch[2] != 0x01) || (scratch[3] != 0xba)) { input->seek(input, 2324, SEEK_SET); - if (input->read(input, this->scratch, 4) != 4) + if (input->read(input, scratch, 4) != 4) return 0; - if (this->scratch[0] || this->scratch[1] - || (this->scratch[2] != 0x01) || (this->scratch[3] != 0xba)) + if (scratch[0] || scratch[1] + || (scratch[2] != 0x01) || (scratch[3] != 0xba)) return 0; return 2324; @@ -1390,7 +1388,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->demux_plugin.get_optional_data = demux_mpeg_block_get_optional_data; this->demux_plugin.demux_class = class_gen; - this->scratch = av_mallocz(4096); this->status = DEMUX_FINISHED; lprintf ("open_plugin:detection_method=%d\n", @@ -1402,13 +1399,14 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str /* use demux_mpeg for non-block devices */ if (!(input->get_capabilities(input) & INPUT_CAP_BLOCK)) { - av_free (this->scratch); free (this); return NULL; } if (((input->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) ) { + uint8_t scratch[5] = {0xff, 0xff, 0xff, 0xff, 0xff}; /* result of input->read() won't matter */ + this->blocksize = input->get_blocksize(input); lprintf("open_plugin:blocksize=%d\n",this->blocksize); @@ -1416,29 +1414,25 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->blocksize = demux_mpeg_detect_blocksize( this, input ); if (!this->blocksize) { - av_free (this->scratch); free (this); return NULL; } input->seek(input, 0, SEEK_SET); - memset (this->scratch, 255, 5); /* result of input->read() won't matter */ - if (input->read(input, this->scratch, this->blocksize)) { + if (input->read(input, scratch, 5)) { lprintf("open_plugin:read worked\n"); - if (this->scratch[0] || this->scratch[1] - || (this->scratch[2] != 0x01) || (this->scratch[3] != 0xba)) { + if (scratch[0] || scratch[1] + || (scratch[2] != 0x01) || (scratch[3] != 0xba)) { lprintf("open_plugin:scratch failed\n"); - av_free (this->scratch); free (this); return NULL; } /* if it's a file then make sure it's mpeg-2 */ if ( !input->get_blocksize(input) - && ((this->scratch[4]>>4) != 4) ) { - av_free (this->scratch); + && ((scratch[4]>>4) != 4) ) { free (this); return NULL; } @@ -1452,7 +1446,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; } } - av_free (this->scratch); free (this); return NULL; } @@ -1469,7 +1462,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->blocksize = demux_mpeg_detect_blocksize( this, input ); if (!this->blocksize) { - av_free (this->scratch); free (this); return NULL; } @@ -1479,7 +1471,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; default: - av_free (this->scratch); free (this); return NULL; } |
