#ifndef AEEMPUTIL_H
#define AEEMPUTIL_H

/*============================================================================
FILE: AEEMpUtil.h

SERVICES:  BREW Interactive Multimedia Player Services

DESCRIPTION:
   This file defines an abstract interface for BREW Interactive Multimedia Player.

PUBLIC CLASSES:  Not Applicable

INITIALIZATION AND SEQUENCING REQUIREMENTS:  Not Applicable

============================================================================*/
/*===============================================================================
    INCLUDES AND VARIABLE DEFINITIONS
===============================================================================*/
/*-------------------------------------------------------------------
      Include Files
-------------------------------------------------------------------*/
#include "AEE.h"
#include "IDataFolder.h"

/*-------------------------------------------------------------------
      Defines
-------------------------------------------------------------------*/

/*-------------------------------------------------------------------
      Type Declarations
-------------------------------------------------------------------*/
// Define interface pointers
typedef struct _IMPUtil    IMPUtil;

//===============================================================================
// FUNCTION DECLARATIONS and INLINE FUNCTION DEFINITIONS
//===============================================================================


#define AEE_MPUTIL_CMD_BASE             1
#define AEE_MPUTIL_CMD_USER_BASE        0x100

#define AEE_MPUTIL_CMD_SELECTDATA       (AEE_MPUTIL_CMD_BASE + 1)
#define AEE_MPUTIL_CMD_GETDATA          (AEE_MPUTIL_CMD_BASE + 2)
#define AEE_MPUTIL_CMD_UPDATEDATA       (AEE_MPUTIL_CMD_BASE + 3)
#define AEE_MPUTIL_CMD_DELETEDATA       (AEE_MPUTIL_CMD_BASE + 4)
#define AEE_MPUTIL_CMD_SEARCHDATA       (AEE_MPUTIL_CMD_BASE + 5)
#define AEE_MPUTIL_CMD_SEARCHPLDATA     (AEE_MPUTIL_CMD_BASE + 6)
#define AEE_MPUTIL_CMD_SEEKDATA         (AEE_MPUTIL_CMD_BASE + 7)
#define AEE_MPUTIL_CMD_SEARCHLABELDATA  (AEE_MPUTIL_CMD_BASE + 8)
#define AEE_MPUTIL_CMD_DECODEDATA       (AEE_MPUTIL_CMD_BASE + 9)
#define AEE_MPUTIL_CMD_SETPLAYLISTDATA  (AEE_MPUTIL_CMD_BASE + 10)
#define AEE_MPUTIL_CMD_MATCH_MMID       (AEE_MPUTIL_CMD_BASE + 11)
#define AEE_MPUTIL_CMD_OUTSIDEMEMORY    (AEE_MPUTIL_CMD_BASE + 12)


#define AEE_MPUTIL_STATUS_BASE          1
#define AEE_MPUTIL_STATUS_USER_BASE     0x100

#define AEE_MPUTIL_STATUS_DONE          (AEE_MPUTIL_STATUS_BASE + 1)
#define AEE_MPUTIL_STATUS_ERROR         (AEE_MPUTIL_STATUS_BASE + 2)
#define AEE_MPUTIL_STATUS_NOENTRY        (AEE_MPUTIL_STATUS_BASE + 3)


enum{
    AEE_MPUTIL_LIST_ARTIST = 0,
    AEE_MPUTIL_LIST_ALBUM,
    AEE_MPUTIL_LIST_SONGS,
    AEE_MPUTIL_LIST_TOPCOUNT,
    AEE_MPUTIL_LIST_TOPRATE,
    AEE_MPUTIL_LIST_RECENT
// PTX808IMP_MSA add 2006.1.12 ooshima if1
   ,AEE_MPUTIL_LIST_MSA = 16,
    AEE_MPUTIL_LIST_MSAGROUP,
    AEE_MPUTIL_LIST_ALLDATA
// PTX808IMP_MSA add 2006.1.12 ooshima endif

    /* SEMC API拡張用 PTX805 051115[S]
       IMPUTIL_SelectDataで使用可能 */
   ,AEE_MPUTIL_LIST_ARTIST_NUM,
    AEE_MPUTIL_LIST_ALBUM_NUM
    /* SEMC API拡張用 PTX805 051115[E] */
};


#define AEE_MPUTIL_DATA_INFO            0
#define AEE_MPUTIL_DATA_IMAGE           (AEE_MPUTIL_DATA_INFO + 1)


#define AEE_MPUTIL_SEEK_CURRENT         0
#define AEE_MPUTIL_SEEK_START           (AEE_MPUTIL_SEEK_CURRENT  + 1)
#define AEE_MPUTIL_SEEK_END             (AEE_MPUTIL_SEEK_CURRENT  + 2)


