MediaSourceAsset
MediaSourceAsset (.mmedia) — a clip plus how it should play, the way UE's MediaSource + MediaPlayer settings pair.
- Module
- AssetSystem
- Header
#include "AssetSystem/Assets/MediaSourceAsset.h"- Namespace
Mowo
FMediaPlayer::Open already takes a path, so why an asset: a bare path is not a reference. It cannot be renamed with a redirector, it does not appear in the dependency graph, and the cook has no way to know a movie is used — so a packaged build ships with the cutscene missing and nothing says so until a player reaches it. Naming the clip through an asset puts it on the same footing as a texture or a mesh.
The playback settings live here rather than at each call site because they belong to the CLIP: a looping ambient screen and a one-shot cutscene want different answers, and the answer should travel with the content instead of being re-decided by whoever opens it.
Constructors
| Signature | Name | Description |
|---|---|---|
MediaSourceAsset() | MediaSourceAsset | |
~MediaSourceAsset() override | ~MediaSourceAsset |
Public functions
| Returns | Name | Description |
|---|---|---|
bool | Load | |
void | Unload | |
bool | CreateGPU | |
void | DestroyGPU | |
bool | DestroyGPUIsFrameSafe | |
bool | SaveToFile | |
std::string | SerializeToString | |
bool | LoadFromString | |
const std::string& | GetClipPath | VFS path of the clip itself ("Content/Movies/intro.mpg"). |
void | SetClipPath | |
bool | IsLooping | |
void | SetLooping | |
bool | IsAutoPlay | |
void | SetAutoPlay | |
float | GetVolume | |
void | SetVolume | |
bool | OpenOn | Open the clip on player with this asset's settings and, when autoPlay is set, start it. |
Function details
MediaSourceAsset
MediaSourceAsset()~MediaSourceAsset
~MediaSourceAsset() overrideLoad
bool Load(const std::string& path) overrideUnload
void Unload() overrideCreateGPU
bool CreateGPU(const GPUContext& ctx) overrideDestroyGPU
void DestroyGPU() overrideDestroyGPUIsFrameSafe
bool DestroyGPUIsFrameSafe() const overrideSaveToFile
bool SaveToFile(const std::string& path) constSerializeToString
std::string SerializeToString() constLoadFromString
bool LoadFromString(const std::string& text)GetClipPath
const std::string& GetClipPath() constVFS path of the clip itself ("Content/Movies/intro.mpg"). This is the edge the cook follows, so it is also what a dependency walk reports.
SetClipPath
void SetClipPath(std::string path)IsLooping
bool IsLooping() constSetLooping
void SetLooping(bool loop)IsAutoPlay
bool IsAutoPlay() constSetAutoPlay
void SetAutoPlay(bool autoPlay)GetVolume
float GetVolume() constSetVolume
void SetVolume(float volume)OpenOn
bool OpenOn(FMediaPlayer& player) constOpen the clip on player with this asset's settings and, when autoPlay is set, start it. One call so no caller has to remember the order (volume only sticks once a stream exists, i.e. after Open). Returns false when the clip fails to open.