summaryrefslogtreecommitdiff
path: root/libavformat/tta.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2013-05-30 19:57:47 +0000
committerPaul B Mahol <onemda@gmail.com>2013-05-30 20:17:27 +0000
commitc4e0e314248865830ec073e5a3ef08e0a40aabf2 (patch)
tree3d0ea2f8b5a04b6b89dc00175787f4d7b274eda2 /libavformat/tta.c
parent2886e8065e635141db1df0a5236c2551573babaa (diff)
tta: remove pointless code
Checking seek table crc in decoder is pointless, as seek table is not used in decoder anyway, so also stop storing seek table into extradata.
Diffstat (limited to 'libavformat/tta.c')
-rw-r--r--libavformat/tta.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/libavformat/tta.c b/libavformat/tta.c
index 656f914a5d..cb04ff44e0 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -96,6 +96,16 @@ static int tta_read_header(AVFormatContext *s)
framepos = avio_tell(s->pb) + 4*c->totalframes + 4;
+ st->codec->extradata_size = avio_tell(s->pb) - start_offset;
+ st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!st->codec->extradata) {
+ st->codec->extradata_size = 0;
+ return AVERROR(ENOMEM);
+ }
+
+ avio_seek(s->pb, start_offset, SEEK_SET);
+ avio_read(s->pb, st->codec->extradata, st->codec->extradata_size);
+
for (i = 0; i < c->totalframes; i++) {
uint32_t size = avio_rl32(s->pb);
av_add_index_entry(st, framepos, i * c->frame_size, size, 0,
@@ -110,20 +120,6 @@ static int tta_read_header(AVFormatContext *s)
st->codec->sample_rate = samplerate;
st->codec->bits_per_coded_sample = bps;
- st->codec->extradata_size = avio_tell(s->pb) - start_offset;
- if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){
- //this check is redundant as avio_read should fail
- av_log(s, AV_LOG_ERROR, "extradata_size too large\n");
- return -1;
- }
- st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
- if (!st->codec->extradata) {
- st->codec->extradata_size = 0;
- return AVERROR(ENOMEM);
- }
- avio_seek(s->pb, start_offset, SEEK_SET);
- avio_read(s->pb, st->codec->extradata, st->codec->extradata_size);
-
return 0;
}