enum {
    AEE_MPUTIL_IMAGE_JPG = 0,
    AEE_MPUTIL_IMAGE_PNG,
    AEE_MPUTIL_IMAGE_GIF
};


enum {
    AEE_MPUTIL_UPDATE_RATE = 0,
    AEE_MPUTIL_UPDATE_PLAY_COUNT
};


enum {
    AEE_MPUTIL_PLAYLIST_USER = 0,
    AEE_MPUTIL_PLAYLIST_DOWNLOAD
};


enum {
    AEE_MPUTIL_IMAGE_JACKET = 0,
    AEE_MPUTIL_IMAGE_LYRICS,
    AEE_MPUTIL_IMAGE_WALLPAPER
};


enum{
    AEE_MPUTIL_LANG_JPN = 0,
    AEE_MPUTIL_LANG_ENG
};


enum{
    AEE_MPUTIL_OUTSIDEMEMORY_UMOUNT = 0
};


enum{
    AEE_MPUTIL_ALLMEMORY = 0,
    AEE_MPUTIL_INSIDEMEMORY,
    AEE_MPUTIL_OUTSIDEMEMORY
};


#define AEE_MPUTIL_TITLE_NAME_SIZE_MAX       257
#define AEE_MPUTIL_ALBUM_NAME_SIZE_MAX       257
#define AEE_MPUTIL_ARTIST_NAME_SIZE_MAX      257
#define AEE_MPUTIL_RIGHT_PERSON_SIZE_MAX     201
#define AEE_MPUTIL_SALE_ORIGIN_SIZE_MAX      201
#define AEE_MPUTIL_PLNAME_SIZE_MAX           257
#define AEE_MPUTIL_MMID_SIZE_MAX             16
#define AEE_MPUTIL_FILENAME_SIZE_MAX         256


enum {
    AEE_MPUTIL_KIND_KMF = 0,
    AEE_MPUTIL_KIND_RIP,
    AEE_MPUTIL_KIND_EMD
// PTX808IMP_MSA add 2006.1.12 ooshima if1
   ,AEE_MPUTIL_KIND_MSA = 16
// PTX808IMP_MSA add 2006.1.12 ooshima endif

};


enum {
    AEE_MPUTIL_SUCCESS = 0,
    AEE_MPUTIL_FAILED,
    AEE_MPUTIL_BADPARM
};


typedef struct _AEEMPUtilDataInfo {
    char    TitleName[AEE_MPUTIL_TITLE_NAME_SIZE_MAX];
    char    AlbumName[AEE_MPUTIL_ALBUM_NAME_SIZE_MAX];
    char    ArtistName[AEE_MPUTIL_ARTIST_NAME_SIZE_MAX];
    int     nPlayTime;
    int     nJacketImageCount;
    int     nlyricsImageCount;
    int     nPlayCount;
    int     nRate;
    int32   nPlayLastTime;
    boolean bRegister;
    unsigned char  ucTrackNum;
    unsigned char  ucAllTrackCount;
    char    cRightPerson[AEE_MPUTIL_RIGHT_PERSON_SIZE_MAX];
    char    cSaleOrigin[AEE_MPUTIL_SALE_ORIGIN_SIZE_MAX];
    char    cMmid[AEE_MPUTIL_MMID_SIZE_MAX];
    KDDIDFDEVICE dev;
    char    szFileName[AEE_MPUTIL_FILENAME_SIZE_MAX];
    int     nWallPaperImageCount;
    int     nDataKind;
    char    cInitial;
} AEEMPUtilDataInfo;


typedef struct _AEEMPUtilImageInfo {
    int nImageID;
    int nImageNum;
} AEEMPUtilImageInfo;


typedef struct _AEEMPUtilSeekInfo {
    int    nPosition;
    int32  nSeekData;
} AEEMPUtilSeekInfo;


typedef struct _AEEMPUtilDecodeDataInfo {
    AEECLSID     clsData;
    int32        dwType;
    void       * pSrc;
    int32        dwSrcSize;
    int32        dwWidth;
    int32        dwHeight;
    const char * pDstFileName;
    int32      * pdwDstSize;
    int32      * pdwx2;
    int32      * pdwy2;
} AEEMPUtilDecodeDataInfo;


typedef struct _AEEMPUtilPlayListInfo {
    char ListName[AEE_MPUTIL_PLNAME_SIZE_MAX];
    int  nListID;
    int  nDataSize;
    KDDIDFDEVICE dev;
    char szFileName[AEE_MPUTIL_FILENAME_SIZE_MAX];
} AEEMPUtilPlayListInfo;


typedef struct _AEEMPUtilPlayList {
    char *  pcMMID;
    int     nMMIDSize;
    boolean bExist;
} AEEMPUtilPlayList;


typedef struct _AEEMPUtilPlayOrder {
    int * pnOrder;
    int   nCount;
} AEEMPUtilPlayOrder;


