summaryrefslogtreecommitdiff
blob: b347d4ce42614656352d48bf753a6f8ba0f22613 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Author: Philip Rinn <rinni@inventati.org>
Description: Prevent crash when generating keyframes with gstreamermm 0.10.11
--- a/plugins/actions/keyframesmanagement/keyframesgenerator.cc
+++ b/plugins/actions/keyframesmanagement/keyframesgenerator.cc
@@ -87,12 +87,20 @@
 			if(structure_name.find("video") == Glib::ustring::npos)
 				return Glib::RefPtr<Gst::Element>(NULL);
 
-			Glib::RefPtr<Gst::Bin> videobin = Glib::RefPtr<Gst::Bin>::cast_dynamic(
-					Gst::Parse::create_bin(
-						"ffmpegcolorspace ! fakesink name=vsink", true));
+			// ffmpegcolorspace
+			Glib::RefPtr<Gst::Element> conv = Gst::ElementFactory::create_element("ffmpegcolorspace", "conv");
+			// fakesink
+			Glib::RefPtr<Gst::FakeSink> vsink = Gst::FakeSink::create("vsink");
+			// videobin
+			Glib::RefPtr<Gst::Bin> videobin = Gst::Bin::create("videobin");
 
-			Glib::RefPtr<Gst::FakeSink> vsink = Glib::RefPtr<Gst::FakeSink>::cast_dynamic(
-					videobin->get_element("vsink"));
+			// Add and link
+			videobin->add(conv)->add(vsink);
+			conv->link_pads("src", vsink, "sink");
+
+			// Add sink pad to bin element
+			Glib::RefPtr<Gst::Pad> pad = conv->get_static_pad("sink");
+			videobin->add_pad(Gst::GhostPad::create(pad, "sink"));
 
 			vsink->set_sync(false);
 			vsink->property_silent() = true;