可以通过appsrc将外部的数据添加到gstreamer 的 pipeline中,下面链接是appsrc 的一些说明(可能需要翻墙才能打开,其中还有appsink的一些说明和例子)
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-data-spoof.html
下面是其中的一例子
#include <gst/gst.h>
static GMainLoop *loop;
static void
cb_need_data (GstElement *appsrc,
guint unused_size,
gpointer user_data)
{
static gboolean white = FALSE;
static GstClockTime timestamp = 0;
GstBuffer *buffer;
guint size;
GstFlowReturn ret;
size = 385 * 288 * 2;
buffer = gst_buffer_new_allocate (NULL, size, NULL);
/* this makes the image black/white */
gst_buffer_memset (buffer, 0, white ? 0xff : 0x0, size);
white = !white;
GST_BUFFER_PTS (buffer) = timestamp;
GST_BUFFER_DURATION (buffer) = gst_util_uint64_scale_int (1, GST_SECOND, 2);
timestamp += GST_BUFFER_DURATION (buffer);
g_signal_emit_by_name (appsrc, "push-buffer"

本文介绍了如何利用GStreamer的appsrc元素将外部数据整合到管道中,通过提供一个示例来阐述其用法,并强调了正确释放内存的重要性,避免长时间运行导致内存占用不断增加。
最低0.47元/天 解锁文章
3454

被折叠的 条评论
为什么被折叠?



