我一直在关注许多关于将图像推送到 Gstreamer 管道的示例,但仍然无法使我的代码工作。
任何建议(除了告诉我尝试使用 Gstreamer1.0 而不是 0.10)将不胜感激。我想了解以下appsrc使用 jpeg 图像提供元素的脚本有什么问题。稍后我将使用相同的代码来提供我从相机获取的 openCv 图像,但首先我想通过使这个简单的示例工作来了解基础知识。
#include <gst/gst.h>
#include <string.h>
#include <cv.h>
#include <highgui.h>
#include <stdio.h>
#define VIDEO_CAPS "video/x-raw-rgb,bpp=8,depth=8,width=640,height=360,framerate=5/1,red_mask=224,green_mask=28,blue_mask=3,endianness=1234;"
/* Structure to contain all our information, so we can pass it to callbacks */
guint64 imagecounter=1;
typedef struct _CustomData {
GstElement *pipeline, *app_source;
GstElement *video_convert, *video_sink;
GstElement *image_manage;
guint64 num_samples; /* Number of samples generated so far (for timestamp generation) */
guint sourceid; /* To control the GSource */
GMainLoop *main_loop; /* GLib's …Run Code Online (Sandbox Code Playgroud)