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.3  2008/02/28 06:21:07  aka
15   Moved THP_SOUND_MODE_??? to THPPlayerCommon.h.
16 
17   Revision 1.2  2008/02/28 05:24:37  aka
18   Added THP_SOUND_MODE_???.
19   Added THPSimpleGetSoundMode()
20   Added THPSimpleSetSoundMode().
21   Added a member soundMode in THPSimple structure.
22 
23   Revision 1.1  2006/02/03 10:00:34  aka
24   Imported from Dolphin tree.
25 
26 
27     3     02/05/14 9:20a Suzuki
28     Supported multi audio track
29 
30     2     02/02/28 6:34p 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 __THPSIMPLE_H__
41 #define __THPSIMPLE_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 READ_BUFFER_NUM         10
53 #define AUDIO_BUFFER_NUM         3
54 
55 typedef enum
56 {
57     THP_DECODE_OK = 0,
58     THP_VIDEO_DECODE_FAIL,
59     THP_NO_READ_BUFFER,
60     THP_NO_AUDIO_BUFFER,
61     THP_INVALID_AUDIO_TRACK
62 
63 } THPDecodeError;
64 
65 typedef struct
66 {
67     DVDFileInfo         fileInfo;
68     THPHeader           header;
69     THPFrameCompInfo    compInfo;
70     THPVideoInfo        videoInfo;
71     THPAudioInfo        audioInfo;
72     void                *thpWork;
73     BOOL                open;
74     u8                  preFetchState;
75     u8                  audioState;
76     u8                  loop;
77     u8                  audioExist;
78     s32                 curOffset;
79     BOOL                dvdError;
80     volatile u32        readProgress;
81     s32                 nextDecodeIndex;
82     s32                 readIndex;
83     s32                 readSize;
84     s32                 totalReadFrame;
85     f32                 curVolume;
86     f32                 targetVolume;
87     f32                 deltaVolume;
88     s32                 rampCount;
89     THPReadBuffer       readBuffer[READ_BUFFER_NUM];
90     THPTextureSet       textureSet;
91     THPAudioBuffer      audioBuffer[AUDIO_BUFFER_NUM];
92     s32                 audioDecodeIndex;
93     s32                 audioOutputIndex;
94     s32                 soundMode;
95 
96 } THPSimple;
97 
98 extern BOOL THPSimpleInit(s32 audioSystem);
99 extern void THPSimpleQuit(void);
100 extern BOOL THPSimpleOpen(char *fileName);
101 extern BOOL THPSimpleClose(void);
102 extern u32  THPSimpleCalcNeedMemory(void);
103 extern BOOL THPSimpleSetBuffer(u8 *buffer);
104 extern BOOL THPSimplePreLoad(s32 loop);
105 extern void THPSimpleAudioStart(void);
106 extern void THPSimpleAudioStop(void);
107 extern BOOL THPSimpleLoadStop(void);
108 extern s32  THPSimpleDecode(s32 audioTrack);
109 extern s32  THPSimpleDrawCurrentFrame(GXRenderModeObj *rmode,
110                                       u32 x,
111                                       u32 y,
112                                       u32 polygonW,
113                                       u32 polygonH);
114 extern BOOL THPSimpleGetVideoInfo(THPVideoInfo *videoInfo);
115 extern BOOL THPSimpleGetAudioInfo(THPAudioInfo *audioInfo);
116 extern f32  THPSimpleGetFrameRate(void);
117 extern u32  THPSimpleGetTotalFrame(void);
118 extern BOOL THPSimpleSetVolume(s32 vol, s32 time);
119 extern s32  THPSimpleGetVolume(void);
120 
121 extern void THPSimpleSetSoundMode(s32 mode);
122 extern s32  THPSimpleGetSoundMode(void);
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #endif // __THPSIMPLE_H__
129