os/mm/mmplugins/lib3gp/impl/inc/mp4lib.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmplugins/lib3gp/impl/inc/mp4lib.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,1563 @@
     1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @publishedPartner
    1.24 + @deprecated
    1.25 +*/
    1.26 +
    1.27 +#ifndef _MP4LIB_H
    1.28 +#define _MP4LIB_H
    1.29 +
    1.30 +#define MP4Handle mp4_i32*
    1.31 +
    1.32 +#include <f32file.h>
    1.33 +#include <caf/caf.h>
    1.34 +#include <3gplibrary/mp4config.h>
    1.35 +
    1.36 +/**
    1.37 +Provides async parse read observer.
    1.38 +*/
    1.39 +class M3GPMP4LibAsyncObserver
    1.40 +{
    1.41 +   public:
    1.42 +
    1.43 +        /**
    1.44 +        Informs the client about asyncronous parse audio frames operation completion.
    1.45 +        
    1.46 +        @param aError     		Error code.
    1.47 +        @param aAudioSize		Size of the returned audio frames (in bytes).
    1.48 +        @param aTimeStamp 		Audio frame presentation time in milliseconds from the
    1.49 +                   				beginning of the audio sequence.
    1.50 +        @param aReturnedFrames	Number of frames returned, or 0 if not known.
    1.51 +        @param aTimestamp2		Audio frame presentation time in timescale from the
    1.52 +                   				beginning of the audio sequence
    1.53 +        
    1.54 +        */
    1.55 +        virtual void M3GPMP4LibAudioFramesAvailable(MP4Err aError,
    1.56 +        											mp4_u32 aAudioSize, 
    1.57 +        											mp4_u32 aTimeStamp, 
    1.58 +        											mp4_u32 aReturnedFrames,
    1.59 + 					                              	mp4_u32 aTimestamp2) = 0;    
    1.60 +
    1.61 +        /**
    1.62 +        Informs the client about asyncronous parse video frame operation completion.
    1.63 +
    1.64 +        @param aError     	Error code.
    1.65 +        @param aFrameSize   Size of the returned frame (in bytes).
    1.66 +        @param aTimeStamp   Video frame presentation time in milliseconds from the 
    1.67 +        					beginning of the video sequence
    1.68 +        @param aKeyFrame	Returns MP4TRUE if the current frame is a key frame (intra), 
    1.69 +        					otherwise the value is MP4FALSE
    1.70 +        @param aTimestamp2	Video frame presentation time in timescale from the beginning 
    1.71 +        					of the video sequence
    1.72 +        
    1.73 +        */
    1.74 +        virtual void M3GPMP4LibVideoFrameAvailable(MP4Err aError,
    1.75 +        										   mp4_u32 aFrameSize, 
    1.76 +        										   mp4_u32 aTimeStamp, 
    1.77 +        										   mp4_bool aKeyFrame, 
    1.78 +        										   mp4_u32 aTimestamp2) = 0;    
    1.79 +};
    1.80 +
    1.81 +/**  
    1.82 +This class provides async temporary file deleting observer.
    1.83 +*/
    1.84 +class M3GPMP4LibAsyncTempFileRemoverObserver
    1.85 +{
    1.86 +   public:
    1.87 +
    1.88 +        /**
    1.89 +        Informs the client about unused temporary file that can be deleted.
    1.90 +        @param tempFileName		Name of the temporary file that can be deleted.
    1.91 +                     			Ownership of the file name memory buffer is transferred.
    1.92 +        */
    1.93 +        virtual void M3GPMP4LibDeleteTempFileName( MP4FileName tempFileName ) = 0;    
    1.94 +
    1.95 +};
    1.96 +#ifdef __cplusplus
    1.97 +extern "C" {
    1.98 +#endif
    1.99 +
   1.100 +
   1.101 +/**
   1.102 +Error codes returned by the library
   1.103 +*/
   1.104 +enum
   1.105 +	{
   1.106 +	/** Success */
   1.107 +  	MP4_OK,   
   1.108 +  	/** Generic error */                 
   1.109 +	MP4_ERROR,   
   1.110 +	/** Library can't allocate memory */              
   1.111 +	MP4_OUT_OF_MEMORY,   
   1.112 +	/** MP4 library needs more data before the
   1.113 +       requested information can be returned */      
   1.114 +	MP4_NOT_AVAILABLE,  
   1.115 +	/** The library has been opened with the input in a file */       
   1.116 +	MP4_FILE_MODE, 
   1.117 +	/** The input is not streamable */            
   1.118 +	MP4_NOT_STREAMABLE,
   1.119 +	/** Frame of requested type is not available */        
   1.120 +	MP4_NO_REQUESTED_FRAME, 
   1.121 +	/** Requested frame doesn't fit into the given buffer */   
   1.122 +	MP4_BUFFER_TOO_SMALL,
   1.123 +	/** No more video frames left */      
   1.124 +	MP4_END_OF_VIDEO,
   1.125 +	/** Can't seek to requested position */          
   1.126 +	MP4_CANT_SEEK,  
   1.127 +	/** Error in file handling */           
   1.128 +	MP4_FILE_ERROR,        
   1.129 +	/** Input stream is invalid */    
   1.130 +	MP4_INVALID_INPUT_STREAM, 
   1.131 +	/** Frame doesn't exist (previous frame was last) */ 
   1.132 +	MP4_NO_FRAME,   
   1.133 +	/** Illegal type */           
   1.134 +	MP4_INVALID_TYPE, 
   1.135 +	/** Timescale has not been set */         
   1.136 +	MP4_TIMESCALE_NOT_SET,
   1.137 +	/** Error writing metadata */     
   1.138 +	MP4_METADATA_ERROR,
   1.139 +	/** No video in input stream */        
   1.140 +	MP4_NO_VIDEO, 
   1.141 +	/** No audio in input stream */             
   1.142 +	MP4_NO_AUDIO,  
   1.143 +	/** Output buffer has not been initialized for buffer writing */             
   1.144 +	MP4_NO_OUTPUT_BUFFER, 
   1.145 +	/** Not enough space in output buffer to write to */      
   1.146 +	MP4_OUTPUT_BUFFER_TOO_SMALL,
   1.147 +	/** No UDTA data found */	
   1.148 +	MP4_UDTA_NOT_FOUND		 
   1.149 +	};
   1.150 +
   1.151 +
   1.152 +/** 
   1.153 +Possible data source types
   1.154 +*/
   1.155 +enum
   1.156 +	{
   1.157 +	/** Data is read from an RFile64 handle */
   1.158 +	MP4_SOURCE_RFILE,   
   1.159 +	/** Data is read via the CAF */        
   1.160 +	MP4_SOURCE_CAF,             
   1.161 +	};
   1.162 +
   1.163 +/** 
   1.164 +Possible input/output values for audio/video type
   1.165 +*/
   1.166 +
   1.167 +/** No audio or video */
   1.168 +#define MP4_TYPE_NONE              0x0000
   1.169 +/** Video Type. MPEG-4 video (MPEG-4 Part 2) - Simple and Advance Simple Profiles */
   1.170 +#define MP4_TYPE_MPEG4_VIDEO       0x0001
   1.171 +/** Audio Type.  MPEG-4 audio (MPEG-4 Part 3) */
   1.172 +#define MP4_TYPE_MPEG4_AUDIO       0x0002
   1.173 +/** Video Type. H263 Profile 0  */
   1.174 +#define MP4_TYPE_H263_PROFILE_0    0x0004
   1.175 +/** Video Type. H263 Profile 3  */
   1.176 +#define MP4_TYPE_H263_PROFILE_3    0x0008
   1.177 +/** Audio Type. AMR NB */
   1.178 +#define MP4_TYPE_AMR_NB            0x0010
   1.179 +/** Audio Type. AMR WB */
   1.180 +#define MP4_TYPE_AMR_WB            0x0020
   1.181 +/** Type not supported */
   1.182 +#define MP4_TYPE_UNSUPPORTED       0x0040
   1.183 +/** AVC baseline (MPEG-4 Part 10) */
   1.184 +#define MP4_TYPE_AVC_PROFILE_BASELINE      0x0080
   1.185 +/** AVC main (MPEG-4 Part 10) */
   1.186 +#define MP4_TYPE_AVC_PROFILE_MAIN          0x0100
   1.187 +/** AVC extended (MPEG-4 Part 10) */
   1.188 +#define MP4_TYPE_AVC_PROFILE_EXTENDED      0x0200
   1.189 +/** QCELP 13K additions */
   1.190 +#define MP4_TYPE_QCELP_13K         0x0400
   1.191 +/** AVC high (MPEG-4 Part 10) */
   1.192 +#define MP4_TYPE_AVC_PROFILE_HIGH      0x0800
   1.193 +
   1.194 +/**
   1.195 +Flags used by composer
   1.196 +*/
   1.197 +/** No special setup */
   1.198 +#define MP4_FLAG_NONE              0x0000
   1.199 +/** Meta data is placed at end of file */
   1.200 +#define MP4_FLAG_METADATALAST      0x0001
   1.201 +/** Collect metadata in files instead of storing it in memory */
   1.202 +#define MP4_FLAG_LONGCLIP          0x0002
   1.203 +/** Generate a 3G2 File instead of a 3GP File */
   1.204 +#define MP4_FLAG_GENERATE_3G2      0x0004
   1.205 +/** Generate a MP4 File instead of a 3GP File */
   1.206 +#define MP4_FLAG_GENERATE_MP4      0x0008
   1.207 +/** Use large output buffers for writing */
   1.208 +#define MP4_FLAG_LARGEFILEBUFFER   0x0010
   1.209 +
   1.210 +
   1.211 +/** Size of buf in MP4HandleStruct must be at least 128 bytes */
   1.212 +#define TMPBUFSIZE 128  
   1.213 +/** Duration of one AMR frame is 20 ms */         
   1.214 +#define AUDIO_FRAME_DURATION 20  
   1.215 +
   1.216 +#define MP4FALSE (mp4_bool)0
   1.217 +#define MP4TRUE  (mp4_bool)1
   1.218 +
   1.219 +/** 
   1.220 +Possible locations for user data atom (UDTA)
   1.221 +*/
   1.222 +/** No user data */
   1.223 +#define MP4_UDTA_NONE         0x0000
   1.224 +/** User data resides within the Movie Box */
   1.225 +#define MP4_UDTA_MOOV         0x0001
   1.226 +/** User data resides within the Track Box for video */
   1.227 +#define MP4_UDTA_VIDEOTRAK    0x0002
   1.228 +/** User data resides within the Track Box for audio */
   1.229 +#define MP4_UDTA_AUDIOTRAK    0x0004
   1.230 +
   1.231 +/**
   1.232 +Initializes the MP4 composing operation. The instance handle of the library is 
   1.233 +set by the function.
   1.234 + 
   1.235 +The possible values of type parameter are
   1.236 +
   1.237 +     MP4_TYPE_H263_PROFILE_0
   1.238 +     MP4_TYPE_H263_PROFILE_3
   1.239 +     MP4_TYPE_MPEG4_VIDEO
   1.240 +     MP4_TYPE_AMR_NB
   1.241 +     MP4_TYPE_AMR_WB
   1.242 +     MP4_TYPE_MPEG4_AUDIO
   1.243 +     MP4_TYPE_NONE
   1.244 +     MP4_TYPE_AVC_PROFILE_BASELINE 
   1.245 +     MP4_TYPE_AVC_PROFILE_MAIN
   1.246 +     MP4_TYPE_AVC_PROFILE_EXTENDED
   1.247 +	 MP4_TYPE_AVC_PROFILE_HIGH
   1.248 +     MP4_TYPE_QCELP_13K
   1.249 +
   1.250 +In addition, any combination of one video and one audio type are
   1.251 +possible. For example
   1.252 +
   1.253 +     MP4_TYPE_H263_PROFILE_0 | MP4_TYPE_AMR_NB
   1.254 +
   1.255 +The output file is placed in the current working directory if no path is
   1.256 +specified. The type of filename is dependent on the architecture. When
   1.257 +compiling in Symbian OS, this is a unicode string.
   1.258 +
   1.259 + 
   1.260 +@param handle		MP4 library handle
   1.261 +@param filename	Name of the output MP4 file
   1.262 +@param type		Type of the output file
   1.263 + 
   1.264 +@return	MP4_OK             Success
   1.265 + 			MP4_ERROR          Generic error
   1.266 + 			MP4_FILE_ERROR     Error opening file
   1.267 + 			MP4_OUT_OF_MEMORY  Out of memory
   1.268 +*/
   1.269 +extern IMPORT_C MP4Err MP4ComposeOpen(MP4Handle *handle, MP4FileName filename, mp4_u32 type);
   1.270 +
   1.271 +/**
   1.272 +This function initializes the MP4 composing operation. The instance
   1.273 +handle of the library is set by the function.
   1.274 + 
   1.275 +The possible values of type parameter are
   1.276 + 
   1.277 + 	 MP4_TYPE_H263_PROFILE_0
   1.278 +     MP4_TYPE_H263_PROFILE_3
   1.279 +     MP4_TYPE_MPEG4_VIDEO
   1.280 +     MP4_TYPE_AMR_NB
   1.281 +     MP4_TYPE_AMR_WB
   1.282 +     MP4_TYPE_MPEG4_AUDIO
   1.283 +     MP4_TYPE_NONE
   1.284 +     MP4_TYPE_AVC_PROFILE_BASELINE 
   1.285 +     MP4_TYPE_AVC_PROFILE_MAIN
   1.286 +     MP4_TYPE_AVC_PROFILE_EXTENDED
   1.287 +	 MP4_TYPE_AVC_PROFILE_HIGH
   1.288 +     MP4_TYPE_QCELP_13K
   1.289 +     
   1.290 +In addition, any combination of one video and one audio type are possible. For example
   1.291 + 
   1.292 +     MP4_TYPE_H263_PROFILE_0 | MP4_TYPE_AMR_NB
   1.293 + 
   1.294 +The output is placed in the buffer given as argument. 
   1.295 +Size of composed data is in composedSize variable.
   1.296 + 
   1.297 +@param handle	       MP4 library handle
   1.298 +@param type           Type of the output file
   1.299 +@param composeBuffer  Buffer to write to.
   1.300 +@param composedSize   Size of composed data.
   1.301 + 
   1.302 +@return 
   1.303 +   MP4_OK                 Success
   1.304 +   MP4_ERROR              Generic error
   1.305 +   MP4_FILE_ERROR         Error opening file
   1.306 +   MP4_OUT_OF_MEMORY      Out of memory
   1.307 +   MP4_NO_OUTPUT_BUFFER   No composed buffer 
   1.308 +*/
   1.309 +extern IMPORT_C MP4Err MP4ComposeOpenToBuffer(MP4Handle *handle, mp4_u32 type, mp4_u8* composeBuffer, mp4_u32 *composedSize);
   1.310 +
   1.311 +/** 
   1.312 +This function initializes the MP4 composing operation to existing file handle. The instance
   1.313 +handle of the library is set by the function.
   1.314 + 
   1.315 +NOTE: MP4_FLAG_METADATALAST must be defined in MP4ComposeSetFlags if MP4ComposeOpenFileHandle is used!
   1.316 + 
   1.317 +The possible values of type parameter are
   1.318 + 
   1.319 +     MP4_TYPE_H263_PROFILE_0
   1.320 +     MP4_TYPE_H263_PROFILE_3
   1.321 +     MP4_TYPE_MPEG4_VIDEO
   1.322 +     MP4_TYPE_AMR_NB
   1.323 +     MP4_TYPE_AMR_WB
   1.324 +     MP4_TYPE_MPEG4_AUDIO
   1.325 +     MP4_TYPE_NONE
   1.326 +     MP4_TYPE_AVC_PROFILE_BASELINE 
   1.327 +     MP4_TYPE_AVC_PROFILE_MAIN
   1.328 +     MP4_TYPE_AVC_PROFILE_EXTENDED
   1.329 +	 MP4_TYPE_AVC_PROFILE_HIGH
   1.330 +     MP4_TYPE_QCELP_13K
   1.331 + 
   1.332 +In addition, any combination of one video and one audio type are possible. For example
   1.333 + 
   1.334 +      MP4_TYPE_H263_PROFILE_0 | MP4_TYPE_AMR_NB
   1.335 + 
   1.336 +The output file is placed in the current working directory if no path is
   1.337 +specified. The type of filename is dependent on the architecture. When
   1.338 +compiling in Symbian OS, this is a unicode string.
   1.339 + 
   1.340 +@param handle             MP4 library handle
   1.341 +@param composedfile       File handle to output file
   1.342 +@param metadataTempDrive  If MP4ComposeSetFlags() is configured to use temporary files for metadata
   1.343 +                          (MP4_FLAG_LONGCLIP) this is way to tell library which drive to use for 
   1.344 +                          temporary files.
   1.345 +@param type               Type of the output file
   1.346 + 
   1.347 +@return     MP4_OK             Success
   1.348 +            MP4_ERROR          Generic error
   1.349 +            MP4_FILE_ERROR     Error opening file
   1.350 +            MP4_OUT_OF_MEMORY  Out of memory
   1.351 +*/
   1.352 +extern IMPORT_C MP4Err MP4ComposeOpenFileHandle(MP4Handle *handle, RFile *composedfile, TDriveNumber metadataTempDrive, mp4_u32 type);
   1.353 +
   1.354 +/** 
   1.355 +This function initializes the MP4 composing operation to existing file handle. The instance
   1.356 +handle of the library is set by the function.
   1.357 + 
   1.358 +NOTE: MP4_FLAG_METADATALAST must be defined in MP4ComposeSetFlags if MP4ComposeOpenFileHandle is used!
   1.359 + 
   1.360 +The possible values of type parameter are
   1.361 + 
   1.362 +  	 MP4_TYPE_H263_PROFILE_0
   1.363 +     MP4_TYPE_H263_PROFILE_3
   1.364 +     MP4_TYPE_MPEG4_VIDEO
   1.365 +     MP4_TYPE_AMR_NB
   1.366 +     MP4_TYPE_AMR_WB
   1.367 +     MP4_TYPE_MPEG4_AUDIO
   1.368 +     MP4_TYPE_NONE
   1.369 +     MP4_TYPE_AVC_PROFILE_BASELINE 
   1.370 +     MP4_TYPE_AVC_PROFILE_MAIN
   1.371 +     MP4_TYPE_AVC_PROFILE_EXTENDED
   1.372 +	 MP4_TYPE_AVC_PROFILE_HIGH
   1.373 +     MP4_TYPE_QCELP_13K
   1.374 + 
   1.375 +In addition, any combination of one video and one audio type are possible. For example
   1.376 + 
   1.377 +      MP4_TYPE_H263_PROFILE_0 | MP4_TYPE_AMR_NB
   1.378 + 
   1.379 +The output file is placed in the current working directory if no path is
   1.380 +specified. The type of filename is dependent on the architecture. When
   1.381 +compiling in Symbian OS, this is a unicode string.
   1.382 + 
   1.383 +@param handle             MP4 library handle
   1.384 +@param composedfile       File handle to output file
   1.385 +@param metadataTempDrive  If MP4ComposeSetFlags() is configured to use temporary files for metadata
   1.386 +						  (MP4_FLAG_LONGCLIP) this is way to tell library which drive to use for 
   1.387 +  						  temporary files.
   1.388 +@param type               Type of the output file
   1.389 + 
   1.390 +@return		MP4_OK             Success
   1.391 + 			MP4_ERROR          Generic error
   1.392 + 			MP4_FILE_ERROR     Error opening file
   1.393 + 			MP4_OUT_OF_MEMORY  Out of memory
   1.394 +*/
   1.395 +extern IMPORT_C MP4Err MP4ComposeOpenFileHandle64(MP4Handle *handle, RFile64 *composedfile, TDriveNumber metadataTempDrive, mp4_u32 type);
   1.396 +
   1.397 +/**
   1.398 +This function closes the MP4 composing operation. It frees the memory
   1.399 +allocated by the library instance and closes the output MP4 file.
   1.400 + 
   1.401 +It is necessary to call this function before the output file is
   1.402 +guaranteed to be a valid MP4 file even though the file may exist prior to
   1.403 +the call.
   1.404 + 
   1.405 +The library handle is not valid after this call.
   1.406 + 
   1.407 +@param handle   MP4 library handle
   1.408 + 
   1.409 +@return		MP4_OK              Success
   1.410 + 			MP4_ERROR           Generic error
   1.411 + 			MP4_METADATA_ERROR  Metadata could not be written
   1.412 +*/
   1.413 +extern IMPORT_C MP4Err MP4ComposeClose(MP4Handle handle);
   1.414 +
   1.415 +/**
   1.416 +This function is used to inform the MP4 library about the video data. The
   1.417 +data given to the library is inserted into the MP4 file headers.
   1.418 + 
   1.419 +The parameter timescale indicates the timescale of the video data
   1.420 +to be inserted. Timescale tells how many units of time pass in one second.
   1.421 + 
   1.422 +Note: Timescale should be chosen so that the duration of each sample is
   1.423 +an integer. Timescale should also be chosen so that the duration
   1.424 +of the presentation fits into 32 bits.
   1.425 + 
   1.426 +@param handle   	MP4 library handle
   1.427 +@param timescale    Timescale of video
   1.428 +@param width        Video width
   1.429 +@param height       Video height
   1.430 +@param maxbitrate   Maximum bitrate of video
   1.431 +@param avgbitrate   Average bitrate of video
   1.432 + 
   1.433 +@return		MP4_OK       Success
   1.434 + 			MP4_ERROR    Generic error
   1.435 +*/
   1.436 +extern IMPORT_C MP4Err MP4ComposeAddVideoDescription(MP4Handle handle, mp4_u32 timescale, mp4_u16 width, mp4_u16 height, mp4_u32 maxbitrate, mp4_u32 avgbitrate);
   1.437 +
   1.438 +/**
   1.439 +This function is used to inform the MP4 library about the audio data. The
   1.440 +data given to the library is inserted into the MP4 file headers.
   1.441 + 
   1.442 +The parameter timescale indicates the timescale of the audio data
   1.443 +to be inserted. Timescale tells how many units of time pass in one second.
   1.444 + 
   1.445 +Note: timescale must be smaller than 65536.
   1.446 + 
   1.447 +Note: audioFramesPerSample and modeSet are needed only for AMR audio.
   1.448 +    
   1.449 +@param handle                MP4 library handle
   1.450 +@param timescale             Timescale of audio
   1.451 +@param audioFramesPerSample  AMR frames per sample
   1.452 +@param modeSet               AMR mode set
   1.453 + 
   1.454 +@return		MP4_OK     Success
   1.455 + 			MP4_ERROR  Generic error
   1.456 +*/
   1.457 +extern IMPORT_C MP4Err MP4ComposeAddAudioDescription(MP4Handle handle, mp4_u32 timescale, mp4_u8 audioFramesPerSample, mp4_u16 modeSet);
   1.458 +
   1.459 +/**
   1.460 +This function writes one video frame to the MP4 composer library.
   1.461 + 
   1.462 +The frames must be inserted in causal order. Because the library doesn't
   1.463 +analyze the video bitstream, the frames can't be retrieved from the
   1.464 +resulting MP4 file correctly if they are not in proper order.
   1.465 + 
   1.466 +The data is available in the MP4 output file only after calling
   1.467 +MP4ComposeClose. MP4ComposeClose is called exactly once when all audio
   1.468 +and video data has been inserted into the library.
   1.469 + 
   1.470 +@param handle       MP4 library handle
   1.471 +@param buffer       Video frame data
   1.472 +@param framesize    Size of the video frame in bytes
   1.473 +@param duration     Duration of video frame (in timescale,
   1.474 +                 	see MP4ComposeAddVideoDescription)
   1.475 +@param keyframe     Flag to indicate whether this frame is a keyframe
   1.476 + 
   1.477 +@return		MP4_OK					Success
   1.478 + 			MP4_ERROR				Generic error
   1.479 + 			MP4_TIMESCALE_NOT_SET	Timescale has not been set
   1.480 +*/
   1.481 +extern IMPORT_C MP4Err MP4ComposeWriteVideoFrame(MP4Handle handle, mp4_u8 *buffer, mp4_u32 framesize, mp4_u32 duration, mp4_bool keyframe);
   1.482 +
   1.483 +/**
   1.484 +This function writes audio frames to the MP4 composer library. The data is 
   1.485 +available in the MP4 output file only after calling
   1.486 +MP4ComposeClose. MP4ComposeClose is called exactly once when all audio
   1.487 +and video data has been insrted into the library.
   1.488 + 
   1.489 +For MPEG audio:
   1.490 + 
   1.491 +This function writes one MPEG audio frame to the MP4 composer library.
   1.492 + 
   1.493 +Note: numberofframes is meaningless with MPEG audio since only one frame
   1.494 +can be added with one call.
   1.495 + 
   1.496 +For other audio types:
   1.497 + 
   1.498 +This function writes a number of audio frames to the MP4 composer library. 
   1.499 +All audio frames inserted with one function call will be placed inside
   1.500 +one audio sample in the resulting file.
   1.501 + 
   1.502 +Note: Once this function is called with a certain numberofframes
   1.503 +parameter, it can't be changed. This is a limitation of the MP4 file
   1.504 +format. Only the last call can have a different number of frames if
   1.505 +their number is less than numberofframes.
   1.506 + 
   1.507 +@param handle          MP4 library handle
   1.508 +@param buffer          Audio data
   1.509 +@param bytestowrite    Number of bytes of audio data in buffer
   1.510 +@param numberofframes  Number of frames to write
   1.511 +@param duration        Duration of audio frames (in timescale,
   1.512 +	                   see MP4ComposeAddAudioDescription)
   1.513 + 
   1.514 +@return		MP4_OK             		Success
   1.515 + 			MP4_ERROR				Generic error
   1.516 + 			MP4_TIMESCALE_NOT_SET	Timescale has not been set
   1.517 +*/
   1.518 +extern IMPORT_C MP4Err MP4ComposeWriteAudioFrames(MP4Handle handle, mp4_u8 *buffer, mp4_u32 bytestowrite, mp4_u32 numberofframes, mp4_u32 duration);
   1.519 +
   1.520 +/**
   1.521 +This function writes MPEG-4 or AVC video DecoderSpecificInfo data into the appropriate atom.
   1.522 +
   1.523 +If the video type is MPEG-4 the DecoderSpecificInfo will be written into the esds atom. If the
   1.524 +video type is AVC (any profile) the DecoderSpecificInfo will be written into the avcC atom.
   1.525 +
   1.526 +Note: This function needs to be called only when MPEG-4 or AVC video is used.
   1.527 + 
   1.528 +@param handle         MP4 library handle
   1.529 +@param info           Buffer containing DecoderSpecificInfo
   1.530 +@param infosize       Size of info in bytes
   1.531 + 
   1.532 +@return		MP4_OK		Success
   1.533 + 			MP4_ERROR	Generic error
   1.534 +*/
   1.535 +extern IMPORT_C MP4Err MP4ComposeWriteVideoDecoderSpecificInfo(MP4Handle handle, mp4_u8 *info, mp4_u32 infosize);
   1.536 +
   1.537 +/**
   1.538 +This function writes MPEG audio DecoderSpecificInfo data into esds atom.
   1.539 + 
   1.540 +Note: This function needs to be called only when MPEG audio is used.
   1.541 + 
   1.542 +@param handle         MP4 library handle
   1.543 +@param info           Buffer containing DecoderSpecificInfo
   1.544 +@param infosize       Size of info in bytes
   1.545 + 
   1.546 +@return		MP4_OK     Success
   1.547 + 			MP4_ERROR  Generic error
   1.548 +*/
   1.549 +extern IMPORT_C MP4Err MP4ComposeWriteAudioDecoderSpecificInfo(MP4Handle handle, mp4_u8 *info, mp4_u32 infosize);
   1.550 +
   1.551 +/**
   1.552 +This function allows settings flags that modify the behaviour
   1.553 +of the library. Use binary OR to specify several flags.
   1.554 + 
   1.555 +The following flags can be used:
   1.556 + 
   1.557 +MP4_FLAG_NONE            No special setup.
   1.558 + 
   1.559 +MP4_FLAG_METADATALAST    Write metadata last in the file without tmpfile.
   1.560 +                         Default is to write the metadata in the
   1.561 +                         beginning of the file.
   1.562 +                          
   1.563 +MP4_FLAG_LONGCLIP        Collect metadata in files instead of collecting
   1.564 +                         it in memory if the amount is large. Only usable
   1.565 +                         in Symbian OS.
   1.566 + 
   1.567 +MP4_FLAG_GENERATE_3G2    Generate a 3G2 File instead of a 3GP File.
   1.568 +                         If not set, then 3GP file is generated.
   1.569 +                         Generation of 3G2 file may be automatically set 
   1.570 +                         during composition, based on the selection 
   1.571 +                         of 3GPP2 specific codecs.
   1.572 + 
   1.573 +MP4_FLAG_GENERATE_MP4    Generate a MP4 File instead of a 3GP File.
   1.574 +                         If not set, then 3GP file is generated.
   1.575 +                         Generation may be automatically set to 3GP
   1.576 +                         if codecs selected do not support MP4.
   1.577 + 
   1.578 +MP4_FLAG_LARGEFILEBUFFER Use larger output buffers in file writing.
   1.579 +                         Non MP4_ARCH_WIN32 compilations only.
   1.580 + 
   1.581 +Note: This function should be called after MP4ComposeOpen before
   1.582 +      any other MP4Compose functions.
   1.583 + 
   1.584 +Note: If MP4ComposeOpenFileHandle is used instead of MP4ComposeOpen the MP4_FLAG_METADATALAST must be defined.
   1.585 + 
   1.586 +@param handle         MP4 library handle
   1.587 +@param flags          Flags to enable
   1.588 + 
   1.589 +@return		MP4_OK              Success
   1.590 + 			MP4_ERROR  			Generic error
   1.591 + 			MP4_OUT_OF_MEMORY	Out of Memory
   1.592 +*/
   1.593 +extern IMPORT_C MP4Err MP4ComposeSetFlags(MP4Handle handle, mp4_u32 flags);
   1.594 +
   1.595 +/**
   1.596 +This function initializes the MP4 parsing operation. The instance handle
   1.597 +of the library is set by the function.
   1.598 +
   1.599 +The filename parameter is used to specify the type of the input. If the
   1.600 +parameter is non-NULL, it is assumed to be the filename of the input MP4
   1.601 +file. If the parameter is NULL, the library expects the input MP4 data to
   1.602 +be inserted by subsequent calls of MP4ParseWriteData.
   1.603 + 
   1.604 +@param handle     MP4 library handle
   1.605 +@param filename   Name of the input MP4 file or NULL if the data is coming from
   1.606 +                  stream
   1.607 + 
   1.608 +@return		MP4_OK             Success
   1.609 +			MP4_ERROR          Generic error
   1.610 +			MP4_OUT_OF_MEMORY  Out of memory
   1.611 +			MP4_FILE_ERROR     Error opening file
   1.612 +*/
   1.613 +extern IMPORT_C MP4Err MP4ParseOpen(MP4Handle *handle, MP4FileName filename);
   1.614 +
   1.615 +/**
   1.616 +This function initializes the MP4 parsing operation. The instance handle
   1.617 +of the library is set by the function.
   1.618 + 
   1.619 +The RFile *inputfile parameter is pointer to valid file handle.
   1.620 +Library expects that file has been opened and will be closed outside of library.
   1.621 + 
   1.622 +@param handle     MP4 library handle
   1.623 +@param inputfile  File handle to be parsed.
   1.624 +           
   1.625 +@return     MP4_OK             Success
   1.626 +            MP4_ERROR          Generic error
   1.627 +            MP4_OUT_OF_MEMORY  Out of memory
   1.628 +            MP4_FILE_ERROR;    Error accessing file
   1.629 +*/
   1.630 +extern IMPORT_C MP4Err MP4ParseOpenFileHandle(MP4Handle *handle, RFile *inputfile );
   1.631 +
   1.632 +/**
   1.633 +This function initializes the MP4 parsing operation. The instance handle
   1.634 +of the library is set by the function.
   1.635 + 
   1.636 +The RFile64 *inputfile parameter is pointer to valid file handle.
   1.637 +Library expects that file has been opened and will be closed outside of library.
   1.638 + 
   1.639 +@param handle     MP4 library handle
   1.640 +@param inputfile  File handle to be parsed.
   1.641 +           
   1.642 +@return		MP4_OK             Success
   1.643 +			MP4_ERROR          Generic error
   1.644 +			MP4_OUT_OF_MEMORY  Out of memory
   1.645 +			MP4_FILE_ERROR;    Error accessing file
   1.646 +*/
   1.647 +extern IMPORT_C MP4Err MP4ParseOpenFileHandle64(MP4Handle *handle, RFile64 *inputfile );
   1.648 +
   1.649 +/**
   1.650 +This function initializes the MP4 parsing operation. The instance handle
   1.651 +of the library is set by the function.
   1.652 + 
   1.653 +The ContentAccess::CData *inputfile parameter is pointer to valid CAF object.
   1.654 +Library expects that file has been opened and will be closed outside of library.
   1.655 + 
   1.656 +@param handle     MP4 library handle
   1.657 +@param inputfile  CAF data source handle to be parsed.
   1.658 +           
   1.659 +@return		MP4_OK             Success
   1.660 +			MP4_ERROR          Generic error
   1.661 +			MP4_OUT_OF_MEMORY  Out of memory
   1.662 +			MP4_FILE_ERROR;    Error accessing file
   1.663 +*/
   1.664 +extern IMPORT_C MP4Err MP4ParseOpenCAF(MP4Handle *handle, ContentAccess::CData *inputfile );
   1.665 +
   1.666 +/**
   1.667 +This function closes the MP4 parsing operation. It frees the resources
   1.668 +allocated by the library instance.
   1.669 +
   1.670 +The library handle is not valid after this call.
   1.671 + 
   1.672 +@param handle     MP4 library handle
   1.673 + 
   1.674 +@return		MP4_OK		Success
   1.675 +			MP4_ERROR	Generic error
   1.676 +*/
   1.677 +extern IMPORT_C MP4Err MP4ParseClose(MP4Handle handle);
   1.678 +
   1.679 +/**
   1.680 +This function returns parameters describing the video stream. It can be
   1.681 +called after enough data has been inserted into the library so that MP4
   1.682 +headers containing the information can be read. If there is not enough
   1.683 +data, those functions return MP4_NOT_AVAILABLE and more data needs to be
   1.684 +inserted into the library by MP4ParseWriteData.
   1.685 + 
   1.686 +The framerate parameter refers to the frame rate of the original video
   1.687 +material.
   1.688 + 
   1.689 +The videotype parameter can be one of the following:
   1.690 +  MP4_TYPE_MPEG4_VIDEO
   1.691 +  MP4_TYPE_H263_PROFILE_0
   1.692 +  MP4_TYPE_H263_PROFILE_3
   1.693 +  MP4_TYPE_AVC_PROFILE_BASELINE 
   1.694 +  MP4_TYPE_AVC_PROFILE_MAIN
   1.695 +  MP4_TYPE_AVC_PROFILE_EXTENDED
   1.696 +  MP4_TYPE_AVC_PROFILE_HIGH
   1.697 + 
   1.698 +Note: For timescale parameter, NULL can be specified if the caller
   1.699 +      doesn't need the value.
   1.700 + 
   1.701 +@param handle       MP4 library handle
   1.702 +@param videolength  Duration of video in milliseconds
   1.703 +@param framerate    Frame rate of video (in Hz)
   1.704 +@param videotype    Type of video stream
   1.705 +@param videowidth   Width of video image measured in pixels
   1.706 +@param videoheight  Height of video image measured in pixels
   1.707 +@param timescale    Timescale of video track
   1.708 +
   1.709 +@return		MP4_OK             		  Success
   1.710 +			MP4_ERROR                 Generic error
   1.711 +			MP4_NOT_AVAILABLE         MP4 library needs more data before the
   1.712 +    			                      requested information can be returned
   1.713 +			MP4_INVALID_INPUT_STREAM  MP4 stream is invalid
   1.714 +			MP4_NO_VIDEO              Input doesn't contain video track
   1.715 +*/
   1.716 +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);
   1.717 +
   1.718 +/**
   1.719 +This function returns parameters describing the audio stream. It can be
   1.720 +called after enough data has been inserted into the library so that MP4
   1.721 +headers containing the information can be read.
   1.722 + 
   1.723 +Note: framespersample parameter is set only when AMR type audio is used.
   1.724 + 
   1.725 +Note: For timescale parameter, NULL can be specified if the caller
   1.726 +      doesn't need the value.
   1.727 + 
   1.728 +@param handle                    MP4 library handle
   1.729 +@param audiolength               Duration of audio in milliseconds
   1.730 +@param audiotype                 Type of audio
   1.731 +@param framespersample           Number of audio frames in each sample
   1.732 +@param timescale                 Timescale of audio track
   1.733 +@param averagebitrate            Average bitrate of audio
   1.734 + 
   1.735 +@return		MP4_OK            		  Success
   1.736 +			MP4_ERROR                 Generic error
   1.737 +			MP4_NOT_AVAILABLE         MP4 library needs more data before the
   1.738 +                        			  requested information can be returned
   1.739 +			MP4_INVALID_INPUT_STREAM  MP4 stream is invalid
   1.740 +			MP4_NO_AUDIO              Input doesn't contain audio track
   1.741 +*/
   1.742 +extern IMPORT_C MP4Err MP4ParseRequestAudioDescription(MP4Handle handle, mp4_u32 *audiolength, mp4_u32 *audiotype, mp4_u8 *framespersample, mp4_u32 *timescale, mp4_u32 *averagebitrate);
   1.743 +
   1.744 +/**
   1.745 +This function returns parameters describing the contents of the MP4
   1.746 +file. It can be called after enough data has been inserted into the
   1.747 +library so that MP4 headers containing the information can be read.
   1.748 + 
   1.749 +@param handle                 MP4 library handle
   1.750 +@param streamsize             Length of the stream in bytes
   1.751 +@param streamaveragebitrate   Average bitrate of the stream in bps
   1.752 +
   1.753 +@return		MP4_OK					  Success
   1.754 +			MP4_ERROR                 Generic error
   1.755 +			MP4_NOT_AVAILABLE         MP4 library needs more data before the
   1.756 +    			                      requested information can be returned
   1.757 +			MP4_INVALID_INPUT_STREAM  MP4 stream is invalid
   1.758 +*/
   1.759 +extern IMPORT_C MP4Err MP4ParseRequestStreamDescription(MP4Handle handle, mp4_u32 *streamsize, mp4_u32 *streamaveragebitrate);
   1.760 +
   1.761 +/**
   1.762 +This function inserts MP4 data to the MP4 library.
   1.763 + 
   1.764 +It is necessary to call this function only if the input filename has not
   1.765 +been given with MP4ParseOpen. Several functions can return
   1.766 +MP4_NOT_AVAILABLE if the library doesn't have enough data to return the
   1.767 +information that the caller requests. In that case, more data needs to be
   1.768 +inserted to the library before calling those functions again.
   1.769 + 
   1.770 +This function makes a copy of the data inserted into the library so the
   1.771 +caller can use buffer for other purposes. If the function returns
   1.772 +MP4_OUT_OF_MEMORY, the buffer contents have not been copied into the
   1.773 +library and the caller needs to reduce the buffer size before calling
   1.774 +again.
   1.775 + 
   1.776 +If bytestowrite argument is zero, it indicates that there would be no more 
   1.777 +data to feed via this function. Such a function call MUST be done if a 
   1.778 +complete 3GP/MP4 file is to be written to the library's internal memory. The
   1.779 +buffer argument may be inputted as NULL in such a case.
   1.780 + 
   1.781 +@param handle         MP4 library handle
   1.782 +@param buffer         Data to be written
   1.783 +@param bytestowrite   Size of buffer in bytes
   1.784 + 
   1.785 +@return		MP4_OK             Success
   1.786 +			MP4_ERROR          Generic error
   1.787 +			MP4_OUT_OF_MEMORY  Library can't allocate enough memory for the data
   1.788 +*/
   1.789 +extern IMPORT_C MP4Err MP4ParseWriteData(MP4Handle handle, mp4_u8 *buffer, mp4_u32 bytestowrite);
   1.790 +
   1.791 +/**
   1.792 +This function returns the number of bytes that the library instance has
   1.793 +in its allocated buffers.
   1.794 + 
   1.795 +The function is only valid when the filename is not provided when opening
   1.796 +the library. Zero is returned in bytes when in file mode.
   1.797 + 
   1.798 +@see MP4ParseWriteData.
   1.799 + 
   1.800 +@param handle   MP4 library handle
   1.801 +@param bytes    Number of allocated bytes in the library
   1.802 + 
   1.803 +@return		MP4_OK         Success
   1.804 +			MP4_ERROR      Generic error
   1.805 +			MP4_FILE_MODE  The library has been opened with the input in a file
   1.806 +*/
   1.807 +extern IMPORT_C MP4Err MP4ParseGetBufferedBytes(MP4Handle handle, mp4_u32 *bytes);
   1.808 +
   1.809 +/**
   1.810 +This function returns the type of the next audio/video frame in the
   1.811 +stream. The type can be one of the following:
   1.812 + 
   1.813 +MP4_TYPE_MPEG4_VIDEO
   1.814 +MP4_TYPE_MPEG4_AUDIO
   1.815 +MP4_TYPE_H263_PROFILE_0
   1.816 +MP4_TYPE_H263_PROFILE_3
   1.817 +MP4_TYPE_AMR_NB
   1.818 +MP4_TYPE_AMR_WB
   1.819 +MP4_TYPE_AVC_PROFILE_BASELINE 
   1.820 +MP4_TYPE_AVC_PROFILE_MAIN
   1.821 +MP4_TYPE_AVC_PROFILE_EXTENDED
   1.822 +MP4_TYPE_AVC_PROFILE_HIGH
   1.823 +MP4_TYPE_QCELP_13K
   1.824 + 
   1.825 +The function is only valid when the input is streamable.
   1.826 + 
   1.827 +When reading audio/video from an MP4 container in streaming mode, the
   1.828 +samples must be read from the container in the same order as they were
   1.829 +inserted in it. This function determines the type of the next sample and
   1.830 +based on this information the user can call either MP4ParseReadVideoFrame
   1.831 +or MP4ParseReadAudioFrames to fetch more data.
   1.832 + 
   1.833 +@param handle   MP4 library handle
   1.834 +@param type     Type of the next frame
   1.835 +
   1.836 +@return		MP4_OK             		  Success
   1.837 +			MP4_ERROR                 Generic error
   1.838 +			MP4_NOT_STREAMABLE        The input is not streamable
   1.839 +			MP4_NOT_AVAILABLE         MP4 library needs more data before the
   1.840 +			                          requested information can be returned
   1.841 +			MP4_INVALID_INPUT_STREAM  MP4 stream is invalid
   1.842 +			MP4_NO_FRAME              Frame doesn't exist (previous frame was last)
   1.843 +*/
   1.844 +extern IMPORT_C MP4Err MP4ParseNextFrameType(MP4Handle handle, mp4_u32 *type);
   1.845 +
   1.846 +/**
   1.847 +This function returns the size of the next frame of type type in bytes.
   1.848 +The frame type can be one of the following:
   1.849 + 
   1.850 +MP4_TYPE_MPEG4_VIDEO
   1.851 +MP4_TYPE_MPEG4_AUDIO
   1.852 +MP4_TYPE_H263_PROFILE_0
   1.853 +MP4_TYPE_H263_PROFILE_3
   1.854 +MP4_TYPE_AMR_NB
   1.855 +MP4_TYPE_AMR_WB
   1.856 +MP4_TYPE_AVC_PROFILE_BASELINE 
   1.857 +MP4_TYPE_AVC_PROFILE_MAIN
   1.858 +MP4_TYPE_AVC_PROFILE_EXTENDED
   1.859 +MP4_TYPE_AVC_PROFILE_HIGH
   1.860 +MP4_TYPE_QCELP_13K
   1.861 + 
   1.862 +@param handle     MP4 library handle
   1.863 +@param type       Type of the frame
   1.864 +@param framesize  Size of the requested frame in bytes
   1.865 + 
   1.866 +@return		MP4_OK		              Success
   1.867 +			MP4_ERROR                 Generic error
   1.868 +			MP4_NOT_AVAILABLE         MP4 library needs more data before the requested
   1.869 +           				              frames can be returned
   1.870 +			MP4_NO_REQUESTED_FRAME    Frame of requested type is not available
   1.871 +			MP4_INVALID_TYPE          Illegal type
   1.872 +			MP4_INVALID_INPUT_STREAM  MP4 stream is invalid
   1.873 + 
   1.874 +*/
   1.875 +extern IMPORT_C MP4Err MP4ParseNextFrameSize(MP4Handle handle, mp4_u32 type, mp4_u32 *framesize);
   1.876 +
   1.877 +/**
   1.878 +This function reads the next video frame from the MP4 file/stream and
   1.879 +returns it to the caller.
   1.880 + 
   1.881 +Note: Next frame depends on the position in the input MP4 file.
   1.882 +MP4ParseSeek can be used to change the current position in the MP4 file.
   1.883 + 
   1.884 +If the function returns MP4_NOT_AVAILABLE, the caller needs to call
   1.885 +MP4ParseWriteData to insert more data before calling again.
   1.886 + 
   1.887 +framesize is returned even if buffer was too small to contain the data.
   1.888 + 
   1.889 +Note: Specify NULL as timestamp2 if not interested in this parameter.
   1.890 + 
   1.891 +@param handle       MP4 library handle
   1.892 +@param buffer       Video frame is returned here
   1.893 +@param buffersize   Size of the user allocated buffer (in bytes)
   1.894 +@param framesize    Size of the frame that was returned (in bytes)
   1.895 +@param timestamp    Video frame presentation time in milliseconds from the
   1.896 +             		beginning of the video sequence
   1.897 +@param keyframe     Has a value of MP4TRUE if current frame is a keyframe
   1.898 +             		(intra) or MP4FALSE otherwise
   1.899 +@param timestamp2   Video frame presentation time in timescale from the
   1.900 +             		beginning of the video sequence
   1.901 + 
   1.902 +@return		MP4_OK             		  Success
   1.903 +			MP4_NOT_AVAILABLE         MP4 library needs more data before the requested
   1.904 +     			                      frame can be returned
   1.905 +			MP4_BUFFER_TOO_SMALL      Requested frame doesn't fit into the given buffer
   1.906 +			MP4_NO_FRAME              Frame doesn't exist (previous frame was last)
   1.907 +			MP4_ERROR                 Generic error
   1.908 +			MP4_INVALID_INPUT_STREAM  MP4 stream is invalid
   1.909 +*/
   1.910 +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);
   1.911 +
   1.912 +/**
   1.913 +This function reads DecoderSpecificInfo data from MPEG-4 or AVC metadata and
   1.914 +returns it to the caller.
   1.915 +
   1.916 +If the video type is MPEG-4 the DecoderSpecificInfo from the esds atom will be
   1.917 +returned. If the video type is AVC (any profile) the DecoderSpecificInfo from the
   1.918 +avcC atom will be returned.
   1.919 +
   1.920 +decspecinfosize is set even if buffer is too small to contain the data.
   1.921 +The function can be called with buffersize 0 to query the size of
   1.922 +DecoderSpecificInfo.
   1.923 + 
   1.924 +Note: DecoderSpecificInfo is specific to MPEG-4 and AVC video. Therefore,
   1.925 +	  only MPEG-4 or AVC video streams contain this information.
   1.926 + 
   1.927 +@param handle           MP4 library handle
   1.928 +@param buffer           DecoderSpecificInfo is returned here
   1.929 +@param buffersize       Size of the user allocated buffer (in bytes)
   1.930 +@param decspecinfosize  Size of DecoderSpecificInfo is returned here
   1.931 + 
   1.932 +@return		MP4_OK             		  Success
   1.933 +			MP4_NOT_AVAILABLE         MP4 library needs more data before the requested
   1.934 +        			                  frames can be returned
   1.935 +			MP4_BUFFER_TOO_SMALL      Requested data doesn't fit into the given buffer
   1.936 +			MP4_ERROR                 Generic error
   1.937 +			MP4_INVALID_INPUT_STREAM  MP4 stream is invalid
   1.938 +*/
   1.939 +extern IMPORT_C MP4Err MP4ParseReadVideoDecoderSpecificInfo(MP4Handle handle, mp4_u8 *buffer, mp4_u32 buffersize, mp4_u32 *decspecinfosize);
   1.940 +
   1.941 +/**
   1.942 +This function reads the audio frames that are stored in the current
   1.943 +audio sample from the MP4 file/stream and returns them to the caller.
   1.944 + 
   1.945 +Note: Next frame depends on the position in the input MP4 file.
   1.946 +      MP4ParseSeek can be used to change the current position in the
   1.947 +      MP4 file.
   1.948 + 
   1.949 +If the function returns MP4_NOT_AVAILABLE, the caller needs to call
   1.950 +MP4ParseWriteData to insert more data before calling again.
   1.951 + 
   1.952 +audiosize is returned even if buffer was too small to contain the data.
   1.953 + 
   1.954 +Note: returnedframes may differ from the correct value when accessing
   1.955 +      the last audio sample.
   1.956 + 
   1.957 +Note: Specify NULL as timestamp2 if not interested in this parameter.
   1.958 + 
   1.959 +@param handle           MP4 library handle
   1.960 +@param buffer           Audio frames are returned here
   1.961 +@param buffersize       Size of the user allocated buffer (in bytes)
   1.962 +@param audiosize        Size of the returned audio frames (in bytes)
   1.963 +@param timestamp        Audio frame presentation time in milliseconds from the
   1.964 + 		                beginning of the audio sequence
   1.965 +@param returnedframes   Number of frames returned, or 0 if not known
   1.966 +@param timestamp2       Audio frame presentation time in timescale from the
   1.967 + 		                beginning of the audio sequence
   1.968 + 
   1.969 +@return		MP4_OK					  Success
   1.970 +			MP4_NOT_AVAILABLE         MP4 library needs more data before the requested
   1.971 +           				              frames can be returned
   1.972 +			MP4_BUFFER_TOO_SMALL      Requested frames don't fit into the given buffer
   1.973 +			MP4_ERROR                 Generic error
   1.974 +			MP4_INVALID_INPUT_STREAM  MP4 stream is invalid
   1.975 +			MP4_NO_FRAME              No more frames available
   1.976 +*/
   1.977 +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);
   1.978 +
   1.979 +/**
   1.980 +This function reads DecoderSpecificInfo data from MP4 metadata and
   1.981 +returns it to the caller.
   1.982 + 
   1.983 +decspecinfosize is set even if buffer is too small to contain the data.
   1.984 +The function can be called with buffersize 0 to query the size of
   1.985 +DecoderSpecificInfo.
   1.986 + 
   1.987 +Note: This function can be used for both MPEG-4 audio and AMR.
   1.988 + 
   1.989 +@param handle           MP4 library handle
   1.990 +@param buffer           DecoderSpecificInfo is returned here
   1.991 +@param buffersize       Size of the user allocated buffer (in bytes)
   1.992 +@param decspecinfosize  Size of DecoderSpecificInfo is returned here
   1.993 + 
   1.994 +@return		MP4_OK             Success
   1.995 +			MP4_NOT_AVAILABLE  MP4 library needs more data before the requested
   1.996 +                          		frames can be returned
   1.997 +			MP4_BUFFER_TOO_SMALL  Requested data doesn't fit into the given buffer
   1.998 +			MP4_ERROR          Generic error
   1.999 +			MP4_INVALID_INPUT_STREAM  MP4 stream is invalid
  1.1000 +*/
  1.1001 +extern IMPORT_C MP4Err MP4ParseReadAudioDecoderSpecificInfo(MP4Handle handle, mp4_u8 *buffer, mp4_u32 buffersize, mp4_u32 *decspecinfosize);
  1.1002 +
  1.1003 +/**
  1.1004 +Return the timestamp of the next video frame. This only works if the
  1.1005 +input MP4 data is in a file.
  1.1006 + 
  1.1007 +The function can be used to find out which frames have been coded to
  1.1008 +optimize the input frame selection if video frame rate needs to be
  1.1009 +modified.
  1.1010 + 
  1.1011 +When this function call returns MP4_END_OF_VIDEO, there are no more video
  1.1012 +frames left in the MP4 file and the timestamp returned with the previous
  1.1013 +call was the timestamp of the last video frame.
  1.1014 + 
  1.1015 +Note: User must call MP4ParseSeek() to seek to the correct position
  1.1016 +      after calls of this function. Otherwise the current position is
  1.1017 +      undetermined.
  1.1018 + 
  1.1019 +Note: Specify NULL as timestamp2 if this value is not needed.
  1.1020 + 
  1.1021 +@param handle      MP4 library handle
  1.1022 +@param timestamp   Timestamp in milliseconds is returned here
  1.1023 +@param timestamp2  Timestamp in timescale is returned here
  1.1024 + 
  1.1025 +@return		MP4_OK 		              Success
  1.1026 +			MP4_END_OF_VIDEO          No more video frames left
  1.1027 +			MP4_ERROR                 Generic error
  1.1028 +			MP4_NOT_AVAILABLE         MP4 library needs more data before the
  1.1029 +          				                requested information can be returned
  1.1030 +			MP4_INVALID_INPUT_STREAM  MP4 stream is invalid
  1.1031 +*/
  1.1032 +extern IMPORT_C MP4Err MP4ParseGetNextVideoTimestamp(MP4Handle handle, mp4_u32 *timestamp, mp4_u32 *timestamp2);
  1.1033 +
  1.1034 +/**
  1.1035 +This function determines whether the input MP4 stream is streamable,
  1.1036 +i.e. the media data is arranged in such a manner that playback can be
  1.1037 +started without downloading the entire stream.
  1.1038 + 
  1.1039 +@param handle   MP4 library handle
  1.1040 + 
  1.1041 +@return		MP4_OK                    The file is streamable
  1.1042 +			MP4_NOT_STREAMABLE        The file is not streamable
  1.1043 +			MP4_NOT_AVAILABLE         MP4 library needs more data before the requested
  1.1044 +        			                  information can be returned
  1.1045 +			MP4_ERROR                 Generic error
  1.1046 +			MP4_INVALID_INPUT_STREAM  MP4 stream is invalid
  1.1047 +*/
  1.1048 +extern IMPORT_C MP4Err MP4ParseIsStreamable(MP4Handle handle);
  1.1049 +
  1.1050 +/**
  1.1051 +This function seeks to the position specified by position parameter in
  1.1052 +the input MP4 file. The function can be called only if the input MP4 data
  1.1053 +is in a file and the file name has been specified with MP4ParseOpen
  1.1054 +function call.
  1.1055 + 
  1.1056 +The position is considered to be from the start of the presentation time
  1.1057 +line in the MP4 file. Thus audio and video positions can't be given
  1.1058 +separately.
  1.1059 + 
  1.1060 +The function will set current audio and video positions in the following
  1.1061 +manner:
  1.1062 + 
  1.1063 +If there is only audio in the file, the current position will be set to
  1.1064 +the audio frame at or just before the given position.
  1.1065 + 
  1.1066 +If there is only video in the file and keyframe is MP4FALSE, the current
  1.1067 +position will be set to the video frame at or just before the given
  1.1068 +position. If keyframe is set to MP4TRUE, the current position will be set
  1.1069 +to the first keyframe at or before current position.
  1.1070 + 
  1.1071 +If there are both audio and video in the file, video is first positioned
  1.1072 +as explained above and then audio is seeked to the closest position in
  1.1073 +relation to video.
  1.1074 + 
  1.1075 +@param handle          MP4 library handle
  1.1076 +@param position        Position to seek to in milliseconds in the MP4
  1.1077 +                	   presentation time line
  1.1078 +@param audioPosition   Position of audio after seek (in milliseconds)
  1.1079 +@param videoPosition   Position of video after seek (in milliseconds)
  1.1080 +@param keyframe        If set to MP4TRUE, the 1st video keyframe before given
  1.1081 +                	   point will be seeked to. If set to MP4FALSE, the first
  1.1082 +                	   video frame before given point will be seeked to.
  1.1083 + 
  1.1084 +@return		MP4_OK         Success
  1.1085 +			MP4_ERROR      Generic error
  1.1086 +			MP4_CANT_SEEK  Can't seek to requested position
  1.1087 + 
  1.1088 +*/
  1.1089 +extern IMPORT_C MP4Err MP4ParseSeek(MP4Handle handle, mp4_u32 position, mp4_u32 *audioPosition, mp4_u32 *videoPosition, mp4_bool keyframe);
  1.1090 +
  1.1091 +/**
  1.1092 +This function determines whether the next frame of type type is
  1.1093 +available.
  1.1094 + 
  1.1095 +The frame type can be one of the following:
  1.1096 + 
  1.1097 +MP4_TYPE_MPEG4_VIDEO
  1.1098 +MP4_TYPE_MPEG4_AUDIO
  1.1099 +MP4_TYPE_H263_PROFILE_0
  1.1100 +MP4_TYPE_H263_PROFILE_3
  1.1101 +MP4_TYPE_AMR_NB
  1.1102 +MP4_TYPE_AMR_WB
  1.1103 +MP4_TYPE_AVC_PROFILE_BASELINE 
  1.1104 +MP4_TYPE_AVC_PROFILE_MAIN
  1.1105 +MP4_TYPE_AVC_PROFILE_EXTENDED
  1.1106 +MP4_TYPE_AVC_PROFILE_HIGH
  1.1107 +MP4_TYPE_QCELP_13K
  1.1108 + 
  1.1109 +@param handle     MP4 library handle
  1.1110 +@param type       Type of the frame
  1.1111 + 
  1.1112 +@return		MP4_OK                    Frame is available
  1.1113 +			MP4_ERROR                 Generic error
  1.1114 +			MP4_NOT_AVAILABLE         MP4 library needs more data before the requested
  1.1115 +    			                      frames can be returned
  1.1116 +			MP4_NO_REQUESTED_FRAME    Frame of requested type is not available
  1.1117 +			MP4_INVALID_INPUT_STREAM  MP4 stream is invalid
  1.1118 +*/
  1.1119 +extern IMPORT_C MP4Err MP4ParseIsFrameAvailable(MP4Handle handle, mp4_u32 type);
  1.1120 +
  1.1121 +/**
  1.1122 +Return the largest position in a file that has been accessed or the latest accessed 
  1.1123 +absolute byte location of the stream.
  1.1124 + 
  1.1125 +Note: The function returns a valid position after one audio or video
  1.1126 +      sample has been read.
  1.1127 + 
  1.1128 +@param handle     MP4 library handle
  1.1129 +@param position   Result is returned here
  1.1130 + 
  1.1131 +@return		MP4_OK		Success 
  1.1132 +*/
  1.1133 +extern IMPORT_C MP4Err MP4ParseGetLastPosition(MP4Handle handle, mp4_u32 *position);
  1.1134 +
  1.1135 +/**
  1.1136 +Return the largest position in a file that has been accessed or the latest accessed 
  1.1137 +absolute byte location of the stream.
  1.1138 + 
  1.1139 +Note: The function returns a valid position after one audio or video
  1.1140 +      sample has been read.
  1.1141 + 
  1.1142 +@param handle     MP4 library handle
  1.1143 +@param position   Result is returned here
  1.1144 + 
  1.1145 +@return		MP4_OK		Success 
  1.1146 +*/
  1.1147 +extern IMPORT_C MP4Err MP4ParseGetLastPosition64(MP4Handle handle, mp4_u64 *position);
  1.1148 +
  1.1149 +/**
  1.1150 +Return the number of video frames.
  1.1151 + 
  1.1152 +@param handle			MP4 library handle
  1.1153 +@param numberOfFrames   Result is returned here
  1.1154 + 
  1.1155 +@return		MP4_OK		Success
  1.1156 +			MP4_ERROR	Generic error
  1.1157 +*/
  1.1158 +extern IMPORT_C MP4Err MP4ParseGetNumberOfVideoFrames(MP4Handle handle, mp4_u32 *numberOfFrames);
  1.1159 +
  1.1160 +/**
  1.1161 +Return video frame size.
  1.1162 + 
  1.1163 +@param handle           MP4 library handle
  1.1164 +@param index            Index of video frame
  1.1165 +@param frameSize        Result is returned here
  1.1166 + 
  1.1167 +@return		MP4_OK		Success
  1.1168 +			MP4_ERROR	Generic error
  1.1169 +*/
  1.1170 +extern IMPORT_C MP4Err MP4ParseGetVideoFrameSize(MP4Handle handle, mp4_u32 index, mp4_u32 *frameSize);
  1.1171 +
  1.1172 +/**
  1.1173 +Return video frame start time.
  1.1174 + 
  1.1175 +@param handle           MP4 library handle
  1.1176 +@param index            Index of video frame
  1.1177 +@param timestamp        Result is returned here
  1.1178 +@param timestampms      Result in milliseconds
  1.1179 + 
  1.1180 +@return		MP4_OK		Success
  1.1181 +			MP4_ERROR	Generic error
  1.1182 +*/
  1.1183 +extern IMPORT_C MP4Err MP4ParseGetVideoFrameStartTime(MP4Handle handle, mp4_u32 index, mp4_u32 *timestamp, mp4_u32 *timestampms);
  1.1184 +
  1.1185 +/**
  1.1186 +Return video frame type.
  1.1187 + 
  1.1188 +@param handle           MP4 library handle
  1.1189 +@param index            Index of video frame
  1.1190 +@param frametype        Result is returned here
  1.1191 + 
  1.1192 +@return		MP4_OK 		Success
  1.1193 +			MP4_ERROR	Generic error
  1.1194 +*/
  1.1195 +extern IMPORT_C MP4Err MP4ParseGetVideoFrameType(MP4Handle handle, mp4_u32 index, mp4_bool *frametype);
  1.1196 +
  1.1197 +/**
  1.1198 +Return the video sample entry index of the next video frame to be read.
  1.1199 + 
  1.1200 +The smallest index value is 1.
  1.1201 + 
  1.1202 +@param handle     MP4 library handle
  1.1203 +@param videosampleentryindex   Visual SampleEntry index of the next video frame to be read.
  1.1204 + 
  1.1205 +@return		MP4_OK		Success
  1.1206 +			MP4_ERROR	Generic error
  1.1207 +*/
  1.1208 +extern IMPORT_C MP4Err MP4ParseGetVideoSampleEntryIndex(MP4Handle handle, mp4_u32 *videosampleentryindex);
  1.1209 +
  1.1210 +/**
  1.1211 +Return the audio sample entry index of the next audio frame to be read.
  1.1212 + 
  1.1213 +The smallest index value is 1.
  1.1214 + 
  1.1215 +@param handle     MP4 library handle
  1.1216 +@param audiosampleentryindex   Visual SampleEntry index of the next audio frame to be read.
  1.1217 + 
  1.1218 +@return		MP4_OK		Success
  1.1219 +			MP4_ERROR	Generic error
  1.1220 +*/
  1.1221 +extern IMPORT_C MP4Err MP4ParseGetAudioSampleEntryIndex(MP4Handle handle, mp4_u32 *audiosampleentryindex);
  1.1222 +
  1.1223 +/**
  1.1224 + This function sets the storage mode of QCELP 13K
  1.1225 + qcelpStorageMode = 0  ...QCELP will be registered using QCELPSampleEntry Box (Default)
  1.1226 + qcelpStorageMode = 1  ...QCELP will be registered using MP4AudioDescription Box 
  1.1227 + 
  1.1228 + Note: This function needs to be called only when QCLEP 13K is used and when it is going to 
  1.1229 +       be stored registered using the MP4AudioDescription Box. 
  1.1230 + 
  1.1231 + @param handle         	   MP4 library handle
  1.1232 + @param qcelpStorageMode   Decoder configuration registration mode of QCELP 13K Codec
  1.1233 + 
  1.1234 + @return	MP4_OK		Success
  1.1235 + 			MP4_ERROR	Generic error
  1.1236 +*/
  1.1237 +extern IMPORT_C MP4Err MP4ComposeSetQCELPStorageMode(MP4Handle handle, mp4_u8 qcelpStorageMode);
  1.1238 +
  1.1239 +/**
  1.1240 +Return the decoder configuration registration mode of QCELP 13K Codec.
  1.1241 + 
  1.1242 + qcelpStorageMode = 0        QCELP is registered using QCELPSampleEntry Box (Default)
  1.1243 + qcelpStorageMode = 1        QCELP is registered using MP4AudioDescription Box
  1.1244 + 
  1.1245 +@param handle     MP4 library handle
  1.1246 +@param qcelpStorageMode   Decoder configuration registration mode of QCELP 13K Codec
  1.1247 + 
  1.1248 +@return		MP4_OK		Success
  1.1249 +			MP4_ERROR  	Generic error 
  1.1250 +*/
  1.1251 +extern IMPORT_C MP4Err MP4ParseGetQCELPStorageMode(MP4Handle handle, mp4_u8 *qcelpStorageMode);
  1.1252 +
  1.1253 +/**
  1.1254 +This function gets the frame infoparameters from star index to number of elements in array from that index,
  1.1255 +properties obtained are startTime, frameType and frameSize.  
  1.1256 + 
  1.1257 +Important Note:--- The number of elements allocated in the array should be equal to the sizeofarray
  1.1258 + 
  1.1259 + 
  1.1260 +@param apihandle     MP4 library handle
  1.1261 +@param startindex    Index from where to start getting information for the array
  1.1262 +@param sizeofarray   number of elements that exist in the allocated frame array
  1.1263 +@param aFrameInfoArray Array of Structures of frame parameters 
  1.1264 + 
  1.1265 +
  1.1266 +@return		MP4_OK             Success
  1.1267 +			MP4_ERROR          Generic error
  1.1268 +			MP4_NO_OUTPUT_BUFFER Output buffer pointer uninitialized
  1.1269 +*/
  1.1270 +extern IMPORT_C MP4Err MP4GetVideoFrameProperties(MP4Handle apihandle,mp4_u32 startindex,mp4_u32 sizeofarray,TFrameInfoParameters* aFrameInfoArray);
  1.1271 +
  1.1272 +/**
  1.1273 + This function sets properties of composed video clip.
  1.1274 + 	 
  1.1275 + Setup details in TVideoClipProperties struct:
  1.1276 + 
  1.1277 +       mp4_u32 iH263Level        level of H.263
  1.1278 + 
  1.1279 + @param apihandle              MP4 library handle
  1.1280 + @param aVideoClipProperties   Setup info struct.
  1.1281 + 
  1.1282 + @return	MP4_OK             Success
  1.1283 + 			MP4_ERROR          Generic error
  1.1284 +*/
  1.1285 +extern IMPORT_C MP4Err MP4ComposeSetVideoClipProperties(MP4Handle apihandle, const TVideoClipProperties& aVideoClipProperties);
  1.1286 +
  1.1287 +/**
  1.1288 +This function gets properties of parsed video clip.
  1.1289 +
  1.1290 +Returned details in TVideoClipProperties struct:
  1.1291 + 
  1.1292 +    mp4_u32 iH263Level        level of H.263
  1.1293 + 
  1.1294 +@param apihandle     		MP4 library handle
  1.1295 +@param aVideoClipProperties Filled info struct.
  1.1296 + 
  1.1297 +@return		MP4_OK             Success
  1.1298 +			MP4_ERROR          Generic error
  1.1299 +*/
  1.1300 +extern IMPORT_C MP4Err MP4ParseGetVideoClipProperties(MP4Handle apihandle, TVideoClipProperties& aVideoClipProperties);
  1.1301 +
  1.1302 +/**
  1.1303 +Retrieve an atom of given type from user data atom (UDTA) to the given buffer.
  1.1304 + 
  1.1305 +Note: on return parameters contain following information:
  1.1306 +	udtaLocation   Hash of all locations in file that contain UDTA atom.
  1.1307 +                   MP4_UDTA_NONE | MP4_UDTA_MOOV | MP4_UDTA_VIDEOTRAK | MP4_UDTA_AUDIOTRAK
  1.1308 +	buffer         Buffer containing asked atom.
  1.1309 +	bufferSize     Size of atom written in buffer. If buffer is too small for atom variable contains needed size.
  1.1310 +	atomIndex      Count of same subatom type in this UDTA. Starts from 0 (zero) index.
  1.1311 +
  1.1312 +@param handle         MP4 library handle
  1.1313 +@param udtaLocation   Location of UDTA atom inside file.
  1.1314 +@param udtaAtomType   Type of atom to be read from UDTA.
  1.1315 +   		                Hex value of 4 chars representing atom type defined in standard.
  1.1316 +       		            For example: 0x7469746c //'titl' - title for the media atom
  1.1317 +                                0x61757468 //'auth' - author of the media atom
  1.1318 +                                0x676e7265 //'gnre' - genre (category and style) of the media atom  
  1.1319 +@param buffer         Buffer to write atom to.
  1.1320 +@param bufferSize     Size of given buffer.
  1.1321 +@param atomIndex      Index of atom if UDTA contains multiple subatoms of same asked udtaAtomType.
  1.1322 + 
  1.1323 +@return		MP4_OK             			   Success
  1.1324 +			MP4_ERROR                      Generic error 
  1.1325 +			MP4_OUTPUT_BUFFER_TOO_SMALL    Buffer to write atom to is too small, required size in buffersize argument.
  1.1326 +			MP4_INVALID_TYPE               Asked udtaLocation is invalid.
  1.1327 +			MP4_NOT_AVAILABLE              UDTA or wanted subatom is not available in asked location.
  1.1328 +			MP4_CANT_SEEK                  Can't seek to UDTA atom location.
  1.1329 +*/
  1.1330 +extern IMPORT_C MP4Err MP4ParseGetUserDataAtom(MP4Handle handle, 
  1.1331 +                                                            mp4_u8& udtaLocation,
  1.1332 +                                                            mp4_u32 udtaAtomType,
  1.1333 +                                                            mp4_u8* buffer,
  1.1334 +                                                            mp4_u32& bufferSize,
  1.1335 +                                                            mp4_u32& atomIndex );
  1.1336 +
  1.1337 +/**
  1.1338 +Writes a buffer containing whole atom to inside of user data atom (UDTA) defined in udtaLocation.
  1.1339 + 
  1.1340 +@param apihandle      MP4 library handle
  1.1341 +@param udtaLocation   Location of UDTA atom inside file.
  1.1342 +                       MP4_UDTA_MOOV | MP4_UDTA_VIDEOTRAK | MP4_UDTA_AUDIOTRAK 
  1.1343 +@param buffer         Buffer to write atom from.
  1.1344 +@param bufferSize     Size of buffer.
  1.1345 + 
  1.1346 +@return		MP4_OK             			   Success
  1.1347 + 			MP4_ERROR                      Generic error 
  1.1348 + 			MP4_OUT_OF_MEMORY              Out of memory
  1.1349 + 			MP4_INVALID_TYPE               Asked udtaLocation is invalid.
  1.1350 +*/
  1.1351 +extern IMPORT_C MP4Err MP4ComposeSetUserDataAtom(MP4Handle apihandle, 
  1.1352 +                                                            mp4_u8& udtaLocation,
  1.1353 +                                                            mp4_u8* buffer,
  1.1354 +                                                            mp4_u32& bufferSize );     
  1.1355 +
  1.1356 +/**
  1.1357 +Sets internal buffer sizes to 3GPMP4Lib. Usage optional.
  1.1358 +Must be used after MP4ComposeSetFlags when composing.
  1.1359 + 
  1.1360 +Defaults for composing (with MP4_FLAG_LARGEFILEBUFFER): 
  1.1361 + 
  1.1362 +	mediaWriteBufferSize:       2048, (2*65536)
  1.1363 +	writeBufferMaxCount:        15
  1.1364 + 
  1.1365 +Default for parsing:
  1.1366 +	readBufferSize:             8k             
  1.1367 +                 
  1.1368 +@param apihandle			MP4 library handle
  1.1369 +@param mediaWriteBufferSize	Size of media data file output buffers (bytes).
  1.1370 + 							0 to use default internal value.
  1.1371 +@param writeBufferMaxCount	Max amount of buffers (both media and meta) before file output changes
  1.1372 +							to synchronous (by default file writing is asynchronous operation).
  1.1373 +	                        0 to use default internal value.
  1.1374 +	                        Min value 6.
  1.1375 +@param readBufferSize		Size of file read buffer. 0 to use default internal value.
  1.1376 + 
  1.1377 +@return		MP4_OK             Success
  1.1378 +			MP4_ERROR          Generic error
  1.1379 + 			MP4_OUT_OF_MEMORY  Out of Memory error 
  1.1380 +*/
  1.1381 +extern IMPORT_C MP4Err MP4SetCustomFileBufferSizes( MP4Handle apihandle, 
  1.1382 +                                                               mp4_u32 mediaWriteBufferSize,
  1.1383 +                                                               mp4_u32 writeBufferMaxCount,
  1.1384 +                                                               mp4_u32 readBufferSize );
  1.1385 +
  1.1386 +/**
  1.1387 +This function gets the next frame's dependency information from SDTP box.
  1.1388 + 
  1.1389 +Return values of each parameter can be the following:
  1.1390 +  aDependsOn:
  1.1391 +    0: the dependency of this sample is unknown;
  1.1392 +    1: this sample does depend on others (not an I picture);
  1.1393 +    2: this sample does not depend on others (I picture);
  1.1394 + 
  1.1395 +  aIsDependedOn:
  1.1396 +    0: the dependency of other samples on this sample is unknown;
  1.1397 +    1: other samples depend on this one (not disposable);
  1.1398 +    2: no other sample depends on this one (disposable);
  1.1399 + 
  1.1400 +  aHasRedundancy:
  1.1401 +    0: it is unknown whether there is redundant coding in this sample;
  1.1402 +    1: there is redundant coding in this sample;
  1.1403 +    2: there is no redundant coding in this sample;
  1.1404 + 
  1.1405 +@param apihandle       MP4 library handle
  1.1406 +@param aDependsOn      Defines whether current frame is I-frame (2), isn't I-frame (1) or if it only
  1.1407 + 		               can be found out by using MP4ParseReadVideoFrame()-method (0).
  1.1408 +@param aIsDependentOn  Defined the dependency of other frames on this one
  1.1409 +@param aHasRedundancy  Defined the existence of redundant coding in this frame
  1.1410 +
  1.1411 +@return		MP4_OK             Success
  1.1412 +			MP4_ERROR          Generic error
  1.1413 +			MP4_NOT_AVAILABLE  Metadata not available
  1.1414 +			MP4_INVALID_INPUT_STREAM Error in reading metadata
  1.1415 +			MP4_NO_OUTPUT_BUFFER Output buffer uninitialized	
  1.1416 +*/
  1.1417 +extern IMPORT_C MP4Err MP4ParseNextVideoFrameDependencies(MP4Handle apihandle, mp4_u8* aDependsOn, mp4_u8* aIsDependentOn, mp4_u8* aHasRedundancy);
  1.1418 +
  1.1419 +/**
  1.1420 +This function sets the next frame's dependency information to SDTP box.
  1.1421 + 
  1.1422 +NOTE: This function should be called before MP4ComposeWriteVideoFrame for each frame. Otherwise
  1.1423 +      default values are inserted for the missing frames (0 = unknown).
  1.1424 + 
  1.1425 +Possible values for each parameter are the following:
  1.1426 +    aDependsOn:
  1.1427 +       0: the dependency of this sample is unknown;
  1.1428 +       1: this sample does depend on others (not an I picture);
  1.1429 +       2: this sample does not depend on others (I picture);
  1.1430 +       3: reserved, DO NOT USE
  1.1431 +
  1.1432 +    aIsDependedOn:
  1.1433 +       0: the dependency of other samples on this sample is unknown;
  1.1434 +       1: other samples depend on this one (not disposable);
  1.1435 +       2: no other sample depends on this one (disposable);
  1.1436 +       3: reserved, DO NOT USE
  1.1437 +
  1.1438 +    aHasRedundancy:
  1.1439 +       0: it is unknown whether there is redundant coding in this sample;
  1.1440 +       1: there is redundant coding in this sample;
  1.1441 +       2: there is no redundant coding in this sample;
  1.1442 +       3: reserved, DO NOT USE
  1.1443 +
  1.1444 +@param apihandle		MP4 library handle
  1.1445 +@param aDependsOn		Defines whether current frame is I-frame (2), isn't I-frame (1) or if it only
  1.1446 +						can be found out by using MP4ParseReadVideoFrame()-method (0).
  1.1447 +@param aIsDependentOn	Defines the dependency of other frames on this one
  1.1448 +@param aHasRedundancy	Defines the existence of redundant coding in this frame
  1.1449 + 
  1.1450 +@return		MP4_OK             Success
  1.1451 +			MP4_ERROR          Generic error
  1.1452 +*/
  1.1453 +extern IMPORT_C MP4Err MP4ComposeWriteNextVideoFrameDependencies(MP4Handle apihandle, mp4_u8 aDependsOn, mp4_u8 aIsDependentOn, mp4_u8 aHasRedundancy);
  1.1454 +
  1.1455 +/**
  1.1456 +This function reads the audio frames asynchronously that are stored in the current
  1.1457 +audio sample from the MP4 file and returns them to the caller.
  1.1458 + 
  1.1459 +Note: Only one async parse audio or video frame(s) operation can be ongoing at any given time.
  1.1460 + 
  1.1461 +Note: Observer notification only comes if called function returns MP4_OK.
  1.1462 +If given buffer is too small MP4_BUFFER_TOO_SMALL is returned and buffersize contains needed
  1.1463 +size for audio frame.
  1.1464 + 
  1.1465 +When feeding in parsed clip as memory buffers if the function returns MP4_NOT_AVAILABLE, 
  1.1466 +the client needs to call MP4ParseWriteData to insert more data before calling this method again.
  1.1467 + 
  1.1468 +@param handle       MP4 library handle
  1.1469 +@param aObserver	Observer designed to receive notification of Asynchronous event completion
  1.1470 +@param buffer       Buffer that audio frames are written to.
  1.1471 +@param buffersize   Size of the user allocated buffer (in bytes). In MP4_BUFFER_TOO_SMALL error case contains
  1.1472 +	 				needed size for memory buffer.
  1.1473 + 
  1.1474 +@return		MP4_OK            		  Success
  1.1475 +			MP4_NOT_AVAILABLE         MP4 library needs more data before the requested
  1.1476 +									  frames can be returned
  1.1477 +			MP4_BUFFER_TOO_SMALL      Requested frames don't fit into the given buffer
  1.1478 +			MP4_ERROR                 Generic error
  1.1479 +			MP4_FILE_ERROR			  Async operation is not for buffer mode
  1.1480 +			MP4_INVALID_INPUT_STREAM  MP4 stream is invalid
  1.1481 +			MP4_NO_FRAME              No more frames available
  1.1482 +			MP4_OUT_OF_MEMORY		  Out of Memory.
  1.1483 +*/ 
  1.1484 +extern IMPORT_C MP4Err MP4ParseReadAudioFramesAsync(MP4Handle handle, M3GPMP4LibAsyncObserver* aObserver, mp4_u8 *buffer, mp4_u32* buffersize );
  1.1485 +
  1.1486 +/**
  1.1487 +This function reads the next video frame from the MP4 file and returns it to the caller.
  1.1488 + 
  1.1489 +Note: Only one async parse audio or video frame(s) operation can be ongoing at any given time.
  1.1490 + 
  1.1491 +Note: Observer notification only comes if called function returns MP4_OK.
  1.1492 +If given buffer is too small MP4_BUFFER_TOO_SMALL is returned and buffersize contains needed
  1.1493 +size for video frame.
  1.1494 + 
  1.1495 +When feeding in parsed clip as memory buffers if the function returns MP4_NOT_AVAILABLE, 
  1.1496 +the client needs to call MP4ParseWriteData to insert more data before calling this method again.
  1.1497 + 
  1.1498 +@param handle       MP4 library handle
  1.1499 +@param aObserver	Observer designed to receive notification of Asynchronous event completion
  1.1500 +@param buffer       Video frame is returned here
  1.1501 +@param buffersize   Size of the user allocated buffer (in bytes). In MP4_BUFFER_TOO_SMALL error case contains
  1.1502 +					needed size for memory buffer.
  1.1503 + 
  1.1504 +@return		MP4_OK             		  Success
  1.1505 +			MP4_NOT_AVAILABLE         MP4 library needs more data before the requested
  1.1506 +          				              frame can be returned
  1.1507 +			MP4_BUFFER_TOO_SMALL      Requested frame doesn't fit into the given buffer
  1.1508 +			MP4_NO_FRAME              Frame doesn't exist (previous frame was last)
  1.1509 +			MP4_ERROR                 Generic error
  1.1510 +			MP4_OUT_OF_MEMORY		  Out of Memory
  1.1511 +			MP4_INVALID_INPUT_STREAM  MP4 stream is invalid
  1.1512 +			MP4_FILE_ERROR			  Async operation is not for buffer mode			
  1.1513 +*/
  1.1514 +extern IMPORT_C MP4Err MP4ParseReadVideoFrameAsync(MP4Handle handle, M3GPMP4LibAsyncObserver* aObserver, mp4_u8* buffer, mp4_u32* buffersize );
  1.1515 +
  1.1516 +/**
  1.1517 +This function sets async temporary file deleting observer. Meta data temporary file removing can be done 
  1.1518 +on background to improve video recording stopping.
  1.1519 +
  1.1520 +@param handle       MP4 library handle
  1.1521 +@param aObserver    Temorary file deleting observer
  1.1522 + 
  1.1523 +@return		MP4_OK       Success
  1.1524 +			MP4_ERROR    Generic error
  1.1525 +*/
  1.1526 +
  1.1527 +extern IMPORT_C MP4Err MP4ComposeSetTempFileRemoverObserver(MP4Handle *handle, M3GPMP4LibAsyncTempFileRemoverObserver *aObserver);
  1.1528 +  
  1.1529 +/**
  1.1530 +This function cancels the outstanding asynchronous read audio/video frame request. 
  1.1531 +
  1.1532 +No callback function will be called.
  1.1533 +
  1.1534 +Note:  As only one asynchronous parse audio or video frame(s) operation can be ongoing at any given time, 
  1.1535 +this function can be used to cancel audio or video read request. If this is called without any outstanding 
  1.1536 +request, nothing happens.
  1.1537 +
  1.1538 +@param handle       MP4 library handle
  1.1539 +
  1.1540 +@see MP4ParseReadVideoFrameAsync 
  1.1541 +@see MP4ParseReadAudioFramesAsync
  1.1542 +*/
  1.1543 +extern IMPORT_C void MP4CancelReadFrame(MP4Handle handle);
  1.1544 +
  1.1545 +/**
  1.1546 +Fetches ID32 data location.
  1.1547 + *
  1.1548 + * Parameters:
  1.1549 + *
  1.1550 +@param handle         MP4 library handle
  1.1551 +@param location       Returns ID32 data location
  1.1552 +
  1.1553 +@return	MP4_OK                         Success
  1.1554 +		MP4_ERROR                      Generic error 
  1.1555 +		MP4_INVALID_INPUT_STREAM       MP4 stream is invalid
  1.1556 +		MP4_NOT_AVAILABLE              Metadata, META atom or ID32 atom is not available
  1.1557 + */
  1.1558 +extern IMPORT_C MP4Err MP4ParseGetID32Location(MP4Handle apihandle, mp4_u32& location);
  1.1559 +
  1.1560 +#ifdef __cplusplus
  1.1561 +}
  1.1562 +#endif
  1.1563 +
  1.1564 +
  1.1565 +#endif
  1.1566 +// End of File