98e6c6d1 |
1 | // Created by: Kirill GAVRILOV |
2 | // Copyright (c) 2019 OPEN CASCADE SAS |
3 | // |
4 | // This file is part of Open CASCADE Technology software library. |
5 | // |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
11 | // |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
14 | |
15 | #ifndef _Media_Packet_HeaderFile |
16 | #define _Media_Packet_HeaderFile |
17 | |
18 | #include <Standard_Transient.hxx> |
19 | #include <Standard_Type.hxx> |
20 | |
21 | struct AVPacket; |
22 | |
23 | //! AVPacket wrapper - the packet (data chunk for decoding/encoding) holder. |
24 | class Media_Packet : public Standard_Transient |
25 | { |
26 | DEFINE_STANDARD_RTTIEXT(Media_Packet, Standard_Transient) |
27 | public: |
28 | |
29 | //! Empty constructor |
30 | Standard_EXPORT Media_Packet(); |
31 | |
32 | //! Destructor. |
33 | Standard_EXPORT virtual ~Media_Packet(); |
34 | |
35 | //! av_packet_unref() wrapper. |
36 | Standard_EXPORT void Unref(); |
37 | |
38 | //! Return packet. |
39 | const AVPacket* Packet() const { return myPacket; } |
40 | |
41 | //! Return packet. |
42 | AVPacket* ChangePacket() { return myPacket; } |
43 | |
44 | //! Return data. |
45 | Standard_EXPORT const uint8_t* Data() const; |
46 | |
47 | //! Return data. |
48 | Standard_EXPORT uint8_t* ChangeData(); |
49 | |
50 | //! Return data size. |
51 | Standard_EXPORT int Size() const; |
52 | |
53 | //! Return presentation timestamp (PTS). |
54 | Standard_EXPORT int64_t Pts() const; |
55 | |
56 | //! Return decoding timestamp (DTS). |
57 | Standard_EXPORT int64_t Dts() const; |
58 | |
59 | //! Return Duration. |
60 | Standard_EXPORT int64_t Duration() const; |
61 | |
62 | //! Return Duration in seconds. |
63 | double DurationSeconds() const { return myDurationSec; } |
64 | |
65 | //! Set Duration in seconds. |
66 | void SetDurationSeconds (double theDurationSec) { myDurationSec = theDurationSec; } |
67 | |
68 | //! Return stream index. |
69 | Standard_EXPORT int StreamIndex() const; |
70 | |
71 | //! Return TRUE for a key frame. |
72 | Standard_EXPORT bool IsKeyFrame() const; |
73 | |
74 | //! Mark as key frame. |
75 | Standard_EXPORT void SetKeyFrame(); |
76 | |
77 | protected: |
78 | |
79 | AVPacket* myPacket; //!< packet |
80 | double myDurationSec; //!< packet duration in seconds |
81 | |
82 | }; |
83 | |
84 | #endif // _Media_Packet_HeaderFile |