|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 /** |
|
19 @file |
|
20 @publishedPartner |
|
21 @deprecated |
|
22 */ |
|
23 |
|
24 #ifndef _MP4LIB_H |
|
25 #define _MP4LIB_H |
|
26 |
|
27 #define MP4Handle mp4_i32* |
|
28 |
|
29 #include <f32file.h> |
|
30 #include <caf/caf.h> |
|
31 #include <3gplibrary/mp4config.h> |
|
32 |
|
33 /** |
|
34 Provides async parse read observer. |
|
35 */ |
|
36 class M3GPMP4LibAsyncObserver |
|
37 { |
|
38 public: |
|
39 |
|
40 /** |
|
41 Informs the client about asyncronous parse audio frames operation completion. |
|
42 |
|
43 @param aError Error code. |
|
44 @param aAudioSize Size of the returned audio frames (in bytes). |
|
45 @param aTimeStamp Audio frame presentation time in milliseconds from the |
|
46 beginning of the audio sequence. |
|
47 @param aReturnedFrames Number of frames returned, or 0 if not known. |
|
48 @param aTimestamp2 Audio frame presentation time in timescale from the |
|
49 beginning of the audio sequence |
|
50 |
|
51 */ |
|
52 virtual void M3GPMP4LibAudioFramesAvailable(MP4Err aError, |
|
53 mp4_u32 aAudioSize, |
|
54 mp4_u32 aTimeStamp, |
|
55 mp4_u32 aReturnedFrames, |
|
56 mp4_u32 aTimestamp2) = 0; |
|
57 |
|
58 /** |
|
59 Informs the client about asyncronous parse video frame operation completion. |
|
60 |
|
61 @param aError Error code. |
|
62 @param aFrameSize Size of the returned frame (in bytes). |
|
63 @param aTimeStamp Video frame presentation time in milliseconds from the |
|
64 beginning of the video sequence |
|
65 @param aKeyFrame Returns MP4TRUE if the current frame is a key frame (intra), |
|
66 otherwise the value is MP4FALSE |
|
67 @param aTimestamp2 Video frame presentation time in timescale from the beginning |
|
68 of the video sequence |
|
69 |
|
70 */ |
|
71 virtual void M3GPMP4LibVideoFrameAvailable(MP4Err aError, |
|
72 mp4_u32 aFrameSize, |
|
73 mp4_u32 aTimeStamp, |
|
74 mp4_bool aKeyFrame, |
|
75 mp4_u32 aTimestamp2) = 0; |
|
76 }; |
|
77 |
|
78 /** |
|
79 This class provides async temporary file deleting observer. |
|
80 */ |
|
81 class M3GPMP4LibAsyncTempFileRemoverObserver |
|
82 { |
|
83 public: |
|
84 |
|
85 /** |
|
86 Informs the client about unused temporary file that can be deleted. |
|
87 @param tempFileName Name of the temporary file that can be deleted. |
|
88 Ownership of the file name memory buffer is transferred. |
|
89 */ |
|
90 virtual void M3GPMP4LibDeleteTempFileName( MP4FileName tempFileName ) = 0; |
|
91 |
|
92 }; |
|
93 #ifdef __cplusplus |
|
94 extern "C" { |
|
95 #endif |
|
96 |
|
97 |
|
98 /** |
|
99 Error codes returned by the library |
|
100 */ |
|
101 enum |
|
102 { |
|
103 /** Success */ |
|
104 MP4_OK, |
|
105 /** Generic error */ |
|
106 MP4_ERROR, |
|
107 /** Library can't allocate memory */ |
|
108 MP4_OUT_OF_MEMORY, |
|
109 /** MP4 library needs more data before the |
|
110 requested information can be returned */ |
|
111 MP4_NOT_AVAILABLE, |
|
112 /** The library has been opened with the input in a file */ |
|
113 MP4_FILE_MODE, |
|
114 /** The input is not streamable */ |
|
115 MP4_NOT_STREAMABLE, |
|
116 /** Frame of requested type is not available */ |
|
117 MP4_NO_REQUESTED_FRAME, |
|
118 /** Requested frame doesn't fit into the given buffer */ |
|
119 MP4_BUFFER_TOO_SMALL, |
|
120 /** No more video frames left */ |
|
121 MP4_END_OF_VIDEO, |
|
122 /** Can't seek to requested position */ |
|
123 MP4_CANT_SEEK, |
|
124 /** Error in file handling */ |
|
125 MP4_FILE_ERROR, |
|
126 /** Input stream is invalid */ |
|
127 MP4_INVALID_INPUT_STREAM, |
|
128 /** Frame doesn't exist (previous frame was last) */ |
|
129 MP4_NO_FRAME, |
|
130 /** Illegal type */ |
|
131 MP4_INVALID_TYPE, |
|
132 /** Timescale has not been set */ |
|
133 MP4_TIMESCALE_NOT_SET, |
|
134 /** Error writing metadata */ |
|
135 MP4_METADATA_ERROR, |
|
136 /** No video in input stream */ |
|
137 MP4_NO_VIDEO, |
|
138 /** No audio in input stream */ |
|
139 MP4_NO_AUDIO, |
|
140 /** Output buffer has not been initialized for buffer writing */ |
|
141 MP4_NO_OUTPUT_BUFFER, |
|
142 /** Not enough space in output buffer to write to */ |
|
143 MP4_OUTPUT_BUFFER_TOO_SMALL, |
|
144 /** No UDTA data found */ |
|
145 MP4_UDTA_NOT_FOUND |
|
146 }; |
|
147 |
|
148 |
|
149 /** |
|
150 Possible data source types |
|
151 */ |
|
152 enum |
|
153 { |
|
154 /** Data is read from an RFile64 handle */ |
|
155 MP4_SOURCE_RFILE, |
|
156 /** Data is read via the CAF */ |
|
157 MP4_SOURCE_CAF, |
|
158 }; |
|
159 |
|
160 /** |
|
161 Possible input/output values for audio/video type |
|
162 */ |
|
163 |
|
164 /** No audio or video */ |
|
165 #define MP4_TYPE_NONE 0x0000 |
|
166 /** Video Type. MPEG-4 video (MPEG-4 Part 2) - Simple and Advance Simple Profiles */ |
|
167 #define MP4_TYPE_MPEG4_VIDEO 0x0001 |
|
168 /** Audio Type. MPEG-4 audio (MPEG-4 Part 3) */ |
|
169 #define MP4_TYPE_MPEG4_AUDIO 0x0002 |
|
170 /** Video Type. H263 Profile 0 */ |
|
171 #define MP4_TYPE_H263_PROFILE_0 0x0004 |
|
172 /** Video Type. H263 Profile 3 */ |
|
173 #define MP4_TYPE_H263_PROFILE_3 0x0008 |
|
174 /** Audio Type. AMR NB */ |
|
175 #define MP4_TYPE_AMR_NB 0x0010 |
|
176 /** Audio Type. AMR WB */ |
|
177 #define MP4_TYPE_AMR_WB 0x0020 |
|
178 /** Type not supported */ |
|
179 #define MP4_TYPE_UNSUPPORTED 0x0040 |
|
180 /** AVC baseline (MPEG-4 Part 10) */ |
|
181 #define MP4_TYPE_AVC_PROFILE_BASELINE 0x0080 |
|
182 /** AVC main (MPEG-4 Part 10) */ |
|
183 #define MP4_TYPE_AVC_PROFILE_MAIN 0x0100 |
|
184 /** AVC extended (MPEG-4 Part 10) */ |
|
185 #define MP4_TYPE_AVC_PROFILE_EXTENDED 0x0200 |
|
186 /** QCELP 13K additions */ |
|
187 #define MP4_TYPE_QCELP_13K 0x0400 |
|
188 /** AVC high (MPEG-4 Part 10) */ |
|
189 #define MP4_TYPE_AVC_PROFILE_HIGH 0x0800 |
|
190 |
|
191 /** |
|
192 Flags used by composer |
|
193 */ |
|
194 /** No special setup */ |
|
195 #define MP4_FLAG_NONE 0x0000 |
|
196 /** Meta data is placed at end of file */ |
|
197 #define MP4_FLAG_METADATALAST 0x0001 |
|
198 /** Collect metadata in files instead of storing it in memory */ |
|
199 #define MP4_FLAG_LONGCLIP 0x0002 |
|
200 /** Generate a 3G2 File instead of a 3GP File */ |
|
201 #define MP4_FLAG_GENERATE_3G2 0x0004 |
|
202 /** Generate a MP4 File instead of a 3GP File */ |
|
203 #define MP4_FLAG_GENERATE_MP4 0x0008 |
|
204 /** Use large output buffers for writing */ |
|
205 #define MP4_FLAG_LARGEFILEBUFFER 0x0010 |
|
206 |
|
207 |
|
208 /** Size of buf in MP4HandleStruct must be at least 128 bytes */ |
|
209 #define TMPBUFSIZE 128 |
|
210 /** Duration of one AMR frame is 20 ms */ |
|
211 #define AUDIO_FRAME_DURATION 20 |
|
212 |
|
213 #define MP4FALSE (mp4_bool)0 |
|
214 #define MP4TRUE (mp4_bool)1 |
|
215 |
|
216 /** |
|
217 Possible locations for user data atom (UDTA) |
|
218 */ |
|
219 /** No user data */ |
|
220 #define MP4_UDTA_NONE 0x0000 |
|
221 /** User data resides within the Movie Box */ |
|
222 #define MP4_UDTA_MOOV 0x0001 |
|
223 /** User data resides within the Track Box for video */ |
|
224 #define MP4_UDTA_VIDEOTRAK 0x0002 |
|
225 /** User data resides within the Track Box for audio */ |
|
226 #define MP4_UDTA_AUDIOTRAK 0x0004 |
|
227 |
|
228 /** |
|
229 Initializes the MP4 composing operation. The instance handle of the library is |
|
230 set by the function. |
|
231 |
|
232 The possible values of type parameter are |
|
233 |
|
234 MP4_TYPE_H263_PROFILE_0 |
|
235 MP4_TYPE_H263_PROFILE_3 |
|
236 MP4_TYPE_MPEG4_VIDEO |
|
237 MP4_TYPE_AMR_NB |
|
238 MP4_TYPE_AMR_WB |
|
239 MP4_TYPE_MPEG4_AUDIO |
|
240 MP4_TYPE_NONE |
|
241 MP4_TYPE_AVC_PROFILE_BASELINE |
|
242 MP4_TYPE_AVC_PROFILE_MAIN |
|
243 MP4_TYPE_AVC_PROFILE_EXTENDED |
|
244 MP4_TYPE_AVC_PROFILE_HIGH |
|
245 MP4_TYPE_QCELP_13K |
|
246 |
|
247 In addition, any combination of one video and one audio type are |
|
248 possible. For example |
|
249 |
|
250 MP4_TYPE_H263_PROFILE_0 | MP4_TYPE_AMR_NB |
|
251 |
|
252 The output file is placed in the current working directory if no path is |
|
253 specified. The type of filename is dependent on the architecture. When |
|
254 compiling in Symbian OS, this is a unicode string. |
|
255 |
|
256 |
|
257 @param handle MP4 library handle |
|
258 @param filename Name of the output MP4 file |
|
259 @param type Type of the output file |
|
260 |
|
261 @return MP4_OK Success |
|
262 MP4_ERROR Generic error |
|
263 MP4_FILE_ERROR Error opening file |
|
264 MP4_OUT_OF_MEMORY Out of memory |
|
265 */ |
|
266 extern IMPORT_C MP4Err MP4ComposeOpen(MP4Handle *handle, MP4FileName filename, mp4_u32 type); |
|
267 |
|
268 /** |
|
269 This function initializes the MP4 composing operation. The instance |
|
270 handle of the library is set by the function. |
|
271 |
|
272 The possible values of type parameter are |
|
273 |
|
274 MP4_TYPE_H263_PROFILE_0 |
|
275 MP4_TYPE_H263_PROFILE_3 |
|
276 MP4_TYPE_MPEG4_VIDEO |
|
277 MP4_TYPE_AMR_NB |
|
278 MP4_TYPE_AMR_WB |
|
279 MP4_TYPE_MPEG4_AUDIO |
|
280 MP4_TYPE_NONE |
|
281 MP4_TYPE_AVC_PROFILE_BASELINE |
|
282 MP4_TYPE_AVC_PROFILE_MAIN |
|
283 MP4_TYPE_AVC_PROFILE_EXTENDED |
|
284 MP4_TYPE_AVC_PROFILE_HIGH |
|
285 MP4_TYPE_QCELP_13K |
|
286 |
|
287 In addition, any combination of one video and one audio type are possible. For example |
|
288 |
|
289 MP4_TYPE_H263_PROFILE_0 | MP4_TYPE_AMR_NB |
|
290 |
|
291 The output is placed in the buffer given as argument. |
|
292 Size of composed data is in composedSize variable. |
|
293 |
|
294 @param handle MP4 library handle |
|
295 @param type Type of the output file |
|
296 @param composeBuffer Buffer to write to. |
|
297 @param composedSize Size of composed data. |
|
298 |
|
299 @return |
|
300 MP4_OK Success |
|
301 MP4_ERROR Generic error |
|
302 MP4_FILE_ERROR Error opening file |
|
303 MP4_OUT_OF_MEMORY Out of memory |
|
304 MP4_NO_OUTPUT_BUFFER No composed buffer |
|
305 */ |
|
306 extern IMPORT_C MP4Err MP4ComposeOpenToBuffer(MP4Handle *handle, mp4_u32 type, mp4_u8* composeBuffer, mp4_u32 *composedSize); |
|
307 |
|
308 /** |
|
309 This function initializes the MP4 composing operation to existing file handle. The instance |
|
310 handle of the library is set by the function. |
|
311 |
|
312 NOTE: MP4_FLAG_METADATALAST must be defined in MP4ComposeSetFlags if MP4ComposeOpenFileHandle is used! |
|
313 |
|
314 The possible values of type parameter are |
|
315 |
|
316 MP4_TYPE_H263_PROFILE_0 |
|
317 MP4_TYPE_H263_PROFILE_3 |
|
318 MP4_TYPE_MPEG4_VIDEO |
|
319 MP4_TYPE_AMR_NB |
|
320 MP4_TYPE_AMR_WB |
|
321 MP4_TYPE_MPEG4_AUDIO |
|
322 MP4_TYPE_NONE |
|
323 MP4_TYPE_AVC_PROFILE_BASELINE |
|
324 MP4_TYPE_AVC_PROFILE_MAIN |
|
325 MP4_TYPE_AVC_PROFILE_EXTENDED |
|
326 MP4_TYPE_AVC_PROFILE_HIGH |
|
327 MP4_TYPE_QCELP_13K |
|
328 |
|
329 In addition, any combination of one video and one audio type are possible. For example |
|
330 |
|
331 MP4_TYPE_H263_PROFILE_0 | MP4_TYPE_AMR_NB |
|
332 |
|
333 The output file is placed in the current working directory if no path is |
|
334 specified. The type of filename is dependent on the architecture. When |
|
335 compiling in Symbian OS, this is a unicode string. |
|
336 |
|
337 @param handle MP4 library handle |
|
338 @param composedfile File handle to output file |
|
339 @param metadataTempDrive If MP4ComposeSetFlags() is configured to use temporary files for metadata |
|
340 (MP4_FLAG_LONGCLIP) this is way to tell library which drive to use for |
|
341 temporary files. |
|
342 @param type Type of the output file |
|
343 |
|
344 @return MP4_OK Success |
|
345 MP4_ERROR Generic error |
|
346 MP4_FILE_ERROR Error opening file |
|
347 MP4_OUT_OF_MEMORY Out of memory |
|
348 */ |
|
349 extern IMPORT_C MP4Err MP4ComposeOpenFileHandle(MP4Handle *handle, RFile *composedfile, TDriveNumber metadataTempDrive, mp4_u32 type); |
|
350 |
|
351 /** |
|
352 This function initializes the MP4 composing operation to existing file handle. The instance |
|
353 handle of the library is set by the function. |
|
354 |
|
355 NOTE: MP4_FLAG_METADATALAST must be defined in MP4ComposeSetFlags if MP4ComposeOpenFileHandle is used! |
|
356 |
|
357 The possible values of type parameter are |
|
358 |
|
359 MP4_TYPE_H263_PROFILE_0 |
|
360 MP4_TYPE_H263_PROFILE_3 |
|
361 MP4_TYPE_MPEG4_VIDEO |
|
362 MP4_TYPE_AMR_NB |
|
363 MP4_TYPE_AMR_WB |
|
364 MP4_TYPE_MPEG4_AUDIO |
|
365 MP4_TYPE_NONE |
|
366 MP4_TYPE_AVC_PROFILE_BASELINE |
|
367 MP4_TYPE_AVC_PROFILE_MAIN |
|
368 MP4_TYPE_AVC_PROFILE_EXTENDED |
|
369 MP4_TYPE_AVC_PROFILE_HIGH |
|
370 MP4_TYPE_QCELP_13K |
|
371 |
|
372 In addition, any combination of one video and one audio type are possible. For example |
|
373 |
|
374 MP4_TYPE_H263_PROFILE_0 | MP4_TYPE_AMR_NB |
|
375 |
|
376 The output file is placed in the current working directory if no path is |
|
377 specified. The type of filename is dependent on the architecture. When |
|
378 compiling in Symbian OS, this is a unicode string. |
|
379 |
|
380 @param handle MP4 library handle |
|
381 @param composedfile File handle to output file |
|
382 @param metadataTempDrive If MP4ComposeSetFlags() is configured to use temporary files for metadata |
|
383 (MP4_FLAG_LONGCLIP) this is way to tell library which drive to use for |
|
384 temporary files. |
|
385 @param type Type of the output file |
|
386 |
|
387 @return MP4_OK Success |
|
388 MP4_ERROR Generic error |
|
389 MP4_FILE_ERROR Error opening file |
|
390 MP4_OUT_OF_MEMORY Out of memory |
|
391 */ |
|
392 extern IMPORT_C MP4Err MP4ComposeOpenFileHandle64(MP4Handle *handle, RFile64 *composedfile, TDriveNumber metadataTempDrive, mp4_u32 type); |
|
393 |
|
394 /** |
|
395 This function closes the MP4 composing operation. It frees the memory |
|
396 allocated by the library instance and closes the output MP4 file. |
|
397 |
|
398 It is necessary to call this function before the output file is |
|
399 guaranteed to be a valid MP4 file even though the file may exist prior to |
|
400 the call. |
|
401 |
|
402 The library handle is not valid after this call. |
|
403 |
|
404 @param handle MP4 library handle |
|
405 |
|
406 @return MP4_OK Success |
|
407 MP4_ERROR Generic error |
|
408 MP4_METADATA_ERROR Metadata could not be written |
|
409 */ |
|
410 extern IMPORT_C MP4Err MP4ComposeClose(MP4Handle handle); |
|
411 |
|
412 /** |
|
413 This function is used to inform the MP4 library about the video data. The |
|
414 data given to the library is inserted into the MP4 file headers. |
|
415 |
|
416 The parameter timescale indicates the timescale of the video data |
|
417 to be inserted. Timescale tells how many units of time pass in one second. |
|
418 |
|
419 Note: Timescale should be chosen so that the duration of each sample is |
|
420 an integer. Timescale should also be chosen so that the duration |
|
421 of the presentation fits into 32 bits. |
|
422 |
|
423 @param handle MP4 library handle |
|
424 @param timescale Timescale of video |
|
425 @param width Video width |
|
426 @param height Video height |
|
427 @param maxbitrate Maximum bitrate of video |
|
428 @param avgbitrate Average bitrate of video |
|
429 |
|
430 @return MP4_OK Success |
|
431 MP4_ERROR Generic error |
|
432 */ |
|
433 extern IMPORT_C MP4Err MP4ComposeAddVideoDescription(MP4Handle handle, mp4_u32 timescale, mp4_u16 width, mp4_u16 height, mp4_u32 maxbitrate, mp4_u32 avgbitrate); |
|
434 |
|
435 /** |
|
436 This function is used to inform the MP4 library about the audio data. The |
|
437 data given to the library is inserted into the MP4 file headers. |
|
438 |
|
439 The parameter timescale indicates the timescale of the audio data |
|
440 to be inserted. Timescale tells how many units of time pass in one second. |
|
441 |
|
442 Note: timescale must be smaller than 65536. |
|
443 |
|
444 Note: audioFramesPerSample and modeSet are needed only for AMR audio. |
|
445 |
|
446 @param handle MP4 library handle |
|
447 @param timescale Timescale of audio |
|
448 @param audioFramesPerSample AMR frames per sample |
|
449 @param modeSet AMR mode set |
|
450 |
|
451 @return MP4_OK Success |
|
452 MP4_ERROR Generic error |
|
453 */ |
|
454 extern IMPORT_C MP4Err MP4ComposeAddAudioDescription(MP4Handle handle, mp4_u32 timescale, mp4_u8 audioFramesPerSample, mp4_u16 modeSet); |
|
455 |
|
456 /** |
|
457 This function writes one video frame to the MP4 composer library. |
|
458 |
|
459 The frames must be inserted in causal order. Because the library doesn't |
|
460 analyze the video bitstream, the frames can't be retrieved from the |
|
461 resulting MP4 file correctly if they are not in proper order. |
|
462 |
|
463 The data is available in the MP4 output file only after calling |
|
464 MP4ComposeClose. MP4ComposeClose is called exactly once when all audio |
|
465 and video data has been inserted into the library. |
|
466 |
|
467 @param handle MP4 library handle |
|
468 @param buffer Video frame data |
|
469 @param framesize Size of the video frame in bytes |
|
470 @param duration Duration of video frame (in timescale, |
|
471 see MP4ComposeAddVideoDescription) |
|
472 @param keyframe Flag to indicate whether this frame is a keyframe |
|
473 |
|
474 @return MP4_OK Success |
|
475 MP4_ERROR Generic error |
|
476 MP4_TIMESCALE_NOT_SET Timescale has not been set |
|
477 */ |
|
478 extern IMPORT_C MP4Err MP4ComposeWriteVideoFrame(MP4Handle handle, mp4_u8 *buffer, mp4_u32 framesize, mp4_u32 duration, mp4_bool keyframe); |
|
479 |
|
480 /** |
|
481 This function writes audio frames to the MP4 composer library. The data is |
|
482 available in the MP4 output file only after calling |
|
483 MP4ComposeClose. MP4ComposeClose is called exactly once when all audio |
|
484 and video data has been insrted into the library. |
|
485 |
|
486 For MPEG audio: |
|
487 |
|
488 This function writes one MPEG audio frame to the MP4 composer library. |
|
489 |
|
490 Note: numberofframes is meaningless with MPEG audio since only one frame |
|
491 can be added with one call. |
|
492 |
|
493 For other audio types: |
|
494 |
|
495 This function writes a number of audio frames to the MP4 composer library. |
|
496 All audio frames inserted with one function call will be placed inside |
|
497 one audio sample in the resulting file. |
|
498 |
|
499 Note: Once this function is called with a certain numberofframes |
|
500 parameter, it can't be changed. This is a limitation of the MP4 file |
|
501 format. Only the last call can have a different number of frames if |
|
502 their number is less than numberofframes. |
|
503 |
|
504 @param handle MP4 library handle |
|
505 @param buffer Audio data |
|
506 @param bytestowrite Number of bytes of audio data in buffer |
|
507 @param numberofframes Number of frames to write |
|
508 @param duration Duration of audio frames (in timescale, |
|
509 see MP4ComposeAddAudioDescription) |
|
510 |
|
511 @return MP4_OK Success |
|
512 MP4_ERROR Generic error |
|
513 MP4_TIMESCALE_NOT_SET Timescale has not been set |
|
514 */ |
|
515 extern IMPORT_C MP4Err MP4ComposeWriteAudioFrames(MP4Handle handle, mp4_u8 *buffer, mp4_u32 bytestowrite, mp4_u32 numberofframes, mp4_u32 duration); |
|
516 |
|
517 /** |
|
518 This function writes MPEG-4 or AVC video DecoderSpecificInfo data into the appropriate atom. |
|
519 |
|
520 If the video type is MPEG-4 the DecoderSpecificInfo will be written into the esds atom. If the |
|
521 video type is AVC (any profile) the DecoderSpecificInfo will be written into the avcC atom. |
|
522 |
|
523 Note: This function needs to be called only when MPEG-4 or AVC video is used. |
|
524 |
|
525 @param handle MP4 library handle |
|
526 @param info Buffer containing DecoderSpecificInfo |
|
527 @param infosize Size of info in bytes |
|
528 |
|
529 @return MP4_OK Success |
|
530 MP4_ERROR Generic error |
|
531 */ |
|
532 extern IMPORT_C MP4Err MP4ComposeWriteVideoDecoderSpecificInfo(MP4Handle handle, mp4_u8 *info, mp4_u32 infosize); |
|
533 |
|
534 /** |
|
535 This function writes MPEG audio DecoderSpecificInfo data into esds atom. |
|
536 |
|
537 Note: This function needs to be called only when MPEG audio is used. |
|
538 |
|
539 @param handle MP4 library handle |
|
540 @param info Buffer containing DecoderSpecificInfo |
|
541 @param infosize Size of info in bytes |
|
542 |
|
543 @return MP4_OK Success |
|
544 MP4_ERROR Generic error |
|
545 */ |
|
546 extern IMPORT_C MP4Err MP4ComposeWriteAudioDecoderSpecificInfo(MP4Handle handle, mp4_u8 *info, mp4_u32 infosize); |
|
547 |
|
548 /** |
|
549 This function allows settings flags that modify the behaviour |
|
550 of the library. Use binary OR to specify several flags. |
|
551 |
|
552 The following flags can be used: |
|
553 |
|
554 MP4_FLAG_NONE No special setup. |
|
555 |
|
556 MP4_FLAG_METADATALAST Write metadata last in the file without tmpfile. |
|
557 Default is to write the metadata in the |
|
558 beginning of the file. |
|
559 |
|
560 MP4_FLAG_LONGCLIP Collect metadata in files instead of collecting |
|
561 it in memory if the amount is large. Only usable |
|
562 in Symbian OS. |
|
563 |
|
564 MP4_FLAG_GENERATE_3G2 Generate a 3G2 File instead of a 3GP File. |
|
565 If not set, then 3GP file is generated. |
|
566 Generation of 3G2 file may be automatically set |
|
567 during composition, based on the selection |
|
568 of 3GPP2 specific codecs. |
|
569 |
|
570 MP4_FLAG_GENERATE_MP4 Generate a MP4 File instead of a 3GP File. |
|
571 If not set, then 3GP file is generated. |
|
572 Generation may be automatically set to 3GP |
|
573 if codecs selected do not support MP4. |
|
574 |
|
575 MP4_FLAG_LARGEFILEBUFFER Use larger output buffers in file writing. |
|
576 Non MP4_ARCH_WIN32 compilations only. |
|
577 |
|
578 Note: This function should be called after MP4ComposeOpen before |
|
579 any other MP4Compose functions. |
|
580 |
|
581 Note: If MP4ComposeOpenFileHandle is used instead of MP4ComposeOpen the MP4_FLAG_METADATALAST must be defined. |
|
582 |
|
583 @param handle MP4 library handle |
|
584 @param flags Flags to enable |
|
585 |
|
586 @return MP4_OK Success |
|
587 MP4_ERROR Generic error |
|
588 MP4_OUT_OF_MEMORY Out of Memory |
|
589 */ |
|
590 extern IMPORT_C MP4Err MP4ComposeSetFlags(MP4Handle handle, mp4_u32 flags); |
|
591 |
|
592 /** |
|
593 This function initializes the MP4 parsing operation. The instance handle |
|
594 of the library is set by the function. |
|
595 |
|
596 The filename parameter is used to specify the type of the input. If the |
|
597 parameter is non-NULL, it is assumed to be the filename of the input MP4 |
|
598 file. If the parameter is NULL, the library expects the input MP4 data to |
|
599 be inserted by subsequent calls of MP4ParseWriteData. |
|
600 |
|
601 @param handle MP4 library handle |
|
602 @param filename Name of the input MP4 file or NULL if the data is coming from |
|
603 stream |
|
604 |
|
605 @return MP4_OK Success |
|
606 MP4_ERROR Generic error |
|
607 MP4_OUT_OF_MEMORY Out of memory |
|
608 MP4_FILE_ERROR Error opening file |
|
609 */ |
|
610 extern IMPORT_C MP4Err MP4ParseOpen(MP4Handle *handle, MP4FileName filename); |
|
611 |
|
612 /** |
|
613 This function initializes the MP4 parsing operation. The instance handle |
|
614 of the library is set by the function. |
|
615 |
|
616 The RFile *inputfile parameter is pointer to valid file handle. |
|
617 Library expects that file has been opened and will be closed outside of library. |
|
618 |
|
619 @param handle MP4 library handle |
|
620 @param inputfile File handle to be parsed. |
|
621 |
|
622 @return MP4_OK Success |
|
623 MP4_ERROR Generic error |
|
624 MP4_OUT_OF_MEMORY Out of memory |
|
625 MP4_FILE_ERROR; Error accessing file |
|
626 */ |
|
627 extern IMPORT_C MP4Err MP4ParseOpenFileHandle(MP4Handle *handle, RFile *inputfile ); |
|
628 |
|
629 /** |
|
630 This function initializes the MP4 parsing operation. The instance handle |
|
631 of the library is set by the function. |
|
632 |
|
633 The RFile64 *inputfile parameter is pointer to valid file handle. |
|
634 Library expects that file has been opened and will be closed outside of library. |
|
635 |
|
636 @param handle MP4 library handle |
|
637 @param inputfile File handle to be parsed. |
|
638 |
|
639 @return MP4_OK Success |
|
640 MP4_ERROR Generic error |
|
641 MP4_OUT_OF_MEMORY Out of memory |
|
642 MP4_FILE_ERROR; Error accessing file |
|
643 */ |
|
644 extern IMPORT_C MP4Err MP4ParseOpenFileHandle64(MP4Handle *handle, RFile64 *inputfile ); |
|
645 |
|
646 /** |
|
647 This function initializes the MP4 parsing operation. The instance handle |
|
648 of the library is set by the function. |
|
649 |
|
650 The ContentAccess::CData *inputfile parameter is pointer to valid CAF object. |
|
651 Library expects that file has been opened and will be closed outside of library. |
|
652 |
|
653 @param handle MP4 library handle |
|
654 @param inputfile CAF data source handle to be parsed. |
|
655 |
|
656 @return MP4_OK Success |
|
657 MP4_ERROR Generic error |
|
658 MP4_OUT_OF_MEMORY Out of memory |
|
659 MP4_FILE_ERROR; Error accessing file |
|
660 */ |
|
661 extern IMPORT_C MP4Err MP4ParseOpenCAF(MP4Handle *handle, ContentAccess::CData *inputfile ); |
|
662 |
|
663 /** |
|
664 This function closes the MP4 parsing operation. It frees the resources |
|
665 allocated by the library instance. |
|
666 |
|
667 The library handle is not valid after this call. |
|
668 |
|
669 @param handle MP4 library handle |
|
670 |
|
671 @return MP4_OK Success |
|
672 MP4_ERROR Generic error |
|
673 */ |
|
674 extern IMPORT_C MP4Err MP4ParseClose(MP4Handle handle); |
|
675 |
|
676 /** |
|
677 This function returns parameters describing the video stream. It can be |
|
678 called after enough data has been inserted into the library so that MP4 |
|
679 headers containing the information can be read. If there is not enough |
|
680 data, those functions return MP4_NOT_AVAILABLE and more data needs to be |
|
681 inserted into the library by MP4ParseWriteData. |
|
682 |
|
683 The framerate parameter refers to the frame rate of the original video |
|
684 material. |
|
685 |
|
686 The videotype parameter can be one of the following: |
|
687 MP4_TYPE_MPEG4_VIDEO |
|
688 MP4_TYPE_H263_PROFILE_0 |
|
689 MP4_TYPE_H263_PROFILE_3 |
|
690 MP4_TYPE_AVC_PROFILE_BASELINE |
|
691 MP4_TYPE_AVC_PROFILE_MAIN |
|
692 MP4_TYPE_AVC_PROFILE_EXTENDED |
|
693 MP4_TYPE_AVC_PROFILE_HIGH |
|
694 |
|
695 Note: For timescale parameter, NULL can be specified if the caller |
|
696 doesn't need the value. |
|
697 |
|
698 @param handle MP4 library handle |
|
699 @param videolength Duration of video in milliseconds |
|
700 @param framerate Frame rate of video (in Hz) |
|
701 @param videotype Type of video stream |
|
702 @param videowidth Width of video image measured in pixels |
|
703 @param videoheight Height of video image measured in pixels |
|
704 @param timescale Timescale of video track |
|
705 |
|
706 @return MP4_OK Success |
|
707 MP4_ERROR Generic error |
|
708 MP4_NOT_AVAILABLE MP4 library needs more data before the |
|
709 requested information can be returned |
|
710 MP4_INVALID_INPUT_STREAM MP4 stream is invalid |
|
711 MP4_NO_VIDEO Input doesn't contain video track |
|
712 */ |
|
713 extern IMPORT_C MP4Err MP4ParseRequestVideoDescription(MP4Handle handle, mp4_u32 *videolength, mp4_double *framerate, mp4_u32 *videotype, mp4_u32 *videowidth, mp4_u32 *videoheight, mp4_u32 *timescale); |
|
714 |
|
715 /** |
|
716 This function returns parameters describing the audio stream. It can be |
|
717 called after enough data has been inserted into the library so that MP4 |
|
718 headers containing the information can be read. |
|
719 |
|
720 Note: framespersample parameter is set only when AMR type audio is used. |
|
721 |
|
722 Note: For timescale parameter, NULL can be specified if the caller |
|
723 doesn't need the value. |
|
724 |
|
725 @param handle MP4 library handle |
|
726 @param audiolength Duration of audio in milliseconds |
|
727 @param audiotype Type of audio |
|
728 @param framespersample Number of audio frames in each sample |
|
729 @param timescale Timescale of audio track |
|
730 @param averagebitrate Average bitrate of audio |
|
731 |
|
732 @return MP4_OK Success |
|
733 MP4_ERROR Generic error |
|
734 MP4_NOT_AVAILABLE MP4 library needs more data before the |
|
735 requested information can be returned |
|
736 MP4_INVALID_INPUT_STREAM MP4 stream is invalid |
|
737 MP4_NO_AUDIO Input doesn't contain audio track |
|
738 */ |
|
739 extern IMPORT_C MP4Err MP4ParseRequestAudioDescription(MP4Handle handle, mp4_u32 *audiolength, mp4_u32 *audiotype, mp4_u8 *framespersample, mp4_u32 *timescale, mp4_u32 *averagebitrate); |
|
740 |
|
741 /** |
|
742 This function returns parameters describing the contents of the MP4 |
|
743 file. It can be called after enough data has been inserted into the |
|
744 library so that MP4 headers containing the information can be read. |
|
745 |
|
746 @param handle MP4 library handle |
|
747 @param streamsize Length of the stream in bytes |
|
748 @param streamaveragebitrate Average bitrate of the stream in bps |
|
749 |
|
750 @return MP4_OK Success |
|
751 MP4_ERROR Generic error |
|
752 MP4_NOT_AVAILABLE MP4 library needs more data before the |
|
753 requested information can be returned |
|
754 MP4_INVALID_INPUT_STREAM MP4 stream is invalid |
|
755 */ |
|
756 extern IMPORT_C MP4Err MP4ParseRequestStreamDescription(MP4Handle handle, mp4_u32 *streamsize, mp4_u32 *streamaveragebitrate); |
|
757 |
|
758 /** |
|
759 This function inserts MP4 data to the MP4 library. |
|
760 |
|
761 It is necessary to call this function only if the input filename has not |
|
762 been given with MP4ParseOpen. Several functions can return |
|
763 MP4_NOT_AVAILABLE if the library doesn't have enough data to return the |
|
764 information that the caller requests. In that case, more data needs to be |
|
765 inserted to the library before calling those functions again. |
|
766 |
|
767 This function makes a copy of the data inserted into the library so the |
|
768 caller can use buffer for other purposes. If the function returns |
|
769 MP4_OUT_OF_MEMORY, the buffer contents have not been copied into the |
|
770 library and the caller needs to reduce the buffer size before calling |
|
771 again. |
|
772 |
|
773 If bytestowrite argument is zero, it indicates that there would be no more |
|
774 data to feed via this function. Such a function call MUST be done if a |
|
775 complete 3GP/MP4 file is to be written to the library's internal memory. The |
|
776 buffer argument may be inputted as NULL in such a case. |
|
777 |
|
778 @param handle MP4 library handle |
|
779 @param buffer Data to be written |
|
780 @param bytestowrite Size of buffer in bytes |
|
781 |
|
782 @return MP4_OK Success |
|
783 MP4_ERROR Generic error |
|
784 MP4_OUT_OF_MEMORY Library can't allocate enough memory for the data |
|
785 */ |
|
786 extern IMPORT_C MP4Err MP4ParseWriteData(MP4Handle handle, mp4_u8 *buffer, mp4_u32 bytestowrite); |
|
787 |
|
788 /** |
|
789 This function returns the number of bytes that the library instance has |
|
790 in its allocated buffers. |
|
791 |
|
792 The function is only valid when the filename is not provided when opening |
|
793 the library. Zero is returned in bytes when in file mode. |
|
794 |
|
795 @see MP4ParseWriteData. |
|
796 |
|
797 @param handle MP4 library handle |
|
798 @param bytes Number of allocated bytes in the library |
|
799 |
|
800 @return MP4_OK Success |
|
801 MP4_ERROR Generic error |
|
802 MP4_FILE_MODE The library has been opened with the input in a file |
|
803 */ |
|
804 extern IMPORT_C MP4Err MP4ParseGetBufferedBytes(MP4Handle handle, mp4_u32 *bytes); |
|
805 |
|
806 /** |
|
807 This function returns the type of the next audio/video frame in the |
|
808 stream. The type can be one of the following: |
|
809 |
|
810 MP4_TYPE_MPEG4_VIDEO |
|
811 MP4_TYPE_MPEG4_AUDIO |
|
812 MP4_TYPE_H263_PROFILE_0 |
|
813 MP4_TYPE_H263_PROFILE_3 |
|
814 MP4_TYPE_AMR_NB |
|
815 MP4_TYPE_AMR_WB |
|
816 MP4_TYPE_AVC_PROFILE_BASELINE |
|
817 MP4_TYPE_AVC_PROFILE_MAIN |
|
818 MP4_TYPE_AVC_PROFILE_EXTENDED |
|
819 MP4_TYPE_AVC_PROFILE_HIGH |
|
820 MP4_TYPE_QCELP_13K |
|
821 |
|
822 The function is only valid when the input is streamable. |
|
823 |
|
824 When reading audio/video from an MP4 container in streaming mode, the |
|
825 samples must be read from the container in the same order as they were |
|
826 inserted in it. This function determines the type of the next sample and |
|
827 based on this information the user can call either MP4ParseReadVideoFrame |
|
828 or MP4ParseReadAudioFrames to fetch more data. |
|
829 |
|
830 @param handle MP4 library handle |
|
831 @param type Type of the next frame |
|
832 |
|
833 @return MP4_OK Success |
|
834 MP4_ERROR Generic error |
|
835 MP4_NOT_STREAMABLE The input is not streamable |
|
836 MP4_NOT_AVAILABLE MP4 library needs more data before the |
|
837 requested information can be returned |
|
838 MP4_INVALID_INPUT_STREAM MP4 stream is invalid |
|
839 MP4_NO_FRAME Frame doesn't exist (previous frame was last) |
|
840 */ |
|
841 extern IMPORT_C MP4Err MP4ParseNextFrameType(MP4Handle handle, mp4_u32 *type); |
|
842 |
|
843 /** |
|
844 This function returns the size of the next frame of type type in bytes. |
|
845 The frame type can be one of the following: |
|
846 |
|
847 MP4_TYPE_MPEG4_VIDEO |
|
848 MP4_TYPE_MPEG4_AUDIO |
|
849 MP4_TYPE_H263_PROFILE_0 |
|
850 MP4_TYPE_H263_PROFILE_3 |
|
851 MP4_TYPE_AMR_NB |
|
852 MP4_TYPE_AMR_WB |
|
853 MP4_TYPE_AVC_PROFILE_BASELINE |
|
854 MP4_TYPE_AVC_PROFILE_MAIN |
|
855 MP4_TYPE_AVC_PROFILE_EXTENDED |
|
856 MP4_TYPE_AVC_PROFILE_HIGH |
|
857 MP4_TYPE_QCELP_13K |
|
858 |
|
859 @param handle MP4 library handle |
|
860 @param type Type of the frame |
|
861 @param framesize Size of the requested frame in bytes |
|
862 |
|
863 @return MP4_OK Success |
|
864 MP4_ERROR Generic error |
|
865 MP4_NOT_AVAILABLE MP4 library needs more data before the requested |
|
866 frames can be returned |
|
867 MP4_NO_REQUESTED_FRAME Frame of requested type is not available |
|
868 MP4_INVALID_TYPE Illegal type |
|
869 MP4_INVALID_INPUT_STREAM MP4 stream is invalid |
|
870 |
|
871 */ |
|
872 extern IMPORT_C MP4Err MP4ParseNextFrameSize(MP4Handle handle, mp4_u32 type, mp4_u32 *framesize); |
|
873 |
|
874 /** |
|
875 This function reads the next video frame from the MP4 file/stream and |
|
876 returns it to the caller. |
|
877 |
|
878 Note: Next frame depends on the position in the input MP4 file. |
|
879 MP4ParseSeek can be used to change the current position in the MP4 file. |
|
880 |
|
881 If the function returns MP4_NOT_AVAILABLE, the caller needs to call |
|
882 MP4ParseWriteData to insert more data before calling again. |
|
883 |
|
884 framesize is returned even if buffer was too small to contain the data. |
|
885 |
|
886 Note: Specify NULL as timestamp2 if not interested in this parameter. |
|
887 |
|
888 @param handle MP4 library handle |
|
889 @param buffer Video frame is returned here |
|
890 @param buffersize Size of the user allocated buffer (in bytes) |
|
891 @param framesize Size of the frame that was returned (in bytes) |
|
892 @param timestamp Video frame presentation time in milliseconds from the |
|
893 beginning of the video sequence |
|
894 @param keyframe Has a value of MP4TRUE if current frame is a keyframe |
|
895 (intra) or MP4FALSE otherwise |
|
896 @param timestamp2 Video frame presentation time in timescale from the |
|
897 beginning of the video sequence |
|
898 |
|
899 @return MP4_OK Success |
|
900 MP4_NOT_AVAILABLE MP4 library needs more data before the requested |
|
901 frame can be returned |
|
902 MP4_BUFFER_TOO_SMALL Requested frame doesn't fit into the given buffer |
|
903 MP4_NO_FRAME Frame doesn't exist (previous frame was last) |
|
904 MP4_ERROR Generic error |
|
905 MP4_INVALID_INPUT_STREAM MP4 stream is invalid |
|
906 */ |
|
907 extern IMPORT_C MP4Err MP4ParseReadVideoFrame(MP4Handle handle, mp4_u8 *buffer, mp4_u32 buffersize, mp4_u32 *framesize, mp4_u32 *timestamp, mp4_bool *keyframe, mp4_u32 *timestamp2); |
|
908 |
|
909 /** |
|
910 This function reads DecoderSpecificInfo data from MPEG-4 or AVC metadata and |
|
911 returns it to the caller. |
|
912 |
|
913 If the video type is MPEG-4 the DecoderSpecificInfo from the esds atom will be |
|
914 returned. If the video type is AVC (any profile) the DecoderSpecificInfo from the |
|
915 avcC atom will be returned. |
|
916 |
|
917 decspecinfosize is set even if buffer is too small to contain the data. |
|
918 The function can be called with buffersize 0 to query the size of |
|
919 DecoderSpecificInfo. |
|
920 |
|
921 Note: DecoderSpecificInfo is specific to MPEG-4 and AVC video. Therefore, |
|
922 only MPEG-4 or AVC video streams contain this information. |
|
923 |
|
924 @param handle MP4 library handle |
|
925 @param buffer DecoderSpecificInfo is returned here |
|
926 @param buffersize Size of the user allocated buffer (in bytes) |
|
927 @param decspecinfosize Size of DecoderSpecificInfo is returned here |
|
928 |
|
929 @return MP4_OK Success |
|
930 MP4_NOT_AVAILABLE MP4 library needs more data before the requested |
|
931 frames can be returned |
|
932 MP4_BUFFER_TOO_SMALL Requested data doesn't fit into the given buffer |
|
933 MP4_ERROR Generic error |
|
934 MP4_INVALID_INPUT_STREAM MP4 stream is invalid |
|
935 */ |
|
936 extern IMPORT_C MP4Err MP4ParseReadVideoDecoderSpecificInfo(MP4Handle handle, mp4_u8 *buffer, mp4_u32 buffersize, mp4_u32 *decspecinfosize); |
|
937 |
|
938 /** |
|
939 This function reads the audio frames that are stored in the current |
|
940 audio sample from the MP4 file/stream and returns them to the caller. |
|
941 |
|
942 Note: Next frame depends on the position in the input MP4 file. |
|
943 MP4ParseSeek can be used to change the current position in the |
|
944 MP4 file. |
|
945 |
|
946 If the function returns MP4_NOT_AVAILABLE, the caller needs to call |
|
947 MP4ParseWriteData to insert more data before calling again. |
|
948 |
|
949 audiosize is returned even if buffer was too small to contain the data. |
|
950 |
|
951 Note: returnedframes may differ from the correct value when accessing |
|
952 the last audio sample. |
|
953 |
|
954 Note: Specify NULL as timestamp2 if not interested in this parameter. |
|
955 |
|
956 @param handle MP4 library handle |
|
957 @param buffer Audio frames are returned here |
|
958 @param buffersize Size of the user allocated buffer (in bytes) |
|
959 @param audiosize Size of the returned audio frames (in bytes) |
|
960 @param timestamp Audio frame presentation time in milliseconds from the |
|
961 beginning of the audio sequence |
|
962 @param returnedframes Number of frames returned, or 0 if not known |
|
963 @param timestamp2 Audio frame presentation time in timescale from the |
|
964 beginning of the audio sequence |
|
965 |
|
966 @return MP4_OK Success |
|
967 MP4_NOT_AVAILABLE MP4 library needs more data before the requested |
|
968 frames can be returned |
|
969 MP4_BUFFER_TOO_SMALL Requested frames don't fit into the given buffer |
|
970 MP4_ERROR Generic error |
|
971 MP4_INVALID_INPUT_STREAM MP4 stream is invalid |
|
972 MP4_NO_FRAME No more frames available |
|
973 */ |
|
974 extern IMPORT_C MP4Err MP4ParseReadAudioFrames(MP4Handle handle, mp4_u8 *buffer, mp4_u32 buffersize, mp4_u32 *audiosize, mp4_u32 *timestamp, mp4_u32 *returnedframes, mp4_u32 *timestamp2); |
|
975 |
|
976 /** |
|
977 This function reads DecoderSpecificInfo data from MP4 metadata and |
|
978 returns it to the caller. |
|
979 |
|
980 decspecinfosize is set even if buffer is too small to contain the data. |
|
981 The function can be called with buffersize 0 to query the size of |
|
982 DecoderSpecificInfo. |
|
983 |
|
984 Note: This function can be used for both MPEG-4 audio and AMR. |
|
985 |
|
986 @param handle MP4 library handle |
|
987 @param buffer DecoderSpecificInfo is returned here |
|
988 @param buffersize Size of the user allocated buffer (in bytes) |
|
989 @param decspecinfosize Size of DecoderSpecificInfo is returned here |
|
990 |
|
991 @return MP4_OK Success |
|
992 MP4_NOT_AVAILABLE MP4 library needs more data before the requested |
|
993 frames can be returned |
|
994 MP4_BUFFER_TOO_SMALL Requested data doesn't fit into the given buffer |
|
995 MP4_ERROR Generic error |
|
996 MP4_INVALID_INPUT_STREAM MP4 stream is invalid |
|
997 */ |
|
998 extern IMPORT_C MP4Err MP4ParseReadAudioDecoderSpecificInfo(MP4Handle handle, mp4_u8 *buffer, mp4_u32 buffersize, mp4_u32 *decspecinfosize); |
|
999 |
|
1000 /** |
|
1001 Return the timestamp of the next video frame. This only works if the |
|
1002 input MP4 data is in a file. |
|
1003 |
|
1004 The function can be used to find out which frames have been coded to |
|
1005 optimize the input frame selection if video frame rate needs to be |
|
1006 modified. |
|
1007 |
|
1008 When this function call returns MP4_END_OF_VIDEO, there are no more video |
|
1009 frames left in the MP4 file and the timestamp returned with the previous |
|
1010 call was the timestamp of the last video frame. |
|
1011 |
|
1012 Note: User must call MP4ParseSeek() to seek to the correct position |
|
1013 after calls of this function. Otherwise the current position is |
|
1014 undetermined. |
|
1015 |
|
1016 Note: Specify NULL as timestamp2 if this value is not needed. |
|
1017 |
|
1018 @param handle MP4 library handle |
|
1019 @param timestamp Timestamp in milliseconds is returned here |
|
1020 @param timestamp2 Timestamp in timescale is returned here |
|
1021 |
|
1022 @return MP4_OK Success |
|
1023 MP4_END_OF_VIDEO No more video frames left |
|
1024 MP4_ERROR Generic error |
|
1025 MP4_NOT_AVAILABLE MP4 library needs more data before the |
|
1026 requested information can be returned |
|
1027 MP4_INVALID_INPUT_STREAM MP4 stream is invalid |
|
1028 */ |
|
1029 extern IMPORT_C MP4Err MP4ParseGetNextVideoTimestamp(MP4Handle handle, mp4_u32 *timestamp, mp4_u32 *timestamp2); |
|
1030 |
|
1031 /** |
|
1032 This function determines whether the input MP4 stream is streamable, |
|
1033 i.e. the media data is arranged in such a manner that playback can be |
|
1034 started without downloading the entire stream. |
|
1035 |
|
1036 @param handle MP4 library handle |
|
1037 |
|
1038 @return MP4_OK The file is streamable |
|
1039 MP4_NOT_STREAMABLE The file is not streamable |
|
1040 MP4_NOT_AVAILABLE MP4 library needs more data before the requested |
|
1041 information can be returned |
|
1042 MP4_ERROR Generic error |
|
1043 MP4_INVALID_INPUT_STREAM MP4 stream is invalid |
|
1044 */ |
|
1045 extern IMPORT_C MP4Err MP4ParseIsStreamable(MP4Handle handle); |
|
1046 |
|
1047 /** |
|
1048 This function seeks to the position specified by position parameter in |
|
1049 the input MP4 file. The function can be called only if the input MP4 data |
|
1050 is in a file and the file name has been specified with MP4ParseOpen |
|
1051 function call. |
|
1052 |
|
1053 The position is considered to be from the start of the presentation time |
|
1054 line in the MP4 file. Thus audio and video positions can't be given |
|
1055 separately. |
|
1056 |
|
1057 The function will set current audio and video positions in the following |
|
1058 manner: |
|
1059 |
|
1060 If there is only audio in the file, the current position will be set to |
|
1061 the audio frame at or just before the given position. |
|
1062 |
|
1063 If there is only video in the file and keyframe is MP4FALSE, the current |
|
1064 position will be set to the video frame at or just before the given |
|
1065 position. If keyframe is set to MP4TRUE, the current position will be set |
|
1066 to the first keyframe at or before current position. |
|
1067 |
|
1068 If there are both audio and video in the file, video is first positioned |
|
1069 as explained above and then audio is seeked to the closest position in |
|
1070 relation to video. |
|
1071 |
|
1072 @param handle MP4 library handle |
|
1073 @param position Position to seek to in milliseconds in the MP4 |
|
1074 presentation time line |
|
1075 @param audioPosition Position of audio after seek (in milliseconds) |
|
1076 @param videoPosition Position of video after seek (in milliseconds) |
|
1077 @param keyframe If set to MP4TRUE, the 1st video keyframe before given |
|
1078 point will be seeked to. If set to MP4FALSE, the first |
|
1079 video frame before given point will be seeked to. |
|
1080 |
|
1081 @return MP4_OK Success |
|
1082 MP4_ERROR Generic error |
|
1083 MP4_CANT_SEEK Can't seek to requested position |
|
1084 |
|
1085 */ |
|
1086 extern IMPORT_C MP4Err MP4ParseSeek(MP4Handle handle, mp4_u32 position, mp4_u32 *audioPosition, mp4_u32 *videoPosition, mp4_bool keyframe); |
|
1087 |
|
1088 /** |
|
1089 This function determines whether the next frame of type type is |
|
1090 available. |
|
1091 |
|
1092 The frame type can be one of the following: |
|
1093 |
|
1094 MP4_TYPE_MPEG4_VIDEO |
|
1095 MP4_TYPE_MPEG4_AUDIO |
|
1096 MP4_TYPE_H263_PROFILE_0 |
|
1097 MP4_TYPE_H263_PROFILE_3 |
|
1098 MP4_TYPE_AMR_NB |
|
1099 MP4_TYPE_AMR_WB |
|
1100 MP4_TYPE_AVC_PROFILE_BASELINE |
|
1101 MP4_TYPE_AVC_PROFILE_MAIN |
|
1102 MP4_TYPE_AVC_PROFILE_EXTENDED |
|
1103 MP4_TYPE_AVC_PROFILE_HIGH |
|
1104 MP4_TYPE_QCELP_13K |
|
1105 |
|
1106 @param handle MP4 library handle |
|
1107 @param type Type of the frame |
|
1108 |
|
1109 @return MP4_OK Frame is available |
|
1110 MP4_ERROR Generic error |
|
1111 MP4_NOT_AVAILABLE MP4 library needs more data before the requested |
|
1112 frames can be returned |
|
1113 MP4_NO_REQUESTED_FRAME Frame of requested type is not available |
|
1114 MP4_INVALID_INPUT_STREAM MP4 stream is invalid |
|
1115 */ |
|
1116 extern IMPORT_C MP4Err MP4ParseIsFrameAvailable(MP4Handle handle, mp4_u32 type); |
|
1117 |
|
1118 /** |
|
1119 Return the largest position in a file that has been accessed or the latest accessed |
|
1120 absolute byte location of the stream. |
|
1121 |
|
1122 Note: The function returns a valid position after one audio or video |
|
1123 sample has been read. |
|
1124 |
|
1125 @param handle MP4 library handle |
|
1126 @param position Result is returned here |
|
1127 |
|
1128 @return MP4_OK Success |
|
1129 */ |
|
1130 extern IMPORT_C MP4Err MP4ParseGetLastPosition(MP4Handle handle, mp4_u32 *position); |
|
1131 |
|
1132 /** |
|
1133 Return the largest position in a file that has been accessed or the latest accessed |
|
1134 absolute byte location of the stream. |
|
1135 |
|
1136 Note: The function returns a valid position after one audio or video |
|
1137 sample has been read. |
|
1138 |
|
1139 @param handle MP4 library handle |
|
1140 @param position Result is returned here |
|
1141 |
|
1142 @return MP4_OK Success |
|
1143 */ |
|
1144 extern IMPORT_C MP4Err MP4ParseGetLastPosition64(MP4Handle handle, mp4_u64 *position); |
|
1145 |
|
1146 /** |
|
1147 Return the number of video frames. |
|
1148 |
|
1149 @param handle MP4 library handle |
|
1150 @param numberOfFrames Result is returned here |
|
1151 |
|
1152 @return MP4_OK Success |
|
1153 MP4_ERROR Generic error |
|
1154 */ |
|
1155 extern IMPORT_C MP4Err MP4ParseGetNumberOfVideoFrames(MP4Handle handle, mp4_u32 *numberOfFrames); |
|
1156 |
|
1157 /** |
|
1158 Return video frame size. |
|
1159 |
|
1160 @param handle MP4 library handle |
|
1161 @param index Index of video frame |
|
1162 @param frameSize Result is returned here |
|
1163 |
|
1164 @return MP4_OK Success |
|
1165 MP4_ERROR Generic error |
|
1166 */ |
|
1167 extern IMPORT_C MP4Err MP4ParseGetVideoFrameSize(MP4Handle handle, mp4_u32 index, mp4_u32 *frameSize); |
|
1168 |
|
1169 /** |
|
1170 Return video frame start time. |
|
1171 |
|
1172 @param handle MP4 library handle |
|
1173 @param index Index of video frame |
|
1174 @param timestamp Result is returned here |
|
1175 @param timestampms Result in milliseconds |
|
1176 |
|
1177 @return MP4_OK Success |
|
1178 MP4_ERROR Generic error |
|
1179 */ |
|
1180 extern IMPORT_C MP4Err MP4ParseGetVideoFrameStartTime(MP4Handle handle, mp4_u32 index, mp4_u32 *timestamp, mp4_u32 *timestampms); |
|
1181 |
|
1182 /** |
|
1183 Return video frame type. |
|
1184 |
|
1185 @param handle MP4 library handle |
|
1186 @param index Index of video frame |
|
1187 @param frametype Result is returned here |
|
1188 |
|
1189 @return MP4_OK Success |
|
1190 MP4_ERROR Generic error |
|
1191 */ |
|
1192 extern IMPORT_C MP4Err MP4ParseGetVideoFrameType(MP4Handle handle, mp4_u32 index, mp4_bool *frametype); |
|
1193 |
|
1194 /** |
|
1195 Return the video sample entry index of the next video frame to be read. |
|
1196 |
|
1197 The smallest index value is 1. |
|
1198 |
|
1199 @param handle MP4 library handle |
|
1200 @param videosampleentryindex Visual SampleEntry index of the next video frame to be read. |
|
1201 |
|
1202 @return MP4_OK Success |
|
1203 MP4_ERROR Generic error |
|
1204 */ |
|
1205 extern IMPORT_C MP4Err MP4ParseGetVideoSampleEntryIndex(MP4Handle handle, mp4_u32 *videosampleentryindex); |
|
1206 |
|
1207 /** |
|
1208 Return the audio sample entry index of the next audio frame to be read. |
|
1209 |
|
1210 The smallest index value is 1. |
|
1211 |
|
1212 @param handle MP4 library handle |
|
1213 @param audiosampleentryindex Visual SampleEntry index of the next audio frame to be read. |
|
1214 |
|
1215 @return MP4_OK Success |
|
1216 MP4_ERROR Generic error |
|
1217 */ |
|
1218 extern IMPORT_C MP4Err MP4ParseGetAudioSampleEntryIndex(MP4Handle handle, mp4_u32 *audiosampleentryindex); |
|
1219 |
|
1220 /** |
|
1221 This function sets the storage mode of QCELP 13K |
|
1222 qcelpStorageMode = 0 ...QCELP will be registered using QCELPSampleEntry Box (Default) |
|
1223 qcelpStorageMode = 1 ...QCELP will be registered using MP4AudioDescription Box |
|
1224 |
|
1225 Note: This function needs to be called only when QCLEP 13K is used and when it is going to |
|
1226 be stored registered using the MP4AudioDescription Box. |
|
1227 |
|
1228 @param handle MP4 library handle |
|
1229 @param qcelpStorageMode Decoder configuration registration mode of QCELP 13K Codec |
|
1230 |
|
1231 @return MP4_OK Success |
|
1232 MP4_ERROR Generic error |
|
1233 */ |
|
1234 extern IMPORT_C MP4Err MP4ComposeSetQCELPStorageMode(MP4Handle handle, mp4_u8 qcelpStorageMode); |
|
1235 |
|
1236 /** |
|
1237 Return the decoder configuration registration mode of QCELP 13K Codec. |
|
1238 |
|
1239 qcelpStorageMode = 0 QCELP is registered using QCELPSampleEntry Box (Default) |
|
1240 qcelpStorageMode = 1 QCELP is registered using MP4AudioDescription Box |
|
1241 |
|
1242 @param handle MP4 library handle |
|
1243 @param qcelpStorageMode Decoder configuration registration mode of QCELP 13K Codec |
|
1244 |
|
1245 @return MP4_OK Success |
|
1246 MP4_ERROR Generic error |
|
1247 */ |
|
1248 extern IMPORT_C MP4Err MP4ParseGetQCELPStorageMode(MP4Handle handle, mp4_u8 *qcelpStorageMode); |
|
1249 |
|
1250 /** |
|
1251 This function gets the frame infoparameters from star index to number of elements in array from that index, |
|
1252 properties obtained are startTime, frameType and frameSize. |
|
1253 |
|
1254 Important Note:--- The number of elements allocated in the array should be equal to the sizeofarray |
|
1255 |
|
1256 |
|
1257 @param apihandle MP4 library handle |
|
1258 @param startindex Index from where to start getting information for the array |
|
1259 @param sizeofarray number of elements that exist in the allocated frame array |
|
1260 @param aFrameInfoArray Array of Structures of frame parameters |
|
1261 |
|
1262 |
|
1263 @return MP4_OK Success |
|
1264 MP4_ERROR Generic error |
|
1265 MP4_NO_OUTPUT_BUFFER Output buffer pointer uninitialized |
|
1266 */ |
|
1267 extern IMPORT_C MP4Err MP4GetVideoFrameProperties(MP4Handle apihandle,mp4_u32 startindex,mp4_u32 sizeofarray,TFrameInfoParameters* aFrameInfoArray); |
|
1268 |
|
1269 /** |
|
1270 This function sets properties of composed video clip. |
|
1271 |
|
1272 Setup details in TVideoClipProperties struct: |
|
1273 |
|
1274 mp4_u32 iH263Level level of H.263 |
|
1275 |
|
1276 @param apihandle MP4 library handle |
|
1277 @param aVideoClipProperties Setup info struct. |
|
1278 |
|
1279 @return MP4_OK Success |
|
1280 MP4_ERROR Generic error |
|
1281 */ |
|
1282 extern IMPORT_C MP4Err MP4ComposeSetVideoClipProperties(MP4Handle apihandle, const TVideoClipProperties& aVideoClipProperties); |
|
1283 |
|
1284 /** |
|
1285 This function gets properties of parsed video clip. |
|
1286 |
|
1287 Returned details in TVideoClipProperties struct: |
|
1288 |
|
1289 mp4_u32 iH263Level level of H.263 |
|
1290 |
|
1291 @param apihandle MP4 library handle |
|
1292 @param aVideoClipProperties Filled info struct. |
|
1293 |
|
1294 @return MP4_OK Success |
|
1295 MP4_ERROR Generic error |
|
1296 */ |
|
1297 extern IMPORT_C MP4Err MP4ParseGetVideoClipProperties(MP4Handle apihandle, TVideoClipProperties& aVideoClipProperties); |
|
1298 |
|
1299 /** |
|
1300 Retrieve an atom of given type from user data atom (UDTA) to the given buffer. |
|
1301 |
|
1302 Note: on return parameters contain following information: |
|
1303 udtaLocation Hash of all locations in file that contain UDTA atom. |
|
1304 MP4_UDTA_NONE | MP4_UDTA_MOOV | MP4_UDTA_VIDEOTRAK | MP4_UDTA_AUDIOTRAK |
|
1305 buffer Buffer containing asked atom. |
|
1306 bufferSize Size of atom written in buffer. If buffer is too small for atom variable contains needed size. |
|
1307 atomIndex Count of same subatom type in this UDTA. Starts from 0 (zero) index. |
|
1308 |
|
1309 @param handle MP4 library handle |
|
1310 @param udtaLocation Location of UDTA atom inside file. |
|
1311 @param udtaAtomType Type of atom to be read from UDTA. |
|
1312 Hex value of 4 chars representing atom type defined in standard. |
|
1313 For example: 0x7469746c //'titl' - title for the media atom |
|
1314 0x61757468 //'auth' - author of the media atom |
|
1315 0x676e7265 //'gnre' - genre (category and style) of the media atom |
|
1316 @param buffer Buffer to write atom to. |
|
1317 @param bufferSize Size of given buffer. |
|
1318 @param atomIndex Index of atom if UDTA contains multiple subatoms of same asked udtaAtomType. |
|
1319 |
|
1320 @return MP4_OK Success |
|
1321 MP4_ERROR Generic error |
|
1322 MP4_OUTPUT_BUFFER_TOO_SMALL Buffer to write atom to is too small, required size in buffersize argument. |
|
1323 MP4_INVALID_TYPE Asked udtaLocation is invalid. |
|
1324 MP4_NOT_AVAILABLE UDTA or wanted subatom is not available in asked location. |
|
1325 MP4_CANT_SEEK Can't seek to UDTA atom location. |
|
1326 */ |
|
1327 extern IMPORT_C MP4Err MP4ParseGetUserDataAtom(MP4Handle handle, |
|
1328 mp4_u8& udtaLocation, |
|
1329 mp4_u32 udtaAtomType, |
|
1330 mp4_u8* buffer, |
|
1331 mp4_u32& bufferSize, |
|
1332 mp4_u32& atomIndex ); |
|
1333 |
|
1334 /** |
|
1335 Writes a buffer containing whole atom to inside of user data atom (UDTA) defined in udtaLocation. |
|
1336 |
|
1337 @param apihandle MP4 library handle |
|
1338 @param udtaLocation Location of UDTA atom inside file. |
|
1339 MP4_UDTA_MOOV | MP4_UDTA_VIDEOTRAK | MP4_UDTA_AUDIOTRAK |
|
1340 @param buffer Buffer to write atom from. |
|
1341 @param bufferSize Size of buffer. |
|
1342 |
|
1343 @return MP4_OK Success |
|
1344 MP4_ERROR Generic error |
|
1345 MP4_OUT_OF_MEMORY Out of memory |
|
1346 MP4_INVALID_TYPE Asked udtaLocation is invalid. |
|
1347 */ |
|
1348 extern IMPORT_C MP4Err MP4ComposeSetUserDataAtom(MP4Handle apihandle, |
|
1349 mp4_u8& udtaLocation, |
|
1350 mp4_u8* buffer, |
|
1351 mp4_u32& bufferSize ); |
|
1352 |
|
1353 /** |
|
1354 Sets internal buffer sizes to 3GPMP4Lib. Usage optional. |
|
1355 Must be used after MP4ComposeSetFlags when composing. |
|
1356 |
|
1357 Defaults for composing (with MP4_FLAG_LARGEFILEBUFFER): |
|
1358 |
|
1359 mediaWriteBufferSize: 2048, (2*65536) |
|
1360 writeBufferMaxCount: 15 |
|
1361 |
|
1362 Default for parsing: |
|
1363 readBufferSize: 8k |
|
1364 |
|
1365 @param apihandle MP4 library handle |
|
1366 @param mediaWriteBufferSize Size of media data file output buffers (bytes). |
|
1367 0 to use default internal value. |
|
1368 @param writeBufferMaxCount Max amount of buffers (both media and meta) before file output changes |
|
1369 to synchronous (by default file writing is asynchronous operation). |
|
1370 0 to use default internal value. |
|
1371 Min value 6. |
|
1372 @param readBufferSize Size of file read buffer. 0 to use default internal value. |
|
1373 |
|
1374 @return MP4_OK Success |
|
1375 MP4_ERROR Generic error |
|
1376 MP4_OUT_OF_MEMORY Out of Memory error |
|
1377 */ |
|
1378 extern IMPORT_C MP4Err MP4SetCustomFileBufferSizes( MP4Handle apihandle, |
|
1379 mp4_u32 mediaWriteBufferSize, |
|
1380 mp4_u32 writeBufferMaxCount, |
|
1381 mp4_u32 readBufferSize ); |
|
1382 |
|
1383 /** |
|
1384 This function gets the next frame's dependency information from SDTP box. |
|
1385 |
|
1386 Return values of each parameter can be the following: |
|
1387 aDependsOn: |
|
1388 0: the dependency of this sample is unknown; |
|
1389 1: this sample does depend on others (not an I picture); |
|
1390 2: this sample does not depend on others (I picture); |
|
1391 |
|
1392 aIsDependedOn: |
|
1393 0: the dependency of other samples on this sample is unknown; |
|
1394 1: other samples depend on this one (not disposable); |
|
1395 2: no other sample depends on this one (disposable); |
|
1396 |
|
1397 aHasRedundancy: |
|
1398 0: it is unknown whether there is redundant coding in this sample; |
|
1399 1: there is redundant coding in this sample; |
|
1400 2: there is no redundant coding in this sample; |
|
1401 |
|
1402 @param apihandle MP4 library handle |
|
1403 @param aDependsOn Defines whether current frame is I-frame (2), isn't I-frame (1) or if it only |
|
1404 can be found out by using MP4ParseReadVideoFrame()-method (0). |
|
1405 @param aIsDependentOn Defined the dependency of other frames on this one |
|
1406 @param aHasRedundancy Defined the existence of redundant coding in this frame |
|
1407 |
|
1408 @return MP4_OK Success |
|
1409 MP4_ERROR Generic error |
|
1410 MP4_NOT_AVAILABLE Metadata not available |
|
1411 MP4_INVALID_INPUT_STREAM Error in reading metadata |
|
1412 MP4_NO_OUTPUT_BUFFER Output buffer uninitialized |
|
1413 */ |
|
1414 extern IMPORT_C MP4Err MP4ParseNextVideoFrameDependencies(MP4Handle apihandle, mp4_u8* aDependsOn, mp4_u8* aIsDependentOn, mp4_u8* aHasRedundancy); |
|
1415 |
|
1416 /** |
|
1417 This function sets the next frame's dependency information to SDTP box. |
|
1418 |
|
1419 NOTE: This function should be called before MP4ComposeWriteVideoFrame for each frame. Otherwise |
|
1420 default values are inserted for the missing frames (0 = unknown). |
|
1421 |
|
1422 Possible values for each parameter are the following: |
|
1423 aDependsOn: |
|
1424 0: the dependency of this sample is unknown; |
|
1425 1: this sample does depend on others (not an I picture); |
|
1426 2: this sample does not depend on others (I picture); |
|
1427 3: reserved, DO NOT USE |
|
1428 |
|
1429 aIsDependedOn: |
|
1430 0: the dependency of other samples on this sample is unknown; |
|
1431 1: other samples depend on this one (not disposable); |
|
1432 2: no other sample depends on this one (disposable); |
|
1433 3: reserved, DO NOT USE |
|
1434 |
|
1435 aHasRedundancy: |
|
1436 0: it is unknown whether there is redundant coding in this sample; |
|
1437 1: there is redundant coding in this sample; |
|
1438 2: there is no redundant coding in this sample; |
|
1439 3: reserved, DO NOT USE |
|
1440 |
|
1441 @param apihandle MP4 library handle |
|
1442 @param aDependsOn Defines whether current frame is I-frame (2), isn't I-frame (1) or if it only |
|
1443 can be found out by using MP4ParseReadVideoFrame()-method (0). |
|
1444 @param aIsDependentOn Defines the dependency of other frames on this one |
|
1445 @param aHasRedundancy Defines the existence of redundant coding in this frame |
|
1446 |
|
1447 @return MP4_OK Success |
|
1448 MP4_ERROR Generic error |
|
1449 */ |
|
1450 extern IMPORT_C MP4Err MP4ComposeWriteNextVideoFrameDependencies(MP4Handle apihandle, mp4_u8 aDependsOn, mp4_u8 aIsDependentOn, mp4_u8 aHasRedundancy); |
|
1451 |
|
1452 /** |
|
1453 This function reads the audio frames asynchronously that are stored in the current |
|
1454 audio sample from the MP4 file and returns them to the caller. |
|
1455 |
|
1456 Note: Only one async parse audio or video frame(s) operation can be ongoing at any given time. |
|
1457 |
|
1458 Note: Observer notification only comes if called function returns MP4_OK. |
|
1459 If given buffer is too small MP4_BUFFER_TOO_SMALL is returned and buffersize contains needed |
|
1460 size for audio frame. |
|
1461 |
|
1462 When feeding in parsed clip as memory buffers if the function returns MP4_NOT_AVAILABLE, |
|
1463 the client needs to call MP4ParseWriteData to insert more data before calling this method again. |
|
1464 |
|
1465 @param handle MP4 library handle |
|
1466 @param aObserver Observer designed to receive notification of Asynchronous event completion |
|
1467 @param buffer Buffer that audio frames are written to. |
|
1468 @param buffersize Size of the user allocated buffer (in bytes). In MP4_BUFFER_TOO_SMALL error case contains |
|
1469 needed size for memory buffer. |
|
1470 |
|
1471 @return MP4_OK Success |
|
1472 MP4_NOT_AVAILABLE MP4 library needs more data before the requested |
|
1473 frames can be returned |
|
1474 MP4_BUFFER_TOO_SMALL Requested frames don't fit into the given buffer |
|
1475 MP4_ERROR Generic error |
|
1476 MP4_FILE_ERROR Async operation is not for buffer mode |
|
1477 MP4_INVALID_INPUT_STREAM MP4 stream is invalid |
|
1478 MP4_NO_FRAME No more frames available |
|
1479 MP4_OUT_OF_MEMORY Out of Memory. |
|
1480 */ |
|
1481 extern IMPORT_C MP4Err MP4ParseReadAudioFramesAsync(MP4Handle handle, M3GPMP4LibAsyncObserver* aObserver, mp4_u8 *buffer, mp4_u32* buffersize ); |
|
1482 |
|
1483 /** |
|
1484 This function reads the next video frame from the MP4 file and returns it to the caller. |
|
1485 |
|
1486 Note: Only one async parse audio or video frame(s) operation can be ongoing at any given time. |
|
1487 |
|
1488 Note: Observer notification only comes if called function returns MP4_OK. |
|
1489 If given buffer is too small MP4_BUFFER_TOO_SMALL is returned and buffersize contains needed |
|
1490 size for video frame. |
|
1491 |
|
1492 When feeding in parsed clip as memory buffers if the function returns MP4_NOT_AVAILABLE, |
|
1493 the client needs to call MP4ParseWriteData to insert more data before calling this method again. |
|
1494 |
|
1495 @param handle MP4 library handle |
|
1496 @param aObserver Observer designed to receive notification of Asynchronous event completion |
|
1497 @param buffer Video frame is returned here |
|
1498 @param buffersize Size of the user allocated buffer (in bytes). In MP4_BUFFER_TOO_SMALL error case contains |
|
1499 needed size for memory buffer. |
|
1500 |
|
1501 @return MP4_OK Success |
|
1502 MP4_NOT_AVAILABLE MP4 library needs more data before the requested |
|
1503 frame can be returned |
|
1504 MP4_BUFFER_TOO_SMALL Requested frame doesn't fit into the given buffer |
|
1505 MP4_NO_FRAME Frame doesn't exist (previous frame was last) |
|
1506 MP4_ERROR Generic error |
|
1507 MP4_OUT_OF_MEMORY Out of Memory |
|
1508 MP4_INVALID_INPUT_STREAM MP4 stream is invalid |
|
1509 MP4_FILE_ERROR Async operation is not for buffer mode |
|
1510 */ |
|
1511 extern IMPORT_C MP4Err MP4ParseReadVideoFrameAsync(MP4Handle handle, M3GPMP4LibAsyncObserver* aObserver, mp4_u8* buffer, mp4_u32* buffersize ); |
|
1512 |
|
1513 /** |
|
1514 This function sets async temporary file deleting observer. Meta data temporary file removing can be done |
|
1515 on background to improve video recording stopping. |
|
1516 |
|
1517 @param handle MP4 library handle |
|
1518 @param aObserver Temorary file deleting observer |
|
1519 |
|
1520 @return MP4_OK Success |
|
1521 MP4_ERROR Generic error |
|
1522 */ |
|
1523 |
|
1524 extern IMPORT_C MP4Err MP4ComposeSetTempFileRemoverObserver(MP4Handle *handle, M3GPMP4LibAsyncTempFileRemoverObserver *aObserver); |
|
1525 |
|
1526 /** |
|
1527 This function cancels the outstanding asynchronous read audio/video frame request. |
|
1528 |
|
1529 No callback function will be called. |
|
1530 |
|
1531 Note: As only one asynchronous parse audio or video frame(s) operation can be ongoing at any given time, |
|
1532 this function can be used to cancel audio or video read request. If this is called without any outstanding |
|
1533 request, nothing happens. |
|
1534 |
|
1535 @param handle MP4 library handle |
|
1536 |
|
1537 @see MP4ParseReadVideoFrameAsync |
|
1538 @see MP4ParseReadAudioFramesAsync |
|
1539 */ |
|
1540 extern IMPORT_C void MP4CancelReadFrame(MP4Handle handle); |
|
1541 |
|
1542 #ifdef __cplusplus |
|
1543 } |
|
1544 #endif |
|
1545 |
|
1546 |
|
1547 #endif |
|
1548 // End of File |