]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/mov.c
Merge commit '312daa15891dc7abb77a404fe927d5ee35c52a71'
[ffmpeg] / libavformat / mov.c
index 6ba7b96f20d3a690a51b29d75331afe2aceaebef..d65e40f009d21097e6520a2901018636ca4bdf42 100644 (file)
@@ -691,16 +691,16 @@ static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 static int mov_read_wfex(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
+    int ret;
 
     if (c->fc->nb_streams < 1)
         return 0;
     st = c->fc->streams[c->fc->nb_streams-1];
 
-    if (ff_get_wav_header(pb, st->codec, atom.size) < 0) {
+    if ((ret = ff_get_wav_header(pb, st->codec, atom.size)) < 0)
         av_log(c->fc, AV_LOG_WARNING, "get_wav_header failed\n");
-    }
 
-    return 0;
+    return ret;
 }
 
 static int mov_read_pasp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
@@ -3819,36 +3819,42 @@ static int mov_read_mfra(MOVContext *c, AVIOContext *f)
 {
     int64_t stream_size = avio_size(f);
     int64_t original_pos = avio_tell(f);
+    int64_t seek_ret;
     int32_t mfra_size;
     int ret = -1;
-    if ((ret = avio_seek(f, stream_size - 4, SEEK_SET)) < 0) goto fail;
+    if ((seek_ret = avio_seek(f, stream_size - 4, SEEK_SET)) < 0) {
+        ret = seek_ret;
+        goto fail;
+    }
     mfra_size = avio_rb32(f);
     if (mfra_size < 0 || mfra_size > stream_size) {
         av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (unreasonable size)\n");
-        ret = -1;
         goto fail;
     }
-    if ((ret = avio_seek(f, -mfra_size, SEEK_CUR)) < 0) goto fail;
+    if ((seek_ret = avio_seek(f, -mfra_size, SEEK_CUR)) < 0) {
+        ret = seek_ret;
+        goto fail;
+    }
     if (avio_rb32(f) != mfra_size) {
         av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (size mismatch)\n");
-        ret = -1;
         goto fail;
     }
     if (avio_rb32(f) != MKBETAG('m', 'f', 'r', 'a')) {
         av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (tag mismatch)\n");
         goto fail;
     }
+    ret = 0;
     av_log(c->fc, AV_LOG_VERBOSE, "stream has mfra\n");
     while (!read_tfra(c, f)) {
         /* Empty */
     }
 fail:
-    ret = avio_seek(f, original_pos, SEEK_SET);
-    if (ret < 0)
+    seek_ret = avio_seek(f, original_pos, SEEK_SET);
+    if (seek_ret < 0) {
         av_log(c->fc, AV_LOG_ERROR,
                "failed to seek back after looking for mfra\n");
-    else
-        ret = 0;
+        ret = seek_ret;
+    }
     return ret;
 }