| 1 |
/* gstreamermm - a C++ wrapper for gstreamer |
| 2 |
* |
| 3 |
* Copyright 2011-2016 The gstreamermm Development Team |
| 4 |
* |
| 5 |
* This library is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU Lesser General Public |
| 7 |
* License as published by the Free Software Foundation; either |
| 8 |
* version 2.1 of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This library is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* Lesser General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU Lesser General Public |
| 16 |
* License along with this library; if not, write to the Free |
| 17 |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 18 |
*/ |
| 19 |
|
| 20 |
#include <glibmm/object.h> |
| 21 |
#include <gstreamermm/clock.h> |
| 22 |
#include <gst/pbutils/pbutils.h> |
| 23 |
|
| 24 |
_DEFS(gstreamermm,gst) |
| 25 |
|
| 26 |
namespace Gst |
| 27 |
{ |
| 28 |
|
| 29 |
class DiscovererInfo; |
| 30 |
class Element; |
| 31 |
|
| 32 |
/** Discoverer - Utility for discovering information on URIs. |
| 33 |
* The Discoverer is a utility object which allows to get as much information |
| 34 |
* as possible from one or many URIs. |
| 35 |
* |
| 36 |
* It provides two APIs, allowing usage in blocking or non-blocking mode. |
| 37 |
* |
| 38 |
* The blocking mode just requires calling discover_uri() with the URI one |
| 39 |
* wishes to discover. |
| 40 |
* |
| 41 |
* The non-blocking mode requires a running Glib::MainLoop iterating a |
| 42 |
* Glib::MainContext, where one connects to the various signals, appends the |
| 43 |
* URIs to be processed (through discover_uri_async()) and then |
| 44 |
* asks for the discovery to begin (through start()). |
| 45 |
* By default this will use the GLib default main context unless you have |
| 46 |
* set a custom context using Glib::MainContext::push_thread_default(). |
| 47 |
* |
| 48 |
* All the information is returned in a DiscovererInfo structure. |
| 49 |
* |
| 50 |
* Last reviewed on 2016-05-18 (1.8.0) |
| 51 |
*/ |
| 52 |
class Discoverer : public Glib::Object |
| 53 |
{ |
| 54 |
_CLASS_GOBJECT(Discoverer, GstDiscoverer, GST_DISCOVERER, Glib::Object, GObject) |
| 55 |
|
| 56 |
protected: |
| 57 |
explicit Discoverer(ClockTime timeout); |
| 58 |
|
| 59 |
public: |
| 60 |
_WRAP_METHOD_DOCS_ONLY(gst_discoverer_new, errthrow) |
| 61 |
_WRAP_CREATE(ClockTime timeout) |
| 62 |
|
| 63 |
_WRAP_METHOD(void start(), gst_discoverer_start) |
| 64 |
_WRAP_METHOD(void stop(), gst_discoverer_stop) |
| 65 |
_WRAP_METHOD(Glib::RefPtr<Gst::DiscovererInfo> discover_uri(const Glib::ustring& uri), gst_discoverer_discover_uri, errthrow) |
| 66 |
_WRAP_METHOD(bool discover_uri_async(const Glib::ustring& uri), gst_discoverer_discover_uri_async) |
| 67 |
|
| 68 |
_WRAP_PROPERTY("timeout", guint64) |
| 69 |
|
| 70 |
#m4 _CONVERSION(`GstDiscovererInfo*', `const Glib::RefPtr<Gst::DiscovererInfo>&', `Glib::wrap($3,true)') |
| 71 |
#m4 _CONVERSION(`const GError*', `const Glib::Error&', `Glib::Error(const_cast<GError*>($3), true)') |
| 72 |
_WRAP_SIGNAL(void discovered(const Glib::RefPtr<Gst::DiscovererInfo>& info, const Glib::Error& error), "discovered") |
| 73 |
|
| 74 |
_WRAP_SIGNAL(void finished(), "finished") |
| 75 |
_WRAP_SIGNAL(void starting(), "starting") |
| 76 |
|
| 77 |
#m4 _CONVERSION(`GstElement*', `const Glib::RefPtr<Gst::Element>&', `Glib::wrap($3,true)') |
| 78 |
_WRAP_SIGNAL(void source_setup(const Glib::RefPtr<Gst::Element>& source), "source_setup") |
| 79 |
}; |
| 80 |
|
| 81 |
} //namespace Gst |