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