From 59d1397c90bd594efb80734a2e6f213fb8c5e584 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 10 Jan 2016 20:47:55 +0100 Subject: [PATCH] Better error messages on avio_open2 failure. --- httpd.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/httpd.cpp b/httpd.cpp index e71f40e..f148fa1 100644 --- 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); } -- 2.39.2