remove no more needed MOVAtom.offset field

Originally committed as revision 21023 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Baptiste Coudurier 2010-01-04 22:51:38 +00:00
parent 7ead7e2181
commit cb41b2b6e0
2 changed files with 3 additions and 11 deletions

View File

@ -64,7 +64,6 @@ typedef struct {
typedef struct {
uint32_t type;
int64_t offset;
int64_t size; /* total size (excluding the size and type fields) */
} MOVAtom;

View File

@ -183,8 +183,6 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
int i;
int err = 0;
a.offset = atom.offset;
if (atom.size < 0)
atom.size = INT64_MAX;
while(((total_size + 8) < atom.size) && !url_feof(pb) && !err) {
@ -196,12 +194,10 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
a.type = get_le32(pb);
}
total_size += 8;
a.offset += 8;
dprintf(c->fc, "type: %08x %.4s sz: %"PRIx64" %"PRIx64" %"PRIx64"\n",
a.type, (char*)&a.type, a.size, atom.size, total_size);
if (a.size == 1) { /* 64 bit extended size */
a.size = get_be64(pb) - 8;
a.offset += 8;
total_size += 8;
}
if (a.size == 0) {
@ -238,7 +234,6 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
url_fskip(pb, left);
}
a.offset += a.size;
total_size += a.size;
}
@ -862,7 +857,7 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
//Parsing Sample description table
enum CodecID id;
int dref_id = 1;
MOVAtom a = { 0, 0, 0 };
MOVAtom a = { 0 };
int64_t start_pos = url_ftell(pb);
int size = get_be32(pb); /* size */
uint32_t format = get_le32(pb); /* data format */
@ -1935,7 +1930,6 @@ static int mov_read_wide(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0;
}
atom.type = get_le32(pb);
atom.offset += 8;
atom.size -= 8;
if (atom.type != MKTAG('m','d','a','t')) {
url_fskip(pb, atom.size);
@ -1981,7 +1975,6 @@ static int mov_read_cmov(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
if(init_put_byte(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0)
goto free_and_return;
atom.type = MKTAG('m','o','o','v');
atom.offset = 0;
atom.size = moov_len;
#ifdef DEBUG
// { int fd = open("/tmp/uncompheader.mov", O_WRONLY | O_CREAT); write(fd, moov_data, moov_len); close(fd); }
@ -2133,7 +2126,7 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
MOVContext *mov = s->priv_data;
ByteIOContext *pb = s->pb;
int err;
MOVAtom atom = { 0, 0, 0 };
MOVAtom atom = { 0 };
mov->fc = s;
/* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */
@ -2194,7 +2187,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
if (!sample) {
mov->found_mdat = 0;
if (!url_is_streamed(s->pb) ||
mov_read_default(mov, s->pb, (MOVAtom){ 0, 0, INT64_MAX }) < 0 ||
mov_read_default(mov, s->pb, (MOVAtom){ 0, INT64_MAX }) < 0 ||
url_feof(s->pb))
return AVERROR_EOF;
dprintf(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb));