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 { typedef struct {
uint32_t type; uint32_t type;
int64_t offset;
int64_t size; /* total size (excluding the size and type fields) */ int64_t size; /* total size (excluding the size and type fields) */
} MOVAtom; } MOVAtom;

View File

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