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