1 /*---------------------------------------------------------------------------* 2 Project: THP demo 3 File: THPSimple.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: THPSimple.h,v $ 14 Revision 1.1 02/03/2006 10:00:34 aka 15 Imported from Dolphin tree. 16 17 18 3 02/05/14 9:20a Suzuki 19 Supported multi audio track 20 21 2 02/02/28 6:34p Akagi 22 enabled to use with MusyX/AX by Suzuki-san (IRD). 23 24 1 02/01/16 11:03a Akagi 25 Initial revision made by Suzuki-san (IRD). 26 27 $NoKeywords: $ 28 29 *---------------------------------------------------------------------------*/ 30 31 #ifndef __THPSIMPLE_H__ 32 #define __THPSIMPLE_H__ 33 34 #include <revolution.h> 35 #include <revolution/thp.h> 36 #include <revolution/thpfile.h> 37 #include "THPPlayerCommon.h" 38 39 #ifdef __cplusplus 40 extern "C" { 41 #endif 42 43 #define READ_BUFFER_NUM 10 44 #define AUDIO_BUFFER_NUM 3 45 46 typedef enum 47 { 48 THP_DECODE_OK = 0, 49 THP_VIDEO_DECODE_FAIL, 50 THP_NO_READ_BUFFER, 51 THP_NO_AUDIO_BUFFER, 52 THP_INVALID_AUDIO_TRACK 53 } THPDecodeError; 54 55 typedef struct 56 { 57 DVDFileInfo fileInfo; 58 THPHeader header; 59 THPFrameCompInfo compInfo; 60 THPVideoInfo videoInfo; 61 THPAudioInfo audioInfo; 62 void *thpWork; 63 BOOL open; 64 u8 preFetchState; 65 u8 audioState; 66 u8 loop; 67 u8 audioExist; 68 s32 curOffset; 69 BOOL dvdError; 70 volatile u32 readProgress; 71 s32 nextDecodeIndex; 72 s32 readIndex; 73 s32 readSize; 74 s32 totalReadFrame; 75 f32 curVolume; 76 f32 targetVolume; 77 f32 deltaVolume; 78 s32 rampCount; 79 THPReadBuffer readBuffer[READ_BUFFER_NUM]; 80 THPTextureSet textureSet; 81 THPAudioBuffer audioBuffer[AUDIO_BUFFER_NUM]; 82 s32 audioDecodeIndex; 83 s32 audioOutputIndex; 84 } THPSimple; 85 86 extern BOOL THPSimpleInit(s32 audioSystem); 87 extern void THPSimpleQuit(void); 88 extern BOOL THPSimpleOpen(char *fileName); 89 extern BOOL THPSimpleClose(void); 90 extern u32 THPSimpleCalcNeedMemory(void); 91 extern BOOL THPSimpleSetBuffer(u8 *buffer); 92 extern BOOL THPSimplePreLoad(s32 loop); 93 extern void THPSimpleAudioStart(void); 94 extern void THPSimpleAudioStop(void); 95 extern BOOL THPSimpleLoadStop(void); 96 extern s32 THPSimpleDecode(s32 audioTrack); 97 extern s32 THPSimpleDrawCurrentFrame(GXRenderModeObj *rmode, 98 u32 x, 99 u32 y, 100 u32 polygonW, 101 u32 polygonH); 102 extern BOOL THPSimpleGetVideoInfo(THPVideoInfo *videoInfo); 103 extern BOOL THPSimpleGetAudioInfo(THPAudioInfo *audioInfo); 104 extern f32 THPSimpleGetFrameRate(void); 105 extern u32 THPSimpleGetTotalFrame(void); 106 extern BOOL THPSimpleSetVolume(s32 vol, s32 time); 107 extern s32 THPSimpleGetVolume(void); 108 109 #ifdef __cplusplus 110 } 111 #endif 112 113 #endif // __THPSIMPLE_H__ 114