#ifndef __SCEMPEG_H__
#define __SCEMPEG_H__

typedef void SceVoid;
typedef SceVoid SceMpegStream;
typedef void * ScePVoid;
typedef ScePVoid SceMpeg;
typedef SceInt32 (* sceMpegRingbufferCB)(ScePVoid pData, SceInt32 iNumPackets, ScePVoid pParam);
typedef SceInt32 SceMpegAuMode;

typedef struct SceMpegAu
{
	SceUInt32 iUnk0;
	SceInt32 iTimestamp;
	SceUInt32 iUnk1;
	SceUInt32 iUnk2;
	SceUInt32 iUnk3;
	SceUInt32 iUnk4;
} SceMpegAu;

typedef struct SceMpegRingbuffer
{
	SceInt32 iPackets;
	SceUInt32 iUnk0;
	SceUInt32 iUnk1;
	SceUInt32 iUnk2;
	SceUInt32 iUnk3;
	ScePVoid pData;
	sceMpegRingbufferCB Callback;
	ScePVoid pCBparam;
	SceUInt32 iUnk4;
	SceUInt32 iUnk5;
	SceMpeg pSceMpeg;
} SceMpegRingbuffer;

typedef struct SceMpegAvcMode
{
	SceInt32 iUnk0;
	SceInt32 iPixelFormat;
} SceMpegAvcMode;

typedef struct SceMpegAvcDecodeDetailInfo
{
	SceInt32	iDecodeResult;
	SceUInt32	uiRecoveryPoint;

	SceUInt32	uiHorizontalSize;
	SceUInt32	uiVerticalSize;
	SceUInt32	uiFrameCropLeftOffset;
	SceUInt32	uiFrameCropRightOffset;
	SceUInt32	uiFrameCropTopOffset;
	SceUInt32	uiFrameCropBottomOffset;
	SceUInt32	uiDisplayFrameNum;

} SceMpegAvcDecodeDetailInfo;

typedef struct SceMpegLLI
{
	ScePVoid 	pSrc;
	ScePVoid 	pDst;
	ScePVoid	Next;
	SceInt32	iSize;
} SceMpegLLI;

typedef struct {
   SceInt32 height;
   SceInt32 width;
   SceInt32 mode0;
   SceInt32 mode1;
   ScePVoid buffer0;
   ScePVoid buffer1;
   ScePVoid buffer2;
   ScePVoid buffer3;
   ScePVoid buffer4;
   ScePVoid buffer5;
   ScePVoid buffer6;
   ScePVoid buffer7;
} AvcCscStruct;

