highgui: fix segfault on CvCapture_GStreamer::open

when compiled with GStreamer, open (of a file) segfaults.

Fix was suggested by Bostjan Vesnicer.
This commit is contained in:
Éric Piel 2012-12-15 12:11:13 +01:00
parent 9b09f09b9a
commit 7701fa7a63

View File

@ -399,12 +399,12 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
gst_app_sink_set_max_buffers (GST_APP_SINK(sink), 1); gst_app_sink_set_max_buffers (GST_APP_SINK(sink), 1);
gst_app_sink_set_drop (GST_APP_SINK(sink), stream); gst_app_sink_set_drop (GST_APP_SINK(sink), stream);
caps = gst_caps_new_simple("video/x-raw-rgb",
gst_app_sink_set_caps(GST_APP_SINK(sink), gst_caps_new_simple("video/x-raw-rgb", "red_mask", G_TYPE_INT, 0x0000FF,
"red_mask", G_TYPE_INT, 0x0000FF, "green_mask", G_TYPE_INT, 0x00FF00,
"green_mask", G_TYPE_INT, 0x00FF00, "blue_mask", G_TYPE_INT, 0xFF0000,
"blue_mask", G_TYPE_INT, 0xFF0000, NULL);
NULL)); gst_app_sink_set_caps(GST_APP_SINK(sink), caps);
gst_caps_unref(caps); gst_caps_unref(caps);
if(gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_READY) == if(gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_READY) ==