resonance 1.0.1
Loading...
Searching...
No Matches
amovieset.h
Go to the documentation of this file.
1#pragma once
2
4#include "rndartt/abitmap.h"
5
6class ACircBuff;
7
8namespace Rnd {
9
24class AMovieSet {
25public:
27 static constexpr int kTrackCount = 16;
28
36 struct Track {
38 }
39
40 unsigned char mReserved00[4]; // +0x00
41 short mWidth;
42 short mHeight;
43 unsigned char mReserved08[0x24]; // +0x08
44 };
45
47 struct PaletteChunk {
48 int mCount;
49 int mFlags;
50 unsigned int mEntries[1];
51 };
52
54 struct FrameChunk {
55 short mX;
56 short mY;
57 int mReserved04; // +0x04
58 int mFlags;
60 };
61
63 struct BlankChunk {
64 unsigned int mColor;
65 };
66
74 typedef void (*ChunkHandler)(AMovieChunkHdr *pHeader, void *pPayload, void *pData);
75
92 AMovieSet(const char *pszPath, int bStreaming, int *pnError);
93
104
118 void Update(int nTick, int nReadSize);
119
132 int ParseHeader(char *pBuffer, int nBytes);
133
143 void AssignHandler(int nTrackId, ChunkHandler pfnHandler, void *pData);
144
158 int RequestRead(int nBytes);
159
160 int mFile;
162 char *mBuffer;
164 unsigned char mReserved10[8]; // +0x10
175 unsigned char mReserved364[4]; // +0x364
182};
183
192extern const unsigned int g_nMovsTag;
197extern const unsigned int g_nMovtTag;
202extern const unsigned int g_nPallTag;
207extern const unsigned int g_nFramTag;
212extern const unsigned int g_nBlakTag;
217extern const unsigned int g_nLoopTag;
222extern const unsigned int g_nSndhTag;
227extern const unsigned int g_nSndbTag;
232extern const unsigned int g_nSndpTag;
233
245extern const char *const g_apszMovieStreamErrors[];
246
247} // namespace Rnd
Description of a pixel rectangle, its layout, and its palette.
Definition abitmap.h:95
Ring buffer the movie stream reads its file through.
Definition acircbuff.h:16
int ParseHeader(char *pBuffer, int nBytes)
Parse the MOVS and MOVT chunks at the start of a loaded buffer and set up the ring buffer.
static constexpr int kTrackCount
Tracks a file can describe, and so the handler slots.
Definition amovieset.h:27
unsigned char mReserved10[8]
Definition amovieset.h:164
char * mBuffer
Definition amovieset.h:162
int mLoaded
Definition amovieset.h:177
void AssignHandler(int nTrackId, ChunkHandler pfnHandler, void *pData)
Install the handler for one track.
ACircBuff * mCircBuff
Definition amovieset.h:161
int mStreaming
Definition amovieset.h:176
AMovieSet(const char *pszPath, int bStreaming, int *pnError)
Open a movie file and queue its first read.
void Update(int nTick, int nReadSize)
Consume every chunk due by nTick and top up a streaming buffer.
void(* ChunkHandler)(AMovieChunkHdr *pHeader, void *pPayload, void *pData)
Receiver of one track's chunks.
Definition amovieset.h:74
~AMovieSet()
Close the file, cancel an outstanding read, and destroy the ring buffer.
Track mTracks[kTrackCount]
Definition amovieset.h:165
int mFileLength
Definition amovieset.h:178
int mDataStart
Definition amovieset.h:174
unsigned char mReserved364[4]
Definition amovieset.h:175
int mLoopTicks
Tick offset the LOOP chunks have accumulated.
Definition amovieset.h:172
void * mHandlerData[kTrackCount]
Definition amovieset.h:167
ChunkHandler mHandlers[kTrackCount]
Definition amovieset.h:166
int mFileOffset
Definition amovieset.h:179
int mSoundHold
Definition amovieset.h:181
int mAsyncHandle
Definition amovieset.h:180
int mLastTick
Definition amovieset.h:173
int mBufferSize
Definition amovieset.h:163
int RequestRead(int nBytes)
Queue the next streaming read of up to nBytes, as Update() does inline.
int mFile
Definition amovieset.h:160
The rendering engine.
Definition animhelper.h:3
const unsigned int g_nSndpTag
const unsigned int g_nBlakTag
const unsigned int g_nMovsTag
Chunk type codes, four characters read as a word, built by the unit's static initialiser.
const unsigned int g_nSndhTag
const unsigned int g_nPallTag
const unsigned int g_nFramTag
const unsigned int g_nSndbTag
const unsigned int g_nLoopTag
const char *const g_apszMovieStreamErrors[]
Text for each error an AMovieSet reports, indexed by the negated error code.
const unsigned int g_nMovtTag
Header of every chunk in a movie file, followed by mSize payload bytes.
Definition amoviechunkhdr.h:10
Payload of a BLAK chunk.
Definition amovieset.h:63
unsigned int mColor
Definition amovieset.h:64
Payload of a FRAM chunk, followed by the frame's pixels.
Definition amovieset.h:54
short mX
Definition amovieset.h:55
short mY
Definition amovieset.h:56
ABitmap mBitmap
Definition amovieset.h:59
int mReserved04
Definition amovieset.h:57
int mFlags
Definition amovieset.h:58
Payload of a PALL chunk.
Definition amovieset.h:47
int mFlags
Definition amovieset.h:49
int mCount
Definition amovieset.h:48
unsigned int mEntries[1]
Definition amovieset.h:50
Track description a MOVT chunk supplies, 0x2c bytes.
Definition amovieset.h:36
unsigned char mReserved00[4]
Definition amovieset.h:40
Track()
Definition amovieset.h:37
short mWidth
Definition amovieset.h:41
short mHeight
Definition amovieset.h:42
unsigned char mReserved08[0x24]
Definition amovieset.h:43