Debian Codegraph @

tests/integration/pluginbin.h

raw symbols SCIP
1 /*
2 * pluginbin.h
3 *
4 * Created on: 8 sie 2013
5 * Author: loganek
6 */
7
8 #ifndef TESTS_INTEGRATION_PLUGINBIN_H_
9 #define TESTS_INTEGRATION_PLUGINBIN_H_
10
11 #include <gstreamermm.h>
12 #include <gstreamermm/private/bin_p.h>
13 #include <cstdio>
14 #include <sys/stat.h>
15
16 class PluginBin: public Gst::Bin
17 {
18 private:
19 Glib::RefPtr<Gst::GhostPad> srcpad;
20 Glib::Property<Glib::ustring> location;
21
22 public:
23 static void class_init(Gst::ElementClass<PluginBin> *klass)
24 {
25 klass->set_metadata("Custom test bin", "test/bins", "test bin", "author");
26 }
27
28 explicit PluginBin(GstBin *gobj)
29 : Glib::ObjectBase(typeid (PluginBin)),
30 Gst::Bin(gobj),
31 location(*this, "location")
32 {
33 add_pad(srcpad = Gst::GhostPad::create( Gst::PadTemplate::create("src", Gst::PAD_SRC, Gst::PAD_ALWAYS,
34 Gst::Caps::create_any()), "src"));
35 }
36
37 static bool register_pluginbin(Glib::RefPtr<Gst::Plugin> plugin)
38 {
39 Gst::ElementFactory::register_element(plugin, "pluginbin", 10,
40 Gst::register_mm_type<PluginBin>("pluginbin"));
41
42 return true;
43 }
44
45 virtual ~PluginBin() { }
46
47 virtual Gst::StateChangeReturn change_state_vfunc(Gst::StateChange transition)
48 {
49 if (transition == Gst::STATE_CHANGE_NULL_TO_READY)
50 {
51 Glib::RefPtr<Gst::Element> source_file = Gst::ElementFactory::create_element("filesrc", "source-file");
52 Glib::RefPtr<Gst::Element> png_decoder = Gst::ElementFactory::create_element("pngdec");
53 Glib::ustring str = "resources/input-image.png";
54 source_file->set_property("location", location.get_value());
55
56 add(source_file);
57 add(png_decoder);
58 source_file->link(png_decoder);
59
60 srcpad->set_target(png_decoder->get_static_pad("src"));
61 }
62
63 return Bin::change_state_vfunc(transition);
64 }
65 };
66
67 #endif /* TESTS_INTEGRATION_PLUGINBIN_H_ */