]> git.sesse.net Git - nageru/commitdiff
Better error messages on avio_open2 failure.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 10 Jan 2016 19:47:55 +0000 (20:47 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 10 Jan 2016 19:47:55 +0000 (20:47 +0100)
httpd.cpp

index e71f40e2e52844604849cba0ff395d8a85c83d53..f148fa1d22b889c2a64d8576a34e2ee8cce118de 100644 (file)
--- a/httpd.cpp
+++ b/httpd.cpp
@@ -30,8 +30,10 @@ HTTPD::HTTPD(const char *output_filename, int width, int height)
        AVFormatContext *avctx = avformat_alloc_context();
        avctx->oformat = av_guess_format(NULL, output_filename, NULL);
        strcpy(avctx->filename, output_filename);
-       if (avio_open2(&avctx->pb, output_filename, AVIO_FLAG_WRITE, &avctx->interrupt_callback, NULL) < 0) {
-               fprintf(stderr, "%s: avio_open2() failed\n", output_filename);
+       int ret = avio_open2(&avctx->pb, output_filename, AVIO_FLAG_WRITE, &avctx->interrupt_callback, NULL);
+       if (ret < 0) {
+               char tmp[AV_ERROR_MAX_STRING_SIZE];
+               fprintf(stderr, "%s: avio_open2() failed: %s\n", output_filename, av_make_error_string(tmp, sizeof(tmp), ret));
                exit(1);
        }