44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
/*
|
|
* VizionStreamer - Streaming Engine Interface
|
|
* Copyright (c) 2025 Maik Jurischka
|
|
*
|
|
* Licensed under CC BY-NC-SA 4.0
|
|
* https://creativecommons.org/licenses/by-nc-sa/4.0/
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <vizionsdk/VizionSDK.h>
|
|
#include "GStreamerPipeline.h"
|
|
#include <memory>
|
|
#include <thread>
|
|
#include <atomic>
|
|
#include <mutex>
|
|
|
|
class StreamingEngine {
|
|
public:
|
|
explicit StreamingEngine(std::shared_ptr<VxCamera> camera);
|
|
~StreamingEngine();
|
|
|
|
bool start(const std::string& gstPipeline);
|
|
void stop();
|
|
[[nodiscard]] bool isRunning() const { return running_; }
|
|
|
|
void setFormat(const VxFormat& format);
|
|
[[nodiscard]] VxFormat getCurrentFormat() const { return currentFormat_; }
|
|
|
|
void setPipelineDescription(const std::string& pipeline);
|
|
|
|
private:
|
|
void acquisitionLoop();
|
|
|
|
std::shared_ptr<VxCamera> camera_;
|
|
std::unique_ptr<GStreamerPipeline> gstPipeline_;
|
|
std::unique_ptr<std::thread> acquisitionThread_;
|
|
std::atomic<bool> running_;
|
|
std::mutex mutex_;
|
|
VxFormat currentFormat_;
|
|
std::unique_ptr<uint8_t[]> buffer_;
|
|
size_t bufferSize_;
|
|
};
|