| 1 | /* |
|---|
| 2 | * MatroskaImport.r |
|---|
| 3 | * |
|---|
| 4 | * MatroskaImport.r - Component resources for the import component |
|---|
| 5 | * |
|---|
| 6 | * |
|---|
| 7 | * Copyright (c) 2006 David Conrad |
|---|
| 8 | * |
|---|
| 9 | * This program is free software; you can redistribute it and/or |
|---|
| 10 | * modify it under the terms of the GNU Lesser General Public |
|---|
| 11 | * License as published by the Free Software Foundation; |
|---|
| 12 | * version 2.1 of the License. |
|---|
| 13 | * |
|---|
| 14 | * This program is distributed in the hope that it will be useful, |
|---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 17 | * Lesser General Public License for more details. |
|---|
| 18 | * |
|---|
| 19 | * You should have received a copy of the GNU Lesser General Public |
|---|
| 20 | * License along with this program; if not, write to the Free Software |
|---|
| 21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 22 | * |
|---|
| 23 | */ |
|---|
| 24 | |
|---|
| 25 | /* |
|---|
| 26 | thng_RezTemplateVersion: |
|---|
| 27 | 0 - original 'thng' template <-- default |
|---|
| 28 | 1 - extended 'thng' template <-- used for multiplatform things |
|---|
| 29 | 2 - extended 'thng' template including resource map id |
|---|
| 30 | */ |
|---|
| 31 | #define thng_RezTemplateVersion 2 |
|---|
| 32 | |
|---|
| 33 | /* |
|---|
| 34 | cfrg_RezTemplateVersion: |
|---|
| 35 | 0 - original <-- default |
|---|
| 36 | 1 - extended |
|---|
| 37 | */ |
|---|
| 38 | #define cfrg_RezTemplateVersion 1 |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | #if TARGET_REZ_CARBON_MACHO |
|---|
| 42 | #if defined(ppc_YES) |
|---|
| 43 | // PPC architecture |
|---|
| 44 | #define TARGET_REZ_MAC_PPC 1 |
|---|
| 45 | #else |
|---|
| 46 | #define TARGET_REZ_MAC_PPC 0 |
|---|
| 47 | #endif |
|---|
| 48 | |
|---|
| 49 | #if defined(i386_YES) |
|---|
| 50 | // x86 architecture |
|---|
| 51 | #define TARGET_REZ_MAC_X86 1 |
|---|
| 52 | #else |
|---|
| 53 | #define TARGET_REZ_MAC_X86 0 |
|---|
| 54 | #endif |
|---|
| 55 | |
|---|
| 56 | #define TARGET_REZ_WIN32 0 |
|---|
| 57 | #else |
|---|
| 58 | // Must be building on Windows |
|---|
| 59 | #define TARGET_REZ_WIN32 1 |
|---|
| 60 | #endif |
|---|
| 61 | |
|---|
| 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 "PerianResourceIDs.h" |
|---|
| 80 | |
|---|
| 81 | #define kMkvImportResource 510 |
|---|
| 82 | |
|---|
| 83 | // These flags specify information about the capabilities of the component |
|---|
| 84 | // Can import from files |
|---|
| 85 | // Can create a movie from a file without having to write to a separate disk file |
|---|
| 86 | // Can accept a data reference (such as a handle) as the source for the import |
|---|
| 87 | #define kMatroskaImportFlags \ |
|---|
| 88 | (canMovieImportFiles | canMovieImportInPlace | canMovieImportDataReferences | \ |
|---|
| 89 | canMovieImportValidateFile | canMovieImportValidateDataReferences | canMovieImportWithIdle | \ |
|---|
| 90 | hasMovieImportMIMEList | cmpThreadSafe) |
|---|
| 91 | |
|---|
| 92 | // Component Manager Thing |
|---|
| 93 | resource 'thng' (kMkvImportResource) { |
|---|
| 94 | 'eat ', // Type |
|---|
| 95 | 'MkvF', // SubType |
|---|
| 96 | 'vide', // Manufacturer |
|---|
| 97 | // For 'eat ' the media type supported by the component |
|---|
| 98 | // - use componentHasMultiplePlatforms |
|---|
| 99 | 0, // not used Component flags |
|---|
| 100 | 0, // not used Component flags Mask |
|---|
| 101 | 0, // not used Code Type |
|---|
| 102 | 0, // not used Code ID |
|---|
| 103 | 'STR ', // Name Type |
|---|
| 104 | kMkvImportResource, // Name ID |
|---|
| 105 | 0, // Info Type |
|---|
| 106 | 0, // Info ID |
|---|
| 107 | 0, // Icon Type |
|---|
| 108 | 0, // Icon ID |
|---|
| 109 | kMatroskaImportVersion, // Version |
|---|
| 110 | componentHasMultiplePlatforms + // Registration Flags |
|---|
| 111 | componentDoAutoVersion, |
|---|
| 112 | 0, // Resource ID of Icon Family |
|---|
| 113 | { |
|---|
| 114 | #if TARGET_OS_MAC // COMPONENT PLATFORM INFORMATION ---------------------- |
|---|
| 115 | #if TARGET_REZ_CARBON_MACHO |
|---|
| 116 | #if !(TARGET_REZ_MAC_PPC || TARGET_REZ_MAC_X86) |
|---|
| 117 | #error "Platform architecture not defined, TARGET_REZ_MAC_PPC and/or TARGET_REZ_MAC_X86 must be defined!" |
|---|
| 118 | #endif |
|---|
| 119 | #if TARGET_REZ_MAC_PPC |
|---|
| 120 | kMatroskaImportFlags, |
|---|
| 121 | 'dlle', // Code Resource type - Entry point found by symbol name 'dlle' resource |
|---|
| 122 | kMkvImportResource, // ID of 'dlle' resource |
|---|
| 123 | platformPowerPCNativeEntryPoint, // PPC |
|---|
| 124 | #endif |
|---|
| 125 | #if TARGET_REZ_MAC_X86 |
|---|
| 126 | kMatroskaImportFlags, |
|---|
| 127 | 'dlle', |
|---|
| 128 | kMkvImportResource, |
|---|
| 129 | platformIA32NativeEntryPoint, // INTEL |
|---|
| 130 | #endif |
|---|
| 131 | #else |
|---|
| 132 | #error "Only Mach-O is support for Mac OS (everything else is obsolete)." |
|---|
| 133 | #endif |
|---|
| 134 | #endif |
|---|
| 135 | #if TARGET_OS_WIN32 |
|---|
| 136 | kMatroskaImportFlags, |
|---|
| 137 | 'dlle', |
|---|
| 138 | kMkvImportResource, |
|---|
| 139 | platformWin32, |
|---|
| 140 | #endif |
|---|
| 141 | }, |
|---|
| 142 | 'thnr', kMkvImportResource // Component public resource identifier |
|---|
| 143 | }; |
|---|
| 144 | |
|---|
| 145 | // Component Alias |
|---|
| 146 | resource 'thga' (kMkvImportResource + 1) { |
|---|
| 147 | 'eat ', // Type |
|---|
| 148 | 'MKV ', // Subtype - this must be in uppercase. It will match an ".eim" suffix case-insensitively. |
|---|
| 149 | 'vide', // Manufaturer - for 'eat ' the media type supported by the component |
|---|
| 150 | kMatroskaImportFlags | // Component Flags |
|---|
| 151 | movieImportSubTypeIsFileExtension, // The subtype is a file name suffix |
|---|
| 152 | 0, // Component Flags Mask |
|---|
| 153 | 0, // Code Type |
|---|
| 154 | 0, // Code ID |
|---|
| 155 | 'STR ', // Name Type |
|---|
| 156 | kMkvImportResource, // Name ID |
|---|
| 157 | 0, // Info Type |
|---|
| 158 | 0, // Info ID |
|---|
| 159 | 0, // Icon Type |
|---|
| 160 | 0, // Icon ID |
|---|
| 161 | // TARGET COMPONENT --------------- |
|---|
| 162 | 'eat ', // Type |
|---|
| 163 | 'MkvF', // SubType |
|---|
| 164 | 'vide', // Manufaturer |
|---|
| 165 | 0, // Component Flags |
|---|
| 166 | 0, // Component Flags Mask |
|---|
| 167 | 'thnr', kMkvImportResource, // Component public resource identifier |
|---|
| 168 | cmpAliasOnlyThisFile |
|---|
| 169 | }; |
|---|
| 170 | |
|---|
| 171 | // Component Alias |
|---|
| 172 | resource 'thga' (kMkvImportResource + 2) { |
|---|
| 173 | 'eat ', // Type |
|---|
| 174 | 'MKA ', // Subtype - this must be in uppercase. It will match an ".eim" suffix case-insensitively. |
|---|
| 175 | 'soun', // Manufaturer - for 'eat ' the media type supported by the component |
|---|
| 176 | kMatroskaImportFlags | // Component Flags |
|---|
| 177 | movieImportSubTypeIsFileExtension, // The subtype is a file name suffix |
|---|
| 178 | 0, // Component Flags Mask |
|---|
| 179 | 0, // Code Type |
|---|
| 180 | 0, // Code ID |
|---|
| 181 | 'STR ', // Name Type |
|---|
| 182 | kMkvImportResource, // Name ID |
|---|
| 183 | 0, // Info Type |
|---|
| 184 | 0, // Info ID |
|---|
| 185 | 0, // Icon Type |
|---|
| 186 | 0, // Icon ID |
|---|
| 187 | // TARGET COMPONENT --------------- |
|---|
| 188 | 'eat ', // Type |
|---|
| 189 | 'MkvF', // SubType |
|---|
| 190 | 'vide', // Manufaturer |
|---|
| 191 | 0, // Component Flags |
|---|
| 192 | 0, // Component Flags Mask |
|---|
| 193 | 'thnr', kMkvImportResource, // Component public resource identifier |
|---|
| 194 | cmpAliasOnlyThisFile |
|---|
| 195 | }; |
|---|
| 196 | |
|---|
| 197 | // Import components should include a public component resource holding the same data that |
|---|
| 198 | // MovieImportGetMIMETypeList would return. This public resource's type and ID should be 'mime' and 1, |
|---|
| 199 | // respectively. By including this public resource, QuickTime and applications don't need to open the |
|---|
| 200 | // import component and call MovieImportGetMIMETypeList to determine the MIME types the importer supports. |
|---|
| 201 | // In the absence of this resource, QuickTime and applications will use MovieImportGetMIMETypeList |
|---|
| 202 | // |
|---|
| 203 | // Component public resource |
|---|
| 204 | resource 'thnr' (kMkvImportResource) { |
|---|
| 205 | { |
|---|
| 206 | 'mime', 1, 0, |
|---|
| 207 | 'mime', kMkvImportResource, 0, |
|---|
| 208 | |
|---|
| 209 | 'mcfg', 1, 0, |
|---|
| 210 | 'mcfg', kMkvImportResource, 0 |
|---|
| 211 | } |
|---|
| 212 | }; |
|---|
| 213 | |
|---|
| 214 | // QuickTime Media Configuration Resources ('mcfg' aka kQTMediaConfigResourceType) are used by the QuickTime MIME |
|---|
| 215 | // Configuration Control Panel to build and configure its User Interface. The 'mcfg' resource is also used by the |
|---|
| 216 | // QuickTime Plug-In to build a list of MIME types it registers for, and to figure out how to open files. |
|---|
| 217 | // In a future version of QuickTime for Windows the 'mcfg' resource will be used for the File Type Registration Control Panel. |
|---|
| 218 | // Some, but not all of the information contained within the 'mcfg' resources is available in other places in a component. |
|---|
| 219 | // However not everything is available, and not all in one place for example, Group ID, Plug-In, Application Flags and so on. |
|---|
| 220 | // |
|---|
| 221 | // Every Movie Importer ('eat ') and Graphics Importer ('grip') component should really have one. |
|---|
| 222 | // |
|---|
| 223 | // If either or both of the kQTMediaConfigCanUseApp and kQTMediaConfigCanUsePlugin flags are set, the MIME type will |
|---|
| 224 | // automatically show up in the MIME Configuration Control Panel allowing a user to choose how they want QuickTime to handle |
|---|
| 225 | // the file, if at all. |
|---|
| 226 | // |
|---|
| 227 | // If the kQTMediaConfigUsePluginByDefault flag is set, QuickTime will automatically register the MIME type for the |
|---|
| 228 | // QuickTime plug-in with all browsers on both platforms. |
|---|
| 229 | // |
|---|
| 230 | // Added in QuickTime 6 |
|---|
| 231 | resource 'mcfg' (kMkvImportResource) |
|---|
| 232 | { |
|---|
| 233 | kVersionDoesntMatter, // Version of the component this applies to |
|---|
| 234 | |
|---|
| 235 | { |
|---|
| 236 | // The ID of the group this type belongs with, (OSType, one of kQTMediaConfigStreamGroupID, etc.) |
|---|
| 237 | // This flag determines which group this MIME type will be listed under in the MIME Configuration Control Panel |
|---|
| 238 | kQTMediaConfigVideoGroupID, |
|---|
| 239 | |
|---|
| 240 | // MIME config flags (unsigned long, one or more of kQTMediaConfigCanUseApp, etc.) |
|---|
| 241 | kQTMediaConfigUseAppByDefault // By default, associate with application specified below instead of the QuickTime plug-in |
|---|
| 242 | | kQTMediaConfigCanUseApp // This type can be associated with an application |
|---|
| 243 | | kQTMediaConfigCanUsePlugin // This type can be associated with the QuickTime plug-in |
|---|
| 244 | | kQTMediaConfigBinaryFile, // The file is binary, not just text |
|---|
| 245 | |
|---|
| 246 | 'MkvF', // MacOS file type when saved (OSType) |
|---|
| 247 | 'TVOD', // MacOS file creator when saved (OSType) |
|---|
| 248 | |
|---|
| 249 | // Component information, used by the QuickTime plug-in to find the component to open this type of file |
|---|
| 250 | 'eat ', // Component type (OSType) |
|---|
| 251 | 'MkvF', // Component subtype (OSType) |
|---|
| 252 | 'vide', // Component manufacturer (OSType) |
|---|
| 253 | kMatroskaImportFlags, // Component flags |
|---|
| 254 | 0, // Flags mask |
|---|
| 255 | |
|---|
| 256 | 'MKV ', // Default file extension (OSType) - this must be in uppercase. It will match an ".eim" suffix case-insensitively. |
|---|
| 257 | kQTMediaInfoNetGroup, // QT file type group (OSType, one of kQTMediaInfoNetGroup, etc.) |
|---|
| 258 | |
|---|
| 259 | // Media type synonyms, an array of zero or more Pascal strings - none here |
|---|
| 260 | { |
|---|
| 261 | }, |
|---|
| 262 | |
|---|
| 263 | { |
|---|
| 264 | "Matroska file", // Media type description for MIME configuration panel and browser |
|---|
| 265 | "mkv,mka", // File extension(s), comma delimited if more than one |
|---|
| 266 | "QuickTime Player", // Opening application name for MIME configuration panel and browser |
|---|
| 267 | "Matroska Movie Importer", // Missing software description for the missing software dialog |
|---|
| 268 | "Version 0.1", // Vendor info string (copyright, version, etc) |
|---|
| 269 | }, |
|---|
| 270 | |
|---|
| 271 | // Array of one or more MIME types that describe this media type (eg. audio/mpeg, audio/x-mpeg, etc.) |
|---|
| 272 | { |
|---|
| 273 | "video/x-matroska", |
|---|
| 274 | "audio/x-matroska", |
|---|
| 275 | }, |
|---|
| 276 | } |
|---|
| 277 | }; |
|---|
| 278 | |
|---|
| 279 | // Component Name |
|---|
| 280 | resource 'STR ' (kMkvImportResource) { |
|---|
| 281 | "Matroska Movie Importer" |
|---|
| 282 | }; |
|---|
| 283 | |
|---|
| 284 | /* |
|---|
| 285 | This is an example of how to build an atom container resource to hold mime types. |
|---|
| 286 | This component's GetMIMETypeList implementation simply loads this resource and returns it. |
|---|
| 287 | Please note that atoms of the same type MUST be grouped together within an atom container. |
|---|
| 288 | (Also note that "video/electric-image" may not have been registered with the IETF.) |
|---|
| 289 | */ |
|---|
| 290 | resource 'mime' (kMkvImportResource) { |
|---|
| 291 | { |
|---|
| 292 | kMimeInfoMimeTypeTag, 1, "video/x-matroska"; |
|---|
| 293 | kMimeInfoMimeTypeTag, 2, "audio/x-matroska"; |
|---|
| 294 | kMimeInfoFileExtensionTag, 1, "mkv"; |
|---|
| 295 | kMimeInfoFileExtensionTag, 2, "mka"; |
|---|
| 296 | kMimeInfoDescriptionTag, 1, "Matroska"; |
|---|
| 297 | kMimeInfoDescriptionTag, 2, "Matroska"; |
|---|
| 298 | }; |
|---|
| 299 | }; |
|---|
| 300 | |
|---|
| 301 | #if TARGET_REZ_CARBON_MACHO || TARGET_REZ_WIN32 |
|---|
| 302 | // Code Entry Point for Mach-O and Windows |
|---|
| 303 | resource 'dlle' (kMkvImportResource) { |
|---|
| 304 | "MatroskaImportComponentDispatch" |
|---|
| 305 | }; |
|---|
| 306 | #endif |
|---|