Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:15

0001 // Created by: Kirill GAVRILOV
0002 // Copyright (c) 2019 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef _Media_Packet_HeaderFile
0016 #define _Media_Packet_HeaderFile
0017 
0018 #include <Standard_Transient.hxx>
0019 #include <Standard_Type.hxx>
0020 
0021 struct AVPacket;
0022 
0023 //! AVPacket wrapper - the packet (data chunk for decoding/encoding) holder.
0024 class Media_Packet : public Standard_Transient
0025 {
0026   DEFINE_STANDARD_RTTIEXT(Media_Packet, Standard_Transient)
0027 public:
0028 
0029   //! Empty constructor
0030   Standard_EXPORT Media_Packet();
0031 
0032   //! Destructor.
0033   Standard_EXPORT virtual ~Media_Packet();
0034 
0035   //! av_packet_unref() wrapper.
0036   Standard_EXPORT void Unref();
0037 
0038   //! Return packet.
0039   const AVPacket* Packet() const { return myPacket; }
0040 
0041   //! Return packet.
0042   AVPacket* ChangePacket() { return myPacket; }
0043 
0044   //! Return data.
0045   Standard_EXPORT const uint8_t* Data() const;
0046 
0047   //! Return data.
0048   Standard_EXPORT uint8_t* ChangeData();
0049 
0050   //! Return data size.
0051   Standard_EXPORT int Size() const;
0052 
0053   //! Return presentation timestamp (PTS).
0054   Standard_EXPORT int64_t Pts() const;
0055 
0056   //! Return decoding timestamp (DTS).
0057   Standard_EXPORT int64_t Dts() const;
0058 
0059   //! Return Duration.
0060   Standard_EXPORT int64_t Duration() const;
0061 
0062   //! Return Duration in seconds.
0063   double DurationSeconds() const { return myDurationSec; }
0064 
0065   //! Set Duration in seconds.
0066   void SetDurationSeconds (double theDurationSec) { myDurationSec = theDurationSec; }
0067 
0068   //! Return stream index.
0069   Standard_EXPORT int StreamIndex() const;
0070 
0071   //! Return TRUE for a key frame.
0072   Standard_EXPORT bool IsKeyFrame() const;
0073 
0074   //! Mark as key frame.
0075   Standard_EXPORT void SetKeyFrame();
0076 
0077 protected:
0078 
0079   AVPacket* myPacket;      //!< packet
0080   double    myDurationSec; //!< packet duration in seconds
0081 
0082 };
0083 
0084 #endif // _Media_Packet_HeaderFile