| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | #ifndef _GSTREAMERMM_BASESRC_H |
| 3 | #define _GSTREAMERMM_BASESRC_H |
| 4 | |
| 5 | |
| 6 | #include <glibmm/ustring.h> |
| 7 | #include <sigc++/sigc++.h> |
| 8 | |
| 9 | /* gstreamermm - a C++ wrapper for gstreamer |
| 10 | * |
| 11 | * Copyright 2008-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 <gst/base/gstbasesrc.h> |
| 29 | #include <gstreamermm/element.h> |
| 30 | #include <gstreamermm/pad.h> |
| 31 | #include <gstreamermm/format.h> |
| 32 | #include <gstreamermm/clock.h> |
| 33 | #include <gstreamermm/segment.h> |
| 34 | |
| 35 | |
| 36 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 37 | using GstBaseSrc = struct _GstBaseSrc; |
| 38 | using GstBaseSrcClass = struct _GstBaseSrcClass; |
| 39 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 40 | |
| 41 | |
| 42 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 43 | namespace Gst |
| 44 | { class BaseSrc_Class; } // namespace Gst |
| 45 | #endif //DOXYGEN_SHOULD_SKIP_THIS |
| 46 | |
| 47 | namespace Gst |
| 48 | { |
| 49 | |
| 50 | /** @addtogroup gstreamermmEnums gstreamermm Enums and Flags */ |
| 51 | |
| 52 | /** |
| 53 | * @var BaseSrcFlags BASE_SRC_FLAG_STARTING |
| 54 | * Has source is starting. |
| 55 | * |
| 56 | * @var BaseSrcFlags BASE_SRC_FLAG_STARTED |
| 57 | * Has source been started. |
| 58 | * |
| 59 | * @var BaseSrcFlags BASE_SRC_FLAG_LAST |
| 60 | * Offset to define more flags. |
| 61 | * |
| 62 | * @enum BaseSrcFlags |
| 63 | * |
| 64 | * The Gst::Element flags that a basesrc element may have. |
| 65 | * |
| 66 | * @ingroup gstreamermmEnums |
| 67 | * @par Bitwise operators: |
| 68 | * <tt>%BaseSrcFlags operator|(BaseSrcFlags, BaseSrcFlags)</tt><br> |
| 69 | * <tt>%BaseSrcFlags operator&(BaseSrcFlags, BaseSrcFlags)</tt><br> |
| 70 | * <tt>%BaseSrcFlags operator^(BaseSrcFlags, BaseSrcFlags)</tt><br> |
| 71 | * <tt>%BaseSrcFlags operator~(BaseSrcFlags)</tt><br> |
| 72 | * <tt>%BaseSrcFlags& operator|=(BaseSrcFlags&, BaseSrcFlags)</tt><br> |
| 73 | * <tt>%BaseSrcFlags& operator&=(BaseSrcFlags&, BaseSrcFlags)</tt><br> |
| 74 | * <tt>%BaseSrcFlags& operator^=(BaseSrcFlags&, BaseSrcFlags)</tt><br> |
| 75 | */ |
| 76 | enum BaseSrcFlags |
| 77 | { |
| 78 | BASE_SRC_FLAG_STARTING = (((GST_OBJECT_FLAG_LAST << 10)) << 0), |
| 79 | BASE_SRC_FLAG_STARTED = (((GST_OBJECT_FLAG_LAST << 10)) << 1), |
| 80 | BASE_SRC_FLAG_LAST = (((GST_OBJECT_FLAG_LAST << 10)) << 6) |
| 81 | }; |
| 82 | |
| 83 | /** @ingroup gstreamermmEnums */ |
| 84 | inline BaseSrcFlags operator|(BaseSrcFlags lhs, BaseSrcFlags rhs) |
| 85 | { return static_cast<BaseSrcFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } |
| 86 | |
| 87 | /** @ingroup gstreamermmEnums */ |
| 88 | inline BaseSrcFlags operator&(BaseSrcFlags lhs, BaseSrcFlags rhs) |
| 89 | { return static_cast<BaseSrcFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } |
| 90 | |
| 91 | /** @ingroup gstreamermmEnums */ |
| 92 | inline BaseSrcFlags operator^(BaseSrcFlags lhs, BaseSrcFlags rhs) |
| 93 | { return static_cast<BaseSrcFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } |
| 94 | |
| 95 | /** @ingroup gstreamermmEnums */ |
| 96 | inline BaseSrcFlags operator~(BaseSrcFlags flags) |
| 97 | { return static_cast<BaseSrcFlags>(~static_cast<unsigned>(flags)); } |
| 98 | |
| 99 | /** @ingroup gstreamermmEnums */ |
| 100 | inline BaseSrcFlags& operator|=(BaseSrcFlags& lhs, BaseSrcFlags rhs) |
| 101 | { return (lhs = static_cast<BaseSrcFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } |
| 102 | |
| 103 | /** @ingroup gstreamermmEnums */ |
| 104 | inline BaseSrcFlags& operator&=(BaseSrcFlags& lhs, BaseSrcFlags rhs) |
| 105 | { return (lhs = static_cast<BaseSrcFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } |
| 106 | |
| 107 | /** @ingroup gstreamermmEnums */ |
| 108 | inline BaseSrcFlags& operator^=(BaseSrcFlags& lhs, BaseSrcFlags rhs) |
| 109 | { return (lhs = static_cast<BaseSrcFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } |
| 110 | |
| 111 | |
| 112 | /** A base class for getrange based source elements. |
| 113 | * |
| 114 | * This is a generice base class for source elements. The following types of |
| 115 | * sources are supported: |
| 116 | * |
| 117 | * - random access sources like files, |
| 118 | * - seekable sources, |
| 119 | * - live sources. |
| 120 | * |
| 121 | * The source can be configured to operate in any Gst::Format with the |
| 122 | * set_format() method. The currently set format determines the format of the |
| 123 | * internal Gst::Segment and any Gst::EVENT_NEWSEGMENT events. The default |
| 124 | * format for Gst::BaseSrc is Gst::FORMAT_BYTES. |
| 125 | * |
| 126 | * Gst::BaseSrc always supports push mode scheduling. If the following |
| 127 | * conditions are met, it also supports pull mode scheduling: |
| 128 | * |
| 129 | * - The format is set to Gst::FORMAT_BYTES (default). |
| 130 | * - Gst::BaseSrc::is_seekable_vfunc() returns TRUE. |
| 131 | * |
| 132 | * Since GStreamer 0.10.9, any Gst::BaseSrc can enable pull based scheduling at |
| 133 | * any time by overriding Gst::BaseSrc::check_get_range_vfunc() so that it |
| 134 | * returns TRUE. |
| 135 | * |
| 136 | * If all the conditions are met for operating in pull mode, Gst::BaseSrc is |
| 137 | * automatically seekable in push mode as well. The following conditions must |
| 138 | * be met to make the element seekable in push mode when the format is not |
| 139 | * Gst::FORMAT_BYTES: |
| 140 | * |
| 141 | * - Gst::BaseSrc::is_seekable_vfunc() returns TRUE. |
| 142 | * - Gst::BaseSrc::query_vfunc() can convert all supported seek formats to |
| 143 | * the internal format as set with set_format(). |
| 144 | * - Gst::BaseSrc::do_seek_vfunc() is implemented, performs the seek and |
| 145 | * returns TRUE. |
| 146 | * |
| 147 | * When the element does not meet the requirements to operate in pull mode, the |
| 148 | * offset and length in the Gst::BaseSrc::create_vfunc() method should be |
| 149 | * ignored. It is recommended to subclass Gst::PushSrc instead, in this |
| 150 | * situation. If the element can operate in pull mode but only with specific |
| 151 | * offsets and lengths, it is allowed to generate an error when the wrong |
| 152 | * values are passed to the Gst::BaseSrc::create_vfunc() function. |
| 153 | * |
| 154 | * Gst::BaseSrc has support for live sources. Live sources are sources that |
| 155 | * when paused discard data, such as audio or video capture devices. A typical |
| 156 | * live source also produces data at a fixed rate and thus provides a clock to |
| 157 | * publish this rate. Use set_live() to activate the live source mode. |
| 158 | * |
| 159 | * A live source does not produce data in the PAUSED state. This means that the |
| 160 | * Gst::BaseSrc::create_vfunc() method will not be called in PAUSED but only in |
| 161 | * PLAYING. To signal the pipeline that the element will not produce data, the |
| 162 | * return value from the READY to PAUSED state will be |
| 163 | * Gst::STATE_CHANGE_NO_PREROLL. |
| 164 | * |
| 165 | * A typical live source will timestamp the buffers it creates with the current |
| 166 | * running time of the pipeline. This is one reason why a live source can only |
| 167 | * produce data in the PLAYING state, when the clock is actually distributed |
| 168 | * and running. |
| 169 | * |
| 170 | * Live sources that synchronize and block on the clock (an audio source, for |
| 171 | * example) can since GStreamer 0.10.12 use wait_playing() when the |
| 172 | * create_vfunc() function was interrupted by a state change to PAUSED. |
| 173 | * |
| 174 | * The Gst::BaseSrc::get_times_vfunc() method can be used to implement |
| 175 | * pseudo-live sources. It only makes sense to implement the get_times_vfunc() |
| 176 | * function if the source is a live source. The get_times_vfunc() function |
| 177 | * should return timestamps starting from 0, as if it were a non-live source. |
| 178 | * The base class will make sure that the timestamps are transformed into the |
| 179 | * current running_time. The base source will then wait for the calculated |
| 180 | * running_time before pushing out the buffer. |
| 181 | * |
| 182 | * For live sources, the base class will by default report a latency of 0. For |
| 183 | * pseudo live sources, the base class will by default measure the difference |
| 184 | * between the first buffer timestamp and the start time of get_times_vfunc() |
| 185 | * and will report this value as the latency. Subclasses should override the |
| 186 | * query_vfunc() function when this behaviour is not acceptable. |
| 187 | * |
| 188 | * TODO: Edit below paragraph for C++ and include C++ example from C API (if |
| 189 | * necessary): |
| 190 | * |
| 191 | * There is only support in Gst::BaseSrc for exactly one source pad, which |
| 192 | * should be named "src". A source implementation (subclass of Gst::BaseSrc) |
| 193 | * should install a pad template in its class_init function, like so: |
| 194 | * @code |
| 195 | * // static |
| 196 | * void SampleBaseSrc::base_init(Gst::ElementClass<SampleBaseSrc> *klass) |
| 197 | * { |
| 198 | * klass->add_pad_template(Gst::PadTemplate::create( |
| 199 | * "src", |
| 200 | * Gst::PAD_SRC, |
| 201 | * Gst::PAD_ALWAYS, |
| 202 | * Gst::Caps::create_from_string("x-application/x-foo1") |
| 203 | * )); |
| 204 | * |
| 205 | * klass->set_metadata("Source name", "Source", "My source element", "The author <[email protected]>"); |
| 206 | * } |
| 207 | * @endcode |
| 208 | * |
| 209 | * <H2>Controlled shutdown of live sources in applications</H2> |
| 210 | * |
| 211 | * Applications that record from a live source may want to stop recording in a |
| 212 | * controlled way, so that the recording is stopped, but the data already in |
| 213 | * the pipeline is processed to the end (remember that many live sources would |
| 214 | * go on recording forever otherwise). For that to happen the application needs |
| 215 | * to make the source stop recording and send an EOS event down the pipeline. |
| 216 | * The application would then wait for an EOS message posted on the pipeline's |
| 217 | * bus to know when all data has been processed and the pipeline can safely be |
| 218 | * stopped. |
| 219 | * |
| 220 | * Since GStreamer 0.10.16 an application may send an EOS event to a source |
| 221 | * element to make it perform the EOS logic (send EOS event downstream or post |
| 222 | * a Gst::MESSAGE_SEGMENT_DONE on the bus). This can typically be done with the |
| 223 | * Gst::Element::send_event() function on the element or its parent bin. |
| 224 | * |
| 225 | * After the EOS has been sent to the element, the application should wait for |
| 226 | * an EOS message to be posted on the pipeline's bus. Once this EOS message is |
| 227 | * received, it may safely shut down the entire pipeline. |
| 228 | * |
| 229 | * The old behaviour for controlled shutdown introduced since GStreamer 0.10.3 |
| 230 | * is still available but deprecated as it is dangerous and less flexible. |
| 231 | * |
| 232 | * Last reviewed on 2016-05-05 (1.8.0). |
| 233 | * |
| 234 | * @ingroup GstBaseClasses |
| 235 | */ |
| 236 | |
| 237 | class BaseSrc |
| 238 | : public Element |
| 239 | { |
| 240 | |
| 241 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 242 | |
| 243 | public: |
| 244 | using CppObjectType = BaseSrc; |
| 245 | using CppClassType = BaseSrc_Class; |
| 246 | using BaseObjectType = GstBaseSrc; |
| 247 | using BaseClassType = GstBaseSrcClass; |
| 248 | |
| 249 | // noncopyable |
| 250 | BaseSrc(const BaseSrc&) = delete; |
| 251 | BaseSrc& operator=(const BaseSrc&) = delete; |
| 252 | |
| 253 | private: friend class BaseSrc_Class; |
| 254 | static CppClassType basesrc_class_; |
| 255 | |
| 256 | protected: |
| 257 | explicit BaseSrc(const Glib::ConstructParams& construct_params); |
| 258 | explicit BaseSrc(GstBaseSrc* castitem); |
| 259 | |
| 260 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 261 | |
| 262 | public: |
| 263 | |
| 264 | BaseSrc(BaseSrc&& src) noexcept; |
| 265 | BaseSrc& operator=(BaseSrc&& src) noexcept; |
| 266 | |
| 267 | ~BaseSrc() noexcept override; |
| 268 | |
| 269 | /** Get the GType for this class, for use with the underlying GObject type system. |
| 270 | */ |
| 271 | static GType get_type() G_GNUC_CONST; |
| 272 | |
| 273 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 274 | |
| 275 | |
| 276 | static GType get_base_type() G_GNUC_CONST; |
| 277 | #endif |
| 278 | |
| 279 | ///Provides access to the underlying C GObject. |
| 280 | GstBaseSrc* gobj() { return reinterpret_cast<GstBaseSrc*>(gobject_); } |
| 281 | |
| 282 | ///Provides access to the underlying C GObject. |
| 283 | const GstBaseSrc* gobj() const { return reinterpret_cast<GstBaseSrc*>(gobject_); } |
| 284 | |
| 285 | ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. |
| 286 | GstBaseSrc* gobj_copy(); |
| 287 | |
| 288 | private: |
| 289 | |
| 290 | |
| 291 | public: |
| 292 | |
| 293 | /** If the Gst::BaseSrcClass.create() method performs its own synchronisation |
| 294 | * against the clock it must unblock when going from PLAYING to the PAUSED state |
| 295 | * and call this method before continuing to produce the remaining data. |
| 296 | * |
| 297 | * This function will block until a state change to PLAYING happens (in which |
| 298 | * case this function returns Gst::FLOW_OK) or the processing must be stopped due |
| 299 | * to a state change to READY or a FLUSH event (in which case this function |
| 300 | * returns Gst::FLOW_FLUSHING). |
| 301 | * |
| 302 | * @return Gst::FLOW_OK if @a src is PLAYING and processing can |
| 303 | * continue. Any other return value should be returned from the create vmethod. |
| 304 | */ |
| 305 | FlowReturn wait_playing(); |
| 306 | |
| 307 | /** Check if an element is in live mode. |
| 308 | * |
| 309 | * @return <tt>true</tt> if element is in live mode. |
| 310 | */ |
| 311 | bool is_live() const; |
| 312 | |
| 313 | /** If the element listens to a live source, @a live should |
| 314 | * be set to <tt>true</tt>. |
| 315 | * |
| 316 | * A live source will not produce data in the PAUSED state and |
| 317 | * will therefore not be able to participate in the PREROLL phase |
| 318 | * of a pipeline. To signal this fact to the application and the |
| 319 | * pipeline, the state change return value of the live source will |
| 320 | * be GST_STATE_CHANGE_NO_PREROLL. |
| 321 | * |
| 322 | * @param live New live-mode. |
| 323 | */ |
| 324 | void set_live(bool live); |
| 325 | |
| 326 | /** Sets the default format of the source. This will be the format used |
| 327 | * for sending SEGMENT events and for performing seeks. |
| 328 | * |
| 329 | * If a format of GST_FORMAT_BYTES is set, the element will be able to |
| 330 | * operate in pull mode if the Gst::BaseSrcClass.is_seekable() returns <tt>true</tt>. |
| 331 | * |
| 332 | * This function must only be called in states < Gst::STATE_PAUSED. |
| 333 | * |
| 334 | * @param format The format to use. |
| 335 | */ |
| 336 | void set_format(Format format); |
| 337 | |
| 338 | /** Query the source for the latency parameters. @a live will be <tt>true</tt> when @a src is |
| 339 | * configured as a live source. @a min_latency and @a max_latency will be set |
| 340 | * to the difference between the running time and the timestamp of the first |
| 341 | * buffer. |
| 342 | * |
| 343 | * This function is mostly used by subclasses. |
| 344 | * |
| 345 | * @param live If the source is live. |
| 346 | * @param min_latency The min latency of the source. |
| 347 | * @param max_latency The max latency of the source. |
| 348 | * @return <tt>true</tt> if the query succeeded. |
| 349 | */ |
| 350 | bool query_latency(bool& live, Gst::ClockTime& min_latency, Gst::ClockTime& max_latency) const; |
| 351 | |
| 352 | /** Get the number of bytes that @a src will push out with each buffer. |
| 353 | * |
| 354 | * @return The number of bytes pushed with each buffer. |
| 355 | */ |
| 356 | guint get_blocksize() const; |
| 357 | |
| 358 | /** Set the number of bytes that @a src will push out with each buffer. When |
| 359 | * @a blocksize is set to -1, a default length will be used. |
| 360 | * |
| 361 | * @param blocksize The new blocksize in bytes. |
| 362 | */ |
| 363 | void set_blocksize(guint blocksize); |
| 364 | |
| 365 | /** Query if @a src timestamps outgoing buffers based on the current running_time. |
| 366 | * |
| 367 | * @return <tt>true</tt> if the base class will automatically timestamp outgoing buffers. |
| 368 | */ |
| 369 | bool get_do_timestamp() const; |
| 370 | |
| 371 | /** Configure @a src to automatically timestamp outgoing buffers based on the |
| 372 | * current running_time of the pipeline. This property is mostly useful for live |
| 373 | * sources. |
| 374 | * |
| 375 | * @param timestamp Enable or disable timestamping. |
| 376 | */ |
| 377 | void set_do_timestamp(bool timestamp); |
| 378 | |
| 379 | /** Prepare a new seamless segment for emission downstream. This function must |
| 380 | * only be called by derived sub-classes, and only from the create() function, |
| 381 | * as the stream-lock needs to be held. |
| 382 | * |
| 383 | * The format for the new segment will be the current format of the source, as |
| 384 | * configured with set_format() |
| 385 | * |
| 386 | * @param start The new start value for the segment. |
| 387 | * @param stop Stop value for the new segment. |
| 388 | * @param position The new time value for the start of the new segment. |
| 389 | * @return <tt>true</tt> if preparation of the seamless segment succeeded. |
| 390 | */ |
| 391 | bool new_seamless_segment(gint64 start, gint64 stop, gint64 position); |
| 392 | |
| 393 | /** Set new caps on the basesrc source pad. |
| 394 | * |
| 395 | * @param caps A Gst::Caps. |
| 396 | * @return <tt>true</tt> if the caps could be set. |
| 397 | */ |
| 398 | bool set_caps(const Glib::RefPtr<Gst::Caps>& caps); |
| 399 | |
| 400 | /** Wait until the start operation completes. |
| 401 | * |
| 402 | * @return A Gst::FlowReturn. |
| 403 | */ |
| 404 | Gst::FlowReturn start_wait(); |
| 405 | |
| 406 | /** If not @a dynamic_size, size is only updated when needed, such as when trying to |
| 407 | * read past current tracked size. Otherwise, size is checked for upon each |
| 408 | * read. |
| 409 | * |
| 410 | * @param dynamic_size New dynamic size mode. |
| 411 | */ |
| 412 | void set_dynamic_size(bool dynamic_size); |
| 413 | |
| 414 | /** Configure async behaviour in @a src, no state change will block. The open, |
| 415 | * close, start, stop, play and pause virtual methods will be executed in a |
| 416 | * different thread and are thus allowed to perform blocking operations. Any |
| 417 | * blocking operation should be unblocked with the unlock vmethod. |
| 418 | * |
| 419 | * @param async New async mode. |
| 420 | */ |
| 421 | void set_async(bool async); |
| 422 | |
| 423 | /** Get the current async behaviour of @a src. See also set_async(). |
| 424 | * |
| 425 | * @return <tt>true</tt> if @a src is operating in async mode. |
| 426 | */ |
| 427 | bool is_async() const; |
| 428 | |
| 429 | /** Complete an asynchronous start operation. When the subclass overrides the |
| 430 | * start method, it should call start_complete() when the start |
| 431 | * operation completes either from the same thread or from an asynchronous |
| 432 | * helper thread. |
| 433 | * |
| 434 | * @param ret A Gst::FlowReturn. |
| 435 | */ |
| 436 | void start_complete(Gst::FlowReturn ret); |
| 437 | |
| 438 | /** If @a automatic_eos is <tt>true</tt>, @a src will automatically go EOS if a buffer |
| 439 | * after the total size is returned. By default this is <tt>true</tt> but sources |
| 440 | * that can't return an authoritative size and only know that they're EOS |
| 441 | * when trying to read more should set this to <tt>false</tt>. |
| 442 | * |
| 443 | * @param automatic_eos Automatic eos. |
| 444 | */ |
| 445 | void set_automatic_eos(bool automatic_eos); |
| 446 | |
| 447 | /** Returns the memory @a allocator used by the base class and its @a params. |
| 448 | * |
| 449 | * @param params The Gst::AllocationParams of @a allocator. |
| 450 | * @return The Gst::Allocator used. |
| 451 | */ |
| 452 | Glib::RefPtr<Gst::Allocator> get_allocator(Gst::AllocationParams& params); |
| 453 | |
| 454 | |
| 455 | /** Gets the source Gst::Pad object of the element. |
| 456 | */ |
| 457 | Glib::RefPtr<Gst::Pad> get_src_pad(); |
| 458 | Glib::RefPtr<const Gst::Pad> get_src_pad() const; |
| 459 | |
| 460 | /** Size in bytes to read per buffer (-1 = default). |
| 461 | * |
| 462 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 463 | * or receive notification when the value of the property changes. |
| 464 | */ |
| 465 | Glib::PropertyProxy< gulong > property_blocksize() ; |
| 466 | |
| 467 | /** Size in bytes to read per buffer (-1 = default). |
| 468 | * |
| 469 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 470 | * or receive notification when the value of the property changes. |
| 471 | */ |
| 472 | Glib::PropertyProxy_ReadOnly< gulong > property_blocksize() const; |
| 473 | |
| 474 | /** Apply current stream time to buffers. |
| 475 | * |
| 476 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 477 | * or receive notification when the value of the property changes. |
| 478 | */ |
| 479 | Glib::PropertyProxy< bool > property_do_timestamp() ; |
| 480 | |
| 481 | /** Apply current stream time to buffers. |
| 482 | * |
| 483 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 484 | * or receive notification when the value of the property changes. |
| 485 | */ |
| 486 | Glib::PropertyProxy_ReadOnly< bool > property_do_timestamp() const; |
| 487 | |
| 488 | /** Number of buffers to output before sending EOS (-1 = unlimited). |
| 489 | * |
| 490 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 491 | * or receive notification when the value of the property changes. |
| 492 | */ |
| 493 | Glib::PropertyProxy< int > property_num_buffers() ; |
| 494 | |
| 495 | /** Number of buffers to output before sending EOS (-1 = unlimited). |
| 496 | * |
| 497 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 498 | * or receive notification when the value of the property changes. |
| 499 | */ |
| 500 | Glib::PropertyProxy_ReadOnly< int > property_num_buffers() const; |
| 501 | |
| 502 | /** Run typefind before negotiating. |
| 503 | * |
| 504 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 505 | * or receive notification when the value of the property changes. |
| 506 | */ |
| 507 | Glib::PropertyProxy< bool > property_typefind() ; |
| 508 | |
| 509 | /** Run typefind before negotiating. |
| 510 | * |
| 511 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 512 | * or receive notification when the value of the property changes. |
| 513 | */ |
| 514 | Glib::PropertyProxy_ReadOnly< bool > property_typefind() const; |
| 515 | |
| 516 | |
| 517 | /** Called to get the caps to report. |
| 518 | */ |
| 519 | virtual Glib::RefPtr<Gst::Caps> get_caps_vfunc(const Glib::RefPtr<Gst::Caps>& caps) const; |
| 520 | |
| 521 | |
| 522 | /** Notify subclass of changed output caps. |
| 523 | */ |
| 524 | virtual bool set_caps_vfunc(const Glib::RefPtr<Gst::Caps>& caps); |
| 525 | |
| 526 | |
| 527 | /** Negotiated the caps with the peer. |
| 528 | */ |
| 529 | virtual bool negotiate_vfunc(); |
| 530 | |
| 531 | |
| 532 | /** Stop processing. Subclasses should use this to close resources. |
| 533 | */ |
| 534 | virtual bool stop_vfunc(); |
| 535 | |
| 536 | |
| 537 | /** Start processing. Subclasses should open resources and prepare to produce |
| 538 | * data. |
| 539 | */ |
| 540 | virtual bool start_vfunc(); |
| 541 | |
| 542 | |
| 543 | /** Given a buffer, return the start and stop time when it should be pushed |
| 544 | * out. The base class will sync on the clock using these times. |
| 545 | */ |
| 546 | virtual void get_times_vfunc(const Glib::RefPtr<Gst::Buffer>& buffer, Gst::ClockTime& start, Gst::ClockTime& end) const; |
| 547 | |
| 548 | |
| 549 | /** Return the total size of the resource, in the configured format. |
| 550 | */ |
| 551 | virtual bool get_size_vfunc(guint64& size) const; |
| 552 | |
| 553 | |
| 554 | /** Check if the source can seek. |
| 555 | */ |
| 556 | virtual bool is_seekable_vfunc() const; |
| 557 | |
| 558 | |
| 559 | /** Unlock any pending access to the resource. Subclasses should unblock any |
| 560 | * blocked function ASAP. |
| 561 | */ |
| 562 | virtual bool unlock_vfunc(); |
| 563 | |
| 564 | |
| 565 | /** Override this to implement custom event handling. |
| 566 | */ |
| 567 | virtual bool event_vfunc(const Glib::RefPtr<Gst::Event>& event); |
| 568 | |
| 569 | |
| 570 | virtual FlowReturn create_vfunc(guint64 offset, guint size, Glib::RefPtr<Gst::Buffer>& buffer); |
| 571 | |
| 572 | /** Perform seeking on the resource to the indicated segment. |
| 573 | */ |
| 574 | virtual bool do_seek_vfunc(Gst::Segment& segment); |
| 575 | |
| 576 | // Cannot use query_vfunc because the name has been used in the Gst::Element class. |
| 577 | // We have to provide custom implementation, because query vfunc expects writable |
| 578 | // query object. |
| 579 | /** Handle a requested query. |
| 580 | */ |
| 581 | virtual bool base_src_query_vfunc(const Glib::RefPtr<Gst::Query>& query); |
| 582 | |
| 583 | /** Called during negotiation if caps need fixating. Implement instead of |
| 584 | * setting a fixate function on the source pad. |
| 585 | */ |
| 586 | virtual Glib::RefPtr<Gst::Caps> fixate_vfunc(const Glib::RefPtr<Gst::Caps>& caps); |
| 587 | |
| 588 | |
| 589 | /** Clear the previous unlock request. Subclasses should clear any state they |
| 590 | * set during unlock_vfunc(), such as clearing command queues. |
| 591 | */ |
| 592 | virtual bool unlock_stop_vfunc(); |
| 593 | |
| 594 | |
| 595 | /** Prepare the Gst::Segment that will be passed to the do_seek_vfunc() |
| 596 | * vmethod for executing a seek request. Sub-classes should override this if |
| 597 | * they support seeking in formats other than the configured native format. |
| 598 | * By default, it tries to convert the seek arguments to the configured |
| 599 | * native format and prepare a segment in that format. |
| 600 | */ |
| 601 | virtual bool prepare_seek_segment_vfunc(const Glib::RefPtr<Gst::Event>& seek, Gst::Segment& segment); |
| 602 | |
| 603 | |
| 604 | /** Configure the allocation query. |
| 605 | */ |
| 606 | virtual bool decide_allocation_vfunc(const Glib::RefPtr<Gst::Query>& query); |
| 607 | |
| 608 | |
| 609 | /** Ask the subclass to allocate a buffer with for offset and size. The default |
| 610 | * implementation will create a new buffer from the negotiated allocator. |
| 611 | */ |
| 612 | Gst::FlowReturn alloc_vfunc(guint64 offset, guint size, Glib::RefPtr<Gst::Buffer>& buffer); |
| 613 | |
| 614 | /** Ask the subclass to fill the buffer with data for offset and size. The passed |
| 615 | * buffer is guaranteed to hold the requested amount of bytes. |
| 616 | */ |
| 617 | virtual Gst::FlowReturn fill_vfunc(guint64 offset, guint size, const Glib::RefPtr<Gst::Buffer>& buffer); |
| 618 | |
| 619 | protected: |
| 620 | |
| 621 | |
| 622 | public: |
| 623 | |
| 624 | public: |
| 625 | //C++ methods used to invoke GTK+ virtual functions: |
| 626 | |
| 627 | protected: |
| 628 | //GTK+ Virtual Functions (override these to change behaviour): |
| 629 | |
| 630 | //Default Signal Handlers:: |
| 631 | |
| 632 | |
| 633 | }; |
| 634 | |
| 635 | } //namespace Gst |
| 636 | |
| 637 | |
| 638 | namespace Glib |
| 639 | { |
| 640 | /** A Glib::wrap() method for this object. |
| 641 | * |
| 642 | * @param object The C instance. |
| 643 | * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
| 644 | * @result A C++ instance that wraps this C instance. |
| 645 | * |
| 646 | * @relates Gst::BaseSrc |
| 647 | */ |
| 648 | Glib::RefPtr<Gst::BaseSrc> wrap(GstBaseSrc* object, bool take_copy = false); |
| 649 | } |
| 650 | |
| 651 | |
| 652 | #endif /* _GSTREAMERMM_BASESRC_H */ |
| 653 |