2015-10-17 20:46:58 -04:00
|
|
|
|
/*
|
|
|
|
|
File: AudioFileObject.h
|
|
|
|
|
Abstract: Part of CoreAudio Utility Classes
|
|
|
|
|
Version: 1.1
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
|
|
|
|
Inc. ("Apple") in consideration of your agreement to the following
|
|
|
|
|
terms, and your use, installation, modification or redistribution of
|
|
|
|
|
this Apple software constitutes acceptance of these terms. If you do
|
|
|
|
|
not agree with these terms, please do not use, install, modify or
|
|
|
|
|
redistribute this Apple software.
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
In consideration of your agreement to abide by the following terms, and
|
|
|
|
|
subject to these terms, Apple grants you a personal, non-exclusive
|
|
|
|
|
license, under Apple's copyrights in this original Apple software (the
|
|
|
|
|
"Apple Software"), to use, reproduce, modify and redistribute the Apple
|
|
|
|
|
Software, with or without modifications, in source and/or binary forms;
|
|
|
|
|
provided that if you redistribute the Apple Software in its entirety and
|
|
|
|
|
without modifications, you must retain this notice and the following
|
|
|
|
|
text and disclaimers in all such redistributions of the Apple Software.
|
|
|
|
|
Neither the name, trademarks, service marks or logos of Apple Inc. may
|
|
|
|
|
be used to endorse or promote products derived from the Apple Software
|
|
|
|
|
without specific prior written permission from Apple. Except as
|
|
|
|
|
expressly stated in this notice, no other rights or licenses, express or
|
|
|
|
|
implied, are granted by Apple herein, including but not limited to any
|
|
|
|
|
patent rights that may be infringed by your derivative works or by other
|
|
|
|
|
works in which the Apple Software may be incorporated.
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
|
|
|
|
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
|
|
|
|
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
|
|
|
|
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
|
|
|
|
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
|
|
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
|
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
|
|
|
|
|
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
|
|
|
|
|
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
|
|
|
|
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
|
|
|
|
POSSIBILITY OF SUCH DAMAGE.
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
*/
|
|
|
|
|
#ifndef _AudioFileObject_H_
|
|
|
|
|
#define _AudioFileObject_H_
|
|
|
|
|
|
|
|
|
|
#include <TargetConditionals.h>
|
|
|
|
|
|
|
|
|
|
#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__)
|
|
|
|
|
#include <CoreAudio/CoreAudioTypes.h>
|
|
|
|
|
#include <AudioToolbox/AudioFile.h>
|
|
|
|
|
#include <AudioToolbox/AudioFormat.h>
|
|
|
|
|
#else
|
|
|
|
|
#include "CoreAudioTypes.h"
|
|
|
|
|
#include "AudioFile.h"
|
|
|
|
|
#include "AudioFormat.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "CompressedPacketTable.h"
|
|
|
|
|
#include "CACFDictionary.h"
|
|
|
|
|
#include "DataSource.h"
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
|
|
|
|
#if TARGET_OS_WIN32
|
|
|
|
|
#include <io.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
These are structs defined in 10.5. They are included here for compatibility with sources
|
|
|
|
|
*/
|
|
|
|
|
#if COREAUDIOTYPES_VERSION < 1050
|
|
|
|
|
|
|
|
|
|
struct AudioFormatListItem
|
|
|
|
|
{
|
|
|
|
|
AudioStreamBasicDescription mASBD;
|
|
|
|
|
AudioChannelLayoutTag mChannelLayoutTag;
|
|
|
|
|
};
|
|
|
|
|
typedef struct AudioFormatListItem AudioFormatListItem;
|
|
|
|
|
|
|
|
|
|
struct AudioFormatInfo
|
|
|
|
|
{
|
|
|
|
|
AudioStreamBasicDescription mASBD;
|
|
|
|
|
const void* mMagicCookie;
|
|
|
|
|
UInt32 mMagicCookieSize;
|
|
|
|
|
};
|
|
|
|
|
typedef struct AudioFormatInfo AudioFormatInfo;
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
|
|
|
|
|
kAudioFormatProperty_FormatList = 'flst',
|
|
|
|
|
// Returns a list of AudioFormatListItem structs describing the audio formats contained within the compressed bit stream
|
|
|
|
|
// as described by the magic cookie.
|
|
|
|
|
// The specifier is an AudioFormatInfo struct. At a minimum formatID member of the ASBD struct must filled in. Other fields
|
|
|
|
|
// may be filled in.
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
kAudioFormatProperty_OutputFormatList = 'ofls',
|
|
|
|
|
// Returns a list of AudioFormatListItem structs describing the audio formats which may be obtained by decoding the format
|
|
|
|
|
// described by the specifier.
|
|
|
|
|
// The specifier is an AudioFormatInfo struct. At a minimum formatID member of the ASBD struct must filled in. Other fields
|
2015-10-26 14:35:06 -04:00
|
|
|
|
// may be filled in. If there is no magic cookie, then the number of channels and sample rate should be filled in.
|
2015-10-17 20:46:58 -04:00
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
kAudioFilePropertyPacketSizeUpperBound = 'pkub',
|
|
|
|
|
kAudioFilePropertyFormatList = 'flst',
|
|
|
|
|
kAudioFilePropertyEstimatedDuration = 'edur',
|
|
|
|
|
kAudioFilePropertyBitRate = 'brat'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
kAudioFileCreateURLSelect = 0x0019,
|
|
|
|
|
kAudioFileOpenURLSelect = 0x001A,
|
|
|
|
|
kAudioFileFileDataIsThisFormatSelect = 0x001B
|
|
|
|
|
};
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
kTEMPAudioFilePropertySoundCheckDictionary = 'scdc',
|
|
|
|
|
kTEMPAudioFilePropertyLoudnessInfo = 'loud',
|
|
|
|
|
kTEMPAudioFilePropertyGenerateLoudnessInfo = 'glou'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const UInt32 kCopySoundDataBufferSize = 1024 * 1024;
|
|
|
|
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
// some files encode these as upper case
|
|
|
|
|
enum {
|
|
|
|
|
kUpperCase_IMACompression = 'IMA4', /*IMA 4:1*/
|
|
|
|
|
kUpperCase_ULawCompression = 'ULAW', /*<2A>Law 2:1*/
|
|
|
|
|
kUpperCase_ALawCompression = 'ALAW', /*aLaw 2:1*/
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
kUpperCase_Float32 = 'FL32',
|
|
|
|
|
kUpperCase_Float64 = 'FL64'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
// in what header is this defined? what is it?
|
2015-10-26 14:35:06 -04:00
|
|
|
|
kGSM = 'agsm',
|
2015-10-17 20:46:58 -04:00
|
|
|
|
kUpperCase_GSM = 'GSM '
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define kPackedBESInt (kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsBigEndian | kLinearPCMFormatFlagIsPacked)
|
|
|
|
|
#define kPackedLESInt (kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked)
|
|
|
|
|
#define kPackedBEFloat (kLinearPCMFormatFlagIsFloat | kLinearPCMFormatFlagIsBigEndian | kLinearPCMFormatFlagIsPacked)
|
|
|
|
|
#define kPackedLEFloat (kLinearPCMFormatFlagIsFloat | kLinearPCMFormatFlagIsPacked)
|
|
|
|
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
inline int TransformPerm_FS_O (SInt8 inPerm)
|
|
|
|
|
{
|
|
|
|
|
switch (inPerm) {
|
|
|
|
|
case kAudioFileReadPermission: return O_RDONLY;
|
|
|
|
|
case kAudioFileWritePermission: return O_WRONLY;
|
|
|
|
|
case kAudioFileReadWritePermission: return O_RDWR;
|
|
|
|
|
}
|
|
|
|
|
return O_RDONLY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
#pragma mark "File Error Handling"
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include <CoreAudio/CoreAudioTypes.h>
|
|
|
|
|
|
|
|
|
|
inline OSErr AudioFileTranslateErrno(int err)
|
|
|
|
|
{
|
|
|
|
|
switch (err) {
|
|
|
|
|
#if !TARGET_OS_WIN32
|
|
|
|
|
case ENFILE:
|
|
|
|
|
#endif
|
|
|
|
|
case EMFILE:
|
|
|
|
|
return -42 /* kAudio_TooManyFilesOpenError */;
|
|
|
|
|
#if !TARGET_OS_WIN32
|
|
|
|
|
case EPERM:
|
|
|
|
|
case EROFS:
|
|
|
|
|
#endif
|
|
|
|
|
case EACCES:
|
|
|
|
|
case EEXIST:
|
|
|
|
|
return -54 /* kAudio_FilePermissionError */;
|
|
|
|
|
#if !TARGET_OS_WIN32
|
|
|
|
|
case EMLINK:
|
|
|
|
|
return (OSErr)'!pth' /* kAudio_BadFilePathError */;
|
|
|
|
|
case ENOTDIR:
|
|
|
|
|
case ELOOP:
|
|
|
|
|
#endif
|
|
|
|
|
case ENOENT:
|
|
|
|
|
default:
|
|
|
|
|
return (OSErr)kAudioFileUnspecifiedError;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
class AudioFileObject
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
SInt64 mNumBytes; // total bytes of audio data in the audio file
|
|
|
|
|
SInt64 mNumPackets; // total frames of audio data in the audio file
|
|
|
|
|
AudioStreamBasicDescription mDataFormat; // format of the audio data
|
|
|
|
|
SInt64 mDataOffset; // position if the file where audio data begins
|
|
|
|
|
UInt32 mIsOptimized; // 1 if there is nothing in the file following the audio data, 0 if there is
|
2015-10-26 14:35:06 -04:00
|
|
|
|
UInt32 mFileType; // file type of the audio file (i.e. AIFF, WAVE, etc.)
|
2015-10-17 20:46:58 -04:00
|
|
|
|
CFURLRef mFileRef; // URL of the file passed to AudioFileOpen or AudioFileCreate
|
2015-10-26 14:35:06 -04:00
|
|
|
|
int mFileD; // Ref num of the file after opening within Audio File
|
2015-10-17 20:46:58 -04:00
|
|
|
|
SInt8 mPermissions; // file permissions indicated by the caller, passed by AudioFileOpen or set with SetProperty function
|
|
|
|
|
Boolean mIsInitialized; // has the AudioFileObject for this file been intialized?
|
|
|
|
|
DataSource *mDataSource;
|
|
|
|
|
UInt32 mMaximumPacketSize;
|
|
|
|
|
CompressedPacketTable *mPacketTable;
|
|
|
|
|
UInt32 mDeferSizeUpdates;
|
|
|
|
|
Boolean mNeedsSizeUpdate;
|
|
|
|
|
Boolean mFirstSetFormat;
|
|
|
|
|
Boolean mAlignDataWithFillerChunks;
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
AudioFileObject (UInt32 inFileType)
|
|
|
|
|
: mNumBytes(0),
|
|
|
|
|
mNumPackets(0),
|
|
|
|
|
mDataOffset(0),
|
|
|
|
|
mIsOptimized(1),
|
|
|
|
|
mFileType(inFileType),
|
|
|
|
|
mFileRef(NULL),
|
|
|
|
|
mFileD(-1),
|
|
|
|
|
mPermissions(0),
|
|
|
|
|
mIsInitialized (false),
|
|
|
|
|
mDataSource(0),
|
|
|
|
|
mMaximumPacketSize(0),
|
|
|
|
|
mPacketTable(NULL),
|
|
|
|
|
mDeferSizeUpdates(1),
|
|
|
|
|
mNeedsSizeUpdate(false),
|
|
|
|
|
mFirstSetFormat(true),
|
|
|
|
|
mAlignDataWithFillerChunks(true)
|
|
|
|
|
{
|
|
|
|
|
memset(&mDataFormat, 0, sizeof(mDataFormat));
|
|
|
|
|
}
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual ~AudioFileObject();
|
|
|
|
|
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
/* Public API Function Implementation */
|
|
|
|
|
// The DoSomething() versions of these functions are wrappers that perform a standard prologue.
|
|
|
|
|
// The Something() methods are those which should be overridden in the subclasses.
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
OSStatus DoCreate( CFURLRef inFileRef,
|
|
|
|
|
const AudioStreamBasicDescription *inFormat,
|
|
|
|
|
UInt32 inFlags);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus Create( CFURLRef inFileRef,
|
|
|
|
|
const AudioStreamBasicDescription *inFormat);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
|
|
|
|
OSStatus DoOpen( CFURLRef inFileRef,
|
2015-10-17 20:46:58 -04:00
|
|
|
|
SInt8 inPermissions,
|
|
|
|
|
int inFD);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
|
|
|
|
virtual OSStatus Open( CFURLRef inFileRef,
|
2015-10-17 20:46:58 -04:00
|
|
|
|
SInt8 inPermissions,
|
|
|
|
|
int inFD);
|
|
|
|
|
|
|
|
|
|
OSStatus DoOpenWithCallbacks(
|
2015-10-26 14:35:06 -04:00
|
|
|
|
void * inRefCon,
|
|
|
|
|
AudioFile_ReadProc inReadFunc,
|
|
|
|
|
AudioFile_WriteProc inWriteFunc,
|
2015-10-17 20:46:58 -04:00
|
|
|
|
AudioFile_GetSizeProc inGetSizeFunc,
|
|
|
|
|
AudioFile_SetSizeProc inSetSizeFunc);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
OSStatus DoInitialize( CFURLRef inFileRef,
|
|
|
|
|
const AudioStreamBasicDescription *inFormat,
|
|
|
|
|
UInt32 inFlags);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus Initialize( CFURLRef inFileRef,
|
|
|
|
|
const AudioStreamBasicDescription *inFormat,
|
|
|
|
|
UInt32 inFlags);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
OSStatus DoInitializeWithCallbacks(
|
2015-10-26 14:35:06 -04:00
|
|
|
|
void * inRefCon,
|
|
|
|
|
AudioFile_ReadProc inReadFunc,
|
|
|
|
|
AudioFile_WriteProc inWriteFunc,
|
2015-10-17 20:46:58 -04:00
|
|
|
|
AudioFile_GetSizeProc inGetSizeFunc,
|
|
|
|
|
AudioFile_SetSizeProc inSetSizeFunc,
|
|
|
|
|
UInt32 inFileType,
|
|
|
|
|
const AudioStreamBasicDescription *inFormat,
|
|
|
|
|
UInt32 inFlags);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus OpenFromDataSource(void);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus InitializeDataSource(const AudioStreamBasicDescription *inFormat, UInt32 inFlags);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
OSStatus DoClose();
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus Close();
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
OSStatus DoOptimize();
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus Optimize();
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus ReadBytes( Boolean inUseCache,
|
2015-10-26 14:35:06 -04:00
|
|
|
|
SInt64 inStartingByte,
|
|
|
|
|
UInt32 *ioNumBytes,
|
2015-10-17 20:46:58 -04:00
|
|
|
|
void *outBuffer);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus WriteBytes( Boolean inUseCache,
|
2015-10-26 14:35:06 -04:00
|
|
|
|
SInt64 inStartingByte,
|
|
|
|
|
UInt32 *ioNumBytes,
|
2015-10-17 20:46:58 -04:00
|
|
|
|
const void *inBuffer);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus ReadPackets( Boolean inUseCache,
|
|
|
|
|
UInt32 *outNumBytes,
|
|
|
|
|
AudioStreamPacketDescription *outPacketDescriptions,
|
2015-10-26 14:35:06 -04:00
|
|
|
|
SInt64 inStartingPacket,
|
|
|
|
|
UInt32 *ioNumPackets,
|
2015-10-17 20:46:58 -04:00
|
|
|
|
void *outBuffer);
|
|
|
|
|
|
2015-10-26 14:35:06 -04:00
|
|
|
|
virtual OSStatus ReadPacketData(
|
2015-10-17 20:46:58 -04:00
|
|
|
|
Boolean inUseCache,
|
|
|
|
|
UInt32 *ioNumBytes,
|
|
|
|
|
AudioStreamPacketDescription *outPacketDescriptions,
|
2015-10-26 14:35:06 -04:00
|
|
|
|
SInt64 inStartingPacket,
|
|
|
|
|
UInt32 *ioNumPackets,
|
2015-10-17 20:46:58 -04:00
|
|
|
|
void *outBuffer);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
|
|
|
|
virtual OSStatus ReadPacketDataVBR(
|
2015-10-17 20:46:58 -04:00
|
|
|
|
Boolean inUseCache,
|
|
|
|
|
UInt32 *ioNumBytes,
|
|
|
|
|
AudioStreamPacketDescription *outPacketDescriptions,
|
2015-10-26 14:35:06 -04:00
|
|
|
|
SInt64 inStartingPacket,
|
|
|
|
|
UInt32 *ioNumPackets,
|
2015-10-17 20:46:58 -04:00
|
|
|
|
void *outBuffer);
|
|
|
|
|
|
|
|
|
|
virtual OSStatus HowManyPacketsCanBeReadIntoBuffer(UInt32* ioNumBytes, SInt64 inStartingPacket, UInt32 *ioNumPackets);
|
|
|
|
|
|
2015-10-26 14:35:06 -04:00
|
|
|
|
virtual OSStatus ReadPacketDataVBR_InTable(
|
2015-10-17 20:46:58 -04:00
|
|
|
|
Boolean inUseCache,
|
|
|
|
|
UInt32 *ioNumBytes,
|
|
|
|
|
AudioStreamPacketDescription *outPacketDescriptions,
|
2015-10-26 14:35:06 -04:00
|
|
|
|
SInt64 inStartingPacket,
|
|
|
|
|
UInt32 *ioNumPackets,
|
2015-10-17 20:46:58 -04:00
|
|
|
|
void *outBuffer);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus WritePackets( Boolean inUseCache,
|
|
|
|
|
UInt32 inNumBytes,
|
|
|
|
|
const AudioStreamPacketDescription *inPacketDescriptions,
|
2015-10-26 14:35:06 -04:00
|
|
|
|
SInt64 inStartingPacket,
|
|
|
|
|
UInt32 *ioNumPackets,
|
2015-10-17 20:46:58 -04:00
|
|
|
|
const void *inBuffer);
|
|
|
|
|
/* Property Support */
|
|
|
|
|
|
2015-10-26 14:35:06 -04:00
|
|
|
|
virtual OSStatus GetPropertyInfo (
|
2015-10-17 20:46:58 -04:00
|
|
|
|
AudioFilePropertyID inPropertyID,
|
|
|
|
|
UInt32 *outDataSize,
|
|
|
|
|
UInt32 *isWritable);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus GetProperty ( AudioFilePropertyID inPropertyID,
|
|
|
|
|
UInt32 *ioDataSize,
|
|
|
|
|
void *ioPropertyData);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus SetProperty ( AudioFilePropertyID inPropertyID,
|
|
|
|
|
UInt32 inDataSize,
|
|
|
|
|
const void *inPropertyData);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
UInt32 GetFileType() const { return mFileType; }
|
|
|
|
|
void SetFileType(UInt32 inFileType) { mFileType = inFileType; }
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
// this will set the format in memory only.
|
|
|
|
|
virtual OSStatus SetDataFormat(const AudioStreamBasicDescription* inStreamFormat);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
// this will update the format info on disk and in memory.
|
|
|
|
|
virtual OSStatus UpdateDataFormat(const AudioStreamBasicDescription* inStreamFormat);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
const UInt32 GetBytesPerPacket() const { return mDataFormat.mBytesPerPacket; }
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
const AudioStreamBasicDescription &GetDataFormat() const { return mDataFormat; }
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus GetFormatListInfo( UInt32 &outDataSize,
|
|
|
|
|
UInt32 &outWritable);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus GetFormatList( UInt32 &ioDataSize,
|
|
|
|
|
AudioFormatListItem *ioPropertyData);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus SetFormatList( UInt32 inDataSize,
|
|
|
|
|
const AudioFormatListItem *inPropertyData);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus UpdateSize() { return noErr; }
|
|
|
|
|
UInt32 DeferSizeUpdates() { return mDeferSizeUpdates; }
|
|
|
|
|
void SetDeferSizeUpdates(UInt32 inFlag) { mDeferSizeUpdates = inFlag; }
|
|
|
|
|
OSStatus UpdateSizeIfNeeded();
|
|
|
|
|
OSStatus SizeChanged();
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
Boolean IsOptimized() const { return mIsOptimized != 0; }
|
|
|
|
|
void SetIsOptimized(Boolean inIsOptimized) { mIsOptimized = inIsOptimized ? 1 : 0; }
|
|
|
|
|
|
|
|
|
|
Boolean AlignDataWithFillerChunks() const { return mAlignDataWithFillerChunks; }
|
|
|
|
|
|
|
|
|
|
virtual SInt64 GetNumBytes() { return mNumBytes; }
|
|
|
|
|
virtual void SetNumBytes(SInt64 inNumBytes) { mNumBytes = inNumBytes; }
|
|
|
|
|
|
|
|
|
|
// this will update the header size info on disk
|
|
|
|
|
OSStatus UpdateNumBytes(SInt64 inNumBytes);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual SInt64 GetNumPackets(){ return mNumPackets; }
|
|
|
|
|
virtual void SetNumPackets(SInt64 inNumPackets) { mNumPackets = inNumPackets; }
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
// this will update the header size info on disk
|
|
|
|
|
OSStatus UpdateNumPackets(SInt64 inNumPackets);
|
|
|
|
|
|
|
|
|
|
virtual OSStatus PacketToFrame(SInt64 inPacket, SInt64& outFirstFrameInPacket);
|
|
|
|
|
virtual OSStatus FrameToPacket(SInt64 inFrame, SInt64& outPacket, UInt32& outFrameOffsetInPacket);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus PacketToByte(AudioBytePacketTranslation* abpt);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus ByteToPacket(AudioBytePacketTranslation* abpt);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus GetBitRate( UInt32 *outBitRate);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus GetMagicCookieDataSize( UInt32 *outDataSize,
|
|
|
|
|
UInt32 *isWritable);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus GetMagicCookieData( UInt32 *ioDataSize,
|
|
|
|
|
void *ioPropertyData);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus SetMagicCookieData( UInt32 inDataSize,
|
|
|
|
|
const void *inPropertyData);
|
|
|
|
|
|
|
|
|
|
virtual OSStatus GetMarkerListSize( UInt32 *outDataSize,
|
|
|
|
|
UInt32 *isWritable);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus GetMarkerList( UInt32 *ioDataSize,
|
|
|
|
|
AudioFileMarkerList *ioMarkerList);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus SetMarkerList( UInt32 inDataSize,
|
|
|
|
|
const AudioFileMarkerList *inMarkerList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual OSStatus GetRegionListSize( UInt32 *outDataSize,
|
|
|
|
|
UInt32 *isWritable);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus GetRegionList( UInt32 *ioDataSize,
|
|
|
|
|
AudioFileRegionList *ioRegionList);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus SetRegionList( UInt32 inDataSize,
|
|
|
|
|
const AudioFileRegionList *inRegionList);
|
|
|
|
|
|
|
|
|
|
virtual OSStatus GetChannelLayoutSize( UInt32 *outDataSize,
|
|
|
|
|
UInt32 *isWritable);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus GetChannelLayout( UInt32 *ioDataSize,
|
|
|
|
|
AudioChannelLayout *ioChannelLayout);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus SetChannelLayout( UInt32 inDataSize,
|
|
|
|
|
const AudioChannelLayout *inChannelLayout);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual OSStatus GetInfoDictionarySize( UInt32 *outDataSize,
|
|
|
|
|
UInt32 *isWritable);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus GetInfoDictionary( CACFDictionary *infoDict);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus SetInfoDictionary( CACFDictionary *infoDict);
|
|
|
|
|
|
|
|
|
|
virtual OSStatus GetSoundCheckDictionarySize( UInt32 *outDataSize,
|
|
|
|
|
UInt32 *isWritable) { return kAudioFileUnsupportedPropertyError; }
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus GetSoundCheckDictionary( CACFDictionary *infoDict) { return kAudioFileUnsupportedPropertyError; }
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus SetSoundCheckDictionary( CACFDictionary *infoDict) { return kAudioFileUnsupportedPropertyError; }
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus GetLoudnessInfo( CACFDictionary *infoDict) { return kAudioFileUnsupportedPropertyError; }
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus GetSoundCheckDictionaryFromLoudnessInfo(CACFDictionary* outInfoDict) { return kAudioFileUnsupportedPropertyError; }
|
|
|
|
|
virtual OSStatus GetLoudnessInfoFromSoundCheckDictionary(CACFDictionary* outInfoDict) { return kAudioFileUnsupportedPropertyError; }
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus SetLoudnessInfo( CACFDictionary *infoDict) { return kAudioFileUnsupportedPropertyError; }
|
|
|
|
|
|
|
|
|
|
virtual OSStatus GetLoudnessInfoSize( UInt32 *outDataSize,
|
|
|
|
|
UInt32 *isWritable) { return kAudioFileUnsupportedPropertyError; }
|
|
|
|
|
|
|
|
|
|
virtual OSStatus GenerateLoudnessInfo( CACFDictionary *infoDict) { return kAudioFileUnsupportedPropertyError; }
|
|
|
|
|
|
|
|
|
|
virtual OSStatus GetEstimatedDuration( Float64* duration);
|
|
|
|
|
|
|
|
|
|
virtual OSStatus CountUserData( UInt32 inUserDataID,
|
|
|
|
|
UInt32 *outNumberItems);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus GetUserDataSize( UInt32 inUserDataID,
|
|
|
|
|
UInt32 inIndex,
|
|
|
|
|
UInt32 *outDataSize);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus GetUserData( UInt32 inUserDataID,
|
|
|
|
|
UInt32 inIndex,
|
|
|
|
|
UInt32 *ioDataSize,
|
|
|
|
|
void *ioUserData);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual OSStatus SetUserData( UInt32 inUserDataID,
|
|
|
|
|
UInt32 inIndex,
|
|
|
|
|
UInt32 inDataSize,
|
|
|
|
|
const void *inUserData);
|
|
|
|
|
|
|
|
|
|
virtual OSStatus RemoveUserData( UInt32 inUserDataID,
|
|
|
|
|
UInt32 inIndex);
|
|
|
|
|
|
|
|
|
|
virtual OSStatus GetLyrics(CFStringRef *outLyrics) { return kAudioFileUnsupportedPropertyError; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Boolean CanRead() const { return mPermissions & kAudioFileReadPermission; }
|
|
|
|
|
Boolean CanWrite() const { return mPermissions & kAudioFileWritePermission; }
|
|
|
|
|
|
|
|
|
|
void SetPermissions(SInt8 inPermissions) { mPermissions = inPermissions; }
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
/* Other Helper Methods: (some may not be necessary depending on how things are refactored) */
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
OSStatus OpenFile(SInt8 inPermissions, int inFD);
|
|
|
|
|
|
|
|
|
|
OSStatus CreateDataFile (CFURLRef inFileRef, int &outFileD);
|
|
|
|
|
|
2015-10-26 14:35:06 -04:00
|
|
|
|
OSStatus AddDurationToInfoDictionary(CACFDictionary *infoDict, Float64 &inDuration);
|
2015-10-17 20:46:58 -04:00
|
|
|
|
|
|
|
|
|
virtual Boolean IsDataFormatSupported(const AudioStreamBasicDescription *inFormat) = 0;
|
|
|
|
|
virtual Boolean IsDataFormatValid(const AudioStreamBasicDescription *inFormat);
|
|
|
|
|
|
|
|
|
|
virtual OSStatus IsValidFilePosition(SInt64 /*position*/) { return noErr; }
|
|
|
|
|
|
|
|
|
|
OSStatus MoveData(SInt64 fromPos, SInt64 toPos, SInt64 size);
|
|
|
|
|
|
|
|
|
|
/* Accessors: */
|
|
|
|
|
Boolean IsInitialized() const { return mIsInitialized; }
|
|
|
|
|
void SetInitialized(Boolean inFlag) { mIsInitialized = inFlag; }
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
DataSource* GetDataSource() const { return mDataSource; }
|
|
|
|
|
void SetDataSource(DataSource *inDataSource);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
void SetURL (CFURLRef inURL);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual UInt32 GetMaximumPacketSize() { return mMaximumPacketSize; }
|
|
|
|
|
virtual UInt32 FindMaximumPacketSize() { return mMaximumPacketSize; }
|
|
|
|
|
virtual void SetMaximumPacketSize(const UInt32 inPacketSize) { mMaximumPacketSize = inPacketSize; }
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
virtual UInt32 GetPacketSizeUpperBound() { return GetMaximumPacketSize (); }
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
|
|
|
|
SInt64 GetDataOffset() const { return mDataOffset; }
|
|
|
|
|
void SetDataOffset(SInt64 inOffset) { mDataOffset = inOffset; }
|
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
// I like this idiom better than DoesPacketTableExist+NewPacketTable:
|
|
|
|
|
CompressedPacketTable* GetPacketTable(Boolean inCreateIt = false)
|
|
|
|
|
{
|
|
|
|
|
if (!mPacketTable && inCreateIt)
|
|
|
|
|
mPacketTable = new CompressedPacketTable(mDataFormat.mFramesPerPacket);
|
|
|
|
|
return mPacketTable;
|
|
|
|
|
}
|
2015-10-26 14:35:06 -04:00
|
|
|
|
void ClearPacketTable()
|
2015-10-17 20:46:58 -04:00
|
|
|
|
{
|
|
|
|
|
DeletePacketTable();
|
|
|
|
|
GetPacketTable(true);
|
|
|
|
|
}
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
|
|
|
|
virtual OSStatus ScanForPackets(SInt64 inToPacketCount, DataSource* inDataSrc = NULL, bool fullyParsedIfEndOfDataReached = true)
|
2015-10-17 20:46:58 -04:00
|
|
|
|
{
|
|
|
|
|
// In formats that read packets lazily, this will be overridden to scan for packets up to the index.
|
|
|
|
|
if (inToPacketCount > GetNumPackets())
|
|
|
|
|
return kAudioFileEndOfFileError;
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
|
|
|
|
return noErr;
|
2015-10-17 20:46:58 -04:00
|
|
|
|
}
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
|
|
|
|
void AppendPacket(const AudioStreamPacketDescription &inPacket)
|
2015-10-17 20:46:58 -04:00
|
|
|
|
{
|
|
|
|
|
CompressedPacketTable* packetTable = GetPacketTable(true);
|
|
|
|
|
UInt32 numFramesInPacket = mDataFormat.mFramesPerPacket ? mDataFormat.mFramesPerPacket : inPacket.mVariableFramesInPacket;
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
AudioStreamPacketDescriptionExtended pext;
|
|
|
|
|
memset(&pext, 0, sizeof(pext));
|
|
|
|
|
pext.mStartOffset = inPacket.mStartOffset;
|
|
|
|
|
pext.mDataByteSize = inPacket.mDataByteSize;
|
|
|
|
|
pext.mVariableFramesInPacket = inPacket.mVariableFramesInPacket;
|
|
|
|
|
pext.mFrameOffset = numFramesInPacket + (packetTable->size() ? packetTable->back().mFrameOffset : 0);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
|
|
|
|
packetTable->push_back(pext);
|
|
|
|
|
if (inPacket.mDataByteSize > mMaximumPacketSize)
|
2015-10-17 20:46:58 -04:00
|
|
|
|
mMaximumPacketSize = inPacket.mDataByteSize;
|
|
|
|
|
}
|
|
|
|
|
void DeletePacketTable() { delete mPacketTable; mPacketTable = NULL;}
|
|
|
|
|
SInt64 GetPacketTableSize() { return mPacketTable ? mPacketTable->size() : 0; }
|
|
|
|
|
OSStatus GetPacketDescriptions(UInt32 inStartingPacket, UInt32 *ioDataSize, AudioStreamPacketDescription *outPacketDescriptions)
|
|
|
|
|
{
|
|
|
|
|
if (outPacketDescriptions == NULL) return kAudioFileUnspecifiedError;
|
|
|
|
|
if (mPacketTable)
|
|
|
|
|
{
|
|
|
|
|
// only get as many packet descriptions as can fit in outPacketDescriptions
|
|
|
|
|
UInt32 count = *ioDataSize / sizeof(AudioStreamPacketDescription);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
if (count + inStartingPacket > GetPacketTableSize())
|
2015-10-17 20:46:58 -04:00
|
|
|
|
count = (UInt32)(GetPacketTableSize() - inStartingPacket);
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
*ioDataSize = 0;
|
|
|
|
|
for (UInt32 i = inStartingPacket; i < (count + inStartingPacket); i++)
|
|
|
|
|
{
|
|
|
|
|
AudioStreamPacketDescription curPacket = (*mPacketTable)[i];
|
|
|
|
|
outPacketDescriptions[i].mStartOffset = curPacket.mStartOffset - GetDataOffset();
|
|
|
|
|
outPacketDescriptions[i].mVariableFramesInPacket = curPacket.mVariableFramesInPacket;
|
|
|
|
|
outPacketDescriptions[i].mDataByteSize = curPacket.mDataByteSize;
|
|
|
|
|
*ioDataSize += sizeof(AudioStreamPacketDescription);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
*ioDataSize = 0;
|
|
|
|
|
|
|
|
|
|
return noErr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
|
void DumpPacketTable()
|
|
|
|
|
{
|
|
|
|
|
if (mPacketTable) {
|
|
|
|
|
SInt64 size = mPacketTable->size();
|
|
|
|
|
printf("PacketTable size %d\n", (int)size);
|
|
|
|
|
for (SInt64 i = 0; i < size; i++) {
|
|
|
|
|
AudioStreamPacketDescription curPacket = (*mPacketTable)[i];
|
|
|
|
|
printf("dpkt %5qd %8qd %5d %5d\n", i, curPacket.mStartOffset, (int)curPacket.mDataByteSize, (int)curPacket.mVariableFramesInPacket);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
Boolean GetNeedsSizeUpdate() const { return mNeedsSizeUpdate; }
|
|
|
|
|
void SetNeedsSizeUpdate(Boolean inNeedsSizeUpdate) { mNeedsSizeUpdate = inNeedsSizeUpdate; }
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
CFURLRef GetURL () const { return mFileRef; }
|
|
|
|
|
|
|
|
|
|
virtual OSStatus GetSourceBitDepth(SInt32& outValue) { outValue = 0; return kAudioFileUnsupportedPropertyError; }
|
|
|
|
|
virtual OSStatus SetSourceBitDepth(SInt32 inValue) { return kAudioFileUnsupportedPropertyError; }
|
|
|
|
|
|
|
|
|
|
virtual OSStatus GetAlbumArtwork(CFDataRef& outValue) { outValue = NULL; return kAudioFileUnsupportedPropertyError; }
|
|
|
|
|
virtual OSStatus SetAlbumArtwork(CFDataRef inValue){ return kAudioFileUnsupportedPropertyError; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
void SetAlignDataWithFillerChunks(Boolean inFlag) { mAlignDataWithFillerChunks = inFlag; }
|
|
|
|
|
|
|
|
|
|
OSStatus ValidateFormatAndData();
|
2015-10-26 14:35:06 -04:00
|
|
|
|
|
2015-10-17 20:46:58 -04:00
|
|
|
|
/* debug */
|
|
|
|
|
// virtual void PrintFile (FILE* inFile, const char *indent) = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
inline Boolean cfstrcmpi(CFStringRef a, CFStringRef b)
|
|
|
|
|
{
|
|
|
|
|
// case insensitive CFString compare
|
|
|
|
|
return CFStringCompare(a, b, kCFCompareCaseInsensitive) == kCFCompareEqualTo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CFBundleRef GetAudioToolboxBundle();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
#endif
|