33 lines
833 B
C++
33 lines
833 B
C++
#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_;
|
|
};
|