remove no more needed MOVAtom.offset field
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>
Mon, 4 Jan 2010 22:51:38 +0000 (22:51 +0000)
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>
Mon, 4 Jan 2010 22:51:38 +0000 (22:51 +0000)
Originally committed as revision 21023 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/isom.h
libavformat/mov.c

index abd5f97..c8141f1 100644 (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;
 
index e1f43eb..48242bb 100644 (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));