75 lines
1.9 KiB
C++
75 lines
1.9 KiB
C++
#ifndef ED3217CD_F637_44D5_A6D9_E7AE0B9C3A4D
|
|
#define ED3217CD_F637_44D5_A6D9_E7AE0B9C3A4D
|
|
/*
|
|
*******************************************************************************
|
|
* INCLUDE
|
|
*******************************************************************************
|
|
*/
|
|
#include "VideoComponent.h"
|
|
#include "CodecID.h"
|
|
#include "util/FactoryManager.h"
|
|
#include "util/Task.h"
|
|
#include <Poco/SharedPtr.h>
|
|
#include <functional>
|
|
|
|
namespace Video
|
|
{
|
|
namespace Core
|
|
{
|
|
/*
|
|
*******************************************************************************
|
|
* CLASS DECLARE
|
|
*******************************************************************************
|
|
*/
|
|
class VideoEncoderSelector
|
|
{
|
|
public:
|
|
static CodecID select(CodecID codecID)
|
|
{
|
|
return codecID;
|
|
}
|
|
};
|
|
|
|
class VideoEncoder: public VideoComponent,
|
|
public ::Util::FactoryManager<VideoEncoder, CodecID, VideoEncoderSelector, CodecID>
|
|
{
|
|
public:
|
|
using Ptr = Poco::AutoPtr<VideoEncoder>;
|
|
|
|
public:
|
|
VideoEncoder(const std::string& name, CodecID codecID);
|
|
virtual ~VideoEncoder();
|
|
|
|
public:
|
|
CONFIGURABLE_DECLARE_PARAMETER(CodecID, CodecID);
|
|
CONFIGURABLE_DECLARE_PARAMETER(CodecProfile, CodecProfile);
|
|
CONFIGURABLE_DECLARE_PARAMETER(Bitrate, int64_t);
|
|
CONFIGURABLE_DECLARE_PARAMETER(GOP, int);
|
|
CONFIGURABLE_DECLARE_PARAMETER(GOPMode, GOPMode);
|
|
CONFIGURABLE_DECLARE_PARAMETER(BitrateControl, BitrateControl);
|
|
|
|
CONFIGURABLE_DECLARE_PARAMETER(Adaptable, bool);
|
|
|
|
protected:
|
|
void start() override;
|
|
void stop() override;
|
|
|
|
virtual Packet::Ptr encode(Frame::Ptr pFrame);
|
|
Frame::Ptr readFrame(uint32_t timeout = 4000);
|
|
|
|
void onLink(Core::Component::Ptr pPrevious) override;
|
|
void onUnlink(Core::Component::Ptr pPrevious) override;
|
|
|
|
Util::Task& task();
|
|
|
|
private:
|
|
Util::Task _task;
|
|
};
|
|
|
|
inline Util::Task& VideoEncoder::task()
|
|
{
|
|
return _task;
|
|
}
|
|
}
|
|
}
|
|
#endif
|