2021-01-11 15:57:14 +01:00
|
|
|
#pragma once
|
2020-10-22 16:54:50 +02:00
|
|
|
|
2021-12-05 17:52:25 +01:00
|
|
|
#include <stdio.h>
|
2020-10-22 16:54:50 +02:00
|
|
|
#include <gst/gst.h>
|
2021-01-11 15:57:14 +01:00
|
|
|
#include <gst/app/gstappsrc.h>
|
2023-02-07 21:43:14 +01:00
|
|
|
#include <gst/video/video.h>
|
2020-10-22 16:54:50 +02:00
|
|
|
|
2023-09-06 19:12:41 +02:00
|
|
|
#define GLIB_CHECK_VERSION(major,minor,micro) \
|
|
|
|
(GLIB_MAJOR_VERSION > (major) || \
|
|
|
|
(GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION > (minor)) || \
|
|
|
|
(GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION == (minor) && \
|
|
|
|
GLIB_MICRO_VERSION >= (micro)))
|
|
|
|
|
|
|
|
// g_memdup2 was added in glib 2.67.4, maintain compatibility with older versions
|
|
|
|
#if !GLIB_CHECK_VERSION(2, 67, 4)
|
|
|
|
#define g_memdup2 g_memdup
|
|
|
|
#endif
|
|
|
|
|
2021-12-05 18:16:26 +01:00
|
|
|
typedef struct GstPipelineCtx {
|
|
|
|
int pipelineId;
|
|
|
|
GstElement *pipeline;
|
2021-12-05 22:06:42 +01:00
|
|
|
GstElement *appsink;
|
|
|
|
GstElement *appsrc;
|
2021-12-05 18:16:26 +01:00
|
|
|
} GstPipelineCtx;
|
|
|
|
|
2023-02-14 21:19:02 +01:00
|
|
|
extern void goHandlePipelineBuffer(int pipelineId, void *buffer, int bufferLen, guint64 duration, gboolean deltaUnit);
|
|
|
|
extern void goPipelineLog(int pipelineId, char *level, char *msg);
|
2020-10-22 16:54:50 +02:00
|
|
|
|
2021-12-05 18:16:26 +01:00
|
|
|
GstPipelineCtx *gstreamer_pipeline_create(char *pipelineStr, int pipelineId, GError **error);
|
|
|
|
void gstreamer_pipeline_attach_appsink(GstPipelineCtx *ctx, char *sinkName);
|
2021-12-05 22:06:42 +01:00
|
|
|
void gstreamer_pipeline_attach_appsrc(GstPipelineCtx *ctx, char *srcName);
|
2021-12-05 18:16:26 +01:00
|
|
|
void gstreamer_pipeline_play(GstPipelineCtx *ctx);
|
|
|
|
void gstreamer_pipeline_pause(GstPipelineCtx *ctx);
|
|
|
|
void gstreamer_pipeline_destory(GstPipelineCtx *ctx);
|
2021-12-05 22:06:42 +01:00
|
|
|
void gstreamer_pipeline_push(GstPipelineCtx *ctx, void *buffer, int bufferLen);
|
2021-11-28 22:19:06 +01:00
|
|
|
|
2022-09-10 23:18:16 +02:00
|
|
|
gboolean gstreamer_pipeline_set_prop_int(GstPipelineCtx *ctx, char *binName, char *prop, gint value);
|
|
|
|
gboolean gstreamer_pipeline_set_caps_framerate(GstPipelineCtx *ctx, const gchar* binName, gint numerator, gint denominator);
|
|
|
|
gboolean gstreamer_pipeline_set_caps_resolution(GstPipelineCtx *ctx, const gchar* binName, gint width, gint height);
|
2023-02-07 21:43:14 +01:00
|
|
|
gboolean gstreamer_pipeline_emit_video_keyframe(GstPipelineCtx *ctx);
|