forked from gbooker/perian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MatroskaExport.r
207 lines (187 loc) · 6.71 KB
/
MatroskaExport.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/*
* MatroskaExport.r
*
* MatroskaExport.r - Component resources for the export component
*
*
* Copyright (c) 2006 David Conrad
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
thng_RezTemplateVersion:
0 - original 'thng' template <-- default
1 - extended 'thng' template <-- used for multiplatform things
2 - extended 'thng' template including resource map id
*/
#define thng_RezTemplateVersion 2
/*
cfrg_RezTemplateVersion:
0 - original <-- default
1 - extended
*/
#define cfrg_RezTemplateVersion 1
#if TARGET_REZ_CARBON_MACHO
#if defined(ppc_YES)
// PPC architecture
#define TARGET_REZ_MAC_PPC 1
#else
#define TARGET_REZ_MAC_PPC 0
#endif
#if defined(i386_YES)
// x86 architecture
#define TARGET_REZ_MAC_X86 1
#else
#define TARGET_REZ_MAC_X86 0
#endif
#define TARGET_REZ_WIN32 0
#else
// Must be building on Windows
#define TARGET_REZ_WIN32 1
#endif
#if TARGET_REZ_CARBON_MACHO
#include <Carbon/Carbon.r>
#include <QuickTime/QuickTime.r>
#undef __CARBON_R__
#undef __CORESERVICES_R__
#undef __CARBONCORE_R__
#undef __COMPONENTS_R__
#else
#include "ConditionalMacros.r"
#include "Components.r"
#include "QuickTimeComponents.r"
#include "Types.r"
#include "MacTypes.r"
#include "Components.r"
#include "CodeFragments.r"
#undef __COMPONENTS_R__
#endif
#include "MatroskaExportVersion.h"
#define kMatroskaExportThingRes 1024
#define kMatroskaExportCodeRes 1024
#define kMatroskaExportNameRes 1024
#define kMatroskaExportInfoRes 1025
#define kComponentManufacturer 'Peri'
#define kMatroskaExportFlags \
(canMovieExportFiles | canMovieExportFromProcedures | movieExportMustGetSourceMediaType | \
canMovieExportValidateMovie | cmpThreadSafe)
// hasMovieExportUserInterface
// Component Manager Thing
resource 'thng' (kMatroskaExportThingRes) {
'spit', // Type
'MkvF', // SubType
kComponentManufacturer, // Manufacturer
// - use componentHasMultiplePlatforms
0, // not used Component flags
0, // not used Component flags Mask
0, // not used Code Type
0, // not used Code ID
'STR ', // Name Type
kMatroskaExportNameRes, // Name ID
'STR ', // Info Type
kMatroskaExportInfoRes, // Info ID
0, // Icon Type
0, // Icon ID
kMatroskaExportVersion, // Version
componentHasMultiplePlatforms + // Registration Flags
componentDoAutoVersion,
0, // Resource ID of Icon Family
{
#if TARGET_OS_MAC // COMPONENT PLATFORM INFORMATION ----------------------
#if TARGET_REZ_CARBON_MACHO
#if !(TARGET_REZ_MAC_PPC || TARGET_REZ_MAC_X86)
#error "Platform architecture not defined, TARGET_REZ_MAC_PPC and/or TARGET_REZ_MAC_X86 must be defined!"
#endif
#if TARGET_REZ_MAC_PPC
kMatroskaExportFlags,
'dlle', // Code Resource type - Entry point found by symbol name 'dlle' resource
kMatroskaExportCodeRes, // ID of 'dlle' resource
platformPowerPCNativeEntryPoint, // PPC
#endif
#if TARGET_REZ_MAC_X86
kMatroskaExportFlags,
'dlle',
kMatroskaExportCodeRes,
platformIA32NativeEntryPoint, // INTEL
#endif
#else
#error "At least one non-obsolete TARGET_REZ_XXX_XXX platform must be defined."
#endif
#endif
#if TARGET_OS_WIN32
kMatroskaExportFlags,
'dlle',
kMatroskaExportCodeRes,
platformWin32,
#endif
},
'thnr', kMatroskaExportThingRes // Component public resource identifier
};
// Component Name used in Movie Export Dialog
resource 'STR ' (kMatroskaExportNameRes) {
"Matroska"
};
// Component Information
resource 'STR ' (kMatroskaExportInfoRes) {
"Exports a QuickTime Movie file to an Matroska Video file."
};
resource 'STR#' (kMatroskaExportShortFileTypeNamesResID) {
{
"MkvF"
}
};
// Component public resource
resource 'thnr' (kMatroskaExportThingRes) {
{
'src#', 1, 0,
'src#', kMatroskaExportThingRes, 0,
'trk#', 2, 0,
'trk#', kMatroskaExportThingRes, 0,
}
};
// http://developer.apple.com/techpubs/quicktime/qtdevdocs/REF/refDataExchange.23.htm#pgfId=13688
// Lists a movie exporter component's supported media types and the minimum and maximum number of sources for each.
//
// A'src#' resource may be associated with export components that implement MovieExportFromProceduresToDataRef. The
// resource is used to indicate the types of data sources the export component can support. Moreover, for each type,
// it also indicates the minimum and maximum number of data sources of that type. Clients can use this information to
// determine if the number of data sources they want to export can be handled directly by the exporter. If the data
// source type is supported by fewer sources are allowed, the client application must either export a fewer number of
// sources or combine the data from its candidate sources itself to meet the limitation imposed by the exporter.
resource 'src#' (kMatroskaExportThingRes) {
{
'vide', 0, 127, isSourceType,
'soun', 0, 127, isSourceType
}
};
// Whereas 'src#' is meant to describe the number of data sources supported for use with MovieExportFromProceduresToDataRef,
// the 'trk#' resource is meant to indicate the number of tracks of the given types that can be exported. The resource is
// identical to the resource for data sources. The difference is that the flags will have one of two values:
// isSourceType - A media type such as 'vide' for video tracks, 'soun' for sound tracks, or 'musi' for QuickTime music tracks.
// isMediaCharacteristic - Indicates that mediaType corresponds to a media characteristic such a 'eyes' for visual tracks or
// 'ears' for tracks with sound.
resource 'trk#' (kMatroskaExportThingRes) {
{
'vide', 0, 127, isSourceType,
'soun', 0, 127, isSourceType
}
};
#if TARGET_REZ_CARBON_MACHO || TARGET_REZ_WIN32
// Code Entry Point for Mach-O and Windows
resource 'dlle' (kMatroskaExportCodeRes) {
"MatroskaExportComponentDispatch"
};
#endif