]> git.sesse.net Git - ffmpeg/commitdiff
doc/examples/decode_audio: Fix "warning: ISO C90 forbids mixed declarations and code"
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 28 Aug 2019 17:09:46 +0000 (19:09 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 15 Sep 2019 22:04:18 +0000 (00:04 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
doc/examples/decode_audio.c

index 6f589b98784ee88052e21ccf42175b9006b09165..6c2a8ed5508a3c2a2b43ae4ced3b654943313cf3 100644 (file)
@@ -115,6 +115,9 @@ int main(int argc, char **argv)
     size_t   data_size;
     AVPacket *pkt;
     AVFrame *decoded_frame = NULL;
+    enum AVSampleFormat sfmt;
+    int n_channels = 0;
+    const char *fmt;
 
     if (argc <= 2) {
         fprintf(stderr, "Usage: %s <input file> <output file>\n", argv[0]);
@@ -202,9 +205,7 @@ int main(int argc, char **argv)
     decode(c, pkt, decoded_frame, outfile);
 
     /* print output pcm infomations, because there have no metadata of pcm */
-    enum AVSampleFormat sfmt = c->sample_fmt;
-    int n_channels = 0;
-    const char *fmt;
+    sfmt = c->sample_fmt;
 
     if (av_sample_fmt_is_planar(sfmt)) {
         const char *packed = av_get_sample_fmt_name(sfmt);