changeset 2820:95ce00ad6f3e libavformat

save pointer to parse table, it is unlikely to change
author bcoudurier
date Sun, 16 Dec 2007 18:20:27 +0000
parents 5b055288c138
children 5a12b619e974
files mov.c
diffstat 1 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mov.c	Sun Dec 16 18:10:52 2007 +0000
+++ b/mov.c	Sun Dec 16 18:20:27 2007 +0000
@@ -118,10 +118,6 @@
     int64_t mdat_offset;
     int total_streams;
     MOVStreamContext *streams[MAX_STREAMS];
-
-    const struct MOVParseTableEntry *parse_table; /* could be eventually used to change the table */
-    /* NOTE: for recursion save to/ restore from local variable! */
-
     AVPaletteControl palette_control;
     MOV_mdat_t *mdat_list;
     int mdat_count;
@@ -147,6 +143,8 @@
     mov_parse_function func;
 } MOVParseTableEntry;
 
+static const MOVParseTableEntry mov_default_parse_table[];
+
 static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
 {
     int64_t total_size = 0;
@@ -183,16 +181,16 @@
             break;
         a.size = FFMIN(a.size, atom.size - total_size);
 
-        for (i = 0; c->parse_table[i].type != 0L
-             && c->parse_table[i].type != a.type; i++)
+        for (i = 0; mov_default_parse_table[i].type != 0L
+             && mov_default_parse_table[i].type != a.type; i++)
             /* empty */;
 
-        if (c->parse_table[i].type == 0) { /* skip leaf atoms data */
+        if (mov_default_parse_table[i].type == 0) { /* skip leaf atoms data */
             url_fskip(pb, a.size);
         } else {
             offset_t start_pos = url_ftell(pb);
             int64_t left;
-            err = (c->parse_table[i].func)(c, pb, a);
+            err = (mov_default_parse_table[i].func)(c, pb, a);
             if (c->found_moov && c->found_mdat)
                 break;
             left = a.size - url_ftell(pb) + start_pos;
@@ -1427,7 +1425,6 @@
     MOV_atom_t atom = { 0, 0, 0 };
 
     mov->fc = s;
-    mov->parse_table = mov_default_parse_table;
 
     if(!url_is_streamed(pb)) /* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */
         atom.size = url_fsize(pb);