GrabBag/Module/FFMediaStream/_Inc/CVrFFMediaPusher.h

43 lines
1.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include "IVrFFMediaPusher.h"
#include <atomic>
#include <mutex>
#include <memory>
// ffmedia 头(仅在 Linux/RK3588 平台真正可用)
#if !defined(FFMEDIA_PLATFORM_DUMMY)
#include "module/vi/module_memReader.hpp"
#include "module/vp/module_mppenc.hpp"
#include "module/vo/module_rtspServer.hpp"
#include "module/vp/module_rga.hpp"
#endif
class CVrFFMediaPusher : public IVrFFMediaPusher
{
public:
CVrFFMediaPusher();
~CVrFFMediaPusher() override;
int Init(const VrFFPushConfig& config) override;
int Start() override;
int PushFrame(const void* data, size_t size, int64_t ptsUs = 0) override;
int Stop() override;
int UnInit() override;
std::string GetRtspUrl(const std::string& localIp) const override;
private:
VrFFPushConfig m_config;
std::atomic<bool> m_bStarted{false};
std::atomic<bool> m_bInited{false};
std::mutex m_mutex;
int64_t m_lastPtsUs{0};
#if !defined(FFMEDIA_PLATFORM_DUMMY)
std::shared_ptr<ModuleMemReader> m_memReader;
std::shared_ptr<ModuleRga> m_rga; // 输入格式转 NV12若非 NV12
std::shared_ptr<ModuleMppEnc> m_encoder;
std::shared_ptr<ModuleRtspServer> m_rtspServer;
#endif
};