~ubuntu-branches/ubuntu/trusty/blender/trusty-proposed

« back to all changes in this revision

Viewing changes to source/blender/quicktime/apple/qtkit_export.m

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2013-08-14 10:43:49 UTC
  • mfrom: (14.2.19 sid)
  • Revision ID: package-import@ubuntu.com-20130814104349-t1d5mtwkphp12dyj
Tags: 2.68a-3
* Upload to unstable
* debian/: python3.3 Depends simplified
  - debian/control: python3.3 Depends dropped
    for blender-data package
  - 0001-blender_thumbnailer.patch refreshed
* debian/control: libavcodec b-dep versioning dropped

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
#  include "AUD_C-API.h"
39
39
#endif
40
40
 
 
41
#include "BLI_utildefines.h"
41
42
#include "BKE_global.h"
42
43
#include "BKE_main.h"
43
44
#include "BKE_scene.h"
45
46
 
46
47
#include "BLI_blenlib.h"
47
48
 
48
 
#include "BLO_sys_types.h"
 
49
#include "BLI_sys_types.h"
49
50
 
50
51
#include "IMB_imbuf.h"
51
52
#include "IMB_imbuf_types.h"
218
219
        return [NSString stringWithCString:str encoding:NSASCIIStringEncoding];
219
220
}
220
221
 
221
 
void makeqtstring (RenderData *rd, char *string)
 
222
void makeqtstring(RenderData *rd, char *string)
222
223
{
223
224
        char txt[64];
224
225
 
295
296
        
296
297
        qtexport->audioTotalExportedFrames += *ioNumberDataPackets;
297
298
        
298
 
        AUD_readDevice(qtexport->audioInputDevice, (UInt8*)qtexport->audioInputBuffer, 
299
 
                                   qtexport->audioInputFormat.mFramesPerPacket * *ioNumberDataPackets);
 
299
        AUD_readDevice(qtexport->audioInputDevice, (UInt8 *)qtexport->audioInputBuffer,
 
300
                       qtexport->audioInputFormat.mFramesPerPacket * *ioNumberDataPackets);
300
301
        
301
302
        ioData->mBuffers[0].mDataByteSize = qtexport->audioInputFormat.mBytesPerPacket * *ioNumberDataPackets;
302
303
        ioData->mBuffers[0].mData = qtexport->audioInputBuffer;
357
358
 
358
359
                        tmpnam(name);
359
360
                        strcat(name, extension);
360
 
                        outputFileURL = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,(UInt8*) name, strlen(name), false);
 
361
                        outputFileURL = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,(UInt8 *)name, strlen(name), false);
361
362
                        
362
363
                        if (outputFileURL) {
363
364
                                
648
649
        
649
650
        if (qtexport->audioFile) {
650
651
                UInt32 audioPacketsConverted;
 
652
 
 
653
                // Upper limit on total exported audio frames for this particular video frame
 
654
                const UInt64 exportedAudioFrameLimit = (frame - rd->sfra) * qtexport->audioInputFormat.mSampleRate * rd->frs_sec_base / rd->frs_sec;
 
655
 
651
656
                /* Append audio */
652
 
                while (qtexport->audioTotalExportedFrames < qtexport->audioLastFrame) {
 
657
                while (qtexport->audioTotalExportedFrames < exportedAudioFrameLimit) {
653
658
 
654
659
                        qtexport->audioBufferList.mNumberBuffers = 1;
655
660
                        qtexport->audioBufferList.mBuffers[0].mNumberChannels = qtexport->audioOutputFormat.mChannelsPerFrame;
656
661
                        qtexport->audioBufferList.mBuffers[0].mDataByteSize = AUDIOOUTPUTBUFFERSIZE;
657
662
                        qtexport->audioBufferList.mBuffers[0].mData = qtexport->audioOutputBuffer;
658
 
                        audioPacketsConverted = AUDIOOUTPUTBUFFERSIZE / qtexport->audioCodecMaxOutputPacketSize;
 
663
 
 
664
                        // Convert one audio packet at a time so that enclosing while loop can
 
665
                        // keep audio processing in sync with video frames.
 
666
                        // Previously, this was set to (AUDIOOUTPUTBUFFERSIZE / qtexport->audioCodecMaxOutputPacketSize),
 
667
                        // however this may cause AudioConverterFillComplexBuffer to convert audio spanning multiple
 
668
                        // video frames, which breaks animation of audio parameters such as volume for fade-in/out.
 
669
                        audioPacketsConverted = 1; 
659
670
                        
660
671
                        err = AudioConverterFillComplexBuffer(qtexport->audioConverter, AudioConverterInputCallback,
661
672
                                                              NULL, &audioPacketsConverted, &qtexport->audioBufferList, qtexport->audioOutputPktDesc);