examples/muxing: add check on avformat_write_header() result
authorStefano Sabatini <stefasab@gmail.com>
Tue, 11 Sep 2012 16:25:58 +0000 (18:25 +0200)
committerStefano Sabatini <stefasab@gmail.com>
Tue, 11 Sep 2012 19:43:27 +0000 (21:43 +0200)
doc/examples/muxing.c

index b81f198..0d3f7ab 100644 (file)
@@ -469,7 +469,10 @@ int main(int argc, char **argv)
     }
 
     /* Write the stream header, if any. */
-    avformat_write_header(oc, NULL);
+    if (avformat_write_header(oc, NULL) < 0) {
+        fprintf(stderr, "Error occurred when opening output file\n");
+        return 1;
+    }
 
     frame->pts = 0;
     for (;;) {