#ifndef __MP4_WRITER_H__
#define __MP4_WRITER_H__

#ifdef __cplusplus
extern "C" {
#endif

typedef enum tag_AF_MP4_VIDEO_ENC_TYPE
{
    AF_MP4_VIDEO_H264 = 0,
    AF_MP4_VIDEO_H265,
}AF_MP4_VIDEO_ENC_TYPE;

typedef unsigned long AFMP4Handle;

#define AF_MP4_INVALID_HANDLE ((AFMP4Handle)0)

AFMP4Handle MP4WriterInit();
int MP4WriterExit(AFMP4Handle hMP4File);

int MP4WriterCreateFile(AFMP4Handle hMP4File, char *strName, AF_MP4_VIDEO_ENC_TYPE nEncType, int nWidth, int nHeight, int nFps);
int MP4WriterSaveFile(AFMP4Handle hMP4File);

int MP4WriterWriteFile(AFMP4Handle hMP4File, unsigned char *pData, int nSize, bool bKey, long nTimeStamp);
int MP4InitAudioAAC(AFMP4Handle hMP4File,  unsigned char AudioType, unsigned int SampleRate, unsigned char Channel, unsigned long TimeScale);
int MP4WriteAACSample(AFMP4Handle hMP4File, unsigned char *pData, unsigned int Size, unsigned long TimeStamp);
int MP4WriterWriteAudioFile(AFMP4Handle hMP4File, unsigned char *pData, int nSize, long nTimeStamp, int nSampleRate, int nChannel, int nBitsPerSample);

#ifdef __cplusplus
}
#endif

#endif
