#ifndef AE3F35DC_04CA_417F_8D57_CADC8913678F #define AE3F35DC_04CA_417F_8D57_CADC8913678F /* ******************************************************************************* * INCLUDE ******************************************************************************* */ #include "NotificationQueue.h" #include #include "SerialCode.h" #if defined(USING_FFMPEG) extern "C" { #include #include } #endif namespace Video { namespace Core { /* ******************************************************************************* * CLASS DECLARE ******************************************************************************* */ class Packet { public: using Ptr = Poco::SharedPtr; static const uint32_t FLAG_IS_VIDEO; static const uint32_t FLAG_IS_KEY; static const uint32_t FLAG_IS_AAC_HEADER; static const uint32_t FLAG_IS_SEI; public: Packet(); Packet(const SerialCode& code, uint32_t flags, uint8_t* data, uint32_t length, int64_t pts, int64_t dts); #if defined(USING_FFMPEG) Packet(const SerialCode& code, bool isVideo, AVPacket** packet); #endif Packet(const Packet& other); virtual ~Packet(); virtual void moveTo(AVPacket** packet); bool isVideo() const; bool isKeyFrame() const; Ptr clone(); const SerialCode& serialCode(); const uint8_t* data(); uint32_t length(); uint64_t pts(); uint64_t dts(); uint32_t flags(); Poco::SharedPtr& sharedData(); protected: #if defined(USING_FFMPEG) AVPacket* buildAVPacket(); virtual void convertToAVPacket(AVPacket* pPacket); #endif private: SerialCode _code; uint32_t _flags; int64_t _pts, _dts; Poco::SharedPtr _pData; uint32_t _length; #if defined(USING_FFMPEG) AVPacket* _pAVPacket; #endif }; using PacketQueue = NotificationQueue; inline bool Packet::isVideo() const { return (_flags & FLAG_IS_VIDEO) > 0; } inline bool Packet::isKeyFrame() const { return (_flags & FLAG_IS_KEY) > 0; } inline Packet::Ptr Packet::clone() { return new Packet(*this); } inline uint32_t Packet::length() { return _length; } inline uint64_t Packet::pts() { return _pts; } inline uint64_t Packet::dts() { return _dts; } inline uint32_t Packet::flags() { return _flags; } inline const SerialCode& Packet::serialCode() { return _code; } inline Poco::SharedPtr& Packet::sharedData() { return _pData; } } } #endif