[Bf-blender-cvs] [e82b5f6] master: Attempt to fix mixdown when building without sndfile

Sergey Sharybin noreply at git.blender.org
Fri Feb 28 09:51:15 CET 2014


Commit: e82b5f61fee64a02fd71be605fea75dad4f7ce22
Author: Sergey Sharybin
Date:   Fri Feb 28 14:44:01 2014 +0600
https://developer.blender.org/rBe82b5f61fee64a02fd71be605fea75dad4f7ce22

Attempt to fix mixdown when building without sndfile

This case was handled specially in writeffmpeg.c and seems it makes
audio export happy in all cases now.

TODO: libav-10 doesn't work with AC3 codec yet because this bloody
library ONLY supports FLTP format and FFmpeg ONLY supports FLT.

This is not fun guy, it really isn't! Where's your conscience??

CC: nexyon

===================================================================

M	intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp

===================================================================

diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp
index 859227a..dcacf71 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp
@@ -175,8 +175,10 @@ AUD_FFMPEGWriter::AUD_FFMPEGWriter(std::string filename, AUD_DeviceSpecs specs,
 			m_output_buffer.resize(FF_MIN_BUFFER_SIZE);
 			int samplesize = AUD_MAX(AUD_SAMPLE_SIZE(m_specs), AUD_DEVICE_SAMPLE_SIZE(m_specs));
 
-			if(m_codecCtx->frame_size <= 1)
-				m_input_size = 0;
+			if(m_codecCtx->frame_size <= 1) {
+				m_input_size = FF_MIN_BUFFER_SIZE * 8 / m_codecCtx->bits_per_coded_sample / m_codecCtx->channels;
+				m_input_buffer.resize(m_input_size * samplesize);
+			}
 			else
 			{
 				m_input_buffer.resize(m_codecCtx->frame_size * samplesize);
@@ -190,7 +192,7 @@ AUD_FFMPEGWriter::AUD_FFMPEGWriter(std::string filename, AUD_DeviceSpecs specs,
 			avcodec_get_frame_defaults(m_frame);
 			m_frame->linesize[0]    = m_input_size * samplesize;
 			m_frame->format         = m_codecCtx->sample_fmt;
-			m_frame->nb_samples     = m_codecCtx->frame_size;
+			m_frame->nb_samples     = m_input_size;
 #  ifdef FFMPEG_HAVE_AVFRAME_SAMPLE_RATE
 			m_frame->sample_rate    = m_codecCtx->sample_rate;
 #  endif




More information about the Bf-blender-cvs mailing list