root/trunk/AC3MovieImport/AC3MovieImport.r

Revision 7, 8.2 kB (checked in by gbooker, 3 years ago)

Added an import component to allow QT to read .AC3 files.
Closes #5

Line 
1 /*
2  *  AC3MovieImport.r
3  *
4  *    Information bit definitions for the 'thng' and other OggImport
5  *    resources.
6  *
7  *
8  *  Copyright (c) 2005  Arek Korbik
9  *  Copyright (c) 2006  David Conrad
10  *  Copyright (c) 2006  Graham Booker
11  *
12  *  This file is based off of OggImport.r from XiphQT, the Xiph QuickTime
13  *  Components.
14  *
15  *  XiphQT is free software; you can redistribute it and/or
16  *  modify it under the terms of the GNU Lesser General Public
17  *  License as published by the Free Software Foundation; either
18  *  version 2.1 of the License, or (at your option) any later version.
19  *
20  *  XiphQT is distributed in the hope that it will be useful,
21  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
22  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23  *  Lesser General Public License for more details.
24  *
25  *  You should have received a copy of the GNU Lesser General Public
26  *  License along with XiphQT; if not, write to the Free Software
27  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
28  *
29  * 
30  *  AC3MovieImport is distributed with the same conditions as outlined above.
31  *
32  */
33
34
35 #define TARGET_REZ_CARBON_MACHO 1
36
37 #define thng_RezTemplateVersion 2
38
39 #define cfrg_RezTemplateVersion 1
40
41 #if TARGET_REZ_CARBON_MACHO
42
43     #if defined(ppc_YES)
44         // PPC architecture
45         #define TARGET_REZ_MAC_PPC 1
46     #else
47         #define TARGET_REZ_MAC_PPC 0
48     #endif
49
50     #if defined(i386_YES)
51         // x86 architecture
52         #define TARGET_REZ_MAC_X86 1
53     #else
54         #define TARGET_REZ_MAC_X86 0
55     #endif
56
57     #define TARGET_REZ_WIN32 0
58 #else
59     // Must be building on Windows
60     #define TARGET_REZ_WIN32 1
61 #endif
62
63 #if TARGET_REZ_CARBON_MACHO
64     #include <Carbon/Carbon.r>
65     #include <QuickTime/QuickTime.r>
66         #undef __CARBON_R__
67         #undef __CORESERVICES_R__
68         #undef __CARBONCORE_R__
69         #undef __COMPONENTS_R__
70 #else
71     #include "ConditionalMacros.r"
72     #include "MacTypes.r"
73     #include "Components.r"
74     #include "QuickTimeComponents.r"
75     #include "CodeFragments.r"
76         #undef __COMPONENTS_R__
77 #endif
78
79 #include "versions.h"
80
81 #define kImporterComponentType 'eat '
82
83
84 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85 // AC3 Importer
86
87 #define kImporterFlags canMovieImportFiles | canMovieImportValidateFile | \
88                 canMovieImportPartial | canMovieImportInPlace | hasMovieImportMIMEList | \
89                 canMovieImportDataReferences | canMovieImportValidateDataReferences | \
90         cmpThreadSafe
91
92
93 resource 'thng' (kImporterResID, AC3MovieImporterName, purgeable) {
94     kImporterComponentType,
95     kAC3MovieFormat,
96     'vide',
97     0, 0, 0, 0,
98     'STR ', kImporterNameStringResID,
99     'STR ', kImporterInfoStringResID,
100     0, 0,               // no icon
101     kAC3Movie_eat__Version,
102     componentDoAutoVersion|componentHasMultiplePlatforms, 0,
103     {
104 #if TARGET_OS_MAC              // COMPONENT PLATFORM INFORMATION ----------------------
105     #if TARGET_REZ_CARBON_MACHO
106         #if !(TARGET_REZ_MAC_PPC || TARGET_REZ_MAC_X86)
107                 #error "Platform architecture not defined, TARGET_REZ_MAC_PPC and/or TARGET_REZ_MAC_X86 must be defined!"
108         #endif
109         #if TARGET_REZ_MAC_PPC
110             kImporterFlags,
111             'dlle',                                                             // Code Resource type - Entry point found by symbol name 'dlle' resource
112             kImporterResID,                                                             // ID of 'dlle' resource
113             platformPowerPCNativeEntryPoint,    // PPC
114         #endif
115         #if TARGET_REZ_MAC_X86
116                         kImporterFlags,
117                         'dlle',
118             kImporterResID,
119             platformIA32NativeEntryPoint,               // INTEL
120         #endif
121         #elif TARGET_REZ_CARBON_CFM
122         #error "Obsolete, new components should not be built for this configuration."
123                 kImporterFlags,                         // Component Flags
124                 'cfrg',                                                         // Special Case: data-fork based code fragment
125                 kImporterResID,                                                         /* Code ID usage for CFM components:
126                                                                                                 0 (kCFragResourceID) - This means the first member in the code fragment;
127                                                                                                         Should only be used when building a single component per file. When doing so
128                                                                                                         using kCFragResourceID simplifies things because a custom 'cfrg' resource is not required
129                                                                                                 n - This value must match the special 'cpnt' qualifier 1 in the custom 'cfrg' resource */
130                 platformPowerPCNativeEntryPoint,        // Platform Type (response from gestaltComponentPlatform or failing that, gestaltSysArchitecture)
131         #elif TARGET_REZ_MAC_PPC
132         #error "Obsolete, new components should not be built for this configuration."
133                 kImporterFlags,
134                 'eat ',                                                         // Code Type
135                 kImporterResID,                                                         // Code ID
136                 platformPowerPC,
137         #elif TARGET_REZ_MAC_68K
138         #error "Obsolete, new components should not be built for this configuration."
139                 kImporterFlags,
140                 'eat ',
141                 kImporterResID,
142                 platform68k,
143         #else
144                 #error "At least one TARGET_REZ_XXX_XXX platform must be defined."
145         #endif
146 #endif
147 #if TARGET_OS_WIN32
148     kImporterFlags,
149     'dlle',
150     kImporterResID,
151     platformWin32,
152 #endif
153     },
154     'thnr', kImporterResID
155 };
156
157 // Component Alias
158 resource 'thga' (kImporterResID, AC3MovieImporterName, purgeable) {
159     kImporterComponentType,                    // Type
160     'AC3 ',                             // Subtype - this must be in uppercase. It will match an ".ac3" suffix case-insensitively.
161     'vide',                             // media type supported
162     kImporterFlags | movieImportSubTypeIsFileExtension, // The subtype is a file name suffix
163     0,                                  // Component Flags Mask
164     0,                                  // Code Type
165     0,                                  // Code ID
166     'STR ',                             // Name Type
167     kImporterNameStringResID,           // Name ID
168     'STR ',                             // Info Type
169     kImporterInfoStringResID,           // Info ID
170     0,                                  // Icon Type
171     0,                                  // Icon ID
172                 // TARGET COMPONENT ---------------
173     kImporterComponentType,                    // Type
174     kAC3MovieFormat,                    // SubType
175     'vide',                             // Manufaturer
176     kImporterFlags,                     // Component Flags
177     0,                                  // Component Flags Mask
178     'thnr', kImporterResID, 0
179 };
180
181 resource 'thnr' (kImporterResID, AC3MovieImporterName, purgeable) {
182     {
183         'mime', 1, 0, 'mime', kImporterResID, cmpResourceNoFlags,
184         'mcfg', 1, 0, 'mcfg', kImporterResID, cmpResourceNoFlags,
185     };
186 };
187
188
189 #if TARGET_REZ_CARBON_MACHO /* || TARGET_REZ_WIN32 */
190 resource 'dlle' (kImporterResID, AC3MovieImporterName) {
191     "AC3MovieImportComponentDispatch"
192 };
193 #endif
194
195 // name and info string are shared by the compressor and decompressor
196 resource 'STR ' (kImporterNameStringResID, AC3MovieImporterName, purgeable) {
197     "AC3 Importer"
198 };
199
200 resource 'STR ' (kImporterInfoStringResID, AC3MovieImporterName, purgeable) {
201     "AC3 " "0.1" " (See http://trac.cod3r.com/a52codec)."
202 };
203
204
205 /*
206     This is an example of how to build an atom container resource to hold mime types.
207     This component's GetMIMETypeList implementation simply loads this resource and returns it.
208     Please note that atoms of the same type MUST be grouped together within an atom container.
209 */
210 resource 'mime' (kImporterResID, AC3MovieImporterName, purgeable) {
211     {
212         kMimeInfoMimeTypeTag,      1, "audio/x-ac3";
213         kMimeInfoMimeTypeTag,      2, "audio/ac3";
214         kMimeInfoFileExtensionTag, 1, "ac3";
215         kMimeInfoFileExtensionTag, 2, "ac3";
216         kMimeInfoDescriptionTag,   1, "AC3 Audio";
217         kMimeInfoDescriptionTag,   2, "AC3 Audio";
218     };
219 };
220
221 resource 'mcfg' (kImporterResID, AC3MovieImporterName, purgeable) {
222     kVersionDoesntMatter,
223     {
224         kQTMediaConfigVideoGroupID,
225         kQTMediaConfigBinaryFile | kQTMediaConfigCanUseApp,
226         kAC3MovieFormat,
227         'TVOD', /* we don't have a creator code for our files, hijack QT player */
228         kImporterComponentType,
229         kAC3MovieFormat,
230         'moov',
231         0, 0,
232         'AC3 ',
233         kQTMediaInfoNetGroup,
234        
235         /* no synonyms */
236         {
237         },
238        
239         {
240         "AC3 video file",
241         "ac3",
242         "QuickTime Player",
243         "AC3 file importer",
244         "",
245         },
246        
247         /* mime types array */
248         {
249             "audio/x-ac3";
250             "audio/ac3";
251         };
252 //    };
253 //    {
254     };
255 };
256
257
Note: See TracBrowser for help on using the browser.