| 1 | /* gstreamermm - a C++ wrapper for gstreamer |
| 2 | * |
| 3 | * Copyright 2008 The gstreamermm Development Team |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 |
| 7 | * as published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | */ |
| 18 | |
| 19 | #include <gstreamermm.h>cxx . . $ `<file>/gstreamer/gstreamermm.h`/ |
| 20 | #include <iostream> |
| 21 | |
| 22 | int maincxx . . $ main(afcd3168fc1188a4).(int argc, char** argv) |
| 23 | { |
| 24 | Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Gstcxx . . $ Gst/::Pipelinecxx . . $ Gst/Pipeline#> pipelinecxx . . $ Glib/RefPtr#RefPtr(49f6e7a06ebc5aa8).; |
| 25 | Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Gstcxx . . $ Gst/::Elementcxx . . $ Gst/Element#> element_sourcecxx . . $ Glib/RefPtr#RefPtr(49f6e7a06ebc5aa8)., element_filtercxx . . $ Glib/RefPtr#RefPtr(49f6e7a06ebc5aa8)., element_sinkcxx . . $ Glib/RefPtr#RefPtr(49f6e7a06ebc5aa8).; |
| 26 | |
| 27 | // Initialize Gstreamermm: |
| 28 | Gstcxx . . $ Gst/::initcxx . . $ Gst/init(22930d6ef54703eb).(argc, argv); |
| 29 | |
| 30 | // Create pipeline: |
| 31 | pipeline =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). Gstcxx . . $ Gst/::Pipelinecxx . . $ Gst/Pipeline#::createcxx . . $ Gst/Pipeline#create(4db98da4abd65927).("my-pipeline"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).); |
| 32 | |
| 33 | // Create elements: |
| 34 | element_source =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). Gstcxx . . $ Gst/::ElementFactorycxx . . $ Gst/ElementFactory#::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("fakesrc"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).); |
| 35 | element_filter =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). Gstcxx . . $ Gst/::ElementFactorycxx . . $ Gst/ElementFactory#::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("identity"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).); |
| 36 | element_sink =cxx . . $ Glib/RefPtr#`operator=`(b66de19e2ab7ce1f). Gstcxx . . $ Gst/::ElementFactorycxx . . $ Gst/ElementFactory#::create_elementcxx . . $ Gst/ElementFactory#create_element(1ef5e1ee31814ad5).("fakesink"cxx . . $ Glib/ustring#ustring(85c52e162fed56f9).); |
| 37 | |
| 38 | // We must add the elements to the pipeline before linking them: |
| 39 | try |
| 40 | { |
| 41 | pipeline->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(element_source)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(element_filter)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).addcxx . . $ Gst/Bin#add(25e1dc1b4b432bb3).(element_sink); |
| 42 | } |
| 43 | catch (stdcxx . . $ std/::runtime_errorcxx . . $ std/runtime_error#& ex) |
| 44 | { |
| 45 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Exception while adding: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ex.whatcxx . . $ std/runtime_error#what(a9f41ea0e82d88cf).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 46 | return 1; |
| 47 | } |
| 48 | |
| 49 | // Link the elements together: |
| 50 | try |
| 51 | { |
| 52 | element_source->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(element_filter)->cxx . . $ Glib/RefPtr#`operator->`(5a2a78a048fb49a8).linkcxx . . $ Gst/Element#link(52e71ea9673343b3).(element_sink); |
| 53 | } |
| 54 | catch(const stdcxx . . $ std/::runtime_errorcxx . . $ std/runtime_error#& error) |
| 55 | { |
| 56 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Exception while linking: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). error.whatcxx . . $ std/runtime_error#what(a9f41ea0e82d88cf).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 57 | } |
| 58 | return 0; |
| 59 | } |