OSDN Git Service

avf: make the example output the proper message
authorLuca Barbato <lu_zero@gentoo.org>
Thu, 29 Mar 2012 22:28:00 +0000 (15:28 -0700)
committerLuca Barbato <lu_zero@gentoo.org>
Fri, 30 Mar 2012 00:07:19 +0000 (17:07 -0700)
av_dump_format needs the codecs opened in order to print
them.

libavformat/output-example.c

index a467109..aadd74a 100644 (file)
@@ -464,8 +464,6 @@ int main(int argc, char **argv)
         audio_st = add_audio_stream(oc, fmt->audio_codec);
     }
 
-    av_dump_format(oc, 0, filename, 1);
-
     /* now that all the parameters are set, we can open the audio and
        video codecs and allocate the necessary encode buffers */
     if (video_st)
@@ -473,6 +471,8 @@ int main(int argc, char **argv)
     if (audio_st)
         open_audio(oc, audio_st);
 
+    av_dump_format(oc, 0, filename, 1);
+
     /* open the output file, if needed */
     if (!(fmt->flags & AVFMT_NOFILE)) {
         if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) {