1#include "VideoPlaybackSystem.h"
2#include "IVideoDecoder.h"
7#include "Resources/Texture.h"
23 context->videoDecoderContext->endVideoStream(data.texture);
31 if(!context->videoDecoderContext) {
34 context->videoDecoderContext->update();
39 bool hasParameterSets =
true;
41 if (description.codec == Codec::HEVC) {
42 hasParameterSets &= !description.vps.empty();
44 hasParameterSets &= !description.sps.empty();
45 hasParameterSets &= !description.pps.empty();
48 if ((data.texture != component.texture) || component.restart) {
50 context->videoDecoderContext->endVideoStream(data.texture);
52 component.texture->setName(
"VideoTexture");
53 component.texture->setSource(component.source);
54 component.description.recordToDisk = component.recordToDisk;
55 component.description.recordPath = component.recordPath;
56 component.description.decodeCallback = component.decodeCallback;
57 component.description.decodeCallbackData = component.decodeCallbackData;
58 component.description.presentCallback = component.presentCallback;
59 component.description.presentCallbackData = component.presentCallbackData;
60 component.reconfig =
false;
61 component.restart =
false;
63 context->videoDecoderContext->loadVideoTexture(component.texture, component.description);
64 data.texture = component.texture;
66 else if (component.reconfig) {
67 component.description.recordToDisk = component.recordToDisk;
68 component.description.recordPath = component.recordPath;
69 component.description.decodeCallback = component.decodeCallback;
70 component.description.decodeCallbackData = component.decodeCallbackData;
71 component.description.presentCallback = component.presentCallback;
72 component.description.presentCallbackData = component.presentCallbackData;
73 component.reconfig =
false;
75 context->videoDecoderContext->reloadVideoTexture(component.texture, component.description);
79 context->videoDecoderContext->endVideoStream(data.texture);
virtual ComponentHandle createComponent()
Create a new component instance.
Context * context
Pointer to the Context instance the system lives in.
virtual void destroyComponent(ComponentHandle)
Destroy the component held by the given handle.
void update()
Updates the system state to that of the current frame.
A Context instance contains all the services, systems and runtime components needed to use Cogs.
void destroyComponent(ComponentHandle) override
ComponentHandle createComponent() override
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
bool HandleIsValid(const ResourceHandle_t< T > &handle)
Check if the given resource is valid, that is not equal to NoHandle or InvalidHandle.
Contains reflection support.
Handle to a Component instance.
ComponentType * resolveComponent() const
static const ResourceHandle_t NoHandle
Handle representing a default (or none if default not present) resource.