SceInt32 (* sceMpegAtracDecode) (SceMpeg *Mpeg, SceMpegAu *pAu, ScePVoid pBuffer, SceInt32 iInit) = (void *) (BASE_OFFSET + 0xe6f78);
SceInt32 (* sceMpegAvcDecode) (SceMpeg *Mpeg, SceMpegAu *pAu, SceInt32 iFrameWidth, ScePVoid pBuffer, SceInt32 *iInit) = (void *) (BASE_OFFSET + 0xe6f60);
SceInt32 (* sceMpegAvcDecodeDetail) (SceMpeg *mp, SceMpegAvcDecodeDetailInfo *pDetail) = (void *) 0x09ebd870;
SceInt32 (* sceMpegAvcDecodeMode) (SceMpeg *Mpeg, SceMpegAvcMode *pMode) = (void *) (BASE_OFFSET + 0xe6f68);
SceInt32 (* sceMpegAvcDecodeStop) (SceMpeg *Mpeg, SceInt32 iFrameWidth, ScePVoid pBuffer, SceInt32 *iStatus) = (void *) (BASE_OFFSET + 0xe6f70);
// (* sceMpegbase_0530BE4E) (__) = (void *) 0x09ebd600;
SceInt32 (* sceMpegbase_BEA18F91) (SceMpegLLI *pLLI) = (void *) 0x09ebd5f0;
int (* sceMpegBaseCscAvc) (unsigned char unk0, int unk1, AvcCscStruct* unk2) = (void *) 0x09ebd608;
SceInt32 (* sceMpegBaseCscInit) (SceInt32 width) = (void *) 0x09ebd5f8;
SceInt32 (* sceMpegChangeGetAuMode) (SceMpeg *mp, SceMpegStream *pStream, SceMpegAuMode iAuMode) = (void *) 0x09ebd854;
// (* sceMpegChangeGetAvcAuMode) (__) = (void *) 0x09ebd850;
SceInt32 (* sceMpegCreate) (SceMpeg *Mpeg, ScePVoid pData, SceInt32 iSize, SceMpegRingbuffer *Ringbuffer, SceInt32 iFrameWidth, SceInt32 iUnk1, SceInt32 iUnk2) = (void *) (BASE_OFFSET + 0xe6f08);
SceVoid (* sceMpegDelete) (SceMpeg *Mpeg) = (void *) (BASE_OFFSET + 0xe6f10);
SceInt32 (* sceMpegFinish) (void) = (void *) (BASE_OFFSET + 0xe6ef8);
SceInt32 (* sceMpegFlushAllStream) (SceMpeg *Mpeg) = (void *) (BASE_OFFSET + 0xe6f58);
SceInt32 (* sceMpegFlushStream) (SceMpeg *mp, SceMpegStream *pStream) = (void *) 0x09ebd864;
SceVoid (* sceMpegFreeAvcEsBuf) (SceMpeg *Mpeg, ScePVoid pBuf) = (void *) (BASE_OFFSET + 0xe6f30);
SceInt32 (* sceMpegGetAtracAu) (SceMpeg *Mpeg, SceMpegStream *pStream, SceMpegAu *pAu, ScePVoid pUnk) = (void *) (BASE_OFFSET + 0xe6f50);
SceInt32 (* sceMpegGetAvcAu) (SceMpeg *Mpeg, SceMpegStream *pStream, SceMpegAu *pAu, SceInt32 *iUnk) = (void *) (BASE_OFFSET + 0xe6f48);
SceInt32 (* sceMpegGetPcmAu) (SceMpeg *mp, SceMpegStream *pStream, SceMpegAu *pAu, SceInt32 *iAttr) = (void *) 0x09ebd85c;
SceInt32 (* sceMpegInit) (void) = (void *) (BASE_OFFSET + 0xe6ef0);
SceInt32 (* sceMpegInitAu) (SceMpeg *Mpeg, ScePVoid pEsBuffer, SceMpegAu *pAu) = (void *) (BASE_OFFSET + 0xe6f40);
ScePVoid (* sceMpegMallocAvcEsBuf) (SceMpeg *Mpeg) = (void *) (BASE_OFFSET + 0xe6f28);
SceInt32 (* sceMpegQueryAtracEsSize) (SceMpeg *Mpeg, SceInt32 *iEsSize, SceInt32 *iOutSize) = (void *) (BASE_OFFSET + 0xe6f38);
SceInt32 (* sceMpegQueryMemSize) (int iUnk) = (void *) (BASE_OFFSET + 0xe6f00);
SceInt32 (* sceMpegQueryPcmEsSize) (SceMpeg *mp, SceInt32 *iEsSize, SceInt32 *iOutSize) = (void *) 0x09ebd848;
SceInt32 (* sceMpegQueryStreamOffset) (SceMpeg *Mpeg, ScePVoid pBuffer, SceInt32 *iOffset) = (void *) (BASE_OFFSET + 0xe6ee0);
SceInt32 (* sceMpegQueryStreamSize) (ScePVoid pBuffer, SceInt32 *iSize) = (void *) (BASE_OFFSET + 0xe6ee8);
SceMpegStream (* sceMpegRegistStream) (SceMpeg *Mpeg, SceInt32 iStreamID, SceInt32 iUnk) = (void *) (BASE_OFFSET + 0xe6f18);
SceInt32 (* sceMpegRingbufferAvailableSize) (SceMpegRingbuffer *Ringbuffer) = (void *) (BASE_OFFSET + 0xe6fa0);
SceInt32 (* sceMpegRingbufferConstruct) (SceMpegRingbuffer *Ringbuffer, SceInt32 iPackets, ScePVoid pData, SceInt32 iSize, sceMpegRingbufferCB Callback, ScePVoid pCBparam) = (void *) (BASE_OFFSET + 0xe6f88);
SceVoid (* sceMpegRingbufferDestruct) (SceMpegRingbuffer *Ringbuffer) = (void *) (BASE_OFFSET + 0xe6f90);
SceInt32 (* sceMpegRingbufferPut) (SceMpegRingbuffer *Ringbuffer, SceInt32 iNumPackets, SceInt32 iAvailable) = (void *) (BASE_OFFSET + 0xe6f98);
SceInt32 (* sceMpegRingbufferQueryMemSize) (SceInt32 iPackets) = (void *) (BASE_OFFSET + 0xe6f80);
SceVoid (* sceMpegUnRegistStream) (SceMpeg Mpeg, SceMpegStream *pStream) = (void *) (BASE_OFFSET + 0xe6f20);

#endif
