[gstreamermm] A few other fixes to enable compiling without exceptions.
- From: José Alburquerque <jaalburqu src gnome org>
- To: svn-commits-list gnome org
- Subject: [gstreamermm] A few other fixes to enable compiling without exceptions.
- Date: Wed, 27 May 2009 12:59:38 -0400 (EDT)
commit 2ab22822301d18fab89ec15bd7abdab0e35c2a5d
Author: José Alburquerque <jaalburqu svn gnome org>
Date: Mon May 25 22:42:08 2009 -0400
A few other fixes to enable compiling without exceptions.
---
ChangeLog | 10 ++++++++++
build_shared/Makefile_gensrc.am_fragment | 1 -
examples/ogg_player/main.cc | 20 ++++++++++++--------
examples/ogg_player_gtkmm/main.cc | 19 ++++++++++++-------
gstreamer/src/iterator.hg | 21 +++++++++++++++++++--
5 files changed, 53 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8c3efb1..2912cab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2009-05-25 José Alburquerque <jaalburqu svn gnome org>
+ * examples/ogg_player/main.cc:
+ * examples/ogg_player_gtkmm/main.cc:
+ * gstreamer/src/iterator.hg: A few other fixes to enable compiling
+ without exceptions.
+
+ * build_shared/Makefile_gensrc.am_fragment: Removed unused variable
+ def.
+
+2009-05-25 José Alburquerque <jaalburqu svn gnome org>
+
* configure.ac:
* gstreamer/src/Makefile_list_of_hg.am_fragment:
* build_shared/Makefile_gensrc.am_fragment: Modify the build of
diff --git a/build_shared/Makefile_gensrc.am_fragment b/build_shared/Makefile_gensrc.am_fragment
index d157ff7..0aa6f96 100644
--- a/build_shared/Makefile_gensrc.am_fragment
+++ b/build_shared/Makefile_gensrc.am_fragment
@@ -29,7 +29,6 @@ tools_plugin_m4 = $(files_tools_plugin_m4:%.m4=$(tools_dir_m4)/%.m4)
include $(srcdir)/../src/Makefile_list_of_hg.am_fragment
files_all_ccg = $(files_all_hg:%.hg=%.ccg)
files_all_plugin_ccg = $(files_all_plugin_hg:%.hg=%.ccg)
-files_h = $(files_all_hg:%.hg=$(gensrc_destdir)/%.h)
files_stamp = $(files_all_hg:%.hg=$(stamp_dir)/stamp-%)
files_stamp_plugin = $(files_all_plugin_hg:%.hg=$(stamp_plugin_dir)/plugin-stamp-%)
destdir_files_stamp = $(files_patched_hg:%.hg=$(destdir_stamp_dir)/stamp-%)
diff --git a/examples/ogg_player/main.cc b/examples/ogg_player/main.cc
index 92a2d3d..f90987a 100644
--- a/examples/ogg_player/main.cc
+++ b/examples/ogg_player/main.cc
@@ -98,14 +98,12 @@ void on_parser_pad_added(const Glib::RefPtr<Gst::Pad>& newPad)
// We can now link this pad with the audio decoder
std::cout << "Dynamic pad created. Linking parser/decoder." << std::endl;
Glib::RefPtr<Gst::Pad> sinkPad = decoder->get_static_pad("sink");
+ Gst::PadLinkReturn ret = newPad->link(sinkPad);
- try
- {
- newPad->link(sinkPad);
- }
- catch(const std::runtime_error& ex)
+ if (ret != Gst::PAD_LINK_OK && ret != Gst::PAD_LINK_WAS_LINKED)
{
- std::cerr << "Exception caught while linking: " << ex.what() << std::endl;
+ std::cerr << "Linking of pads " << newPad->get_name() << " and " <<
+ sinkPad->get_name() << " failed." << std::endl;
}
}
@@ -185,20 +183,25 @@ int main(int argc, char* argv[])
// Put all the elements in a pipeline:
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
+#endif
pipeline->add(source)->add(parser)->add(decoder)->add(conv)->add(sink);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(const Glib::Error& ex)
{
std::cerr << "Error while adding elements to the pipeline: " << ex.what() << std::endl;
return -1;
}
-
+#endif
// Link the elements together:
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
+#endif
source->link(parser);
// We cannot link the parser and decoder yet,
@@ -207,12 +210,13 @@ int main(int argc, char* argv[])
parser->signal_pad_added().connect( sigc::ptr_fun(&on_parser_pad_added) );
decoder->link(conv)->link(sink);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(const std::runtime_error& ex)
{
std::cout << "Exception while linking elements: " << ex.what() << std::endl;
}
-
+#endif
// Call on_timeout function at a 200ms
// interval to regularly print the position of the stream
diff --git a/examples/ogg_player_gtkmm/main.cc b/examples/ogg_player_gtkmm/main.cc
index 93a1a7f..201b2f5 100644
--- a/examples/ogg_player_gtkmm/main.cc
+++ b/examples/ogg_player_gtkmm/main.cc
@@ -39,14 +39,12 @@ void on_parser_pad_added(const Glib::RefPtr<Gst::Pad>& newPad)
{
// We can now link this pad with the audio decoder.
Glib::RefPtr<Gst::Pad> sinkPad = decoder->get_static_pad("sink");
+ Gst::PadLinkReturn ret = newPad->link(sinkPad);
- try
+ if (ret != Gst::PAD_LINK_OK && ret != Gst::PAD_LINK_WAS_LINKED)
{
- newPad->link(sinkPad);
- }
- catch(const std::runtime_error& ex)
- {
- std::cerr << "Exception caught while linking: " << ex.what() << std::endl;
+ std::cerr << "Linking of pads " << newPad->get_name() << " and " <<
+ sinkPad->get_name() << " failed." << std::endl;
}
}
@@ -103,20 +101,25 @@ main (int argc, char *argv[])
// Put all elements in a pipeline:
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
+#endif
pipeline->add(source)->add(parser)->add(decoder)->add(conv)->add(sink);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(const std::runtime_error& ex)
{
std::cerr << "Error while adding elements to the pipeline: " << ex.what() << std::endl;
return -1;
}
-
+#endif
// Link the elements together:
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
+#endif
source->link(parser);
// We cannot link the parser and decoder yet,
@@ -125,11 +128,13 @@ main (int argc, char *argv[])
parser->signal_pad_added().connect( sigc::ptr_fun(&on_parser_pad_added) );
decoder->link(conv)->link(sink);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(const std::runtime_error& ex)
{
std::cout << "Exception while linking elements: " << ex.what() << std::endl;
}
+#endif
// Create our window and show it:
PlayerWindow mainWindow(source, pipeline);
diff --git a/gstreamer/src/iterator.hg b/gstreamer/src/iterator.hg
index 5c03842..fecc778 100644
--- a/gstreamer/src/iterator.hg
+++ b/gstreamer/src/iterator.hg
@@ -20,6 +20,10 @@
#include <gst/gstiterator.h>
#include <stdexcept>
+#ifndef GLIBMM_EXCEPTIONS_ENABLED
+#include <iostream>
+#endif
+
_DEFS(gstreamermm,gst)
namespace Gst
@@ -182,6 +186,9 @@ public:
* concurrent update to the iterator occurs while it iterates).
*/
IteratorBasic<CppType> operator++(int);
+
+private:
+ void handle_error(const Glib::ustring& message);
};
/** Gst::Iterator - Class that retrieve multiple reference counted elements in
@@ -390,9 +397,9 @@ IteratorBasic<CppType>& IteratorBasic<CppType>::operator++()
const IteratorResult result = this->next();
if(result == Gst::ITERATOR_RESYNC)
- throw std::runtime_error("Concurrent update of iterator elements. Please resync.");
+ handle_error("Concurrent update of iterator elements. Please resync.");
else if(result == Gst::ITERATOR_ERROR)
- throw std::runtime_error("Iterator error while incrementing.");
+ handle_error("Iterator error while incrementing.");
return *this;
}
@@ -405,6 +412,16 @@ IteratorBasic<CppType> IteratorBasic<CppType>::operator++(int)
return original;
}
+template<class CppType>
+void IteratorBasic<CppType>::handle_error(const Glib::ustring& message)
+{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ throw std::runtime_error(message);
+#else
+ std::cerr << "gstreamermm: " << message << std::endl;
+#endif
+}
+
/******************* Gst::Iterator<CppType> **************************/
template <class CppType>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]