typedef struct _AEEMPUtilMMID {
    char * pucMmid; 
    int    nMmidSize;
} AEEMPUtilMMID;


typedef struct _AEEMPUtilMatchMMID {
    char   ucMmid[AEE_MPUTIL_MMID_SIZE_MAX]; 
    int    nResult;
} AEEMPUtilMatchMMID;


typedef struct _AEEMPUtilCmdNotify {
    IMPUtil *          pIMPUtil;           /* Pointer to IMPUTIL */
    int                nCmd;               /* Command code */
    int                nSubCmd;            /* Sub command code, if any or 0 */
    int                nStatus;            /* Status code */
    void *             pCmdData;           /* Contains one of the values listed above */
    uint32             dwSize;             /* Size of pCmdData */
} AEEMPUtilCmdNotify;


typedef void (*PFNMPUTILNOTIFY)( void * pUser, AEEMPUtilCmdNotify * pCmdNotify );

//PTX808_IMP_MSA add 2006.1.19 toida MSAグループ情報 if1
#define AEE_MPUTIL_GROUP_NAME_SIZE_MAX 257
typedef struct{
    char               name[AEE_MPUTIL_GROUP_NAME_SIZE_MAX];
    unsigned short     numOfTrack;
    unsigned int       totalTime;
} AEEMPUTILGroupInfo;
//PTX808_IMP_MSA add 2006.1.19 toida MSAグループ情報 endif

// IMPUtil Initialization.
extern void IMPUtil_Init (IShell * ps);
// Constructor and destructor
extern int  IMPUtil_New  (IShell * ps, AEECLSID cls, void ** ppif);

//-------------------------------------------------------------------
// Interface Definitions - C Style
//-------------------------------------------------------------------
/*===========================================================================

                      IEXTDISPUTIL INTERFACE

===========================================================================*/
#define INHERIT_IMPUtil(iname) \
   INHERIT_IBase(iname);\
   \
   int               (*RegisterNotify)(iname * po, PFNMPUTILNOTIFY pfnNotify, void * pUser);\
   int               (*SelectData)(iname * po, int nSelectID, char * pcData, int * pnDataCount);\
   int               (*GetListCount)(iname * po, int nListID, int * pnListCount);\
   int               (*GetListData)(iname * po, int nListID, int32 * pP1, int32 * pP2);\
   int               (*GetData)(iname * po, int nDataID, int32 * pP1, int32 * pP2);\
   int               (*SeekData)(iname * po, AEEMPUtilSeekInfo * pSeekInfo);\
   int               (*UpdateData)(iname * po, int nParamID, int nSetData);\
   int               (*GetDecodeData)(iname * po, AEEMPUtilDecodeDataInfo * pDecodeDataInfo);\
   int               (*DeleteData)(iname * po);\
   int               (*SearchData)(iname * po, AEEMPUtilMMID * pMmid, boolean * pbExist);\
   int               (*SearchPlayListData)(iname * po, AEEMPUtilPlayList * pPlayList, int nListCount);\
   int               (*GetPlayListCount)(iname * po, int * pnPlayListCount);\
   int               (*GetPlayListInfo)(iname * po, int nPlayListNum, AEEMPUtilPlayListInfo * pPlayListInfo);\
   int               (*SetPlayListData)(iname * po, int nPlayListNum, char * pData, uint32 dwDataSize, char * pcFileName);\
   int               (*GetPlayListData)(iname * po, int nPlayListNum, char * pData);\
   int               (*SetPlayOrder)(iname * po, AEEMPUtilPlayOrder * pOrder);\
   int               (*GetLabelCount)(iname * po, int nListID, int nLanguageID, int * pnListCount);\
   int               (*GetLabelData)(iname * po, int nLabelNum, char * pcData);\
   int               (*SearchLabelData)(iname * po, char * pcData, int32 * pnSeekData);\
   int               (*GetSpace)(iname * po, int32 nPlayListNum, uint32 * pdwSize, uint32 * pdwFileCount);\
   int               (*DeletePlayListData)(iname * po, int nPlayListNum);\
   int               (*GetMemoryType)(iname * po, int * pMemoryType);\
   int               (*GetGroupInfo)(iname * po, int nGroupNum, AEEMPUTILGroupInfo * pGroupInfo ) //PTX808_IMP_MSA add 2006.1.19 toida MSAグループ情報

QINTERFACE(IMPUtil)
{
   INHERIT_IMPUtil(IMPUtil);
};

