/*
 *******************************************************************************
 *  Copyright (c) 2010-2022 VATICS(KNERON) Inc. All rights reserved.
 *
 *  +-----------------------------------------------------------------+
 *  | THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED |
 *  | AND COPIED IN ACCORDANCE WITH THE TERMS AND CONDITIONS OF SUCH  |
 *  | A LICENSE AND WITH THE INCLUSION OF THE THIS COPY RIGHT NOTICE. |
 *  | THIS SOFTWARE OR ANY OTHER COPIES OF THIS SOFTWARE MAY NOT BE   |
 *  | PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON. THE   |
 *  | OWNERSHIP AND TITLE OF THIS SOFTWARE IS NOT TRANSFERRED.        |
 *  |                                                                 |
 *  | THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT   |
 *  | ANY PRIOR NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY |
 *  | VATICS(KNERON) INC.                                             |
 *  +-----------------------------------------------------------------+
 *
 *******************************************************************************
 */
#ifndef _MP4CONTAINER_H_
#define _MP4CONTAINER_H_

typedef struct {
	char		*szMP4File;
	unsigned int	dwVideoTrackNum;
	unsigned char	*ptVideoTrackBufInfo[2];
	unsigned int	dwAudioTrackNum;
	unsigned char	*ptAudioTrackBufInfo[2];

	//Used by MP4v2
	unsigned int dwFPS;
	unsigned int dwDurationSec;
} MP4CreateOptions;

typedef struct MP4CHandle	MP4CHandle;

#ifdef __cplusplus
extern "C" {
#endif

MP4CHandle *MP4C_Init(void);
void MP4C_Release(MP4CHandle *ptHandle);
int MP4C_CreateFile(MP4CHandle *ptHandle, const MP4CreateOptions *ptOption, unsigned int iMp4Version);
int MP4C_AddSample(MP4CHandle *ptHandle, unsigned int iMp4Version, unsigned int dwTrackID, unsigned char *pucData, unsigned int uiDataLem, unsigned int uiSecs, unsigned int uiUSecs, unsigned int uiIsKeyFrame);
int MP4C_CloseFile(MP4CHandle *ptHandle, unsigned int iMp4Version);
int MP4C_CommitData(MP4CHandle *ptHandle, unsigned int iMp4Version);
int MP4C_FlushCache(MP4CHandle *ptHandle);
int MP4C_CloseFileWithDuration(MP4CHandle *ptHandle, unsigned int iMp4Version, unsigned int uiDuration);
#ifdef __cplusplus
}
#endif

#endif
