This repository has been archived on 2024-05-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
cv_networking_pipeline/gst_get_ndi.h
PodmogilnyjIvan 988ab528af v0.1
2021-12-03 03:54:58 -08:00

40 lines
1.2 KiB
C++

#include <gst/gst.h>
#include <gst/app/gstappsink.h>
#include <sstream>
#include <format>
#include <gst/video/gstvideometa.h>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <mutex>
#include <fstream>
#define MY_GST_USE_OPENCV
#ifdef MY_GST_USE_OPENCV
#include "opencv2/opencv.hpp"
// TODO: use synchronized deque
std::mutex g_mutex;
std::deque<cv::Mat> frameQueue;
#endif // MY_GST_USE_OPENCV
GstFlowReturn new_preroll(GstAppSink* appsink, gpointer data);
GstFlowReturn new_sample(GstAppSink* appsink, gpointer data);
static gboolean my_bus_callback(GstBus* bus, GstMessage* message, gpointer data);
static gint repeats = 2;
static gchar* ndi_name = nullptr;
static gint use_gui = 0;
static gboolean beep = FALSE;
static GOptionEntry entries[] =
{
{ "repeats", 'r', 0, G_OPTION_ARG_INT, &repeats, "Среднее число повторений N", "N" },
{ "ndi-name", 'n', 0, G_OPTION_ARG_STRING, &ndi_name, "you can enter the string here (ndi-name)", "M" },
{ "gui", 'g', 0, G_OPTION_ARG_INT, &use_gui, "use gui", nullptr },
{ "beep", 'b', 0, G_OPTION_ARG_NONE, &beep, "Сигнал при выполнениии", NULL },
{ NULL }
};