File indexing completed on 2025-01-18 10:04:15
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef _Media_Frame_HeaderFile
0016 #define _Media_Frame_HeaderFile
0017
0018 #include <Graphic3d_Vec2.hxx>
0019 #include <Image_PixMap.hxx>
0020 #include <Standard_Transient.hxx>
0021 #include <Standard_Type.hxx>
0022
0023 struct AVFrame;
0024
0025
0026 class Media_Frame : public Standard_Transient
0027 {
0028 DEFINE_STANDARD_RTTIEXT(Media_Frame, Standard_Transient)
0029 public:
0030
0031
0032 Standard_EXPORT static Image_Format FormatFFmpeg2Occt (int theFormat);
0033
0034
0035
0036 Standard_EXPORT static int FormatOcct2FFmpeg (Image_Format theFormat);
0037
0038
0039 Standard_EXPORT static void Swap (const Handle(Media_Frame)& theFrame1,
0040 const Handle(Media_Frame)& theFrame2);
0041
0042 public:
0043
0044
0045 Standard_EXPORT Media_Frame();
0046
0047
0048 Standard_EXPORT virtual ~Media_Frame();
0049
0050
0051 Standard_EXPORT bool IsEmpty() const;
0052
0053
0054 Standard_EXPORT void Unref();
0055
0056
0057 Graphic3d_Vec2i Size() const { return Graphic3d_Vec2i (SizeX(), SizeY()); }
0058
0059
0060 Standard_EXPORT int SizeX() const;
0061
0062
0063 Standard_EXPORT int SizeY() const;
0064
0065
0066 Standard_EXPORT int Format() const;
0067
0068
0069 Standard_EXPORT bool IsFullRangeYUV() const;
0070
0071
0072 Standard_EXPORT uint8_t* Plane (int thePlaneId) const;
0073
0074
0075 Standard_EXPORT int LineSize (int thePlaneId) const;
0076
0077
0078 Standard_EXPORT int64_t BestEffortTimestamp() const;
0079
0080
0081 const AVFrame* Frame() const { return myFrame; }
0082
0083
0084 AVFrame* ChangeFrame() { return myFrame; }
0085
0086
0087 double Pts() const { return myFramePts; }
0088
0089
0090 void SetPts (double thePts) { myFramePts = thePts; }
0091
0092
0093 float PixelAspectRatio() const { return myPixelRatio; }
0094
0095
0096 void SetPixelAspectRatio (float theRatio) { myPixelRatio = theRatio; }
0097
0098
0099 bool IsLocked() const { return myIsLocked; }
0100
0101
0102 void SetLocked (bool theToLock) { myIsLocked = theToLock; }
0103
0104 public:
0105
0106
0107 Standard_EXPORT bool InitWrapper (const Handle(Image_PixMap)& thePixMap);
0108
0109 protected:
0110
0111 AVFrame* myFrame;
0112 double myFramePts;
0113 float myPixelRatio;
0114 bool myIsLocked;
0115
0116 };
0117
0118 #endif