我正在编写一个简单的应用程序gstreamer-1.0
,我想接收流经管道的缓冲区回到我的应用程序。为此,我appsink
在管道末端使用插件。
到目前为止,一切正常,但是当我想接收缓冲区时,我得到了这些错误
(应用程序:31759):GLib-GObject-CRITICAL **:g_signal_emit_by_name:断言“G_TYPE_CHECK_INSTANCE(实例)”失败
和
(app:31759): GLib-GObject-WARNING **: 具有无效 (NULL) 类指针的实例
这是我写的代码
typedef struct _AllElements
{
GstElement *pipeline;
...
GstElement *appsink;
} AllElements;
static void new_sample (AllElements *element)
{
GstSample *sample = NULL;
/* Retrieve the buffer */
g_signal_emit_by_name (element->appsink, "pull-sample", &sample,NULL);
if (sample)
{
g_print ("*");
gst_sample_unref (sample);
}
}
int main(int argc, char *argv[])
{
Allelemets element;
... // making and linking all the elements
g_object_set (G_OBJECT (element.appsink), "sync", TRUE, NULL);
g_object_set (element.appsink, "emit-signals", TRUE, NULL);
g_signal_connect (element.appsink, "new-sample", G_CALLBACK (new_sample), &element);
...
gst_element_set_state (element.pipeline, GST_STATE_PLAYING);
...
return 0;
}
有谁可以帮我解决这个问题?谢谢大家 !