File indexing completed on 2025-01-18 10:03:48
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef _Graphic3d_MediaTextureSet_HeaderFile
0016 #define _Graphic3d_MediaTextureSet_HeaderFile
0017
0018 #include <Media_IFrameQueue.hxx>
0019 #include <Graphic3d_MediaTexture.hxx>
0020 #include <Graphic3d_TextureSet.hxx>
0021
0022 class Graphic3d_ShaderProgram;
0023 class Media_PlayerContext;
0024
0025
0026 class Graphic3d_MediaTextureSet : public Graphic3d_TextureSet, public Media_IFrameQueue
0027 {
0028 DEFINE_STANDARD_RTTIEXT(Graphic3d_MediaTextureSet, Graphic3d_TextureSet)
0029 public:
0030
0031
0032 typedef void (*CallbackOnUpdate_t)(void* theUserPtr);
0033
0034 public:
0035
0036
0037 Standard_EXPORT Graphic3d_MediaTextureSet();
0038
0039
0040 Standard_EXPORT void SetCallback (CallbackOnUpdate_t theCallbackFunction, void* theCallbackUserPtr);
0041
0042
0043 Standard_EXPORT void Notify();
0044
0045
0046 const TCollection_AsciiString& Input() const { return myInput; }
0047
0048
0049
0050 Standard_EXPORT void OpenInput (const TCollection_AsciiString& thePath,
0051 Standard_Boolean theToWait);
0052
0053
0054 const Handle(Media_PlayerContext)& PlayerContext() const { return myPlayerCtx; }
0055
0056
0057 Standard_EXPORT Standard_Boolean SwapFrames();
0058
0059
0060 Graphic3d_Vec2i FrameSize() const { return myFrameSize; }
0061
0062
0063 Handle(Graphic3d_ShaderProgram) ShaderProgram() const
0064 {
0065 if (myIsPlanarYUV)
0066 {
0067 return myIsFullRangeYUV ? myShaderYUVJ : myShaderYUV;
0068 }
0069 return Handle(Graphic3d_ShaderProgram)();
0070 }
0071
0072
0073 Standard_Boolean IsPlanarYUV() const { return myIsPlanarYUV; }
0074
0075
0076 Standard_Boolean IsFullRangeYUV() const { return myIsFullRangeYUV; }
0077
0078
0079 double Duration() const { return myDuration; }
0080
0081
0082 double Progress() const { return myProgress; }
0083
0084
0085 private:
0086
0087
0088 Standard_EXPORT virtual Handle(Media_Frame) LockFrame() Standard_OVERRIDE;
0089
0090
0091 Standard_EXPORT virtual void ReleaseFrame (const Handle(Media_Frame)& theFrame) Standard_OVERRIDE;
0092
0093 protected:
0094
0095 Handle(Media_PlayerContext) myPlayerCtx;
0096 Handle(Media_Frame) myFramePair[2];
0097 Handle(Graphic3d_ShaderProgram) myShaderYUV;
0098 Handle(Graphic3d_ShaderProgram) myShaderYUVJ;
0099 Handle(Standard_HMutex) myMutex;
0100 TCollection_AsciiString myInput;
0101 CallbackOnUpdate_t myCallbackFunction;
0102 void* myCallbackUserPtr;
0103 Graphic3d_Vec2i myFrameSize;
0104 Standard_Real myProgress;
0105 Standard_Real myDuration;
0106 Standard_Integer myFront;
0107 Standard_Boolean myToPresentFrame;
0108 Standard_Boolean myIsPlanarYUV;
0109 Standard_Boolean myIsFullRangeYUV;
0110
0111 };
0112
0113 #endif