Debian Codegraph @

examples/dynamic_changing_source/main.cc

raw symbols SCIP
1 /*
2 * main.cc
3 *
4 * Created on: Aug 19, 2013
5 * Author: m.kolny
6 */
7 #include <gstreamermm.h>cxx . . $ `<file>/gstreamer/gstreamermm.h`/
8 #include <glibmm/main.h>
9 #include <iostream>
10
11 using namespace Gst;
12 using Glibcxx . . $ Glib/::RefPtrcxx . . $ RefPtr#;
13
14 RefPtrcxx . . $ RefPtr#<Elementcxx . . $ Gst/Element#> srccxx . . $ src.;
15 RefPtrcxx . . $ RefPtr#<Elementcxx . . $ Gst/Element#> convertcxx . . $ convert.;
16 RefPtrcxx . . $ RefPtr#<Pipelinecxx . . $ Gst/Pipeline#> pipelinecxx . . $ pipeline.;
17 RefPtrcxx . . $ RefPtr#<Glibcxx . . $ Glib/::MainLoopcxx . . $ Glib/MainLoop#> main_loopcxx . . $ main_loop.;
18
19 bool on_timeoutcxx . . $ on_timeout(c9857a73d68e59ba).()
20 {
21 static int pattern = 0;
22 srccxx . . $ src.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).set_statecxx . . $ Gst/Element#set_state(17bf573d41f9253f).(STATE_NULLcxx . . $ Gst/STATE_NULL.);
23 pipelinecxx . . $ pipeline.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).removecxx . . $ Gst/Bin#remove(25e1dc1b4b432bb3).(srccxx . . $ src.);
24 srccxx . . $ src. =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). ElementFactorycxx . . $ Gst/ElementFactory#::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("videotestsrc"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).);
25 pattern = (pattern == 0) ? 18 : 0;
26 srccxx . . $ src.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).propertycxx . . $ Gst/Element#property(93010079bf2a4b1e).("pattern"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9)., pattern);
27 pipelinecxx . . $ pipeline.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(srccxx . . $ src.);
28 srccxx . . $ src.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(convertcxx . . $ convert.);
29 srccxx . . $ src.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).set_statecxx . . $ Gst/Element#set_state(17bf573d41f9253f).(STATE_PLAYINGcxx . . $ Gst/STATE_PLAYING.);
30
31 return true;
32 }
33
34 int maincxx . . $ main(afcd3168fc1188a4).(int argc, char** argv)
35 {
36 if (argc < 2)
37 {
38 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Usage: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). argv[0] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " <avi output filename>" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
39 return 1;
40 }
41
42 initcxx . . $ Gst/init(22930d6ef54703eb).(argc, argv);
43 main_loopcxx . . $ main_loop. =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). Glibcxx . . $ Glib/::MainLoopcxx . . $ Glib/MainLoop#::createcxx . . $ Glib/MainLoop#create(748caac81bf5da26).();
44
45 pipelinecxx . . $ pipeline. =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). Pipelinecxx . . $ Gst/Pipeline#::createcxx . . $ Gst/Pipeline#create(4db98da4abd65927).("effects-pipeline"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).);
46
47 if (!pipelinecxx . . $ pipeline.)
48 {
49 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Cannot create pipeline element." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
50 return 1;
51 }
52
53 RefPtrcxx . . $ RefPtr#<Elementcxx . . $ Gst/Element#> queue1 = ElementFactorycxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("queue"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).),
54 queue2 = ElementFactorycxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("queue"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).),
55 tee = ElementFactorycxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("tee"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).),
56 autosink = ElementFactorycxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("autovideosink"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).),
57 sink = ElementFactorycxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("filesink"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).),
58 muxer = ElementFactorycxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("avimux"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).);
59
60 srccxx . . $ src. =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). ElementFactorycxx . . $ Gst/ElementFactory#::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("videotestsrc"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).);
61 srccxx . . $ src.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).propertycxx . . $ Gst/Element#property(93010079bf2a4b1e).<int>("num-buffers"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9)., 100);
62 sink->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).propertycxx . . $ Gst/Element#property(93010079bf2a4b1e).<Glibcxx . . $ Glib/::ustringcxx . . $ Glib/ustring#>("location"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9)., argvcxx . . $ Glib/ustring#ustring(85c52e162fed56f9).[1]);
63 convertcxx . . $ convert. =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). ElementFactorycxx . . $ Gst/ElementFactory#::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("videoconvert"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).);
64
65 if (!queue1 || !queue2 || !tee || !autosink ||
66 !sink || !muxer || !srccxx . . $ src. || !sink || !convertcxx . . $ convert.)
67 {
68 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Cannot create one of the elements." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
69 return 1;
70 }
71
72 try
73 {
74 pipelinecxx . . $ pipeline.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(srccxx . . $ src.)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(convertcxx . . $ convert.)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(tee)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(queue1)
75 ->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(autosink)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(queue2)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(muxer)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(sink);
76
77 srccxx . . $ src.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(convertcxx . . $ convert.)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(tee)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(queue1)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(autosink);
78 tee->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(queue2)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(muxer)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(sink);
79 }
80 catch (const stdcxx . . $ std/::exception& ex)
81 {
82 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Exception occured during preparing pipeline. Message: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ex.what() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
83 return 1;
84 }
85
86 pipelinecxx . . $ pipeline.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).set_statecxx . . $ Gst/Element#set_state(17bf573d41f9253f).(STATE_PLAYINGcxx . . $ Gst/STATE_PLAYING.);
87
88 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).), 2000);
89 main_loopcxx . . $ main_loop.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).runcxx . . $ Glib/MainLoop#run(49f6e7a06ebc5aa8).();
90
91 pipelinecxx . . $ pipeline.->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).set_statecxx . . $ Gst/Element#set_state(17bf573d41f9253f).(STATE_NULLcxx . . $ Gst/STATE_NULL.);
92
93 return 0;
94 }
95
96
97
98