提交 6d66d110 编写于 作者: D Dirk Van Haerenborgh

gstreamer: cleaning up resources

上级 1acbc7b7
......@@ -1030,6 +1030,19 @@ void CvVideoWriter_GStreamer::close()
handleMessage(pipeline);
gst_object_unref (GST_OBJECT (pipeline));
if (source)
gst_object_unref (GST_OBJECT (source));
if (encodebin)
gst_object_unref (GST_OBJECT (encodebin));
if (file)
gst_object_unref (GST_OBJECT (file));
if (buffer)
gst_object_unref (GST_OBJECT (buffer));
}
}
......@@ -1155,6 +1168,35 @@ bool CvVideoWriter_GStreamer::open( const char * filename, int fourcc,
source = gst_bin_get_by_name(GST_BIN(encodebin), "appsrc0");
}
// GstIterator *it = gst_bin_iterate_sources (GST_BIN(encodebin));
// gboolean done = FALSE;
// GstElement *item = NULL;
// while (!done) {
// switch (gst_iterator_next (it, &item)) {
// case GST_ITERATOR_OK:
// source = item;
// gst_object_unref (item);
// done = TRUE;
// break;
// case GST_ITERATOR_RESYNC:
// gst_iterator_resync (it);
// break;
// case GST_ITERATOR_ERROR:
// done = TRUE;
// break;
// case GST_ITERATOR_DONE:
// done = TRUE;
// break;
// }
// }
// gst_iterator_free (it);
if (!source){
CV_ERROR(CV_StsError, "GStreamer: cannot find appsrc in manual pipeline\n");
return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册