Debian Codegraph @

examples/basics/element_factory.cc

raw symbols SCIP
1 /*
2 * This example presents how to use Gst::ElementFactory class, getting
3 * information and create specific element.
4 */
5 #include <gstreamermm.h>cxx . . $ `<file>/gstreamer/gstreamermm.h`/
6
7 #include <iostream>
8
9 int maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[])
10 {
11 Gstcxx . . $ Gst/::initcxx . . $ Gst/init(22930d6ef54703eb).(argc, argv);
12
13 // Get list of all primary demuxers in the system
14 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "List of primary demuxers: " <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
15 for (Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Gstcxx . . $ Gst/::ElementFactorycxx . . $ Gst/ElementFactory#> factory
16 : Gstcxx . . $ Gst/::ElementFactorycxx . . $ Gst/ElementFactory#::get_elementscxx . . $ Gst/ElementFactory#get_elements(2c5d7ffa7784084a).(Gstcxx . . $ Gst/::ELEMENT_FACTORY_TYPE_DEMUXERcxx . . $ Gst/ELEMENT_FACTORY_TYPE_DEMUXER., Gstcxx . . $ Gst/::RANK_PRIMARYcxx . . $ Gst/RANK_PRIMARY.))
17 {
18 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " * " <<cxx . . $ Glib/`operator<<`(d3a65685b7328161). factory->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).get_namecxx . . $ Gst/Object#get_name(fff0f585954e56f3).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
19 }
20 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
21
22 Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Gstcxx . . $ Gst/::ElementFactorycxx . . $ Gst/ElementFactory#> fakesrc_factory = Gstcxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).::ElementFactorycxx . . $ Gst/ElementFactory#::findcxx . . $ Gst/ElementFactory#find(d53df8cb57e7c385).("fakesrc"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).);
23 if (!fakesrc_factory)
24 {
25 stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Failed to find factory of type 'fakesrc'" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
26 return -1;
27 }
28
29 // Read information about an author of the element
30 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Author of the element '" <<cxx . . $ Glib/`operator<<`(d3a65685b7328161). fakesrc_factory->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).get_namecxx . . $ Gst/Object#get_name(fff0f585954e56f3).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "' is "
31 <<cxx . . $ Glib/`operator<<`(d3a65685b7328161). fakesrc_factory->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).get_metadatacxx . . $ Gst/ElementFactory#get_metadata(258cbd5fc4df303b).(GST_ELEMENT_METADATA_AUTHORcxx . . $ `<external>/2622341071963897947/gstelementmetadata.h:59:9`!) <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9). <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
32
33 // Read all available information about the element
34 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "All information about element '" <<cxx . . $ Glib/`operator<<`(d3a65685b7328161). fakesrc_factory->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).get_namecxx . . $ Gst/Object#get_name(fff0f585954e56f3).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "':" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
35 for (auto metadata_key : fakesrc_factory->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).get_metadata_keyscxx . . $ Gst/ElementFactory#get_metadata_keys(875676e3b2759068).())
36 {
37 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " * " <<cxx . . $ Glib/`operator<<`(d3a65685b7328161). metadata_key <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ": " <<cxx . . $ Glib/`operator<<`(d3a65685b7328161). fakesrc_factory->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).get_metadatacxx . . $ Gst/ElementFactory#get_metadata(258cbd5fc4df303b).(metadata_key) <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
38 }
39
40
41 // Create element fakesrc
42
43 // Method 1
44 {
45 Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Gstcxx . . $ Gst/::Elementcxx . . $ Gst/Element#> fakesrc = fakesrc_factorycxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).createcxx . . $ Gst/ElementFactory#create(1ef5e1ee31814ad5).("source"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).);
46
47 if (!fakesrc)
48 {
49 stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Failed to create element of type 'fakesrc'" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
50 return -1;
51 }
52 }
53
54 // Method 2
55 {
56 Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Gstcxx . . $ Gst/::Elementcxx . . $ Gst/Element#> fakesrc = Gstcxx . . $ Glib/RefPtr#RefPtr(b50b0f543100b439).::ElementFactorycxx . . $ Gst/ElementFactory#::create_elementcxx . . $ Gst/ElementFactory#create_element(bde311d80d2d00e5).("fakesrc"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9)., "source"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).);
57 if (!fakesrc)
58 {
59 stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Failed to create element of type 'fakesrc'" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
60 return -1;
61 }
62 }
63
64 return 0;
65 }