|
resonance 1.0.1
|
Animation that streams a compressed video file into a set of textures. More...
#include <movie.h>


Classes | |
| struct | TrackTexture |
| One video track of the file and the texture it plays into. More... | |
Public Member Functions | |
| Movie (const HxStr &name) | |
| Construct a movie with no file, no track textures, and a cleared stream buffer. | |
| virtual | ~Movie () |
| Close the file and release every track texture. | |
| virtual void | Load (Stream &stream) |
| Read the movie record from stream. | |
| virtual void | DumpText (Dbg &sink) |
| Write a description of this movie to sink. | |
| virtual void | Save (Stream &stream) |
| Serialise the movie. | |
| virtual void | Replace (Object *pFrom, Object *pTo) |
| Replace one object reference with another. | |
| virtual const HxStr & | ClassName () const |
| Report the class key a .rnd file writes for a movie. | |
| virtual void | Copy (const Object *pSource, unsigned nFlags) |
| Copy another movie over this one. | |
| Tex * | FindTrackTexture (int nTrackId) const |
| Return the texture of the first entry of mTrackTextures that plays nTrackId. | |
| const HxStr & | GetRelativeFilename () const |
| Return mFilename relative to FilePath::sRoot. | |
| virtual void | SetFrameSelf (float flFrame) |
| Advance the movie to a frame. | |
| virtual void | Reopen () |
| Reopen the file this movie already names. | |
| void | SetFilename (const HxStr &name) |
| Set the file this movie plays, under FilePath::sRoot. | |
| void | OpenMovieFile () |
| Open the file mFilename names and take a reference on every track texture. | |
| void | CloseMovieFile () |
| Release every track texture and destroy the stream reader. | |
| void | AttachTrack (int nTrackId) |
| Route one track's chunks to this movie. | |
| void | DetachTrack (int nTrackId) |
| Stop routing one track's chunks anywhere. | |
| void | SetTrackTexture (int nTrackId, Tex *pTex) |
| Play a track into a texture, replacing any texture the track played into before. | |
| void | RemoveTrackTexture (int nTrackId) |
| Drop the first entry of mTrackTextures that plays nTrackId, releasing its texture, and detach the track. | |
| void | OnChunk (AMovieChunkHdr *pHeader, void *pPayload) |
| Draw one video chunk into the texture its track plays into. | |
| Public Member Functions inherited from Rnd::Animatable | |
| Animatable () | |
| Construct an animatable with no children, no filters, and a zero frame. | |
| virtual | ~Animatable () |
| Drop this object's references on its children and delete its filters. | |
| Animatable * | Parent () |
| Report the animatable that animates this one. | |
| void | AddAnim (Animatable *pAnim) |
| Append pAnim to mAnims. | |
| void | RemoveAnim (Animatable *pAnim) |
| Erase pAnim from mAnims. | |
| void | SetFrame (float flFrame) |
| Drive this object and its whole subtree to a frame. | |
| float | UnfilterFrame (float flValue) |
| Map a value back through mFilters. | |
| void | AddFilter (Filter *pFilter) |
| Append an already-built filter to mFilters. | |
| void | AddScaleOffset (float flScale, float flOffset) |
| Append a new ScaleOffset stage to mFilters. | |
| void | AddMinMaxLoop (float flMin, float flMax, int nLoop) |
| Append a new MinMaxLoop stage to mFilters. | |
| void | AddZeroOrder (float flLevel, float flMaxDelta) |
| Append a new ZeroOrder stage to mFilters. | |
| void | AddFirstOrder (float flLevel, float flRatio) |
| Append a new FirstOrder stage to mFilters. | |
| void | AddSecondOrder (float flLevel, float flSpring, float flDamper) |
| Append a new SecondOrder stage to mFilters. | |
| void | RemoveFilter (int nIndex) |
| Delete and erase the filter at one position in mFilters. | |
| Filter * | FilterAt (int nIndex) |
| Return the filter at one position in mFilters. | |
| void | SetRate (float flRate) |
| Change the multiplier of the ScaleOffset stage at the front of mFilters. | |
| void | SetOffset (float flOffset) |
| Change the addend of the ScaleOffset stage at the front of mFilters. | |
| void | SetLoopRange (float flMin, float flMax) |
| Change both ends of the MinMaxLoop stage at the back of mFilters. | |
| virtual float | FilteredFrameEnd () |
| Report the last frame this object's subtree animates to. | |
| virtual void | StartAnim () |
| Restart the animation of this object and its whole subtree. | |
| void | RemoveAllAnims () |
| Drop this object's reference on every mAnims entry and then empty mAnims. | |
| Public Member Functions inherited from Rnd::Object | |
| Object () | |
| Construct an unnamed object. | |
| Object (const HxStr &name) | |
| Construct an object and register it under name. | |
| virtual | ~Object () |
| Erase the registry entry and release the name buffer. | |
| void | SetName (const HxStr &name) |
| Re-register this object under a different name. | |
| void | AddRef (Object *pReferrer) |
| Register pReferrer as a store of a pointer to this object. | |
| void | RemoveRef (Object *pReferrer) |
| Drop one registration made by AddRef(). | |
Static Public Member Functions | |
| static void * | operator new (size_t nSize) |
| Allocate a movie under the tag "Rnd::Movie". | |
| static void | operator delete (void *pBlock) |
| Release a movie block under the same tag. | |
| static void | MasterTrackCallback (AMovieChunkHdr *pHeader, void *pPayload, void *pData) |
| The AMovieSet handler AttachTrack() installs, which passes the chunk to pData's OnChunk(). | |
| static void | ReadTrackTextures (Stream &stream, std::list< TrackTexture > &textures) |
| Read a track texture list from stream. | |
| Static Public Member Functions inherited from Rnd::Animatable | |
| static Filter * | NewFilter (int nType) |
| Build one default-constructed filter for a type tag. | |
Public Attributes | |
| FilePath | mFilename |
| File this movie plays, resolved against FilePath::sRoot. | |
| std::list< TrackTexture > | mTrackTextures |
| Textures the file's tracks play into. | |
| Public Attributes inherited from Rnd::Animatable | |
| float | mFilteredFrame |
| The frame SetFrame() last received, after the filter chain. | |
| Public Attributes inherited from Rnd::Object | |
| HxStr | mName |
| int | mInternal |
Additional Inherited Members | |
| Public Types inherited from Rnd::Animatable | |
| enum | FilterType { kFilterScaleOffset = 0 , kFilterMinMaxLoop = 1 , kFilterZeroOrder = 2 , kFilterFirstOrder = 3 , kFilterSecondOrder = 4 } |
| Value a filter reports from Filter::Type() and a .rnd file stores in front of its payload. More... | |
| Protected Member Functions inherited from Rnd::Object | |
| void | ReleaseAllRefs () |
| Tell every referrer to drop its pointer to this object. | |
| Protected Attributes inherited from Rnd::Object | |
| std::list< Object * > | mRefs |
Animation that streams a compressed video file into a set of textures.
Its RTTI descriptor is at 0x008efc90. It has Rnd::Animatable as its only public non-virtual base at offset 0. Rnd::Manager::RemapLegacyClassName() rewrites the earlier title TexMovie to Movie for any file below format version 5. The rewrite identifies the class as the texture-streaming one rather than a separate video surface.
The object is 0x458 bytes, which the factory at 0x005d20b8 pins by requesting exactly that many under the tag "Rnd::Movie" at 0x00835ba8. Rnd::Animatable derives from Rnd::Object virtually, so the Rnd::Object subobject is placed last, at +0x43c, which the -0x43c adjustment on every entry of the Rnd::Object vtable below confirms. That subobject is 0x18 bytes, so four bytes of tail padding follow it.
Two vtables belong to the class. The eight-entry table at 0x00835d60 is addressed by the Rnd::Object subobject vptr and overrides seven of the eight Rnd::Object slots. The five-entry table at 0x00835da8 is addressed by the Animatable vptr at +0x14; it inherits FilteredFrameEnd() and StartAnim() from Rnd::Animatable, overrides SetFrameSelf(), and adds the one virtual this class declares. Both tables end in an all-zero terminator entry rather than a slot. Reading the second table's terminator as a slot would have run it into the literal pool that follows it, where the bytes decode as further plausible-looking entries.
A movie plays its file through one Rnd::AMovieSet, which it owns and deletes in CloseMovieFile(). Each track of the file is attached to the texture mTrackTextures names for it, and the stream passes that track's video chunks to OnChunk() as SetFrameSelf() advances it.
|
explicit |
Construct a movie with no file, no track textures, and a cleared stream buffer.
The stream reader starts null, the opened flag clear, and the recorded zone at -1. The routine takes only the object name; the second argument the disassembly shows is the compiler's virtual-base construction flag, which the factory passes as 1.
| name | The registry key for this object. |
|
virtual |
Close the file and release every track texture.
|
virtual |
Read the movie record from stream.
The first word is the record revision. A revision of 3 or above reports "Can't load new Movie" and abandons the record. The base record follows, then the file is closed, then mFilename is read through FilePath::Load(), which resolves it against FilePath::sRoot. A revision below 2 then reads and discards one byte. The track texture list follows, and the file is reopened from the name just read.
| stream | The stream to read from. |
Reimplemented from Rnd::Animatable.
|
virtual |
Write a description of this movie to sink.
Rnd::Object and then Rnd::Animatable describe themselves first. At a positive dump level a "[Movie]" section follows with mFilename and mTrackTextures, the list through the printer at 0x005d15e0.
| sink | The text sink. |
Reimplemented from Rnd::Animatable.
|
virtual |
Serialise the movie.
Writes revision 2, then the Rnd::Animatable record, mFilename relative to FilePath::sRoot, and mTrackTextures through the writer at 0x005d1790.
| stream | The stream to write to. |
Reimplemented from Rnd::Animatable.
Replace one object reference with another.
Forwards to Rnd::Animatable, then retargets every track texture that is pFrom, moving this object's reference, and finally notifies the stream reader.
| pFrom | The object being replaced. |
| pTo | The object to point at, which may be null. |
Reimplemented from Rnd::Animatable.
|
virtual |
Report the class key a .rnd file writes for a movie.
Implements Rnd::Object.
|
virtual |
Copy another movie over this one.
Narrows the source with a dynamic cast, runs the Rnd::Animatable copy, closes the file, copies mFilename and mTrackTextures, and opens the file again. The cast result is used without a null check, so a source that is not a movie faults.
| pSource | The source object. |
| nFlags | The copy flags, passed to the base. |
Reimplemented from Rnd::Animatable.
|
static |
Allocate a movie under the tag "Rnd::Movie".
| nSize | The object size the compiler supplies. |
|
static |
Release a movie block under the same tag.
| pBlock | The block. |
| Tex * Rnd::Movie::FindTrackTexture | ( | int | nTrackId | ) | const |
Return the texture of the first entry of mTrackTextures that plays nTrackId.
The routine has no caller in the shipped build, and its name is inferred.
| nTrackId | The track to look up. |
| const HxStr & Rnd::Movie::GetRelativeFilename | ( | ) | const |
Return mFilename relative to FilePath::sRoot.
The routine has no caller in the shipped build, and its name is inferred.
|
virtual |
Advance the movie to a frame.
Animatable vtable slot 3.
| flFrame | The frame to animate to, after this object's filter chain. |
Reimplemented from Rnd::Animatable.
|
virtual |
Reopen the file this movie already names.
Animatable vtable slot 4, and the one virtual this class adds. The body is CloseMovieFile() followed by OpenMovieFile() and it takes no argument, so the routine reloads rather than assigning a name. Nothing in the image calls it or overrides it.
| void Rnd::Movie::SetFilename | ( | const HxStr & | name | ) |
Set the file this movie plays, under FilePath::sRoot.
Hands the name to FilePath::SetFromRoot(), which FilePath::Load() also ends in, so a name set this way and a name read from a file are resolved against the same directory. Neither opens the file; Reopen() does that.
| name | The file name, without the .mmv extension the open path appends. |
| void Rnd::Movie::OpenMovieFile | ( | ) |
Open the file mFilename names and take a reference on every track texture.
Adds this object as a referrer on each track texture first, then returns at once when mFilename is empty. The path is mFilename with ".mmv" appended. A path whose uncompressed length reads as zero reports "Couldn't load movie file: %s" and returns. Otherwise the current zone is recorded, a 0x380-byte stream reader is allocated, and its constructor is run against the path. A constructor that reports an error writes the text from the table at 0x007a8400, indexed by the negative error code, into "Couldn't load movie file %s: %s", then destroys the reader and clears the member.
| void Rnd::Movie::CloseMovieFile | ( | ) |
Release every track texture and destroy the stream reader.
| void Rnd::Movie::AttachTrack | ( | int | nTrackId | ) |
Route one track's chunks to this movie.
Installs MasterTrackCallback() with this movie as its data. Does nothing when no file is open.
| nTrackId | The track. |
| void Rnd::Movie::DetachTrack | ( | int | nTrackId | ) |
Stop routing one track's chunks anywhere.
Does nothing when no file is open.
| nTrackId | The track. |
| void Rnd::Movie::SetTrackTexture | ( | int | nTrackId, |
| Tex * | pTex ) |
Play a track into a texture, replacing any texture the track played into before.
The texture takes a reference from this movie and is appended to mTrackTextures. With a file open, a texture whose size or depth differs from the track's frame is logged and reconfigured as an 8 bit bitmap of the frame's size. The track is then attached. A null texture only removes the track. The routine has no caller in the shipped build, and its name is inferred.
| nTrackId | The track. |
| pTex | The texture, or null. |
| void Rnd::Movie::RemoveTrackTexture | ( | int | nTrackId | ) |
Drop the first entry of mTrackTextures that plays nTrackId, releasing its texture, and detach the track.
The name is inferred.
| nTrackId | The track. |
| void Rnd::Movie::OnChunk | ( | AMovieChunkHdr * | pHeader, |
| void * | pPayload ) |
Draw one video chunk into the texture its track plays into.
A palette chunk is copied into mPalette and handed to the texture. A frame chunk's bitmap takes mPalette and is copied onto the locked mip 0 at the chunk's position. A blank chunk fills mip 0 with its colour. A track with no texture is ignored. The name is inferred.
| pHeader | The chunk. |
| pPayload | The chunk's payload. |
|
static |
The AMovieSet handler AttachTrack() installs, which passes the chunk to pData's OnChunk().
The routine was an orphan in the analysis, and its name is inferred.
| pHeader | The chunk. |
| pPayload | The chunk's payload. |
| pData | The movie. |
|
static |
Read a track texture list from stream.
The first word is the entry count, and the list is resized to it before the entries are read. Each entry is a track id and the object name of its texture, and the name is resolved through Rnd::TheManager and narrowed to Rnd::Tex. A name that resolves to nothing, or to an object that is not a texture, stores a null texture rather than failing the record.
The routine takes no movie. It is placed here because Movie::TrackTexture is the only type it builds, and Load() is its only caller.
| stream | The stream to read from. |
| textures | Receives the entries. |
| FilePath Rnd::Movie::mFilename |
File this movie plays, resolved against FilePath::sRoot.
Public because FilePath's routines take its address from outside the hierarchy and the image exposes no accessor. +0x18
| std::list<TrackTexture> Rnd::Movie::mTrackTextures |
Textures the file's tracks play into.
Public because ReadTrackTextures() receives its address from Load() and fills it from outside the class, and the image exposes no accessor. +0x30