1/* 2 * Copyright (c) 2000-2008 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24 25#ifndef __AIFF_SUPPORT_H__ 26#define __AIFF_SUPPORT_H__ 27 28// This file only needs to be included from the kernel portions of the project. 29#ifdef KERNEL 30 31#ifdef __cplusplus 32extern "C" { 33#endif 34 35#include <stdint.h> 36#include <libkern/OSByteOrder.h> 37 38#pragma pack(push,2) 39 40// Number of channels in file 41enum 42{ 43 kMono = 1, 44 kStereo = 2 45}; 46 47// Number of bits/sample 48enum 49{ 50 k8BitsPerSample = 8, 51 k16BitsPerSample = 16, 52 k16BitLittleEndianFormat = 0x736F7774 // 'sowt' 53}; 54 55// AIFF-C Versions 56enum 57{ 58 kAIFCVersion1 = 0xA2805140 59}; 60 61// Marker ID's 62enum 63{ 64 kAIFFID = 0x41494646, // 'AIFF' 65 kAIFCID = 0x41494643, // 'AIFC' 66 kFormatVersionID = 0x46564552, // 'FVER', 67 kCommonID = 0x434F4D4D, // 'COMM', 68 kFormID = 0x464F524D, // 'FORM', 69 kSoundDataID = 0x53534E44 // 'SSND' 70}; 71 72// Float80 from MacTypes.h 73struct Float80 { 74 int16_t exp; // exponent 75 uint16_t man[4]; // mantissa 76}; 77typedef struct Float80 Float80; 78 79// From AIFF.h 80struct ChunkHeader { 81 uint32_t ckID; 82 int32_t ckSize; 83}; 84typedef struct ChunkHeader ChunkHeader; 85 86struct ContainerChunk { 87 uint32_t ckID; 88 int32_t ckSize; 89 uint32_t formType; 90}; 91typedef struct ContainerChunk ContainerChunk; 92 93struct FormatVersionChunk { 94 uint32_t ckID; 95 int32_t ckSize; 96 uint32_t timeStamp; 97}; 98typedef struct FormatVersionChunk FormatVersionChunk; 99 100struct ExtCommonChunk { 101 uint32_t ckID; 102 int32_t ckSize; 103 int16_t numChannels; 104 uint32_t numSampleFrames; 105 int16_t sampleSize; 106 Float80 sampleRate; 107 uint32_t compressionType; 108 char compressionName[1]; // variable length array, Pascal string 109}; 110typedef struct ExtCommonChunk ExtCommonChunk; 111 112struct SoundDataChunk { 113 uint32_t ckID; 114 int32_t ckSize; 115 uint32_t offset; 116 uint32_t blockSize; 117}; 118typedef struct SoundDataChunk SoundDataChunk; 119 120struct CDAIFFHeader { 121 ContainerChunk containerChunk; 122 FormatVersionChunk formatVersionChunk; 123 ExtCommonChunk commonChunk; 124 SoundDataChunk soundDataChunk; 125}; 126typedef struct CDAIFFHeader CDAIFFHeader; 127 128 129// Building Routines 130void 131BuildCDAIFFHeader ( CDAIFFHeader * header, uint32_t fileSize ); 132 133 134#pragma pack(pop) 135 136 137#ifdef __cplusplus 138} 139#endif 140 141#endif /* KERNEL */ 142 143#endif // __AIFF_SUPPORT_H__