]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/mov.c
avformat/format: simplify ifdeffery
[ffmpeg] / libavformat / mov.c
index 89ecc5400b680fa8bcf7d7741fa0e61bddaa12a9..cfe76cde4bf67d469232d75679eb7ba76d13bb3f 100644 (file)
@@ -227,7 +227,7 @@ static int mov_metadata_loci(MOVContext *c, AVIOContext *pb, unsigned len)
     char language[4] = { 0 };
     char buf[100];
     uint16_t langcode = 0;
-    av_unused double longitude, latitude, altitude;
+    double longitude, latitude;
     const char *key = "location";
 
     if (len < 4 + 2 + 1 + 1 + 4 + 4 + 4)
@@ -248,7 +248,6 @@ static int mov_metadata_loci(MOVContext *c, AVIOContext *pb, unsigned len)
         return AVERROR_INVALIDDATA;
     longitude = ((int32_t) avio_rb32(pb)) / (float) (1 << 16);
     latitude  = ((int32_t) avio_rb32(pb)) / (float) (1 << 16);
-    altitude  = ((int32_t) avio_rb32(pb)) / (float) (1 << 16);
 
     // Try to output in the same format as the ?xyz field
     snprintf(buf, sizeof(buf), "%+08.4f%+09.4f/", latitude, longitude);
@@ -2535,8 +2534,8 @@ static int mov_read_custom_2plus(MOVContext *c, AVIOContext *pb, int size)
                 if(priming>0 && priming<16384)
                     sc->start_pad = priming;
             }
-        } else if (strcmp(key, "cdec") == 0) {
-        } else {
+        }
+        if (strcmp(key, "cdec") != 0) {
             av_dict_set(&c->fc->metadata, key, val,
                         AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
             key = val = NULL;
@@ -3478,12 +3477,8 @@ static int mov_read_close(AVFormatContext *s)
     }
 
     if (mov->dv_demux) {
-        for (i = 0; i < mov->dv_fctx->nb_streams; i++) {
-            av_freep(&mov->dv_fctx->streams[i]->codec);
-            av_freep(&mov->dv_fctx->streams[i]);
-        }
-        av_freep(&mov->dv_fctx);
-        av_freep(&mov->dv_demux);
+        avformat_free_context(mov->dv_fctx);
+        mov->dv_fctx = NULL;
     }
 
     av_freep(&mov->trex_data);