1 /*---------------------------------------------------------------------------* 2 Project: THP demo 3 File: THPPlayer.h 4 5 Copyright (C)2002-2006 Nintendo All Rights Reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Log: THPPlayer.h,v $ 14 Revision 1.2 2008/02/28 06:57:48 aka 15 Added THPPlayerGetSoundMode() 16 Added THPPlayerSetSoundMode(). 17 Added a member soundMode in THPPlayer structure. 18 19 Revision 1.1 2006/02/03 10:00:34 aka 20 Imported from Dolphin tree. 21 22 23 4 03/09/16 15:35 Suzuki 24 removed DECODE_BUFFER_NUM definition. 25 added DECODE_VIDEO_BUFFER_NUM and DECODE_AUDIO_BUFFER_NUM definition. 26 27 3 02/05/14 9:20a Suzuki 28 Supported multi audio track 29 30 2 02/02/28 6:33p Akagi 31 enabled to use with MusyX/AX by Suzuki-san (IRD). 32 33 1 02/01/16 11:03a Akagi 34 Initial revision made by Suzuki-san (IRD). 35 36 $NoKeywords: $ 37 38 *---------------------------------------------------------------------------*/ 39 40 #ifndef __THPPLAYER_H__ 41 #define __THPPLAYER_H__ 42 43 #include <revolution.h> 44 #include <revolution/thp.h> 45 #include <revolution/thpfile.h> 46 #include "THPPlayerCommon.h" 47 48 #ifdef __cplusplus 49 extern "C" { 50 #endif 51 52 #define NTSC_RATE (5994) 53 #define PAL_RATE (5000) 54 55 #define READ_THREAD_PRIORITY 8 56 #define AUDIO_THREAD_PRIORITY 12 57 #define VIDEO_THREAD_PRIORITY 20 58 59 #define READ_BUFFER_NUM 10 60 #define DECODE_VIDEO_BUFFER_NUM 3 61 #define DECODE_AUDIO_BUFFER_NUM 6 62 63 typedef enum 64 { 65 THP_PLAYER_STOP = 0x0, 66 THP_PLAYER_PREPARE, 67 THP_PLAYER_PLAY, 68 THP_PLAYER_PLAYED, 69 THP_PLAYER_PAUSE, 70 THP_PLAYER_ERROR 71 } THPPlayerState; 72 73 typedef struct 74 { 75 DVDFileInfo fileInfo; 76 THPHeader header; 77 THPFrameCompInfo compInfo; 78 THPVideoInfo videoInfo; 79 THPAudioInfo audioInfo; 80 void *thpWork; 81 BOOL open; 82 u8 state; 83 u8 internalState; 84 u8 playFlag; 85 u8 audioExist; 86 s32 dvdError; 87 s32 videoError; 88 BOOL onMemory; 89 u8 *movieData; 90 s32 initOffset; 91 s32 initReadSize; 92 s32 initReadFrame; 93 s64 retraceCount; 94 s32 prevCount; 95 s32 curCount; 96 s32 videoDecodeCount; 97 f32 curVolume; 98 f32 targetVolume; 99 f32 deltaVolume; 100 s32 rampCount; 101 s32 curAudioTrack; 102 s32 curVideoNumber; 103 s32 curAudioNumber; 104 THPTextureSet *dispTextureSet; 105 THPAudioBuffer *playAudioBuffer; 106 THPReadBuffer readBuffer[READ_BUFFER_NUM]; 107 THPTextureSet textureSet[DECODE_VIDEO_BUFFER_NUM]; 108 THPAudioBuffer audioBuffer[DECODE_AUDIO_BUFFER_NUM]; 109 s32 soundMode; 110 111 } THPPlayer; 112 113 extern BOOL THPPlayerInit(s32 audioSystem); 114 extern void THPPlayerQuit(void); 115 extern BOOL THPPlayerOpen(char *fileName, BOOL onMemory); 116 extern BOOL THPPlayerClose(void); 117 extern u32 THPPlayerCalcNeedMemory(void); 118 extern BOOL THPPlayerSetBuffer(u8 *buffer); 119 extern BOOL THPPlayerPrepare(s32 frameNum, s32 playFlag, s32 audioTrack); 120 extern BOOL THPPlayerPlay(void); 121 extern void THPPlayerStop(void); 122 extern BOOL THPPlayerPause(void); 123 extern BOOL THPPlayerSkip(void); 124 extern s32 THPPlayerDrawCurrentFrame(GXRenderModeObj *rmode, 125 u32 x, 126 u32 y, 127 u32 polygonW, 128 u32 polygonH); 129 extern BOOL THPPlayerGetVideoInfo(THPVideoInfo *videoInfo); 130 extern BOOL THPPlayerGetAudioInfo(THPAudioInfo *audioInfo); 131 extern f32 THPPlayerGetFrameRate(void); 132 extern u32 THPPlayerGetTotalFrame(void); 133 extern s32 THPPlayerGetState(void); 134 extern void THPPlayerDrawDone(void); 135 extern BOOL THPPlayerSetVolume(s32 vol, s32 time); 136 extern s32 THPPlayerGetVolume(void); 137 138 extern void THPPlayerSetSoundMode(s32 mode); 139 extern s32 THPPlayerGetSoundMode(void); 140 141 #ifdef __cplusplus 142 } 143 #endif 144 145 #endif // __THPPLAYER_H__ 146