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