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.1 02/03/2006 10:00:34 aka 15 Imported from Dolphin tree. 16 17 18 4 03/09/16 15:35 Suzuki 19 removed DECODE_BUFFER_NUM definition. 20 added DECODE_VIDEO_BUFFER_NUM and DECODE_AUDIO_BUFFER_NUM definition. 21 22 3 02/05/14 9:20a Suzuki 23 Supported multi audio track 24 25 2 02/02/28 6:33p Akagi 26 enabled to use with MusyX/AX by Suzuki-san (IRD). 27 28 1 02/01/16 11:03a Akagi 29 Initial revision made by Suzuki-san (IRD). 30 31 $NoKeywords: $ 32 33 *---------------------------------------------------------------------------*/ 34 35 #ifndef __THPPLAYER_H__ 36 #define __THPPLAYER_H__ 37 38 #include <revolution.h> 39 #include <revolution/thp.h> 40 #include <revolution/thpfile.h> 41 #include "THPPlayerCommon.h" 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 #define NTSC_RATE (5994) 48 #define PAL_RATE (5000) 49 50 #define READ_THREAD_PRIORITY 8 51 #define AUDIO_THREAD_PRIORITY 12 52 #define VIDEO_THREAD_PRIORITY 20 53 54 #define READ_BUFFER_NUM 10 55 #define DECODE_VIDEO_BUFFER_NUM 3 56 #define DECODE_AUDIO_BUFFER_NUM 6 57 58 typedef enum 59 { 60 THP_PLAYER_STOP = 0x0, 61 THP_PLAYER_PREPARE, 62 THP_PLAYER_PLAY, 63 THP_PLAYER_PLAYED, 64 THP_PLAYER_PAUSE, 65 THP_PLAYER_ERROR 66 } THPPlayerState; 67 68 typedef struct 69 { 70 DVDFileInfo fileInfo; 71 THPHeader header; 72 THPFrameCompInfo compInfo; 73 THPVideoInfo videoInfo; 74 THPAudioInfo audioInfo; 75 void *thpWork; 76 BOOL open; 77 u8 state; 78 u8 internalState; 79 u8 playFlag; 80 u8 audioExist; 81 s32 dvdError; 82 s32 videoError; 83 BOOL onMemory; 84 u8 *movieData; 85 s32 initOffset; 86 s32 initReadSize; 87 s32 initReadFrame; 88 s64 retraceCount; 89 s32 prevCount; 90 s32 curCount; 91 s32 videoDecodeCount; 92 f32 curVolume; 93 f32 targetVolume; 94 f32 deltaVolume; 95 s32 rampCount; 96 s32 curAudioTrack; 97 s32 curVideoNumber; 98 s32 curAudioNumber; 99 THPTextureSet *dispTextureSet; 100 THPAudioBuffer *playAudioBuffer; 101 THPReadBuffer readBuffer[READ_BUFFER_NUM]; 102 THPTextureSet textureSet[DECODE_VIDEO_BUFFER_NUM]; 103 THPAudioBuffer audioBuffer[DECODE_AUDIO_BUFFER_NUM]; 104 } THPPlayer; 105 106 extern BOOL THPPlayerInit(s32 audioSystem); 107 extern void THPPlayerQuit(void); 108 extern BOOL THPPlayerOpen(char *fileName, BOOL onMemory); 109 extern BOOL THPPlayerClose(void); 110 extern u32 THPPlayerCalcNeedMemory(void); 111 extern BOOL THPPlayerSetBuffer(u8 *buffer); 112 extern BOOL THPPlayerPrepare(s32 frameNum, s32 playFlag, s32 audioTrack); 113 extern BOOL THPPlayerPlay(void); 114 extern void THPPlayerStop(void); 115 extern BOOL THPPlayerPause(void); 116 extern BOOL THPPlayerSkip(void); 117 extern s32 THPPlayerDrawCurrentFrame(GXRenderModeObj *rmode, 118 u32 x, 119 u32 y, 120 u32 polygonW, 121 u32 polygonH); 122 extern BOOL THPPlayerGetVideoInfo(THPVideoInfo *videoInfo); 123 extern BOOL THPPlayerGetAudioInfo(THPAudioInfo *audioInfo); 124 extern f32 THPPlayerGetFrameRate(void); 125 extern u32 THPPlayerGetTotalFrame(void); 126 extern s32 THPPlayerGetState(void); 127 extern void THPPlayerDrawDone(void); 128 extern BOOL THPPlayerSetVolume(s32 vol, s32 time); 129 extern s32 THPPlayerGetVolume(void); 130 131 #ifdef __cplusplus 132 } 133 #endif 134 135 #endif // __THPPLAYER_H__ 136