| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
#include <smooth.h> |
| 14 |
|
| 15 |
#ifdef callbacks |
| 16 |
# undef callbacks |
| 17 |
#endif |
| 18 |
|
| 19 |
#ifdef __APPLE__ |
| 20 |
|
| 21 |
|
| 22 |
# include <math.h> |
| 23 |
#endif |
| 24 |
|
| 25 |
namespace CA |
| 26 |
{ |
| 27 |
#include <AudioToolbox/AudioFile.h> |
| 28 |
#include <AudioToolbox/AudioConverter.h> |
| 29 |
#include <AudioToolbox/AudioFormat.h> |
| 30 |
|
| 31 |
enum |
| 32 |
{ |
| 33 |
kOptionalAudioFormatMPEG4AAC_ELD = 'aace', |
| 34 |
kOptionalAudioFormatMPEG4AAC_ELD_SBR = 'aacf', |
| 35 |
kOptionalAudioFormatMPEG4AAC_ELD_V2 = 'aacg' |
| 36 |
}; |
| 37 |
}; |
| 38 |
|
| 39 |
#include <mp4v2/mp4v2.h> |
| 40 |
|
| 41 |
using namespace smooth; |
| 42 |
using namespace smooth::System; |
| 43 |
|
| 44 |
extern DynamicLoader *coreaudiodll; |
| 45 |
extern DynamicLoader *mp4v2dll; |
| 46 |
|
| 47 |
Bool LoadCoreAudioDLL(); |
| 48 |
Void FreeCoreAudioDLL(); |
| 49 |
|
| 50 |
Bool LoadMP4v2DLL(); |
| 51 |
Void FreeMP4v2DLL(); |
| 52 |
|
| 53 |
#ifndef __APPLE__ |
| 54 |
namespace CA |
| 55 |
{ |
| 56 |
typedef OSStatus (*AUDIOFILEINITIALIZEWITHCALLBACKS) (void *, AudioFile_ReadProc, AudioFile_WriteProc, AudioFile_GetSizeProc, AudioFile_SetSizeProc, AudioFileTypeID, const AudioStreamBasicDescription *, UInt32, AudioFileID *); |
| 57 |
typedef OSStatus (*AUDIOFILECLOSE) (AudioFileID); |
| 58 |
typedef OSStatus (*AUDIOFILESETPROPERTY) (AudioFileID, AudioFilePropertyID, UInt32, const void *); |
| 59 |
typedef OSStatus (*AUDIOFILEWRITEPACKETS) (AudioFileID, Boolean, UInt32, const AudioStreamPacketDescription *, SInt64, UInt32 *, const void *); |
| 60 |
|
| 61 |
typedef OSStatus (*AUDIOCONVERTERNEW) (const AudioStreamBasicDescription *, const AudioStreamBasicDescription *, AudioConverterRef *); |
| 62 |
typedef OSStatus (*AUDIOCONVERTERDISPOSE) (AudioConverterRef); |
| 63 |
typedef OSStatus (*AUDIOCONVERTERGETPROPERTY) (AudioConverterRef, AudioConverterPropertyID, UInt32 *, void *); |
| 64 |
typedef OSStatus (*AUDIOCONVERTERGETPROPERTYINFO) (AudioConverterRef, AudioConverterPropertyID, UInt32 *, Boolean *); |
| 65 |
typedef OSStatus (*AUDIOCONVERTERSETPROPERTY) (AudioConverterRef, AudioConverterPropertyID, UInt32, const void *); |
| 66 |
typedef OSStatus (*AUDIOCONVERTERFILLCOMPLEXBUFFER) (AudioConverterRef, AudioConverterComplexInputDataProc, void *, UInt32 *, AudioBufferList *, AudioStreamPacketDescription *); |
| 67 |
|
| 68 |
typedef OSStatus (*AUDIOFORMATGETPROPERTY) (AudioFormatPropertyID, UInt32, const void *, UInt32 *, void *); |
| 69 |
typedef OSStatus (*AUDIOFORMATGETPROPERTYINFO) (AudioFormatPropertyID, UInt32, const void *, UInt32 *); |
| 70 |
|
| 71 |
extern AUDIOFILEINITIALIZEWITHCALLBACKS AudioFileInitializeWithCallbacks; |
| 72 |
extern AUDIOFILECLOSE AudioFileClose; |
| 73 |
extern AUDIOFILESETPROPERTY AudioFileSetProperty; |
| 74 |
extern AUDIOFILEWRITEPACKETS AudioFileWritePackets; |
| 75 |
|
| 76 |
extern AUDIOCONVERTERNEW AudioConverterNew; |
| 77 |
extern AUDIOCONVERTERDISPOSE AudioConverterDispose; |
| 78 |
extern AUDIOCONVERTERGETPROPERTY AudioConverterGetProperty; |
| 79 |
extern AUDIOCONVERTERGETPROPERTYINFO AudioConverterGetPropertyInfo; |
| 80 |
extern AUDIOCONVERTERSETPROPERTY AudioConverterSetProperty; |
| 81 |
extern AUDIOCONVERTERFILLCOMPLEXBUFFER AudioConverterFillComplexBuffer; |
| 82 |
|
| 83 |
extern AUDIOFORMATGETPROPERTY AudioFormatGetProperty; |
| 84 |
extern AUDIOFORMATGETPROPERTYINFO AudioFormatGetPropertyInfo; |
| 85 |
}; |
| 86 |
#endif |
| 87 |
|
| 88 |
typedef MP4FileHandle (*MP4MODIFY) (const char *, uint32_t); |
| 89 |
typedef void (*MP4CLOSE) (MP4FileHandle, uint32_t); |
| 90 |
typedef bool (*MP4OPTIMIZE) (const char *, const char *); |
| 91 |
|
| 92 |
typedef MP4TrackId (*MP4FINDTRACKID) (MP4FileHandle, uint16_t, const char *, uint8_t); |
| 93 |
typedef bool (*MP4SETTRACKINTEGERPROPERTY) (MP4FileHandle, MP4TrackId, const char *, int64_t); |
| 94 |
|
| 95 |
extern MP4MODIFY ex_MP4Modify; |
| 96 |
extern MP4CLOSE ex_MP4Close; |
| 97 |
extern MP4OPTIMIZE ex_MP4Optimize; |
| 98 |
|
| 99 |
extern MP4FINDTRACKID ex_MP4FindTrackId; |
| 100 |
extern MP4SETTRACKINTEGERPROPERTY ex_MP4SetTrackIntegerProperty; |