2 Copyright © 2015-2016, The AROS Development Team. All rights reserved.
6 #include <graphics/gfx.h>
7 #include <datatypes/pictureclass.h>
8 #include <datatypes/animationclass.h>
9 #include <datatypes/animationclassext.h>
11 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
12 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
17 #define ANIMDF_CONTROLPANEL (1 << 0)
18 #define ANIMDF_IMMEDIATE (1 << 1)
19 #define ANIMDF_REPEAT (1 << 2)
20 #define ANIMDF_REMAP (1 << 3)
21 #define ANIMDF_ADJUSTPALETTE (1 << 4)
22 #define ANIMDF_ADAPTFPS (1 << 5)
23 #define ANIMDF_FRAMESKIP (1 << 6)
24 #define ANIMDF_SMARTSKIP (1 << 7)
27 special flags used by rendering/layout code
29 #define ANIMDF_LAYOUT (1 << 29)
30 #define ANIMDF_REMAPPEDPENS (1 << 30)
31 #define ANIMDF_SHOWPANEL (1 << 31)
33 #define ANIMPLAYER_TICKFREQ ((struct RealTimeBase *)RealTimeBase)->rtb_Reserved1
35 struct ProcessPrivate
;
36 struct Animation_Data
;
38 BOOL
ProcEnabled(struct ProcessPrivate
*, volatile ULONG
*, ULONG
);
39 void cacheFrame(struct Animation_Data
*, struct AnimFrame
*);
40 void freeFrame(struct Animation_Data
*, struct AnimFrame
*);
44 struct SignalSemaphore acd_PenLock
;
45 struct ColorMap
*acd_ColorMap
;
46 struct ColorRegister
*acd_ColorRegs
;
53 UBYTE
*acd_ColorTable
[2];
54 UBYTE
*acd_Allocated
; /* pens we have actually allocated */
55 ULONG acd_PenPrecison
; /* precision to use allocating pens */
60 struct SignalSemaphore afd_AnimFramesLock
;
61 struct List afd_AnimFrames
;
63 UWORD afd_Frames
; /* # of frames */
64 UWORD afd_FrameCurrent
; /* # of current frame */
65 UWORD afd_FramesStep
; /* how much to skip back/fwd */
70 UWORD atd_FramesPerSec
; /* Playback rate */
71 UWORD atd_TicksPerFrame
; /* realtime.libraries tick frequency /
76 /* our nodes used to play the anim! */
80 #define af_CacheBM af_Node.ln_Name
81 struct adtNewFormatFrame af_Frame
;
84 /* for sanity, we embed the frame number in the ln_type/ln_pri fields */
85 #define NODEID(node) *((UWORD *)(&((struct AnimFrame *)node)->af_Node.ln_Type))
90 ULONG ad_Flags
; /* object control flags */
93 struct Window
*ad_Window
;
95 struct AnimFrame_Data ad_FrameData
;
96 struct AnimTimer_Data ad_TimerData
;
98 struct BitMap
*ad_FrameBM
; /* currently displayed frame */
99 struct BitMap
*ad_CacheBM
; /* .. */
100 struct AnimFrame
*ad_KeyFrame
; /* animations key (first) frame */
102 UWORD ad_VertTop
; /* Y offset of visible rectangle */
105 UWORD ad_HorizTop
; /* X offset of visible rectangle */
111 UWORD ad_RenderWidth
;
112 UWORD ad_RenderHeight
;
115 struct BitMapHeader ad_BitMapHeader
; /* objects embedded bitmap header */
117 struct AnimColor_Data ad_ColorData
;
120 struct ProcessPrivate
*ad_ProcessData
;
121 struct Process
*ad_BufferProc
; /* buffering process */
122 struct Process
*ad_PlayerProc
; /* playback process */
123 struct Player
*ad_Player
;
124 struct Hook ad_PlayerHook
;
126 struct Gadget
*ad_Tapedeck
;
127 ULONG ad_BufferTime
; /* (prefs) how many seconds to buffer */
128 ULONG ad_BufferStep
; /* (prefs) no of frames to try to load in one go */
129 UBYTE ad_PlayerSourceLastState
;
132 struct ProcessPrivate
135 struct Animation_Data
*pp_Data
;
136 char *pp_PlayBackName
;
137 char *pp_BufferingName
;
138 volatile ULONG pp_PlayerFlags
;
139 volatile ULONG pp_BufferFlags
;
140 ULONG pp_BufferFrames
; /* no of frames to buffer in total */
141 ULONG pp_BufferLevel
; /* no of frames buffered */
142 IPTR pp_BufferSpecific
; /* specific frame to load */
143 struct AnimFrame
*pp_BufferFirst
; /* starting point to load from */
144 struct AnimFrame
*pp_PlaybackFrame
;
146 ULONG pp_BufferSigMask
;
147 UBYTE pp_BufferEnable
;
148 UBYTE pp_BufferDisable
;
150 UBYTE pp_BufferPurge
;
152 ULONG pp_PlaybackSigMask
;
153 UBYTE pp_PlaybackEnable
;
154 UBYTE pp_PlaybackDisable
;
155 UBYTE pp_PlaybackTick
; /* signal frames needs to change */
156 UBYTE pp_PlaybackSync
; /* signal position changed */
159 #define PRIVPROCF_ENABLED (1 << 0)
160 #define PRIVPROCF_RUNNING (1 << 1)
161 #define PRIVPROCF_ACTIVE (1 << 2)
162 #define PRIVPROCF_BUSY (1 << 3)
164 #define TAG_PRIVATE (ADTA_Dummy + 100)
165 #define PRIVATE_INITPLAYER (TAG_PRIVATE - 1)
166 #define PRIVATE_ALLOCCOLORTABLES (TAG_PRIVATE - 2)
167 #define PRIVATE_MAPFRAMEPENS (TAG_PRIVATE - 3)
168 #define PRIVATE_FREECOLORTABLES (TAG_PRIVATE - 4)
169 #define PRIVATE_FREEPENS (TAG_PRIVATE - 5)
170 #define PRIVATE_ALLOCBUFFER (TAG_PRIVATE - 6)
171 #define PRIVATE_RENDERFRAME (TAG_PRIVATE - 7)
172 #define PRIVATE_REMAPFRAME (TAG_PRIVATE - 8)
174 struct privAllocColorTables
176 STACKED ULONG MethodID
;
177 STACKED ULONG NumColors
;
180 struct privMapFramePens
182 STACKED ULONG MethodID
;
183 STACKED
struct AnimFrame
*Frame
;
186 struct privAllocBuffer
188 STACKED ULONG MethodID
;
189 STACKED
struct BitMap
*Friend
;
193 struct privRenderFrame
195 STACKED ULONG MethodID
;
196 STACKED
struct AnimFrame
*Frame
;
197 STACKED
struct BitMap
*Target
;
201 #define DFRAMES(...) bug(__VA_ARGS__);