Debian Codegraph @

examples/dynamic_changing_element/main.cc

raw symbols SCIP
1 /*
2 * main.cc
3 *
4 * Created on: Aug 14, 2013
5 * Author: m.kolny
6 *
7 * based on sample described here: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-dynamic-pipelines.html
8 */
9
10 #include <gstreamermm.h>cxx . . $ `<file>/gstreamer/gstreamermm.h`/
11 #include <glibmm/main.h>
12 #include <iostream>
13 #include <vector>
14
15 using namespace Gst;
16 using Glibcxx . . $ Glib/::RefPtrcxx . . $ RefPtr#;
17
18 RefPtrcxx . . $ RefPtr#<Padcxx . . $ Gst/Pad#> blockpadcxx . . $ blockpad.;
19 RefPtrcxx . . $ RefPtr#<Elementcxx . . $ Gst/Element#> conv_beforecxx . . $ conv_before.,
20 conv_aftercxx . . $ conv_after.,
21 curr_effectcxx . . $ curr_effect.;
22 RefPtrcxx . . $ RefPtr#<Pipelinecxx . . $ Gst/Pipeline#> pipelinecxx . . $ pipeline.;
23 stdcxx . . $ std/::vectorcxx . . $ std/vector#<Glibcxx . . $ Glib/::ustringcxx . . $ Glib/ustring#> effectscxx . . $ effects. = {cxx . . $ std/vector#vector(9619226211e5a241)."identity", "exclusion",
24 "navigationtest", "agingtv", "videoflip", "vertigotv",
25 "gaussianblur", "shagadelictv", "edgetv"};
26 int curr_positioncxx . . $ curr_position. = 0;
27
28 RefPtrcxx . . $ RefPtr#<Glibcxx . . $ Glib/::MainLoopcxx . . $ Glib/MainLoop#> main_loopcxx . . $ main_loop.;
29
30 PadProbeReturncxx . . $ Gst/PadProbeReturn# event_probe_cbcxx . . $ event_probe_cb(8c6c12be51149d36). (const RefPtrcxx . . $ RefPtr#<Padcxx . . $ Gst/Pad#>& pad, const PadProbeInfocxx . . $ Gst/PadProbeInfo#& info)
31 {
32 RefPtrcxx . . $ RefPtr#<Eventcxx . . $ Gst/Event#> event = infocxx . . $ Glib/RefPtr#RefPtr(73f8e0eb4f2c32)..get_eventcxx . . $ Gst/PadProbeInfo#get_event(a38918fb3090d59d).();
33 if (event->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).get_event_typecxx . . $ Gst/Event#get_event_type(3bd2194af709aed6).()!= EVENT_EOScxx . . $ Gst/EVENT_EOS.)
34 return PAD_PROBE_OKcxx . . $ Gst/PAD_PROBE_OK.;
35
36 pad->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).remove_probecxx . . $ Gst/Pad#remove_probe(2c44cd906ae4e829).(info.get_idcxx . . $ Gst/PadProbeInfo#get_id(fe4d2d262d4164a8).());
37
38 curr_effectcxx . . $ curr_effect.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).set_statecxx . . $ Gst/Element#set_state(17bf573d41f9253f).(STATE_NULLcxx . . $ Gst/STATE_NULL.);
39 pipelinecxx . . $ pipeline.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).removecxx . . $ Gst/Bin#remove(25e1dc1b4b432bb3).(curr_effectcxx . . $ curr_effect.);
40 curr_effectcxx . . $ curr_effect. =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). ElementFactorycxx . . $ Gst/ElementFactory#::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).(effectscxx . . $ effects.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).curr_positioncxx . . $ curr_position.++ % effectscxx . . $ effects..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).()]);
41 pipelinecxx . . $ pipeline.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(curr_effectcxx . . $ curr_effect.);
42 conv_beforecxx . . $ conv_before.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(curr_effectcxx . . $ curr_effect.)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(conv_aftercxx . . $ conv_after.);
43 curr_effectcxx . . $ curr_effect.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).set_statecxx . . $ Gst/Element#set_state(17bf573d41f9253f).(STATE_PLAYINGcxx . . $ Gst/STATE_PLAYING.);
44
45 return PAD_PROBE_DROPcxx . . $ Gst/PAD_PROBE_DROP.;
46 }
47
48 PadProbeReturncxx . . $ Gst/PadProbeReturn# pad_probe_cbcxx . . $ pad_probe_cb(8c6c12be51149d36).(const RefPtrcxx . . $ RefPtr#<Padcxx . . $ Gst/Pad#>& pad, const PadProbeInfocxx . . $ Gst/PadProbeInfo#& info)
49 {
50 pad->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).remove_probecxx . . $ Gst/Pad#remove_probe(2c44cd906ae4e829).(info.get_idcxx . . $ Gst/PadProbeInfo#get_id(fe4d2d262d4164a8).());
51
52 RefPtrcxx . . $ RefPtr#<Padcxx . . $ Gst/Pad#> srcpad = curr_effectcxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).get_static_padcxx . . $ Gst/Element#get_static_pad(d41a58e7b5052139).("src"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).);
53 srcpad->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).add_probecxx . . $ Gst/Pad#add_probe(ae80ce1fbdc3b914).(PAD_PROBE_TYPE_BLOCKcxx . . $ Gst/PAD_PROBE_TYPE_BLOCK. |cxx . . $ Gst/`operator|`(e83125ca27815e3). PAD_PROBE_TYPE_EVENT_DOWNSTREAMcxx . . $ Gst/PAD_PROBE_TYPE_EVENT_DOWNSTREAM., sigccxx . . $ sigc/slot#slot(edcd8b2679e9bd1a).::ptr_funcxx . . $ sigc/ptr_fun(1a86a404afb7766).(event_probe_cbcxx . . $ event_probe_cb(8c6c12be51149d36).));
54 RefPtrcxx . . $ RefPtr#<Padcxx . . $ Gst/Pad#> sinkpad = curr_effectcxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).get_static_padcxx . . $ Gst/Element#get_static_pad(d41a58e7b5052139).("sink"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).);
55 sinkpad->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).send_eventcxx . . $ Gst/Pad#send_event(9ae445a8aac77a84).(EventEoscxx . . $ Glib/RefPtr#RefPtr(5d20f00e530d62cc).::createcxx . . $ Gst/EventEos#create(16951bc4a2f22253).());
56 return PAD_PROBE_OKcxx . . $ Gst/PAD_PROBE_OK.;
57 }
58
59 bool on_bus_messagecxx . . $ on_bus_message(f80753751e77bf04).(const Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Gstcxx . . $ Gst/::Buscxx . . $ Gst/Bus#>&,
60 const Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Gstcxx . . $ Gst/::Messagecxx . . $ Gst/Message#>& message)
61 {
62 switch (message->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).get_message_typecxx . . $ Gst/Message#get_message_type(97914d44a9bd21bb).())
63 {
64 case MESSAGE_ERRORcxx . . $ Gst/MESSAGE_ERROR.:
65 stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Error." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
66 main_loopcxx . . $ main_loop.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).quitcxx . . $ Glib/MainLoop#quit(49f6e7a06ebc5aa8).();
67 return false;
68 default:
69 break;
70 }
71
72 return true;
73 }
74 bool on_timeoutcxx . . $ on_timeout(c9857a73d68e59ba).()
75 {
76 blockpadcxx . . $ blockpad.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).add_probecxx . . $ Gst/Pad#add_probe(ae80ce1fbdc3b914).(PAD_PROBE_TYPE_BLOCK_DOWNSTREAMcxx . . $ Gst/PAD_PROBE_TYPE_BLOCK_DOWNSTREAM., sigccxx . . $ sigc/slot#slot(edcd8b2679e9bd1a).::ptr_funcxx . . $ sigc/ptr_fun(1a86a404afb7766).(&pad_probe_cbcxx . . $ pad_probe_cb(8c6c12be51149d36).));
77 return true;
78 }
79
80 int maincxx . . $ main(afcd3168fc1188a4).(int argc, char** argv)
81 {
82 initcxx . . $ Gst/init(22930d6ef54703eb).(argc, argv);
83 main_loopcxx . . $ main_loop. =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). Glibcxx . . $ Glib/::MainLoopcxx . . $ Glib/MainLoop#::createcxx . . $ Glib/MainLoop#create(748caac81bf5da26).();
84
85 pipelinecxx . . $ pipeline. =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). Pipelinecxx . . $ Gst/Pipeline#::createcxx . . $ Gst/Pipeline#create(4db98da4abd65927).("effects-pipeline"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).);
86
87 RefPtrcxx . . $ RefPtr#<Elementcxx . . $ Gst/Element#> src = ElementFactorycxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("videotestsrc"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).),
88 sink = ElementFactorycxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("xvimagesink"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).);
89
90 conv_beforecxx . . $ conv_before. =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). ElementFactorycxx . . $ Gst/ElementFactory#::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("videoconvert"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).);
91 curr_effectcxx . . $ curr_effect. =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). ElementFactorycxx . . $ Gst/ElementFactory#::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).(effectscxx . . $ effects.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).curr_positioncxx . . $ curr_position.++]);
92 conv_aftercxx . . $ conv_after. =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). ElementFactorycxx . . $ Gst/ElementFactory#::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("videoconvert"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).);
93
94 blockpadcxx . . $ blockpad. =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). src->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).get_static_padcxx . . $ Gst/Element#get_static_pad(d41a58e7b5052139).("src"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).);
95 src->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).propertycxx . . $ Gst/Element#property(93010079bf2a4b1e).("is-live"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9)., true);
96
97 pipelinecxx . . $ pipeline.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(src)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(conv_beforecxx . . $ conv_before.)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(curr_effectcxx . . $ curr_effect.)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(conv_aftercxx . . $ conv_after.)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(sink);
98 src->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(conv_beforecxx . . $ conv_before.)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(curr_effectcxx . . $ curr_effect.)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(conv_aftercxx . . $ conv_after.)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(sink);
99
100 RefPtrcxx . . $ RefPtr#<Buscxx . . $ Gst/Bus#> bus = pipelinecxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).get_buscxx . . $ Gst/Pipeline#get_bus(ada66d6ded80d30d).();
101 bus->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).add_watchcxx . . $ Gst/Bus#add_watch(125cf56d22b1e63d).(sigccxx . . $ sigc/slot#slot(edcd8b2679e9bd1a).::ptr_funcxx . . $ sigc/ptr_fun(1a86a404afb7766).(on_bus_messagecxx . . $ on_bus_message(f80753751e77bf04).));
102
103 pipelinecxx . . $ pipeline.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).set_statecxx . . $ Gst/Element#set_state(17bf573d41f9253f).(STATE_PLAYINGcxx . . $ Gst/STATE_PLAYING.);
104
105 Glibcxx . . $ Glib/::signal_timeoutcxx . . $ Glib/signal_timeout(66f5cf45299e0490).().connectcxx . . $ Glib/SignalTimeout#connect(c26b6904efe464be).(sigccxx . . $ sigc/slot#slot(edcd8b2679e9bd1a).::ptr_funcxx . . $ sigc/ptr_fun(9a3273562c8d4a7e).(&on_timeoutcxx . . $ on_timeout(c9857a73d68e59ba).), 1000);
106 main_loopcxx . . $ main_loop.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).runcxx . . $ Glib/MainLoop#run(49f6e7a06ebc5aa8).();
107
108 pipelinecxx . . $ pipeline.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).set_statecxx . . $ Gst/Element#set_state(17bf573d41f9253f).(STATE_NULLcxx . . $ Gst/STATE_NULL.);
109
110 return 0;
111 }
112
113