This commit is contained in:
PodmogilnyjIvan
2021-12-03 03:54:58 -08:00
commit 988ab528af
11 changed files with 1832 additions and 0 deletions

40
gst_get_ndi.h Normal file
View File

@@ -0,0 +1,40 @@
#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 }
};