changeset 5495:cce2ae0f48a0 libavformat

remove no more needed MOVAtom.offset field
author bcoudurier
date Mon, 04 Jan 2010 22:51:38 +0000
parents 5f9ff1c93f5d
children 324c7c25e4ad
files isom.h mov.c
diffstat 2 files changed, 3 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/isom.h	Mon Jan 04 22:48:27 2010 +0000
+++ b/isom.h	Mon Jan 04 22:51:38 2010 +0000
@@ -64,7 +64,6 @@
 
 typedef struct {
     uint32_t type;
-    int64_t offset;
     int64_t size; /* total size (excluding the size and type fields) */
 } MOVAtom;
 
--- a/mov.c	Mon Jan 04 22:48:27 2010 +0000
+++ b/mov.c	Mon Jan 04 22:51:38 2010 +0000
@@ -183,8 +183,6 @@
     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 @@
             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 @@
                 url_fskip(pb, left);
         }
 
-        a.offset += a.size;
         total_size += a.size;
     }
 
@@ -862,7 +857,7 @@
         //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 @@
         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 @@
     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 @@
     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 @@
     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));