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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-04 17:17:43 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-04 17:17:43 +0400
commitfd0ad3c8df4c426f341703931e5db30a658ee2d8 (patch)
treeb740279d978800a72bb6bcd13a03719c3984b0c2
parentc6561745788811851049f333c06699202d47898f (diff)
Fix quicktime video export not properly supporting animation of audio properties like volume.
Patch #35184 by James Yonan, see the report for a detailed explanation of why this failed.
-rw-r--r--source/blender/quicktime/apple/qtkit_export.m14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m
index c22544d1891..b23c768545c 100644
--- a/source/blender/quicktime/apple/qtkit_export.m
+++ b/source/blender/quicktime/apple/qtkit_export.m
@@ -648,14 +648,24 @@ int append_qt(struct RenderData *rd, int start_frame, int frame, int *pixels, in
if (qtexport->audioFile) {
UInt32 audioPacketsConverted;
+
+ // Upper limit on total exported audio frames for this particular video frame
+ const UInt64 exportedAudioFrameLimit = (frame - rd->sfra) * qtexport->audioInputFormat.mSampleRate * rd->frs_sec_base / rd->frs_sec;
+
/* Append audio */
- while (qtexport->audioTotalExportedFrames < qtexport->audioLastFrame) {
+ while (qtexport->audioTotalExportedFrames < exportedAudioFrameLimit) {
qtexport->audioBufferList.mNumberBuffers = 1;
qtexport->audioBufferList.mBuffers[0].mNumberChannels = qtexport->audioOutputFormat.mChannelsPerFrame;
qtexport->audioBufferList.mBuffers[0].mDataByteSize = AUDIOOUTPUTBUFFERSIZE;
qtexport->audioBufferList.mBuffers[0].mData = qtexport->audioOutputBuffer;
- audioPacketsConverted = AUDIOOUTPUTBUFFERSIZE / qtexport->audioCodecMaxOutputPacketSize;
+
+ // Convert one audio packet at a time so that enclosing while loop can
+ // keep audio processing in sync with video frames.
+ // Previously, this was set to (AUDIOOUTPUTBUFFERSIZE / qtexport->audioCodecMaxOutputPacketSize),
+ // however this may cause AudioConverterFillComplexBuffer to convert audio spanning multiple
+ // video frames, which breaks animation of audio parameters such as volume for fade-in/out.
+ audioPacketsConverted = 1;
err = AudioConverterFillComplexBuffer(qtexport->audioConverter, AudioConverterInputCallback,
NULL, &audioPacketsConverted, &qtexport->audioBufferList, qtexport->audioOutputPktDesc);