#define IMPUTIL_AddRef(p)                          GET_PVTBL(p, IMPUtil)->AddRef(p)
#define IMPUTIL_Release(p)                         GET_PVTBL(p, IMPUtil)->Release(p)
#define IMPUTIL_RegisterNotify(p, f, pd)           GET_PVTBL(p, IMPUtil)->RegisterNotify(p, f, pd)
#define IMPUTIL_SelectData(p, n, pd, pc)           GET_PVTBL(p, IMPUtil)->SelectData(p, n, pd, pc)
#define IMPUTIL_GetListCount(p, n, pn)             GET_PVTBL(p, IMPUtil)->GetListCount(p, n, pn)
#define IMPUTIL_GetListData(p, n, pw1, pw2)        GET_PVTBL(p, IMPUtil)->GetListData(p, n, pw1, pw2)
#define IMPUTIL_GetData(p, n, pw1, pw2)            GET_PVTBL(p, IMPUtil)->GetData(p, n, pw1, pw2)
#define IMPUTIL_SeekData(p, ps)                    GET_PVTBL(p, IMPUtil)->SeekData(p, ps)
#define IMPUTIL_UpdateData(p, n, nd)               GET_PVTBL(p, IMPUtil)->UpdateData(p, n, nd)
#define IMPUTIL_GetDecodeData(p, d)                GET_PVTBL(p, IMPUtil)->GetDecodeData(p, d)
#define IMPUTIL_DeleteData(p)                      GET_PVTBL(p, IMPUtil)->DeleteData(p)
#define IMPUTIL_SearchData(p, pm, pb)              GET_PVTBL(p, IMPUtil)->SearchData(p, pm, pb)
#define IMPUTIL_SearchPlayListData(p, pl, n)       GET_PVTBL(p, IMPUtil)->SearchPlayListData(p, pl, n)
#define IMPUTIL_GetPlayListCount(p, pn)            GET_PVTBL(p, IMPUtil)->GetPlayListCount(p, pn)
#define IMPUTIL_GetPlayListInfo(p, n, pl)          GET_PVTBL(p, IMPUtil)->GetPlayListInfo(p, n, pl)
#define IMPUTIL_SetPlayListData(p, n, pc, w, pf)   GET_PVTBL(p, IMPUtil)->SetPlayListData(p, n, pc, w, pf)
#define IMPUTIL_GetPlayListData(p, n, pc)          GET_PVTBL(p, IMPUtil)->GetPlayListData(p, n, pc)
#define IMPUTIL_SetPlayOrder(p, po)                GET_PVTBL(p, IMPUtil)->SetPlayOrder(p, po)
#define IMPUTIL_GetLabelCount(p, n, l, pn)         GET_PVTBL(p, IMPUtil)->GetLabelCount(p, n, l, pn)
#define IMPUTIL_GetLabelData(p, n, pc)             GET_PVTBL(p, IMPUtil)->GetLabelData(p, n, pc)
#define IMPUTIL_SearchLabelData(p, pc, pw)         GET_PVTBL(p, IMPUtil)->SearchLabelData(p, pc, pw)
#define IMPUTIL_GetSpace(p, n, pw, pwf)            GET_PVTBL(p, IMPUtil)->GetSpace(p, n, pw, pwf)
#define IMPUTIL_DeletePlayListData(p, n)           GET_PVTBL(p, IMPUtil)->DeletePlayListData(p, n)
#define IMPUTIL_GetMemoryType(p, pm)               GET_PVTBL(p, IMPUtil)->GetMemoryType(p,pm)
//PTX808_IMP_MSA add 2006.1.19 toida MSAグループ情報 if1
#define IMPUTIL_GetGroupInfo(p, n, pn )               GET_PVTBL(p, IMPUtil)->GetGroupInfo(p,n,pn)
//int IMPUTIL_GetGroupInfo( IMPUtil * po, int nGroupNum, AEEMPUTILGroupInfo * pGroupInfo );
//PTX808_IMP_MSA add 2006.1.19 toida MSAグループ情報 endif


// Commonly used API to set/get IMPUTIL parm
#define IMPUTIL_GetArtistCount(p, pn)              IMPUTIL_GetListCount(p, AEE_MPUTIL_LIST_ARTIST, pn)
#define IMPUTIL_GetAlbumCount(p, pn)               IMPUTIL_GetListCount(p, AEE_MPUTIL_LIST_ALBUM, pn)

#define IMPUTIL_GetArtistData(p,n,d)               IMPUTIL_GetListData(p, AEE_MPUTIL_LIST_ARTIST, (int32 *)n, (int32 *)d )
#define IMPUTIL_GetAlbumData(p,n,d)                IMPUTIL_GetListData(p, AEE_MPUTIL_LIST_ALBUM, (int32 *)n, (int32 *)d )

#define IMPUTIL_GetDataInfo(p,pw)                  IMPUTIL_GetData(p,AEE_MPUTIL_DATA_INFO,(int32 *)pw, 0)
#define IMPUTIL_GetImageData(p,pw1,pw2)            IMPUTIL_GetData(p,AEE_MPUTIL_DATA_IMAGE,(int32 *)pw1, (int32 *)pw2)



#endif // AEEMPUTIL_H
