Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-11-19 21:22:40 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-11-19 21:22:40 +0400
commitd0a72598373d23e8c6def4158d29c96ac73411ed (patch)
tree25b222dc76aa05a16da2399d539140bcb6990eb1 /source/blender/blenkernel/intern/writeffmpeg.c
parentefe012eeacdf5db9fb8134026db137516d5b2e09 (diff)
Improved FFmpeg error reports when audio stream failed to be allocated
Also fixed crash using --debug-ffmpeg caused by BLI_vsnprintf modifies va_list -- need to create copy of list if this list is gonna to be reused.
Diffstat (limited to 'source/blender/blenkernel/intern/writeffmpeg.c')
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index da9c919c109..7e73992fc10 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -599,12 +599,14 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
/* Prepare an audio stream for the output file */
-static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContext *of)
+static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContext *of, char *error, int error_size)
{
AVStream *st;
AVCodecContext *c;
AVCodec *codec;
+ error[0] = '\0';
+
st = av_new_stream(of, 1);
if (!st) return NULL;
@@ -626,6 +628,7 @@ static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
if (avcodec_open(c, codec) < 0) {
//XXX error("Couldn't initialize audio codec");
+ BLI_strncpy(error, IMB_ffmpeg_last_error(), error_size);
return NULL;
}
@@ -801,9 +804,12 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
}
if (ffmpeg_audio_codec != CODEC_ID_NONE) {
- audio_stream = alloc_audio_stream(rd, fmt->audio_codec, of);
+ audio_stream = alloc_audio_stream(rd, fmt->audio_codec, of, error, sizeof(error));
if (!audio_stream) {
- BKE_report(reports, RPT_ERROR, "Error initializing audio stream");
+ if (error[0])
+ BKE_report(reports, RPT_ERROR, error);
+ else
+ BKE_report(reports, RPT_ERROR, "Error initializing audio stream");
av_dict_free(&opts);
return 0;
}