整理代码

This commit is contained in:
蒲爽 2026-09-28 21:33:04 +08:00
commit c7b4e178ec
364 changed files with 59691 additions and 0 deletions

75
video/core/VideoEncoder.h Normal file
View file

@ -0,0 +1,75 @@
#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