41 lines
1018 B
C++
41 lines
1018 B
C++
/*
|
|
* VizionStreamer - GStreamer Pipeline 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 <gst/gst.h>
|
|
#include <gst/app/gstappsrc.h>
|
|
#include <string>
|
|
#include <memory>
|
|
|
|
class GStreamerPipeline {
|
|
public:
|
|
explicit GStreamerPipeline(std::string pipelineDescription);
|
|
~GStreamerPipeline();
|
|
|
|
bool start();
|
|
void stop();
|
|
bool pushBuffer(const uint8_t* data, size_t size, int width, int height, const std::string& format);
|
|
bool isRunning() const { return running_; }
|
|
|
|
void setPipelineDescription(const std::string& description);
|
|
|
|
private:
|
|
static void onNeedData(GstAppSrc* appsrc, guint unused, gpointer user_data);
|
|
static void onEnoughData(GstAppSrc* appsrc, gpointer user_data);
|
|
|
|
GstElement* pipeline_;
|
|
GstElement* appsrc_;
|
|
GstBus* bus_;
|
|
bool running_;
|
|
std::string pipelineDescription_;
|
|
int width_;
|
|
int height_;
|
|
std::string format_;
|
|
};
|