this repo has no description
at fixPythonPipStalling 109 lines 4.6 kB view raw
1/* Copyright: � Copyright 2005 Apple Computer, Inc. All rights reserved. 2 3 Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. 4 ("Apple") in consideration of your agreement to the following terms, and your 5 use, installation, modification or redistribution of this Apple software 6 constitutes acceptance of these terms. If you do not agree with these terms, 7 please do not use, install, modify or redistribute this Apple software. 8 9 In consideration of your agreement to abide by the following terms, and subject 10 to these terms, Apple grants you a personal, non-exclusive license, under Apple�s 11 copyrights in this original Apple software (the "Apple Software"), to use, 12 reproduce, modify and redistribute the Apple Software, with or without 13 modifications, in source and/or binary forms; provided that if you redistribute 14 the Apple Software in its entirety and without modifications, you must retain 15 this notice and the following text and disclaimers in all such redistributions of 16 the Apple Software. Neither the name, trademarks, service marks or logos of 17 Apple Computer, Inc. may be used to endorse or promote products derived from the 18 Apple Software without specific prior written permission from Apple. Except as 19 expressly stated in this notice, no other rights or licenses, express or implied, 20 are granted by Apple herein, including but not limited to any patent rights that 21 may be infringed by your derivative works or by other works in which the Apple 22 Software may be incorporated. 23 24 The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO 25 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED 26 WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27 PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN 28 COMBINATION WITH YOUR PRODUCTS. 29 30 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR 31 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 32 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION 34 OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT 35 (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN 36 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37*/ 38/*============================================================================= 39 QTAACFile.h 40 41=============================================================================*/ 42 43#ifndef __QTAACFile_h__ 44#define __QTAACFile_h__ 45 46#include <QuickTime/QuickTime.h> 47#include <AudioToolbox/AudioConverter.h> 48#include <AudioToolbox/AudioFormat.h> 49#include <vector> 50#include "CAStreamBasicDescription.h" 51#include "CAAudioChannelLayout.h" 52 53/* 54 This class is a stripped-down analogue to CAAudioFile, designed solely for reading AAC audio 55 tracks from QuickTime/MP4 files. 56 57 Throws CAXException's on errors. 58*/ 59class QTAACFile { 60public: 61 QTAACFile(); 62 ~QTAACFile(); 63 64 void Open(const char *filePath); 65 void Close(); 66 67 void SetClientFormat(const CAStreamBasicDescription &dataFormat); 68 // set the PCM format to which the movie's audio will be decoded 69 70 OSStatus SetConverterProperty( AudioConverterPropertyID inPropertyID, 71 UInt32 inPropertyDataSize, 72 const void* inPropertyData, 73 bool inCanFail); 74 75 void ReadPackets(UInt32 &ioNumPackets, AudioBufferList *ioData); 76 // read packets from the audio file in the client format 77 78private: 79 void CloseConverter(); 80 void UpdateClientMaxPacketSize(); 81 82 static OSStatus ReadInputProc( AudioConverterRef inAudioConverter, 83 UInt32* ioNumberDataPackets, 84 AudioBufferList* ioData, 85 AudioStreamPacketDescription** outDataPacketDescription, 86 void* inUserData); 87 88private: 89 typedef std::vector<TimeValue> TimeValueList; 90 91 SInt16 mMovieResFile; 92 Movie mMovie; 93 Media mMedia; 94 Handle mPacketHandle; 95 UInt32 mMagicCookieSize; 96 char * mMagicCookie; 97 TimeValueList mPacketTimes; 98 UInt32 mNumberPackets; // in file's format 99 UInt32 mPacketMark; // location in file, in file's format 100 101 CAStreamBasicDescription mFileDataFormat; 102 CAStreamBasicDescription mClientDataFormat; 103 AudioConverterRef mConverter; 104 UInt32 mFileMaxPacketSize; 105 UInt32 mClientMaxPacketSize; 106 AudioStreamPacketDescription mPacketDescription; 107}; 108 109#endif // __QTAACFile_h__