我想在使用Gstreamer的IP摄像机流上覆盖“ .png”图片。适用于我的硬件的工作管道是:
gst-launch-1.0
rtspsrc location=rtsp://user:pass@IP:port/channel latency=400 ! rtph264depay !
vpudec use-vpu-memory=false ! imxvideoconvert_ipu
! video/x-raw,format=I420 ! gdkpixbufoverlay
location=/home/user/folder/image.png offset-x=100 offset-y=100 ! overlaysink
Run Code Online (Sandbox Code Playgroud)
当我尝试用C转换此管道时,问题就来了。我为此管道编写的代码运行了,但是显示器上没有视频播放。在将管道设置为“播放”状态之前,播放器会卡住自己。这里是我的C实现的一个简单版本:
#include <gst/gst.h>
#include <glib.h>
#include <iostream>
typedef struct _CustomData {
GstElement *source;
GstElement *rtp;
GstElement *sink;
GstElement *vpudec;
GstElement *converter, *gdkpixbufoverlay, *capsfilter ;
GstBus *bus;
GstElement *pipeline;
GMainLoop *loop;
} CustomData;
static gboolean bus_call (GstBus *bus,
GstMessage *msg,
gpointer data)
{
GMainLoop *loop = (GMainLoop *) data;
switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_EOS:{
g_print ("End of stream\n"); …Run Code Online (Sandbox Code Playgroud)