| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | #ifndef _GSTREAMERMM_DISCOVERER_H |
| 3 | #define _GSTREAMERMM_DISCOVERER_H |
| 4 | |
| 5 | |
| 6 | #include <glibmm/ustring.h> |
| 7 | #include <sigc++/sigc++.h> |
| 8 | |
| 9 | /* gstreamermm - a C++ wrapper for gstreamer |
| 10 | * |
| 11 | * Copyright 2011-2016 The gstreamermm Development Team |
| 12 | * |
| 13 | * This library is free software; you can redistribute it and/or |
| 14 | * modify it under the terms of the GNU Lesser General Public |
| 15 | * License as published by the Free Software Foundation; either |
| 16 | * version 2.1 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * This library is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | * Lesser General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU Lesser General Public |
| 24 | * License along with this library; if not, write to the Free |
| 25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 26 | */ |
| 27 | |
| 28 | #include <glibmm/object.h> |
| 29 | #include <gstreamermm/clock.h> |
| 30 | #include <gst/pbutils/pbutils.h> |
| 31 | |
| 32 | |
| 33 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 34 | using GstDiscoverer = struct _GstDiscoverer; |
| 35 | using GstDiscovererClass = struct _GstDiscovererClass; |
| 36 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 37 | |
| 38 | |
| 39 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 40 | namespace Gst |
| 41 | { class Discoverer_Class; } // namespace Gst |
| 42 | #endif //DOXYGEN_SHOULD_SKIP_THIS |
| 43 | |
| 44 | namespace Gst |
| 45 | { |
| 46 | |
| 47 | class DiscovererInfo; |
| 48 | class Element; |
| 49 | |
| 50 | /** Discoverer - Utility for discovering information on URIs. |
| 51 | * The Discoverer is a utility object which allows to get as much information |
| 52 | * as possible from one or many URIs. |
| 53 | * |
| 54 | * It provides two APIs, allowing usage in blocking or non-blocking mode. |
| 55 | * |
| 56 | * The blocking mode just requires calling discover_uri() with the URI one |
| 57 | * wishes to discover. |
| 58 | * |
| 59 | * The non-blocking mode requires a running Glib::MainLoop iterating a |
| 60 | * Glib::MainContext, where one connects to the various signals, appends the |
| 61 | * URIs to be processed (through discover_uri_async()) and then |
| 62 | * asks for the discovery to begin (through start()). |
| 63 | * By default this will use the GLib default main context unless you have |
| 64 | * set a custom context using Glib::MainContext::push_thread_default(). |
| 65 | * |
| 66 | * All the information is returned in a DiscovererInfo structure. |
| 67 | * |
| 68 | * Last reviewed on 2016-05-18 (1.8.0) |
| 69 | */ |
| 70 | |
| 71 | class Discoverer : public Glib::Object |
| 72 | { |
| 73 | |
| 74 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 75 | |
| 76 | public: |
| 77 | using CppObjectType = Discoverer; |
| 78 | using CppClassType = Discoverer_Class; |
| 79 | using BaseObjectType = GstDiscoverer; |
| 80 | using BaseClassType = GstDiscovererClass; |
| 81 | |
| 82 | // noncopyable |
| 83 | Discoverer(const Discoverer&) = delete; |
| 84 | Discoverer& operator=(const Discoverer&) = delete; |
| 85 | |
| 86 | private: friend class Discoverer_Class; |
| 87 | static CppClassType discoverer_class_; |
| 88 | |
| 89 | protected: |
| 90 | explicit Discoverer(const Glib::ConstructParams& construct_params); |
| 91 | explicit Discoverer(GstDiscoverer* castitem); |
| 92 | |
| 93 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 94 | |
| 95 | public: |
| 96 | |
| 97 | Discoverer(Discoverer&& src) noexcept; |
| 98 | Discoverer& operator=(Discoverer&& src) noexcept; |
| 99 | |
| 100 | ~Discoverer() noexcept override; |
| 101 | |
| 102 | /** Get the GType for this class, for use with the underlying GObject type system. |
| 103 | */ |
| 104 | static GType get_type() G_GNUC_CONST; |
| 105 | |
| 106 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 107 | |
| 108 | |
| 109 | static GType get_base_type() G_GNUC_CONST; |
| 110 | #endif |
| 111 | |
| 112 | ///Provides access to the underlying C GObject. |
| 113 | GstDiscoverer* gobj() { return reinterpret_cast<GstDiscoverer*>(gobject_); } |
| 114 | |
| 115 | ///Provides access to the underlying C GObject. |
| 116 | const GstDiscoverer* gobj() const { return reinterpret_cast<GstDiscoverer*>(gobject_); } |
| 117 | |
| 118 | ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. |
| 119 | GstDiscoverer* gobj_copy(); |
| 120 | |
| 121 | private: |
| 122 | |
| 123 | |
| 124 | protected: |
| 125 | explicit Discoverer(ClockTime timeout); |
| 126 | |
| 127 | public: |
| 128 | |
| 129 | /** Creates a new Gst::Discoverer with the provided timeout. |
| 130 | * |
| 131 | * @param timeout Timeout per file, in nanoseconds. Allowed are values between |
| 132 | * one second (Gst::SECOND) and one hour (3600 * Gst::SECOND). |
| 133 | * @param err A pointer to a Error. can be <tt>nullptr</tt>. |
| 134 | * @return The new Gst::Discoverer. |
| 135 | * If an error occurred when creating the discoverer, @a err will be set |
| 136 | * accordingly and <tt>nullptr</tt> will be returned. If @a err is set, the caller must |
| 137 | * free it when no longer needed using Glib::error_free(). |
| 138 | */ |
| 139 | |
| 140 | |
| 141 | static Glib::RefPtr<Discoverer> create(ClockTime timeout); |
| 142 | |
| 143 | |
| 144 | /** Allow asynchronous discovering of URIs to take place. |
| 145 | * A MainLoop must be available for Gst::Discoverer to properly work in |
| 146 | * asynchronous mode. |
| 147 | */ |
| 148 | void start(); |
| 149 | |
| 150 | /** Stop the discovery of any pending URIs and clears the list of |
| 151 | * pending URIS (if any). |
| 152 | */ |
| 153 | void stop(); |
| 154 | |
| 155 | /** Synchronously discovers the given @a uri. |
| 156 | * |
| 157 | * @param uri The URI to run on. |
| 158 | * @param If an error occurred, this field will be filled in. |
| 159 | * @return The result of the scanning. Can be <tt>nullptr</tt> if an |
| 160 | * error occurred. |
| 161 | */ |
| 162 | Glib::RefPtr<Gst::DiscovererInfo> discover_uri(const Glib::ustring& uri); |
| 163 | |
| 164 | /** Appends the given @a uri to the list of URIs to discoverer. The actual |
| 165 | * discovery of the @a uri will only take place if start() has |
| 166 | * been called. |
| 167 | * |
| 168 | * @param uri The URI to add. |
| 169 | * @return <tt>true</tt> if the @a uri was successfully appended to the list of pending |
| 170 | * uris, else <tt>false</tt>. |
| 171 | */ |
| 172 | bool discover_uri_async(const Glib::ustring& uri); |
| 173 | |
| 174 | /** Timeout. |
| 175 | * |
| 176 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 177 | * or receive notification when the value of the property changes. |
| 178 | */ |
| 179 | Glib::PropertyProxy< guint64 > property_timeout() ; |
| 180 | |
| 181 | /** Timeout. |
| 182 | * |
| 183 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 184 | * or receive notification when the value of the property changes. |
| 185 | */ |
| 186 | Glib::PropertyProxy_ReadOnly< guint64 > property_timeout() const; |
| 187 | |
| 188 | |
| 189 | /** |
| 190 | * @par Slot Prototype: |
| 191 | * <tt>void on_my_%discovered(const Glib::RefPtr<Gst::DiscovererInfo>& info, const Glib::Error& error)</tt> |
| 192 | * |
| 193 | * Will be emitted in async mode when all information on a URI could be |
| 194 | * discovered, or an error occurred. |
| 195 | * |
| 196 | * When an error occurs, @a info might still contain some partial information, |
| 197 | * depending on the circumstances of the error. |
| 198 | * |
| 199 | * @param info The results Gst::DiscovererInfo. |
| 200 | */ |
| 201 | |
| 202 | Glib::SignalProxy< void,const Glib::RefPtr<Gst::DiscovererInfo>&,const Glib::Error& > signal_discovered(); |
| 203 | |
| 204 | |
| 205 | /** |
| 206 | * @par Slot Prototype: |
| 207 | * <tt>void on_my_%finished()</tt> |
| 208 | * |
| 209 | * Will be emitted in async mode when all pending URIs have been processed. |
| 210 | */ |
| 211 | |
| 212 | Glib::SignalProxy< void > signal_finished(); |
| 213 | |
| 214 | |
| 215 | /** |
| 216 | * @par Slot Prototype: |
| 217 | * <tt>void on_my_%starting()</tt> |
| 218 | * |
| 219 | * Will be emitted when the discover starts analyzing the pending URIs |
| 220 | */ |
| 221 | |
| 222 | Glib::SignalProxy< void > signal_starting(); |
| 223 | |
| 224 | |
| 225 | /** |
| 226 | * @par Slot Prototype: |
| 227 | * <tt>void on_my_%source_setup(const Glib::RefPtr<Gst::Element>& source)</tt> |
| 228 | * |
| 229 | * This signal is emitted after the source element has been created for, so |
| 230 | * the URI being discovered, so it can be configured by setting additional |
| 231 | * properties (e.g.\ set a proxy server for an http source, or set the device |
| 232 | * and read speed for an audio cd source). |
| 233 | * |
| 234 | * This signal is usually emitted from the context of a GStreamer streaming |
| 235 | * thread. |
| 236 | * |
| 237 | * @param source Source element. |
| 238 | */ |
| 239 | |
| 240 | Glib::SignalProxy< void,const Glib::RefPtr<Gst::Element>& > signal_source_setup(); |
| 241 | |
| 242 | |
| 243 | public: |
| 244 | |
| 245 | public: |
| 246 | //C++ methods used to invoke GTK+ virtual functions: |
| 247 | |
| 248 | protected: |
| 249 | //GTK+ Virtual Functions (override these to change behaviour): |
| 250 | |
| 251 | //Default Signal Handlers:: |
| 252 | /// This is a default handler for the signal signal_discovered(). |
| 253 | virtual void on_discovered(const Glib::RefPtr<Gst::DiscovererInfo>& info, const Glib::Error& error); |
| 254 | /// This is a default handler for the signal signal_finished(). |
| 255 | virtual void on_finished(); |
| 256 | /// This is a default handler for the signal signal_starting(). |
| 257 | virtual void on_starting(); |
| 258 | /// This is a default handler for the signal signal_source_setup(). |
| 259 | virtual void on_source_setup(const Glib::RefPtr<Gst::Element>& source); |
| 260 | |
| 261 | |
| 262 | }; |
| 263 | |
| 264 | } //namespace Gst |
| 265 | |
| 266 | |
| 267 | namespace Glib |
| 268 | { |
| 269 | /** A Glib::wrap() method for this object. |
| 270 | * |
| 271 | * @param object The C instance. |
| 272 | * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
| 273 | * @result A C++ instance that wraps this C instance. |
| 274 | * |
| 275 | * @relates Gst::Discoverer |
| 276 | */ |
| 277 | Glib::RefPtr<Gst::Discoverer> wrap(GstDiscoverer* object, bool take_copy = false); |
| 278 | } |
| 279 | |
| 280 | |
| 281 | #endif /* _GSTREAMERMM_DISCOVERER_H */ |
| 282 |