迁移代码。

This commit is contained in:
2025-03-16 23:51:25 +08:00
parent dd97037629
commit 0684c0fbc5
16 changed files with 28 additions and 67 deletions

View File

@ -1,7 +1,8 @@
find_package(OpenSSL REQUIRED)
add_executable(PassengerStatistics main.cpp
DetectAlgorithm.h DetectAlgorithm.cpp
ImageUtilities.h ImageUtilities.cpp
Live555RtspPusher.h Live555RtspPusher.cpp
RtspServer.h RtspServer.cpp
VideoInput.h VideoInput.cpp
)
@ -22,12 +23,14 @@ target_link_directories(PassengerStatistics
)
target_link_libraries(PassengerStatistics
PRIVATE Universal
PRIVATE ${OPENSSL_LIBRARIES}
PRIVATE Kylin::Core
PRIVATE OpenSSL::SSL
PRIVATE OpenSSL::Crypto
PRIVATE rw_mpp
PRIVATE ds_pedestrian_mot_Hi3516DV500
PRIVATE mk_api
PRIVATE opencv_core
PRIVATE opencv_imgcodecs
PRIVATE opencv_imgproc
PRIVATE ${SCTP_LIBRARIES}
)

View File

@ -1,5 +1,5 @@
#include "DetectAlgorithm.h"
#include "BoostLog.h"
#include "Core/Logger.h"
#include "ImageUtilities.h"
#include <ds_pedestrian_mot_hisi.h>
#include <filesystem>

View File

@ -1,12 +0,0 @@
#include "Live555RtspPusher.h"
Live555RtspPusher::Live555RtspPusher(boost::asio::io_context &ioContext) : m_ioContext(ioContext), m_socket(ioContext) {
using boost::asio::ip::udp;
m_socket.open(udp::v4());
}
void Live555RtspPusher::push(const uint8_t *data, uint32_t size) {
using boost::asio::ip::udp;
udp::endpoint point(udp::v4(), 6666);
m_socket.send_to(boost::asio::const_buffer(data, size), point);
}

View File

@ -1,16 +0,0 @@
#ifndef __LIVE555RTSPPUSHER_H__
#define __LIVE555RTSPPUSHER_H__
#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/udp.hpp>
class Live555RtspPusher {
public:
Live555RtspPusher(boost::asio::io_context &ioContext);
void push(const uint8_t *data, uint32_t size);
private:
boost::asio::io_context &m_ioContext;
boost::asio::ip::udp::socket m_socket;
};
#endif // __LIVE555RTSPPUSHER_H__

View File

@ -1,5 +1,5 @@
#include "VideoInput.h"
#include "BoostLog.h"
#include "Core/Logger.h"
#include "DetectAlgorithm.h"
#include "rw_mpp_api.h"
#include <chrono>

View File

@ -1,7 +1,7 @@
#include "BoostLog.h"
#include "DateTime.h"
#include "IoContext.h"
#include "Live555RtspPusher.h"
#include "Core/DateTime.h"
#include "Core/IoContext.h"
#include "Core/Logger.h"
#include "Core/Singleton.h"
#include "RtspServer.h"
#include "VideoInput.h"
#include "rw_mpp_api.h"
@ -9,6 +9,7 @@
#include <fstream>
int main(int argc, char const *argv[]) {
using namespace Core;
LOG(info) << "app start...";
int status = rw_mpp__init();
if (status != 0) {
@ -16,8 +17,7 @@ int main(int argc, char const *argv[]) {
return -1;
}
try {
auto ioContext = Amass::Singleton<IoContext>::instance<Amass::Construct>();
auto pusher = std::make_shared<Live555RtspPusher>(*ioContext->ioContext());
auto ioContext = Singleton<IoContext>::construct(std::thread::hardware_concurrency());
auto rtsp = std::make_shared<RtspServer>();
std::shared_ptr<std::ofstream> ofs;
@ -44,7 +44,7 @@ int main(int argc, char const *argv[]) {
ioContext->ioContext()->stop();
});
ioContext->run<IoContext::Mode::Synchronous>();
ioContext->run(false);
} catch (const boost::exception &e) {
LOG(error) << "error";
} catch (const std::exception &e) {