add GStreamer
This commit is contained in:
32
GStreamerPipeline.h
Normal file
32
GStreamerPipeline.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/app/gstappsrc.h>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
class GStreamerPipeline {
|
||||
public:
|
||||
explicit GStreamerPipeline(const std::string& pipelineDescription);
|
||||
~GStreamerPipeline();
|
||||
|
||||
bool start();
|
||||
void stop();
|
||||
bool pushBuffer(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_;
|
||||
};
|
||||
Reference in New Issue
Block a user