diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-10-04 16:30:26 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-10-04 16:30:26 +0400 |
commit | 215ed84779da71ab8c1c580766f1771617e4828d (patch) | |
tree | b57bc2525ee179b294c1fcfefcc73dabab260a26 /source/blender | |
parent | 019dca9c54289136b34c688a048ee009e2e852ee (diff) |
Partial fix #27978: Problem exporting OGG Theora-Vorbis video (and other audio codecs)
Ogg format does support only vorbis, theora, speex and flac audio codecs.
Added check for result of av_write_header() and show info in header about
error while initializing streams.
This commit also fixed crash when using vorbis audio format.
It used to be floating point exception. SOlved by initializing
audio_stream->codec->time_base with proper rational value as it's
done in FFmpeg sources.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/writeffmpeg.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 6010770e1ee..21289b07f8d 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -571,6 +571,10 @@ static AVStream* alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex return NULL; } + /* need to prevent floating point exception when using vorbis audio codec, + initialize this value in the same way as it's done in FFmpeg iteslf (sergey) */ + st->codec->time_base = (AVRational){1, st->codec->sample_rate}; + audio_outbuf_size = FF_MIN_BUFFER_SIZE; if((c->codec_id >= CODEC_ID_PCM_S16LE) && (c->codec_id <= CODEC_ID_PCM_DVD)) @@ -743,7 +747,11 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report } } - av_write_header(of); + if (av_write_header(of) < 0) { + BKE_report(reports, RPT_ERROR, "Could not initialize streams. Probably unsupported codec combination."); + return 0; + } + outfile = of; av_dump_format(of, 0, name, 1); |