61
|
1 /*
|
|
2 * The contents of this file are subject to the Mozilla Public
|
|
3 * License Version 1.1 (the "License"); you may not use this file
|
|
4 * except in compliance with the License. You may obtain a copy of
|
|
5 * the License at http://www.mozilla.org/MPL/
|
|
6 *
|
|
7 * Software distributed under the License is distributed on an "AS
|
|
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
9 * implied. See the License for the specific language governing
|
|
10 * rights and limitations under the License.
|
|
11 *
|
|
12 * The Original Code is MPEG4IP.
|
|
13 *
|
|
14 * The Initial Developer of the Original Code is Cisco Systems Inc.
|
|
15 * Portions created by Cisco Systems Inc. are
|
201
|
16 * Copyright (C) Cisco Systems Inc. 2001 - 2005. All Rights Reserved.
|
61
|
17 *
|
|
18 * 3GPP features implementation is based on 3GPP's TS26.234-v5.60,
|
|
19 * and was contributed by Ximpo Group Ltd.
|
|
20 *
|
|
21 * Portions created by Ximpo Group Ltd. are
|
|
22 * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved.
|
|
23 *
|
|
24 * Contributor(s):
|
|
25 * Dave Mackie dmackie@cisco.com
|
|
26 * Alix Marchandise-Franquet alix@cisco.com
|
|
27 * Ximpo Group Ltd. mp4v2@ximpo.com
|
201
|
28 * Bill May wmay@cisco.com
|
61
|
29 */
|
|
30
|
|
31 #ifndef __MP4_INCLUDED__
|
|
32 #define __MP4_INCLUDED__
|
|
33
|
|
34 /* include system and project specific headers */
|
|
35 #include "mpeg4ip.h"
|
|
36
|
|
37 #include <math.h> /* to define float HUGE_VAL and/or NAN */
|
|
38 #ifndef NAN
|
|
39 #define NAN HUGE_VAL
|
|
40 #endif
|
|
41
|
|
42 #ifdef __cplusplus
|
|
43 /* exploit C++ ability of default values for function parameters */
|
|
44 #define DEFAULT(x) =x
|
|
45 #else
|
|
46 #define DEFAULT(x)
|
|
47 #endif
|
|
48
|
|
49 /* MP4 API types */
|
|
50 typedef void* MP4FileHandle;
|
|
51 typedef u_int32_t MP4TrackId;
|
|
52 typedef u_int32_t MP4SampleId;
|
|
53 typedef u_int64_t MP4Timestamp;
|
|
54 typedef u_int64_t MP4Duration;
|
|
55 typedef u_int32_t MP4EditId;
|
|
56
|
|
57 /* Invalid values for API types */
|
|
58 #define MP4_INVALID_FILE_HANDLE ((MP4FileHandle)NULL)
|
|
59 #define MP4_INVALID_TRACK_ID ((MP4TrackId)0)
|
|
60 #define MP4_INVALID_SAMPLE_ID ((MP4SampleId)0)
|
|
61 #define MP4_INVALID_TIMESTAMP ((MP4Timestamp)-1)
|
|
62 #define MP4_INVALID_DURATION ((MP4Duration)-1)
|
|
63 #define MP4_INVALID_EDIT_ID ((MP4EditId)0)
|
|
64
|
|
65 /* Macros to test for API type validity */
|
|
66 #define MP4_IS_VALID_FILE_HANDLE(x) ((x) != MP4_INVALID_FILE_HANDLE)
|
|
67 #define MP4_IS_VALID_TRACK_ID(x) ((x) != MP4_INVALID_TRACK_ID)
|
|
68 #define MP4_IS_VALID_SAMPLE_ID(x) ((x) != MP4_INVALID_SAMPLE_ID)
|
|
69 #define MP4_IS_VALID_TIMESTAMP(x) ((x) != MP4_INVALID_TIMESTAMP)
|
|
70 #define MP4_IS_VALID_DURATION(x) ((x) != MP4_INVALID_DURATION)
|
|
71 #define MP4_IS_VALID_EDIT_ID(x) ((x) != MP4_INVALID_EDIT_ID)
|
|
72
|
|
73 /* MP4 verbosity levels - e.g. MP4SetVerbosity() */
|
|
74 #define MP4_DETAILS_ALL 0xFFFFFFFF
|
|
75 #define MP4_DETAILS_ERROR 0x00000001
|
|
76 #define MP4_DETAILS_WARNING 0x00000002
|
|
77 #define MP4_DETAILS_READ 0x00000004
|
|
78 #define MP4_DETAILS_WRITE 0x00000008
|
|
79 #define MP4_DETAILS_FIND 0x00000010
|
|
80 #define MP4_DETAILS_TABLE 0x00000020
|
|
81 #define MP4_DETAILS_SAMPLE 0x00000040
|
|
82 #define MP4_DETAILS_HINT 0x00000080
|
|
83 #define MP4_DETAILS_ISMA 0x00000100
|
|
84 #define MP4_DETAILS_EDIT 0x00000200
|
|
85
|
|
86 #define MP4_DETAILS_READ_ALL \
|
|
87 (MP4_DETAILS_READ | MP4_DETAILS_TABLE | MP4_DETAILS_SAMPLE)
|
|
88 #define MP4_DETAILS_WRITE_ALL \
|
|
89 (MP4_DETAILS_WRITE | MP4_DETAILS_TABLE | MP4_DETAILS_SAMPLE)
|
|
90
|
|
91 /*
|
|
92 * MP4 Known track type names - e.g. MP4GetNumberOfTracks(type)
|
|
93 *
|
|
94 * Note this first group of track types should be created
|
|
95 * via the MP4Add<Type>Track() functions, and not MP4AddTrack(type)
|
|
96 */
|
|
97 #define MP4_OD_TRACK_TYPE "odsm"
|
|
98 #define MP4_SCENE_TRACK_TYPE "sdsm"
|
|
99 #define MP4_AUDIO_TRACK_TYPE "soun"
|
|
100 #define MP4_VIDEO_TRACK_TYPE "vide"
|
|
101 #define MP4_HINT_TRACK_TYPE "hint"
|
201
|
102 #define MP4_CNTL_TRACK_TYPE "cntl"
|
61
|
103 /*
|
|
104 * This second set of track types should be created
|
|
105 * via MP4AddSystemsTrack(type)
|
|
106 */
|
|
107 #define MP4_CLOCK_TRACK_TYPE "crsm"
|
|
108 #define MP4_MPEG7_TRACK_TYPE "m7sm"
|
|
109 #define MP4_OCI_TRACK_TYPE "ocsm"
|
|
110 #define MP4_IPMP_TRACK_TYPE "ipsm"
|
|
111 #define MP4_MPEGJ_TRACK_TYPE "mjsm"
|
|
112
|
|
113 #define MP4_IS_VIDEO_TRACK_TYPE(type) \
|
|
114 (!strcasecmp(type, MP4_VIDEO_TRACK_TYPE))
|
|
115
|
|
116 #define MP4_IS_AUDIO_TRACK_TYPE(type) \
|
|
117 (!strcasecmp(type, MP4_AUDIO_TRACK_TYPE))
|
|
118
|
201
|
119 #define MP4_IS_CNTL_TRACK_TYPE(type) \
|
|
120 (!strcasecmp(type, MP4_CNTL_TRACK_TYPE))
|
|
121
|
61
|
122 #define MP4_IS_OD_TRACK_TYPE(type) \
|
|
123 (!strcasecmp(type, MP4_OD_TRACK_TYPE))
|
|
124
|
|
125 #define MP4_IS_SCENE_TRACK_TYPE(type) \
|
|
126 (!strcasecmp(type, MP4_SCENE_TRACK_TYPE))
|
|
127
|
|
128 #define MP4_IS_HINT_TRACK_TYPE(type) \
|
|
129 (!strcasecmp(type, MP4_HINT_TRACK_TYPE))
|
|
130
|
|
131 #define MP4_IS_SYSTEMS_TRACK_TYPE(type) \
|
|
132 (!strcasecmp(type, MP4_CLOCK_TRACK_TYPE) \
|
|
133 || !strcasecmp(type, MP4_MPEG7_TRACK_TYPE) \
|
|
134 || !strcasecmp(type, MP4_OCI_TRACK_TYPE) \
|
|
135 || !strcasecmp(type, MP4_IPMP_TRACK_TYPE) \
|
|
136 || !strcasecmp(type, MP4_MPEGJ_TRACK_TYPE))
|
|
137
|
|
138 /* MP4 Audio track types - see MP4AddAudioTrack()*/
|
|
139 #define MP4_INVALID_AUDIO_TYPE 0x00
|
|
140 #define MP4_MPEG1_AUDIO_TYPE 0x6B
|
|
141 #define MP4_MPEG2_AUDIO_TYPE 0x69
|
|
142 #define MP4_MP3_AUDIO_TYPE MP4_MPEG2_AUDIO_TYPE
|
|
143 #define MP4_MPEG2_AAC_MAIN_AUDIO_TYPE 0x66
|
|
144 #define MP4_MPEG2_AAC_LC_AUDIO_TYPE 0x67
|
|
145 #define MP4_MPEG2_AAC_SSR_AUDIO_TYPE 0x68
|
|
146 #define MP4_MPEG2_AAC_AUDIO_TYPE MP4_MPEG2_AAC_MAIN_AUDIO_TYPE
|
|
147 #define MP4_MPEG4_AUDIO_TYPE 0x40
|
|
148 #define MP4_PRIVATE_AUDIO_TYPE 0xC0
|
|
149 #define MP4_PCM16_LITTLE_ENDIAN_AUDIO_TYPE 0xE0 /* a private definition */
|
|
150 #define MP4_VORBIS_AUDIO_TYPE 0xE1 /* a private definition */
|
|
151 #define MP4_AC3_AUDIO_TYPE 0xE2 /* a private definition */
|
|
152 #define MP4_ALAW_AUDIO_TYPE 0xE3 /* a private definition */
|
|
153 #define MP4_ULAW_AUDIO_TYPE 0xE4 /* a private definition */
|
|
154 #define MP4_G723_AUDIO_TYPE 0xE5 /* a private definition */
|
|
155 #define MP4_PCM16_BIG_ENDIAN_AUDIO_TYPE 0xE6 /* a private definition */
|
|
156
|
|
157 /* MP4 MPEG-4 Audio types from 14496-3 Table 1.5.1 */
|
|
158 #define MP4_MPEG4_INVALID_AUDIO_TYPE 0
|
|
159 #define MP4_MPEG4_AAC_MAIN_AUDIO_TYPE 1
|
|
160 #define MP4_MPEG4_AAC_LC_AUDIO_TYPE 2
|
|
161 #define MP4_MPEG4_AAC_SSR_AUDIO_TYPE 3
|
|
162 #define MP4_MPEG4_AAC_LTP_AUDIO_TYPE 4
|
|
163 #define MP4_MPEG4_AAC_HE_AUDIO_TYPE 5
|
|
164 #define MP4_MPEG4_AAC_SCALABLE_AUDIO_TYPE 6
|
|
165 #define MP4_MPEG4_CELP_AUDIO_TYPE 8
|
|
166 #define MP4_MPEG4_HVXC_AUDIO_TYPE 9
|
|
167 #define MP4_MPEG4_TTSI_AUDIO_TYPE 12
|
|
168 #define MP4_MPEG4_MAIN_SYNTHETIC_AUDIO_TYPE 13
|
|
169 #define MP4_MPEG4_WAVETABLE_AUDIO_TYPE 14
|
|
170 #define MP4_MPEG4_MIDI_AUDIO_TYPE 15
|
|
171 #define MP4_MPEG4_ALGORITHMIC_FX_AUDIO_TYPE 16
|
|
172
|
|
173 /* MP4 Audio type utilities following common usage */
|
|
174 #define MP4_IS_MP3_AUDIO_TYPE(type) \
|
|
175 ((type) == MP4_MPEG1_AUDIO_TYPE || (type) == MP4_MPEG2_AUDIO_TYPE)
|
|
176
|
|
177 #define MP4_IS_MPEG2_AAC_AUDIO_TYPE(type) \
|
|
178 (((type) >= MP4_MPEG2_AAC_MAIN_AUDIO_TYPE \
|
|
179 && (type) <= MP4_MPEG2_AAC_SSR_AUDIO_TYPE))
|
|
180
|
|
181 #define MP4_IS_MPEG4_AAC_AUDIO_TYPE(mpeg4Type) \
|
|
182 (((mpeg4Type) >= MP4_MPEG4_AAC_MAIN_AUDIO_TYPE \
|
201
|
183 && (mpeg4Type) <= MP4_MPEG4_AAC_HE_AUDIO_TYPE) \
|
61
|
184 || (mpeg4Type) == MP4_MPEG4_AAC_SCALABLE_AUDIO_TYPE \
|
|
185 || (mpeg4Type) == 17)
|
|
186
|
|
187 #define MP4_IS_AAC_AUDIO_TYPE(type) \
|
|
188 (MP4_IS_MPEG2_AAC_AUDIO_TYPE(type) \
|
|
189 || (type) == MP4_MPEG4_AUDIO_TYPE)
|
|
190
|
|
191 /* MP4 Video track types - see MP4AddVideoTrack() */
|
|
192 #define MP4_INVALID_VIDEO_TYPE 0x00
|
|
193 #define MP4_MPEG1_VIDEO_TYPE 0x6A
|
|
194 #define MP4_MPEG2_SIMPLE_VIDEO_TYPE 0x60
|
|
195 #define MP4_MPEG2_MAIN_VIDEO_TYPE 0x61
|
|
196 #define MP4_MPEG2_SNR_VIDEO_TYPE 0x62
|
|
197 #define MP4_MPEG2_SPATIAL_VIDEO_TYPE 0x63
|
|
198 #define MP4_MPEG2_HIGH_VIDEO_TYPE 0x64
|
|
199 #define MP4_MPEG2_442_VIDEO_TYPE 0x65
|
|
200 #define MP4_MPEG2_VIDEO_TYPE MP4_MPEG2_MAIN_VIDEO_TYPE
|
|
201 #define MP4_MPEG4_VIDEO_TYPE 0x20
|
|
202 #define MP4_JPEG_VIDEO_TYPE 0x6C
|
|
203 #define MP4_PRIVATE_VIDEO_TYPE 0xD0
|
|
204 #define MP4_YUV12_VIDEO_TYPE 0xF0 /* a private definition */
|
|
205 #define MP4_H263_VIDEO_TYPE 0xF2 /* a private definition */
|
|
206 #define MP4_H261_VIDEO_TYPE 0xF3 /* a private definition */
|
|
207
|
|
208 /* MP4 Video type utilities */
|
|
209 #define MP4_IS_MPEG1_VIDEO_TYPE(type) \
|
|
210 ((type) == MP4_MPEG1_VIDEO_TYPE)
|
|
211
|
|
212 #define MP4_IS_MPEG2_VIDEO_TYPE(type) \
|
|
213 (((type) >= MP4_MPEG2_SIMPLE_VIDEO_TYPE \
|
|
214 && (type) <= MP4_MPEG2_442_VIDEO_TYPE) \
|
|
215 || MP4_IS_MPEG1_VIDEO_TYPE(type))
|
|
216
|
|
217 #define MP4_IS_MPEG4_VIDEO_TYPE(type) \
|
|
218 ((type) == MP4_MPEG4_VIDEO_TYPE)
|
|
219
|
|
220 /* Mpeg4 Visual Profile Defines - ISO/IEC 14496-2:2001/Amd.2:2002(E) */
|
|
221 #define MPEG4_SP_L1 (0x1)
|
|
222 #define MPEG4_SP_L2 (0x2)
|
|
223 #define MPEG4_SP_L3 (0x3)
|
|
224 #define MPEG4_SP_L0 (0x8)
|
|
225 #define MPEG4_SSP_L1 (0x11)
|
|
226 #define MPEG4_SSP_L2 (0x12)
|
|
227 #define MPEG4_CP_L1 (0x21)
|
|
228 #define MPEG4_CP_L2 (0x22)
|
|
229 #define MPEG4_MP_L2 (0x32)
|
|
230 #define MPEG4_MP_L3 (0x33)
|
|
231 #define MPEG4_MP_L4 (0x34)
|
|
232 #define MPEG4_NBP_L2 (0x42)
|
|
233 #define MPEG4_STP_L1 (0x51)
|
|
234 #define MPEG4_SFAP_L1 (0x61)
|
|
235 #define MPEG4_SFAP_L2 (0x62)
|
|
236 #define MPEG4_SFBAP_L1 (0x63)
|
|
237 #define MPEG4_SFBAP_L2 (0x64)
|
|
238 #define MPEG4_BATP_L1 (0x71)
|
|
239 #define MPEG4_BATP_L2 (0x72)
|
|
240 #define MPEG4_HP_L1 (0x81)
|
|
241 #define MPEG4_HP_L2 (0x82)
|
|
242 #define MPEG4_ARTSP_L1 (0x91)
|
|
243 #define MPEG4_ARTSP_L2 (0x92)
|
|
244 #define MPEG4_ARTSP_L3 (0x93)
|
|
245 #define MPEG4_ARTSP_L4 (0x94)
|
|
246 #define MPEG4_CSP_L1 (0xa1)
|
|
247 #define MPEG4_CSP_L2 (0xa2)
|
|
248 #define MPEG4_CSP_L3 (0xa3)
|
|
249 #define MPEG4_ACEP_L1 (0xb1)
|
|
250 #define MPEG4_ACEP_L2 (0xb2)
|
|
251 #define MPEG4_ACEP_L3 (0xb3)
|
|
252 #define MPEG4_ACEP_L4 (0xb4)
|
|
253 #define MPEG4_ACP_L1 (0xc1)
|
|
254 #define MPEG4_ACP_L2 (0xc2)
|
|
255 #define MPEG4_AST_L1 (0xd1)
|
|
256 #define MPEG4_AST_L2 (0xd2)
|
|
257 #define MPEG4_AST_L3 (0xd3)
|
|
258 #define MPEG4_S_STUDIO_P_L1 (0xe1)
|
|
259 #define MPEG4_S_STUDIO_P_L2 (0xe2)
|
|
260 #define MPEG4_S_STUDIO_P_L3 (0xe3)
|
|
261 #define MPEG4_S_STUDIO_P_L4 (0xe4)
|
|
262 #define MPEG4_C_STUDIO_P_L1 (0xe5)
|
|
263 #define MPEG4_C_STUDIO_P_L2 (0xe6)
|
|
264 #define MPEG4_C_STUDIO_P_L3 (0xe7)
|
|
265 #define MPEG4_C_STUDIO_P_L4 (0xe8)
|
|
266 #define MPEG4_ASP_L0 (0xF0)
|
|
267 #define MPEG4_ASP_L1 (0xF1)
|
|
268 #define MPEG4_ASP_L2 (0xF2)
|
|
269 #define MPEG4_ASP_L3 (0xF3)
|
|
270 #define MPEG4_ASP_L4 (0xF4)
|
|
271 #define MPEG4_ASP_L5 (0xF5)
|
|
272 #define MPEG4_ASP_L3B (0xF7)
|
|
273 #define MPEG4_FGSP_L0 (0xf8)
|
|
274 #define MPEG4_FGSP_L1 (0xf9)
|
|
275 #define MPEG4_FGSP_L2 (0xfa)
|
|
276 #define MPEG4_FGSP_L3 (0xfb)
|
|
277 #define MPEG4_FGSP_L4 (0xfc)
|
|
278 #define MPEG4_FGSP_L5 (0xfd)
|
|
279
|
|
280 /* MP4 API declarations */
|
|
281
|
|
282 #ifdef __cplusplus
|
|
283 extern "C" {
|
|
284 #endif
|
|
285
|
|
286 /* file operations */
|
|
287 #define MP4_CREATE_64BIT_DATA (0x01)
|
|
288 #define MP4_CREATE_64BIT_TIME (0x02) // Quicktime is not compatible with this
|
|
289 #define MP4_CREATE_64BIT (MP4_CREATE_64BIT_DATA | MP4_CREATE_64BIT_TIME)
|
|
290 #define MP4_CREATE_EXTENSIBLE_FORMAT (0x04)
|
|
291
|
|
292 MP4FileHandle MP4Create(
|
|
293 const char* fileName,
|
|
294 u_int32_t verbosity DEFAULT(0),
|
201
|
295 u_int32_t flags DEFAULT(0));
|
|
296 MP4FileHandle MP4CreateEx(
|
|
297 const char *fileName,
|
|
298 u_int32_t verbosity DEFAULT(0),
|
61
|
299 u_int32_t flags DEFAULT(0),
|
|
300 int add_ftyp DEFAULT(1),
|
|
301 int add_iods DEFAULT(1),
|
|
302 char* majorBrand DEFAULT(0),
|
|
303 u_int32_t minorVersion DEFAULT(0),
|
|
304 char** supportedBrands DEFAULT(0),
|
|
305 u_int32_t supportedBrandsCount DEFAULT(0));
|
|
306
|
|
307 MP4FileHandle MP4Modify(
|
|
308 const char* fileName,
|
|
309 u_int32_t verbosity DEFAULT(0),
|
|
310 u_int32_t flags DEFAULT(0));
|
|
311
|
|
312 MP4FileHandle MP4Read(
|
|
313 const char* fileName,
|
|
314 u_int32_t verbosity DEFAULT(0));
|
|
315
|
|
316 bool MP4Close(
|
|
317 MP4FileHandle hFile);
|
|
318
|
|
319 bool MP4Optimize(
|
|
320 const char* existingFileName,
|
|
321 const char* newFileName DEFAULT(NULL),
|
|
322 u_int32_t verbosity DEFAULT(0));
|
|
323
|
|
324 bool MP4Dump(
|
|
325 MP4FileHandle hFile,
|
|
326 FILE* pDumpFile DEFAULT(NULL),
|
|
327 bool dumpImplicits DEFAULT(0));
|
|
328
|
|
329 char* MP4Info(
|
|
330 MP4FileHandle hFile,
|
|
331 MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID));
|
|
332
|
|
333 char* MP4FileInfo(
|
|
334 const char* fileName,
|
|
335 MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID));
|
|
336
|
|
337 /* file properties */
|
|
338
|
|
339 /* specific file properties */
|
|
340
|
|
341 u_int32_t MP4GetVerbosity(MP4FileHandle hFile);
|
|
342
|
|
343 bool MP4SetVerbosity(MP4FileHandle hFile, u_int32_t verbosity);
|
|
344
|
|
345 MP4Duration MP4GetDuration(MP4FileHandle hFile);
|
|
346
|
|
347 u_int32_t MP4GetTimeScale(MP4FileHandle hFile);
|
|
348
|
|
349 bool MP4SetTimeScale(MP4FileHandle hFile, u_int32_t value);
|
|
350
|
|
351 u_int8_t MP4GetODProfileLevel(MP4FileHandle hFile);
|
|
352
|
|
353 bool MP4SetODProfileLevel(MP4FileHandle hFile, u_int8_t value);
|
|
354
|
|
355 u_int8_t MP4GetSceneProfileLevel(MP4FileHandle hFile);
|
|
356
|
|
357 bool MP4SetSceneProfileLevel(MP4FileHandle hFile, u_int8_t value);
|
|
358
|
|
359 u_int8_t MP4GetVideoProfileLevel(MP4FileHandle hFile);
|
|
360
|
|
361 bool MP4SetVideoProfileLevel(MP4FileHandle hFile, u_int8_t value);
|
|
362
|
|
363 u_int8_t MP4GetAudioProfileLevel(MP4FileHandle hFile);
|
|
364
|
|
365 bool MP4SetAudioProfileLevel(MP4FileHandle hFile, u_int8_t value);
|
|
366
|
|
367 u_int8_t MP4GetGraphicsProfileLevel(MP4FileHandle hFile);
|
|
368
|
|
369 bool MP4SetGraphicsProfileLevel(MP4FileHandle hFile, u_int8_t value);
|
|
370
|
|
371 /* generic file properties */
|
|
372
|
|
373 u_int64_t MP4GetIntegerProperty(
|
|
374 MP4FileHandle hFile,
|
|
375 const char* propName);
|
|
376
|
|
377 bool MP4HaveTrackIntegerProperty(
|
|
378 MP4FileHandle hFile, MP4TrackId trackId,
|
|
379 const char* propName);
|
|
380
|
|
381 float MP4GetFloatProperty(
|
|
382 MP4FileHandle hFile,
|
|
383 const char* propName);
|
|
384
|
|
385 const char* MP4GetStringProperty(
|
|
386 MP4FileHandle hFile,
|
|
387 const char* propName);
|
|
388
|
|
389 void MP4GetBytesProperty(
|
|
390 MP4FileHandle hFile,
|
|
391 const char* propName,
|
|
392 u_int8_t** ppValue,
|
|
393 u_int32_t* pValueSize);
|
|
394
|
|
395 bool MP4SetIntegerProperty(
|
|
396 MP4FileHandle hFile,
|
|
397 const char* propName,
|
|
398 int64_t value);
|
|
399
|
|
400 bool MP4SetFloatProperty(
|
|
401 MP4FileHandle hFile,
|
|
402 const char* propName,
|
|
403 float value);
|
|
404
|
|
405 bool MP4SetStringProperty(
|
|
406 MP4FileHandle hFile, const char* propName, const char* value);
|
|
407
|
|
408 bool MP4SetBytesProperty(
|
|
409 MP4FileHandle hFile, const char* propName,
|
|
410 const u_int8_t* pValue, u_int32_t valueSize);
|
|
411
|
|
412 /* track operations */
|
|
413
|
|
414 MP4TrackId MP4AddTrack(
|
|
415 MP4FileHandle hFile,
|
|
416 const char* type);
|
|
417
|
|
418 MP4TrackId MP4AddSystemsTrack(
|
|
419 MP4FileHandle hFile,
|
|
420 const char* type);
|
|
421
|
|
422 MP4TrackId MP4AddODTrack(
|
|
423 MP4FileHandle hFile);
|
|
424
|
|
425 MP4TrackId MP4AddSceneTrack(
|
|
426 MP4FileHandle hFile);
|
|
427
|
|
428 MP4TrackId MP4AddAudioTrack(
|
|
429 MP4FileHandle hFile,
|
|
430 u_int32_t timeScale,
|
|
431 MP4Duration sampleDuration,
|
|
432 u_int8_t audioType DEFAULT(MP4_MPEG4_AUDIO_TYPE));
|
|
433
|
|
434 typedef struct mp4v2_ismacryp_session_params {
|
|
435 u_int32_t scheme_type;
|
|
436 u_int16_t scheme_version;
|
|
437 u_int8_t key_ind_len;
|
|
438 u_int8_t iv_len;
|
|
439 u_int8_t selective_enc;
|
|
440 char *kms_uri;
|
|
441 } mp4v2_ismacrypParams;
|
|
442
|
|
443
|
|
444 MP4TrackId MP4AddEncAudioTrack(
|
|
445 MP4FileHandle hFile,
|
|
446 u_int32_t timeScale,
|
|
447 MP4Duration sampleDuration,
|
|
448 mp4v2_ismacrypParams *icPp,
|
|
449 u_int8_t audioType DEFAULT(MP4_MPEG4_AUDIO_TYPE));
|
|
450 MP4TrackId MP4AddAmrAudioTrack(
|
|
451 MP4FileHandle hFile,
|
|
452 u_int32_t timeScale,
|
|
453 u_int16_t modeSet,
|
|
454 u_int8_t modeChangePeriod,
|
|
455 u_int8_t framesPerSample,
|
|
456 bool isAmrWB);
|
|
457
|
|
458 void MP4SetAmrVendor(
|
|
459 MP4FileHandle hFile,
|
|
460 MP4TrackId trackId,
|
|
461 u_int32_t vendor);
|
|
462
|
|
463 void MP4SetAmrDecoderVersion(
|
|
464 MP4FileHandle hFile,
|
|
465 MP4TrackId trackId,
|
|
466 u_int8_t decoderVersion);
|
|
467
|
|
468 void MP4SetAmrModeSet(MP4FileHandle hFile, MP4TrackId trakId, uint16_t modeSet);
|
|
469 uint16_t MP4GetAmrModeSet(MP4FileHandle hFile, MP4TrackId trackId);
|
|
470
|
201
|
471 MP4TrackId MP4AddHrefTrack(MP4FileHandle hFile,
|
|
472 uint32_t timeScale,
|
|
473 MP4Duration sampleDuration);
|
|
474
|
61
|
475 MP4TrackId MP4AddVideoTrack(
|
|
476 MP4FileHandle hFile,
|
|
477 u_int32_t timeScale,
|
|
478 MP4Duration sampleDuration,
|
|
479 u_int16_t width,
|
|
480 u_int16_t height,
|
|
481 u_int8_t videoType DEFAULT(MP4_MPEG4_VIDEO_TYPE));
|
|
482
|
|
483 MP4TrackId MP4AddEncVideoTrack(
|
|
484 MP4FileHandle hFile,
|
|
485 u_int32_t timeScale,
|
|
486 MP4Duration sampleDuration,
|
|
487 u_int16_t width,
|
|
488 u_int16_t height,
|
|
489 mp4v2_ismacrypParams *icPp,
|
|
490 u_int8_t videoType DEFAULT(MP4_MPEG4_VIDEO_TYPE));
|
|
491
|
|
492 MP4TrackId MP4AddH264VideoTrack(
|
|
493 MP4FileHandle hFile,
|
|
494 u_int32_t timeScale,
|
|
495 MP4Duration sampleDuration,
|
|
496 u_int16_t width,
|
|
497 u_int16_t height,
|
|
498 uint8_t AVCProfileIndication,
|
|
499 uint8_t profile_compat,
|
|
500 uint8_t AVCLevelIndication,
|
|
501 uint8_t sampleLenFieldSizeMinusOne);
|
|
502 bool MP4AddH264SequenceParameterSet(MP4FileHandle hFile,
|
|
503 MP4TrackId trackId,
|
201
|
504 const uint8_t *pSequence,
|
61
|
505 uint16_t sequenceLen);
|
|
506 bool MP4AddH264PictureParameterSet(MP4FileHandle hFile,
|
|
507 MP4TrackId trackId,
|
201
|
508 const uint8_t *pPict,
|
|
509 uint16_t pictLen);
|
61
|
510 void MP4SetH263Vendor(
|
|
511 MP4FileHandle hFile,
|
|
512 MP4TrackId trackId,
|
|
513 u_int32_t vendor);
|
|
514
|
|
515 void MP4SetH263DecoderVersion(
|
|
516 MP4FileHandle hFile,
|
|
517 MP4TrackId trackId,
|
|
518 u_int8_t decoderVersion);
|
|
519
|
|
520 void MP4SetH263Bitrates(
|
|
521 MP4FileHandle hFile,
|
|
522 MP4TrackId trackId,
|
|
523 u_int32_t avgBitrate,
|
|
524 u_int32_t maxBitrate);
|
|
525
|
|
526 MP4TrackId MP4AddH263VideoTrack(
|
|
527 MP4FileHandle hFile,
|
|
528 u_int32_t timeScale,
|
|
529 MP4Duration sampleDuration,
|
|
530 u_int16_t width,
|
|
531 u_int16_t height,
|
|
532 u_int8_t h263Level,
|
|
533 u_int8_t h263Profile,
|
|
534 u_int32_t avgBitrate,
|
|
535 u_int32_t maxBitrate);
|
|
536
|
|
537 MP4TrackId MP4AddHintTrack(
|
|
538 MP4FileHandle hFile,
|
|
539 MP4TrackId refTrackId);
|
|
540
|
|
541 MP4TrackId MP4CloneTrack(
|
|
542 MP4FileHandle srcFile,
|
|
543 MP4TrackId srcTrackId,
|
|
544 MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE),
|
|
545 MP4TrackId dstHintTrackReferenceTrack DEFAULT(MP4_INVALID_TRACK_ID));
|
|
546
|
|
547 MP4TrackId MP4EncAndCloneTrack(
|
|
548 MP4FileHandle srcFile,
|
|
549 MP4TrackId srcTrackId,
|
|
550 mp4v2_ismacrypParams *icPp,
|
|
551 MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE),
|
|
552 MP4TrackId dstHintTrackReferenceTrack DEFAULT(MP4_INVALID_TRACK_ID));
|
|
553
|
|
554 MP4TrackId MP4CopyTrack(
|
|
555 MP4FileHandle srcFile,
|
|
556 MP4TrackId srcTrackId,
|
|
557 MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE),
|
|
558 bool applyEdits DEFAULT(false),
|
|
559 MP4TrackId dstHintTrackReferenceTrack DEFAULT(MP4_INVALID_TRACK_ID));
|
|
560
|
|
561 typedef u_int32_t (*encryptFunc_t)(u_int32_t, u_int32_t, u_int8_t*, u_int32_t*, u_int8_t **);
|
|
562
|
|
563 MP4TrackId MP4EncAndCopyTrack(
|
|
564 MP4FileHandle srcFile,
|
|
565 MP4TrackId srcTrackId,
|
|
566 mp4v2_ismacrypParams *icPp,
|
|
567 encryptFunc_t encfcnp,
|
|
568 u_int32_t encfcnparam1,
|
|
569 MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE),
|
|
570 bool applyEdits DEFAULT(false),
|
|
571 MP4TrackId dstHintTrackReferenceTrack DEFAULT(MP4_INVALID_TRACK_ID));
|
|
572
|
|
573 bool MP4DeleteTrack(
|
|
574 MP4FileHandle hFile,
|
|
575 MP4TrackId trackId);
|
|
576
|
|
577 u_int32_t MP4GetNumberOfTracks(
|
|
578 MP4FileHandle hFile,
|
|
579 const char* type DEFAULT(NULL),
|
|
580 u_int8_t subType DEFAULT(0));
|
|
581
|
|
582 MP4TrackId MP4FindTrackId(
|
|
583 MP4FileHandle hFile,
|
|
584 u_int16_t index,
|
|
585 const char* type DEFAULT(NULL),
|
|
586 u_int8_t subType DEFAULT(0));
|
|
587
|
|
588 u_int16_t MP4FindTrackIndex(
|
|
589 MP4FileHandle hFile,
|
|
590 MP4TrackId trackId);
|
|
591
|
|
592 /* track properties */
|
|
593
|
|
594 /* specific track properties */
|
|
595
|
|
596 const char* MP4GetTrackType(
|
|
597 MP4FileHandle hFile,
|
|
598 MP4TrackId trackId);
|
|
599
|
|
600 const char *MP4GetTrackMediaDataName(MP4FileHandle hFile,
|
|
601 MP4TrackId trackId);
|
|
602 MP4Duration MP4GetTrackDuration(
|
|
603 MP4FileHandle hFile,
|
|
604 MP4TrackId trackId);
|
|
605
|
|
606 u_int32_t MP4GetTrackTimeScale(
|
|
607 MP4FileHandle hFile,
|
|
608 MP4TrackId trackId);
|
|
609
|
|
610 bool MP4SetTrackTimeScale(
|
|
611 MP4FileHandle hFile,
|
|
612 MP4TrackId trackId,
|
|
613 u_int32_t value);
|
|
614
|
|
615 u_int8_t MP4GetTrackAudioMpeg4Type(
|
|
616 MP4FileHandle hFile,
|
|
617 MP4TrackId trackId);
|
|
618
|
|
619 u_int8_t MP4GetTrackEsdsObjectTypeId(
|
|
620 MP4FileHandle hFile,
|
|
621 MP4TrackId trackId);
|
|
622
|
|
623 /* returns MP4_INVALID_DURATION if track samples do not have a fixed duration */
|
|
624 MP4Duration MP4GetTrackFixedSampleDuration(
|
|
625 MP4FileHandle hFile,
|
|
626 MP4TrackId trackId);
|
|
627
|
|
628 u_int32_t MP4GetTrackBitRate(
|
|
629 MP4FileHandle hFile,
|
|
630 MP4TrackId trackId);
|
|
631
|
|
632 bool MP4GetTrackVideoMetadata(MP4FileHandle hFile,
|
|
633 MP4TrackId trackId,
|
|
634 uint8_t **ppConfig,
|
|
635 uint32_t *pConfigSize);
|
|
636
|
|
637 bool MP4GetTrackESConfiguration(
|
|
638 MP4FileHandle hFile,
|
|
639 MP4TrackId trackId,
|
|
640 u_int8_t** ppConfig,
|
|
641 u_int32_t* pConfigSize);
|
|
642
|
|
643 bool MP4SetTrackESConfiguration(
|
|
644 MP4FileHandle hFile,
|
|
645 MP4TrackId trackId,
|
|
646 const u_int8_t* pConfig,
|
|
647 u_int32_t configSize);
|
|
648
|
|
649 /* h264 information routines */
|
|
650 bool MP4GetTrackH264ProfileLevel(MP4FileHandle hFile,
|
|
651 MP4TrackId trackId,
|
|
652 uint8_t *pProfile,
|
|
653 uint8_t *pLevel);
|
|
654 bool MP4GetTrackH264SeqPictHeaders(MP4FileHandle hFile,
|
|
655 MP4TrackId trackId,
|
|
656 uint8_t ***pSeqHeaders,
|
|
657 uint32_t **pSeqHeaderSize,
|
|
658 uint8_t ***pPictHeader,
|
|
659 uint32_t **pPictHeaderSize);
|
|
660 bool MP4GetTrackH264LengthSize(MP4FileHandle hFile,
|
|
661 MP4TrackId trackId,
|
|
662 uint32_t *pLength);
|
|
663 MP4SampleId MP4GetTrackNumberOfSamples(
|
|
664 MP4FileHandle hFile,
|
|
665 MP4TrackId trackId);
|
|
666
|
|
667 u_int16_t MP4GetTrackVideoWidth(
|
|
668 MP4FileHandle hFile,
|
|
669 MP4TrackId trackId);
|
|
670
|
|
671 u_int16_t MP4GetTrackVideoHeight(
|
|
672 MP4FileHandle hFile,
|
|
673 MP4TrackId trackId);
|
|
674
|
201
|
675 double MP4GetTrackVideoFrameRate(
|
61
|
676 MP4FileHandle hFile,
|
|
677 MP4TrackId trackId);
|
|
678
|
|
679 int MP4GetTrackAudioChannels(MP4FileHandle hFile,
|
|
680 MP4TrackId trackId);
|
|
681
|
|
682 bool MP4IsIsmaCrypMediaTrack(
|
|
683 MP4FileHandle hFile,
|
|
684 MP4TrackId trackId);
|
|
685
|
|
686 /* generic track properties */
|
|
687
|
|
688 u_int64_t MP4GetTrackIntegerProperty(
|
|
689 MP4FileHandle hFile,
|
|
690 MP4TrackId trackId,
|
|
691 const char* propName);
|
|
692
|
|
693 float MP4GetTrackFloatProperty(
|
|
694 MP4FileHandle hFile,
|
|
695 MP4TrackId trackId,
|
|
696 const char* propName);
|
|
697
|
|
698 const char* MP4GetTrackStringProperty(
|
|
699 MP4FileHandle hFile,
|
|
700 MP4TrackId trackId,
|
|
701 const char* propName);
|
|
702
|
|
703 void MP4GetTrackBytesProperty(
|
|
704 MP4FileHandle hFile,
|
|
705 MP4TrackId trackId,
|
|
706 const char* propName,
|
|
707 u_int8_t** ppValue,
|
|
708 u_int32_t* pValueSize);
|
|
709
|
|
710 bool MP4SetTrackIntegerProperty(
|
|
711 MP4FileHandle hFile,
|
|
712 MP4TrackId trackId,
|
|
713 const char* propName,
|
|
714 int64_t value);
|
|
715
|
|
716 bool MP4SetTrackFloatProperty(
|
|
717 MP4FileHandle hFile,
|
|
718 MP4TrackId trackId,
|
|
719 const char* propName,
|
|
720 float value);
|
|
721
|
|
722 bool MP4SetTrackStringProperty(
|
|
723 MP4FileHandle hFile,
|
|
724 MP4TrackId trackId,
|
|
725 const char* propName,
|
|
726 const char* value);
|
|
727
|
|
728 bool MP4SetTrackBytesProperty(
|
|
729 MP4FileHandle hFile,
|
|
730 MP4TrackId trackId,
|
|
731 const char* propName,
|
|
732 const u_int8_t* pValue,
|
|
733 u_int32_t valueSize);
|
|
734
|
|
735 /* sample operations */
|
|
736
|
|
737 bool MP4ReadSample(
|
|
738 /* input parameters */
|
|
739 MP4FileHandle hFile,
|
|
740 MP4TrackId trackId,
|
|
741 MP4SampleId sampleId,
|
|
742 /* input/output parameters */
|
|
743 u_int8_t** ppBytes,
|
|
744 u_int32_t* pNumBytes,
|
|
745 /* output parameters */
|
|
746 MP4Timestamp* pStartTime DEFAULT(NULL),
|
|
747 MP4Duration* pDuration DEFAULT(NULL),
|
|
748 MP4Duration* pRenderingOffset DEFAULT(NULL),
|
|
749 bool* pIsSyncSample DEFAULT(NULL));
|
|
750
|
|
751 /* uses (unedited) time to specify sample instead of sample id */
|
|
752 bool MP4ReadSampleFromTime(
|
|
753 /* input parameters */
|
|
754 MP4FileHandle hFile,
|
|
755 MP4TrackId trackId,
|
|
756 MP4Timestamp when,
|
|
757 /* input/output parameters */
|
|
758 u_int8_t** ppBytes,
|
|
759 u_int32_t* pNumBytes,
|
|
760 /* output parameters */
|
|
761 MP4Timestamp* pStartTime DEFAULT(NULL),
|
|
762 MP4Duration* pDuration DEFAULT(NULL),
|
|
763 MP4Duration* pRenderingOffset DEFAULT(NULL),
|
|
764 bool* pIsSyncSample DEFAULT(NULL));
|
|
765
|
|
766 bool MP4WriteSample(
|
|
767 MP4FileHandle hFile,
|
|
768 MP4TrackId trackId,
|
|
769 const u_int8_t* pBytes,
|
|
770 u_int32_t numBytes,
|
|
771 MP4Duration duration DEFAULT(MP4_INVALID_DURATION),
|
|
772 MP4Duration renderingOffset DEFAULT(0),
|
|
773 bool isSyncSample DEFAULT(true));
|
|
774
|
|
775 bool MP4CopySample(
|
|
776 MP4FileHandle srcFile,
|
|
777 MP4TrackId srcTrackId,
|
|
778 MP4SampleId srcSampleId,
|
|
779 MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE),
|
|
780 MP4TrackId dstTrackId DEFAULT(MP4_INVALID_TRACK_ID),
|
|
781 MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION));
|
|
782
|
|
783 bool MP4EncAndCopySample(
|
|
784 MP4FileHandle srcFile,
|
|
785 MP4TrackId srcTrackId,
|
|
786 MP4SampleId srcSampleId,
|
|
787 encryptFunc_t encfcnp,
|
|
788 u_int32_t encfcnparam1,
|
|
789 MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE),
|
|
790 MP4TrackId dstTrackId DEFAULT(MP4_INVALID_TRACK_ID),
|
|
791 MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION));
|
|
792
|
|
793 /* Note this function is not yet implemented */
|
|
794 bool MP4ReferenceSample(
|
|
795 MP4FileHandle srcFile,
|
|
796 MP4TrackId srcTrackId,
|
|
797 MP4SampleId srcSampleId,
|
|
798 MP4FileHandle dstFile,
|
|
799 MP4TrackId dstTrackId,
|
|
800 MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION));
|
|
801
|
|
802 u_int32_t MP4GetSampleSize(
|
|
803 MP4FileHandle hFile,
|
|
804 MP4TrackId trackId,
|
|
805 MP4SampleId sampleId);
|
|
806
|
|
807 u_int32_t MP4GetTrackMaxSampleSize(
|
|
808 MP4FileHandle hFile,
|
|
809 MP4TrackId trackId);
|
|
810
|
|
811 MP4SampleId MP4GetSampleIdFromTime(
|
|
812 MP4FileHandle hFile,
|
|
813 MP4TrackId trackId,
|
|
814 MP4Timestamp when,
|
|
815 bool wantSyncSample DEFAULT(false));
|
|
816
|
|
817 MP4Timestamp MP4GetSampleTime(
|
|
818 MP4FileHandle hFile,
|
|
819 MP4TrackId trackId,
|
|
820 MP4SampleId sampleId);
|
|
821
|
|
822 MP4Duration MP4GetSampleDuration(
|
|
823 MP4FileHandle hFile,
|
|
824 MP4TrackId trackId,
|
|
825 MP4SampleId sampleId);
|
|
826
|
|
827 MP4Duration MP4GetSampleRenderingOffset(
|
|
828 MP4FileHandle hFile,
|
|
829 MP4TrackId trackId,
|
|
830 MP4SampleId sampleId);
|
|
831
|
|
832 bool MP4SetSampleRenderingOffset(
|
|
833 MP4FileHandle hFile,
|
|
834 MP4TrackId trackId,
|
|
835 MP4SampleId sampleId,
|
|
836 MP4Duration renderingOffset);
|
|
837
|
|
838 int8_t MP4GetSampleSync(
|
|
839 MP4FileHandle hFile,
|
|
840 MP4TrackId trackId,
|
|
841 MP4SampleId sampleId);
|
|
842
|
|
843 /* rtp hint track operations */
|
|
844
|
|
845 bool MP4GetHintTrackRtpPayload(
|
|
846 MP4FileHandle hFile,
|
|
847 MP4TrackId hintTrackId,
|
|
848 char** ppPayloadName DEFAULT(NULL),
|
|
849 u_int8_t* pPayloadNumber DEFAULT(NULL),
|
|
850 u_int16_t* pMaxPayloadSize DEFAULT(NULL),
|
|
851 char **ppEncodingParams DEFAULT(NULL));
|
|
852
|
|
853 #define MP4_SET_DYNAMIC_PAYLOAD 0xff
|
|
854
|
|
855 bool MP4SetHintTrackRtpPayload(
|
|
856 MP4FileHandle hFile,
|
|
857 MP4TrackId hintTrackId,
|
|
858 const char* pPayloadName,
|
|
859 u_int8_t* pPayloadNumber,
|
|
860 u_int16_t maxPayloadSize DEFAULT(0),
|
|
861 const char *encode_params DEFAULT(NULL),
|
|
862 bool include_rtp_map DEFAULT(true),
|
|
863 bool include_mpeg4_esid DEFAULT(true));
|
|
864
|
|
865 const char* MP4GetSessionSdp(
|
|
866 MP4FileHandle hFile);
|
|
867
|
|
868 bool MP4SetSessionSdp(
|
|
869 MP4FileHandle hFile,
|
|
870 const char* sdpString);
|
|
871
|
|
872 bool MP4AppendSessionSdp(
|
|
873 MP4FileHandle hFile,
|
|
874 const char* sdpString);
|
|
875
|
|
876 const char* MP4GetHintTrackSdp(
|
|
877 MP4FileHandle hFile,
|
|
878 MP4TrackId hintTrackId);
|
|
879
|
|
880 bool MP4SetHintTrackSdp(
|
|
881 MP4FileHandle hFile,
|
|
882 MP4TrackId hintTrackId,
|
|
883 const char* sdpString);
|
|
884
|
|
885 bool MP4AppendHintTrackSdp(
|
|
886 MP4FileHandle hFile,
|
|
887 MP4TrackId hintTrackId,
|
|
888 const char* sdpString);
|
|
889
|
|
890 MP4TrackId MP4GetHintTrackReferenceTrackId(
|
|
891 MP4FileHandle hFile,
|
|
892 MP4TrackId hintTrackId);
|
|
893
|
|
894 bool MP4ReadRtpHint(
|
|
895 MP4FileHandle hFile,
|
|
896 MP4TrackId hintTrackId,
|
|
897 MP4SampleId hintSampleId,
|
|
898 u_int16_t* pNumPackets DEFAULT(NULL));
|
|
899
|
|
900 u_int16_t MP4GetRtpHintNumberOfPackets(
|
|
901 MP4FileHandle hFile,
|
|
902 MP4TrackId hintTrackId);
|
|
903
|
|
904 int8_t MP4GetRtpPacketBFrame(
|
|
905 MP4FileHandle hFile,
|
|
906 MP4TrackId hintTrackId,
|
|
907 u_int16_t packetIndex);
|
|
908
|
|
909 int32_t MP4GetRtpPacketTransmitOffset(
|
|
910 MP4FileHandle hFile,
|
|
911 MP4TrackId hintTrackId,
|
|
912 u_int16_t packetIndex);
|
|
913
|
|
914 bool MP4ReadRtpPacket(
|
|
915 MP4FileHandle hFile,
|
|
916 MP4TrackId hintTrackId,
|
|
917 u_int16_t packetIndex,
|
|
918 u_int8_t** ppBytes,
|
|
919 u_int32_t* pNumBytes,
|
|
920 u_int32_t ssrc DEFAULT(0),
|
|
921 bool includeHeader DEFAULT(true),
|
|
922 bool includePayload DEFAULT(true));
|
|
923
|
|
924 MP4Timestamp MP4GetRtpTimestampStart(
|
|
925 MP4FileHandle hFile,
|
|
926 MP4TrackId hintTrackId);
|
|
927
|
|
928 bool MP4SetRtpTimestampStart(
|
|
929 MP4FileHandle hFile,
|
|
930 MP4TrackId hintTrackId,
|
|
931 MP4Timestamp rtpStart);
|
|
932
|
|
933 bool MP4AddRtpHint(
|
|
934 MP4FileHandle hFile,
|
|
935 MP4TrackId hintTrackId);
|
|
936
|
|
937 bool MP4AddRtpVideoHint(
|
|
938 MP4FileHandle hFile,
|
|
939 MP4TrackId hintTrackId,
|
|
940 bool isBframe DEFAULT(false),
|
|
941 u_int32_t timestampOffset DEFAULT(0));
|
|
942
|
|
943 bool MP4AddRtpPacket(
|
|
944 MP4FileHandle hFile,
|
|
945 MP4TrackId hintTrackId,
|
|
946 bool setMbit DEFAULT(false),
|
|
947 int32_t transmitOffset DEFAULT(0));
|
|
948
|
|
949 bool MP4AddRtpImmediateData(
|
|
950 MP4FileHandle hFile,
|
|
951 MP4TrackId hintTrackId,
|
|
952 const u_int8_t* pBytes,
|
|
953 u_int32_t numBytes);
|
|
954
|
|
955 bool MP4AddRtpSampleData(
|
|
956 MP4FileHandle hFile,
|
|
957 MP4TrackId hintTrackId,
|
|
958 MP4SampleId sampleId,
|
|
959 u_int32_t dataOffset,
|
|
960 u_int32_t dataLength);
|
|
961
|
|
962 bool MP4AddRtpESConfigurationPacket(
|
|
963 MP4FileHandle hFile,
|
|
964 MP4TrackId hintTrackId);
|
|
965
|
|
966 bool MP4WriteRtpHint(
|
|
967 MP4FileHandle hFile,
|
|
968 MP4TrackId hintTrackId,
|
|
969 MP4Duration duration,
|
|
970 bool isSyncSample DEFAULT(true));
|
|
971
|
|
972 /* 3GP specific utilities */
|
|
973
|
|
974 bool MP4Make3GPCompliant(
|
|
975 const char* fileName,
|
|
976 u_int32_t verbosity DEFAULT(0),
|
|
977 char* majorBrand DEFAULT(0),
|
|
978 u_int32_t minorVersion DEFAULT(0),
|
|
979 char** supportedBrands DEFAULT(NULL),
|
|
980 u_int32_t supportedBrandsCount DEFAULT(0),
|
|
981 bool deleteIodsAtom DEFAULT(true));
|
|
982
|
|
983 /* ISMA specific utilities */
|
|
984
|
|
985 bool MP4MakeIsmaCompliant(const char* fileName,
|
|
986 u_int32_t verbosity DEFAULT(0),
|
|
987 bool addIsmaComplianceSdp DEFAULT(true));
|
|
988
|
|
989 char* MP4MakeIsmaSdpIod(
|
|
990 u_int8_t videoProfile,
|
|
991 u_int32_t videoBitrate,
|
|
992 u_int8_t* videoConfig,
|
|
993 u_int32_t videoConfigLength,
|
|
994 u_int8_t audioProfile,
|
|
995 u_int32_t audioBitrate,
|
|
996 u_int8_t* audioConfig,
|
|
997 u_int32_t audioConfigLength,
|
|
998 u_int32_t verbosity DEFAULT(0));
|
|
999
|
|
1000 /* edit list */
|
|
1001
|
|
1002 /* NOTE this section of functionality
|
|
1003 * has not yet been fully tested
|
|
1004 */
|
|
1005
|
|
1006 MP4EditId MP4AddTrackEdit(
|
|
1007 MP4FileHandle hFile,
|
|
1008 MP4TrackId trackId,
|
|
1009 MP4EditId editId DEFAULT(MP4_INVALID_EDIT_ID),
|
|
1010 MP4Timestamp startTime DEFAULT(0),
|
|
1011 MP4Duration duration DEFAULT(0),
|
|
1012 bool dwell DEFAULT(false));
|
|
1013
|
|
1014 bool MP4DeleteTrackEdit(
|
|
1015 MP4FileHandle hFile,
|
|
1016 MP4TrackId trackId,
|
|
1017 MP4EditId editId);
|
|
1018
|
|
1019 u_int32_t MP4GetTrackNumberOfEdits(
|
|
1020 MP4FileHandle hFile,
|
|
1021 MP4TrackId trackId);
|
|
1022
|
|
1023 MP4Timestamp MP4GetTrackEditStart(
|
|
1024 MP4FileHandle hFile,
|
|
1025 MP4TrackId trackId,
|
|
1026 MP4EditId editId);
|
|
1027
|
|
1028 MP4Duration MP4GetTrackEditTotalDuration(
|
|
1029 MP4FileHandle hFile,
|
|
1030 MP4TrackId trackId,
|
|
1031 MP4EditId editId DEFAULT(MP4_INVALID_EDIT_ID));
|
|
1032
|
|
1033 MP4Timestamp MP4GetTrackEditMediaStart(
|
|
1034 MP4FileHandle hFile,
|
|
1035 MP4TrackId trackId,
|
|
1036 MP4EditId editId);
|
|
1037
|
|
1038 bool MP4SetTrackEditMediaStart(
|
|
1039 MP4FileHandle hFile,
|
|
1040 MP4TrackId trackId,
|
|
1041 MP4EditId editId,
|
|
1042 MP4Timestamp startTime);
|
|
1043
|
|
1044 MP4Duration MP4GetTrackEditDuration(
|
|
1045 MP4FileHandle hFile,
|
|
1046 MP4TrackId trackId,
|
|
1047 MP4EditId editId);
|
|
1048
|
|
1049 bool MP4SetTrackEditDuration(
|
|
1050 MP4FileHandle hFile,
|
|
1051 MP4TrackId trackId,
|
|
1052 MP4EditId editId,
|
|
1053 MP4Duration duration);
|
|
1054
|
|
1055 int8_t MP4GetTrackEditDwell(
|
|
1056 MP4FileHandle hFile,
|
|
1057 MP4TrackId trackId,
|
|
1058 MP4EditId editId);
|
|
1059
|
|
1060 bool MP4SetTrackEditDwell(
|
|
1061 MP4FileHandle hFile,
|
|
1062 MP4TrackId trackId,
|
|
1063 MP4EditId editId,
|
|
1064 bool dwell);
|
|
1065
|
|
1066 bool MP4ReadSampleFromEditTime(
|
|
1067 /* input parameters */
|
|
1068 MP4FileHandle hFile,
|
|
1069 MP4TrackId trackId,
|
|
1070 MP4Timestamp when,
|
|
1071 /* input/output parameters */
|
|
1072 u_int8_t** ppBytes,
|
|
1073 u_int32_t* pNumBytes,
|
|
1074 /* output parameters */
|
|
1075 MP4Timestamp* pStartTime DEFAULT(NULL),
|
|
1076 MP4Duration* pDuration DEFAULT(NULL),
|
|
1077 MP4Duration* pRenderingOffset DEFAULT(NULL),
|
|
1078 bool* pIsSyncSample DEFAULT(NULL));
|
|
1079
|
|
1080 MP4SampleId MP4GetSampleIdFromEditTime(
|
|
1081 MP4FileHandle hFile,
|
|
1082 MP4TrackId trackId,
|
|
1083 MP4Timestamp when,
|
|
1084 MP4Timestamp* pStartTime DEFAULT(NULL),
|
|
1085 MP4Duration* pDuration DEFAULT(NULL));
|
|
1086 /* iTunes metadata handling */
|
|
1087 bool MP4MetadataDelete(MP4FileHandle hFile);
|
|
1088 bool MP4GetMetadataByIndex(MP4FileHandle hFile, u_int32_t index,
|
|
1089 const char** ppName,
|
|
1090 u_int8_t** ppValue, u_int32_t* pValueSize);
|
|
1091 bool MP4SetMetadataName(MP4FileHandle hFile, const char* value);
|
|
1092 bool MP4GetMetadataName(MP4FileHandle hFile, char** value);
|
201
|
1093 bool MP4DeleteMetadataName(MP4FileHandle hFile);
|
61
|
1094 bool MP4SetMetadataArtist(MP4FileHandle hFile, const char* value);
|
|
1095 bool MP4GetMetadataArtist(MP4FileHandle hFile, char** value);
|
201
|
1096 bool MP4DeleteMetadataArtist(MP4FileHandle hFile);
|
61
|
1097 bool MP4SetMetadataWriter(MP4FileHandle hFile, const char* value);
|
|
1098 bool MP4GetMetadataWriter(MP4FileHandle hFile, char** value);
|
201
|
1099 bool MP4DeleteMetadataWriter(MP4FileHandle hFile);
|
61
|
1100 bool MP4SetMetadataComment(MP4FileHandle hFile, const char* value);
|
|
1101 bool MP4GetMetadataComment(MP4FileHandle hFile, char** value);
|
201
|
1102 bool MP4DeleteMetadataComment(MP4FileHandle hFile);
|
61
|
1103 bool MP4SetMetadataTool(MP4FileHandle hFile, const char* value);
|
|
1104 bool MP4GetMetadataTool(MP4FileHandle hFile, char** value);
|
201
|
1105 bool MP4DeleteMetadataTool(MP4FileHandle hFile);
|
61
|
1106 bool MP4SetMetadataYear(MP4FileHandle hFile, const char* value);
|
|
1107 bool MP4GetMetadataYear(MP4FileHandle hFile, char** value);
|
201
|
1108 bool MP4DeleteMetadataYear(MP4FileHandle hFile);
|
61
|
1109 bool MP4SetMetadataAlbum(MP4FileHandle hFile, const char* value);
|
|
1110 bool MP4GetMetadataAlbum(MP4FileHandle hFile, char** value);
|
201
|
1111 bool MP4DeleteMetadataAlbum(MP4FileHandle hFile);
|
61
|
1112 bool MP4SetMetadataTrack(MP4FileHandle hFile,
|
|
1113 u_int16_t track, u_int16_t totalTracks);
|
|
1114 bool MP4GetMetadataTrack(MP4FileHandle hFile,
|
|
1115 u_int16_t* track, u_int16_t* totalTracks);
|
201
|
1116 bool MP4DeleteMetadataTrack(MP4FileHandle hFile);
|
61
|
1117 bool MP4SetMetadataDisk(MP4FileHandle hFile,
|
|
1118 u_int16_t disk, u_int16_t totalDisks);
|
|
1119 bool MP4GetMetadataDisk(MP4FileHandle hFile,
|
|
1120 u_int16_t* disk, u_int16_t* totalDisks);
|
201
|
1121 bool MP4DeleteMetadataDisk(MP4FileHandle hFile);
|
61
|
1122 bool MP4SetMetadataGenre(MP4FileHandle hFile, const char *genre);
|
|
1123 bool MP4GetMetadataGenre(MP4FileHandle hFile, char **genre);
|
201
|
1124 bool MP4DeleteMetadataGenre(MP4FileHandle hFile);
|
|
1125 bool MP4SetMetadataGrouping(MP4FileHandle hFile, const char *grouping);
|
|
1126 bool MP4GetMetadataGrouping(MP4FileHandle hFile, char **grouping);
|
|
1127 bool MP4DeleteMetadataGrouping(MP4FileHandle hFile);
|
61
|
1128 bool MP4SetMetadataTempo(MP4FileHandle hFile, u_int16_t tempo);
|
|
1129 bool MP4GetMetadataTempo(MP4FileHandle hFile, u_int16_t* tempo);
|
201
|
1130 bool MP4DeleteMetadataTempo(MP4FileHandle hFile);
|
61
|
1131 bool MP4SetMetadataCompilation(MP4FileHandle hFile, u_int8_t cpl);
|
|
1132 bool MP4GetMetadataCompilation(MP4FileHandle hFile, u_int8_t* cpl);
|
201
|
1133 bool MP4DeleteMetadataCompilation(MP4FileHandle hFile);
|
61
|
1134 bool MP4SetMetadataCoverArt(MP4FileHandle hFile,
|
|
1135 u_int8_t *coverArt, u_int32_t size);
|
|
1136 bool MP4GetMetadataCoverArt(MP4FileHandle hFile,
|
|
1137 u_int8_t **coverArt, u_int32_t* size);
|
201
|
1138 bool MP4DeleteMetadataCoverArt(MP4FileHandle hFile);
|
61
|
1139 bool MP4SetMetadataFreeForm(MP4FileHandle hFile, char *name,
|
|
1140 u_int8_t* pValue, u_int32_t valueSize);
|
|
1141 bool MP4GetMetadataFreeForm(MP4FileHandle hFile, char *name,
|
|
1142 u_int8_t** pValue, u_int32_t* valueSize);
|
201
|
1143 bool MP4DeleteMetadataFreeForm(MP4FileHandle hFile, char *name);
|
61
|
1144
|
|
1145
|
|
1146 /* time conversion utilties */
|
|
1147
|
|
1148 /* predefined values for timeScale parameter below */
|
|
1149 #define MP4_SECONDS_TIME_SCALE 1
|
|
1150 #define MP4_MILLISECONDS_TIME_SCALE 1000
|
|
1151 #define MP4_MICROSECONDS_TIME_SCALE 1000000
|
|
1152 #define MP4_NANOSECONDS_TIME_SCALE 1000000000
|
|
1153
|
|
1154 #define MP4_SECS_TIME_SCALE MP4_SECONDS_TIME_SCALE
|
|
1155 #define MP4_MSECS_TIME_SCALE MP4_MILLISECONDS_TIME_SCALE
|
|
1156 #define MP4_USECS_TIME_SCALE MP4_MICROSECONDS_TIME_SCALE
|
|
1157 #define MP4_NSECS_TIME_SCALE MP4_NANOSECONDS_TIME_SCALE
|
|
1158
|
|
1159 u_int64_t MP4ConvertFromMovieDuration(
|
|
1160 MP4FileHandle hFile,
|
|
1161 MP4Duration duration,
|
|
1162 u_int32_t timeScale);
|
|
1163
|
|
1164 u_int64_t MP4ConvertFromTrackTimestamp(
|
|
1165 MP4FileHandle hFile,
|
|
1166 MP4TrackId trackId,
|
|
1167 MP4Timestamp timeStamp,
|
|
1168 u_int32_t timeScale);
|
|
1169
|
|
1170 MP4Timestamp MP4ConvertToTrackTimestamp(
|
|
1171 MP4FileHandle hFile,
|
|
1172 MP4TrackId trackId,
|
|
1173 u_int64_t timeStamp,
|
|
1174 u_int32_t timeScale);
|
|
1175
|
|
1176 u_int64_t MP4ConvertFromTrackDuration(
|
|
1177 MP4FileHandle hFile,
|
|
1178 MP4TrackId trackId,
|
|
1179 MP4Duration duration,
|
|
1180 u_int32_t timeScale);
|
|
1181
|
|
1182 MP4Duration MP4ConvertToTrackDuration(
|
|
1183 MP4FileHandle hFile,
|
|
1184 MP4TrackId trackId,
|
|
1185 u_int64_t duration,
|
|
1186 u_int32_t timeScale);
|
|
1187
|
|
1188 char* MP4BinaryToBase16(
|
|
1189 const u_int8_t* pData,
|
|
1190 u_int32_t dataSize);
|
|
1191
|
|
1192 char* MP4BinaryToBase64(
|
|
1193 const u_int8_t* pData,
|
|
1194 u_int32_t dataSize);
|
|
1195
|
|
1196 uint8_t *Base64ToBinary(const char *pData,
|
|
1197 uint32_t decodeSize,
|
|
1198 uint32_t *pDataSize);
|
|
1199
|
|
1200 #ifdef __cplusplus
|
|
1201 }
|
|
1202 #endif
|
|
1203
|
|
1204 /* undefined our utlity macro to avoid conflicts */
|
|
1205 #undef DEFAULT
|
|
1206
|
|
1207 #endif /* __MP4_INCLUDED__ */
|