| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | #ifndef _GSTREAMERMM_BASESINK_H |
| 3 | #define _GSTREAMERMM_BASESINK_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/gstbasesink.h> |
| 29 | #include <gstreamermm/element.h> |
| 30 | #include <gstreamermm/buffer.h> |
| 31 | #include <gstreamermm/pad.h> |
| 32 | #include <gstreamermm/caps.h> |
| 33 | #include <gstreamermm/sample.h> |
| 34 | |
| 35 | |
| 36 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 37 | using GstBaseSink = struct _GstBaseSink; |
| 38 | using GstBaseSinkClass = struct _GstBaseSinkClass; |
| 39 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 40 | |
| 41 | |
| 42 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 43 | namespace Gst |
| 44 | { class BaseSink_Class; } // namespace Gst |
| 45 | #endif //DOXYGEN_SHOULD_SKIP_THIS |
| 46 | |
| 47 | namespace Gst |
| 48 | { |
| 49 | |
| 50 | class BufferList; |
| 51 | |
| 52 | /** The base class for sink elements. |
| 53 | * Gst::BaseSink is the base class for sink elements in GStreamer, such as |
| 54 | * xvimagesink or filesink. It is a layer on top of Gst::Element that provides |
| 55 | * a simplified interface to plugin writers. Gst::BaseSink handles many details |
| 56 | * for you, for example: preroll, clock synchronization, state changes, |
| 57 | * activation in push or pull mode, and queries. |
| 58 | * |
| 59 | * In most cases, when writing sink elements, there is no need to implement |
| 60 | * class methods from Gst::Element or to set functions on pads, because the |
| 61 | * Gst::BaseSink infrastructure should be sufficient. |
| 62 | * |
| 63 | * TODO: correct paragraph below for C++ and include example from C API: |
| 64 | * |
| 65 | * Gst::BaseSink provides support for exactly one sink pad, which should be |
| 66 | * named "sink". A sink implementation (subclass of Gst::BaseSink) should |
| 67 | * install a pad template in its base_init function, like so: |
| 68 | * |
| 69 | * Gst::BaseSink will handle the prerolling correctly. This means that it will |
| 70 | * return Gst::STATE_CHANGE_ASYNC from a state change to PAUSED until the first |
| 71 | * buffer arrives in this element. The base class will call the |
| 72 | * Gst::BaseSink::preroll_vfunc() vmethod with this preroll buffer and will |
| 73 | * then commit the state change to the next asynchronously pending state. |
| 74 | * |
| 75 | * When the element is set to PLAYING, Gst::BaseSink will synchronise on the |
| 76 | * clock using the times returned from get_times_vfunc(). If this function |
| 77 | * returns Gst::CLOCK_TIME_NONE for the start time, no synchronisation will be |
| 78 | * done. Synchronisation can be disabled entirely by setting the object "sync" |
| 79 | * property to FALSE. |
| 80 | * |
| 81 | * After synchronisation the virtual method Gst::BaseSink::render_vfunc() will |
| 82 | * be called. Subclasses should minimally implement this method. |
| 83 | * |
| 84 | * Since GStreamer 0.10.3 subclasses that synchronise on the clock in the |
| 85 | * render_vfunc() vmethod are supported as well. These classes typically |
| 86 | * receive a buffer in the render method and can then potentially block on the |
| 87 | * clock while rendering. A typical example is an audiosink. Since GStreamer |
| 88 | * 0.10.11 these subclasses can use wait_preroll() to perform the blocking |
| 89 | * wait. |
| 90 | * |
| 91 | * Upon receiving the EOS event in the PLAYING state, Gst::BaseSink will wait |
| 92 | * for the clock to reach the time indicated by the stop time of the last |
| 93 | * get_times_vfunc() call before posting an EOS message. When the element |
| 94 | * receives EOS in PAUSED, preroll completes, the event is queued and an EOS |
| 95 | * message is posted when going to PLAYING. |
| 96 | * |
| 97 | * Gst::BaseSink will internally use the Gst::EVENT_NEWSEGMENT events to |
| 98 | * schedule synchronisation and clipping of buffers. Buffers that fall |
| 99 | * completely outside of the current segment are dropped. Buffers that fall |
| 100 | * partially in the segment are rendered (and prerolled). Subclasses should do |
| 101 | * any subbuffer clipping themselves when needed. |
| 102 | * |
| 103 | * Gst::BaseSink will by default report the current playback position in |
| 104 | * Gst::FORMAT_TIME based on the current clock time and segment information. If |
| 105 | * no clock has been set on the element, the query will be forwarded upstream. |
| 106 | * |
| 107 | * The set_caps_vfunc() function will be called when the subclass should |
| 108 | * configure itself to process a specific media type. |
| 109 | * |
| 110 | * The start_vfunc() and stop_vfunc() virtual methods will be called when |
| 111 | * resources should be allocated. Any preroll_vfunc(), render_vfunc() and |
| 112 | * set_caps_vfunc() function will be called between the start_vfunc() and |
| 113 | * stop_vfunc() calls. |
| 114 | * |
| 115 | * The event_vfunc() virtual method will be called when an event is received by |
| 116 | * Gst::BaseSink. Normally this method should only be overriden by very |
| 117 | * specific elements (such as file sinks) which need to handle the newsegment |
| 118 | * event specially. |
| 119 | * The unlock_vfunc() method is called when the elements should unblock any |
| 120 | * blocking operations they perform in the render_vfunc() method. This is |
| 121 | * mostly useful when the render_vfunc() method performs a blocking write on a |
| 122 | * file descriptor, for example. |
| 123 | * |
| 124 | * The max-lateness property affects how the sink deals with buffers that |
| 125 | * arrive too late in the sink. A buffer arrives too late in the sink when the |
| 126 | * presentation time (as a combination of the last segment, buffer timestamp |
| 127 | * and element base_time) plus the duration is before the current time of the |
| 128 | * clock. If the frame is later than max-lateness, the sink will drop the |
| 129 | * buffer without calling the render method. This feature is disabled if sync |
| 130 | * is disabled, the get_times_vfunc() method does not return a valid start time |
| 131 | * or max-lateness is set to -1 (the default). Subclasses can use |
| 132 | * set_max_lateness() to configure the max-lateness value. |
| 133 | * |
| 134 | * The qos property will enable the quality-of-service features of the basesink |
| 135 | * which gather statistics about the real-time performance of the clock |
| 136 | * synchronisation. For each buffer received in the sink, statistics are |
| 137 | * gathered and a QOS event is sent upstream with these numbers. This |
| 138 | * information can then be used by upstream elements to reduce their processing |
| 139 | * rate, for example. |
| 140 | * |
| 141 | * The async property can be used to instruct the sink |
| 142 | * to never perform an ASYNC state change. This feature is mostly usable when |
| 143 | * dealing with non-synchronized streams or sparse streams. |
| 144 | * |
| 145 | * Last reviewed on 2016-04-29 (1.8.0) |
| 146 | * |
| 147 | * @ingroup GstBaseClasses |
| 148 | */ |
| 149 | |
| 150 | class BaseSink |
| 151 | : public Element |
| 152 | { |
| 153 | |
| 154 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 155 | |
| 156 | public: |
| 157 | using CppObjectType = BaseSink; |
| 158 | using CppClassType = BaseSink_Class; |
| 159 | using BaseObjectType = GstBaseSink; |
| 160 | using BaseClassType = GstBaseSinkClass; |
| 161 | |
| 162 | // noncopyable |
| 163 | BaseSink(const BaseSink&) = delete; |
| 164 | BaseSink& operator=(const BaseSink&) = delete; |
| 165 | |
| 166 | private: friend class BaseSink_Class; |
| 167 | static CppClassType basesink_class_; |
| 168 | |
| 169 | protected: |
| 170 | explicit BaseSink(const Glib::ConstructParams& construct_params); |
| 171 | explicit BaseSink(GstBaseSink* castitem); |
| 172 | |
| 173 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 174 | |
| 175 | public: |
| 176 | |
| 177 | BaseSink(BaseSink&& src) noexcept; |
| 178 | BaseSink& operator=(BaseSink&& src) noexcept; |
| 179 | |
| 180 | ~BaseSink() noexcept override; |
| 181 | |
| 182 | /** Get the GType for this class, for use with the underlying GObject type system. |
| 183 | */ |
| 184 | static GType get_type() G_GNUC_CONST; |
| 185 | |
| 186 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 187 | |
| 188 | |
| 189 | static GType get_base_type() G_GNUC_CONST; |
| 190 | #endif |
| 191 | |
| 192 | ///Provides access to the underlying C GObject. |
| 193 | GstBaseSink* gobj() { return reinterpret_cast<GstBaseSink*>(gobject_); } |
| 194 | |
| 195 | ///Provides access to the underlying C GObject. |
| 196 | const GstBaseSink* gobj() const { return reinterpret_cast<GstBaseSink*>(gobject_); } |
| 197 | |
| 198 | ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. |
| 199 | GstBaseSink* gobj_copy(); |
| 200 | |
| 201 | private: |
| 202 | |
| 203 | |
| 204 | public: |
| 205 | |
| 206 | /** Query the sink for the latency parameters. The latency will be queried from |
| 207 | * the upstream elements. @a live will be <tt>true</tt> if @a sink is configured to |
| 208 | * synchronize against the clock. @a upstream_live will be <tt>true</tt> if an upstream |
| 209 | * element is live. |
| 210 | * |
| 211 | * If both @a live and @a upstream_live are <tt>true</tt>, the sink will want to compensate |
| 212 | * for the latency introduced by the upstream elements by setting the |
| 213 | * @a min_latency to a strictly positive value. |
| 214 | * |
| 215 | * This function is mostly used by subclasses. |
| 216 | * |
| 217 | * @param live If the sink is live. |
| 218 | * @param upstream_live If an upstream element is live. |
| 219 | * @param min_latency The min latency of the upstream elements. |
| 220 | * @param max_latency The max latency of the upstream elements. |
| 221 | * @return <tt>true</tt> if the query succeeded. |
| 222 | */ |
| 223 | bool query_latency(bool& live, bool& upstream_live, Gst::ClockTime& min_latency, Gst::ClockTime& max_latency) const; |
| 224 | |
| 225 | /** Get the currently configured latency. |
| 226 | * |
| 227 | * @return The configured latency. |
| 228 | */ |
| 229 | Gst::ClockTime get_latency() const; |
| 230 | |
| 231 | /** If the @a sink spawns its own thread for pulling buffers from upstream it |
| 232 | * should call this method after it has pulled a buffer. If the element needed |
| 233 | * to preroll, this function will perform the preroll and will then block |
| 234 | * until the element state is changed. |
| 235 | * |
| 236 | * This function should be called with the PREROLL_LOCK held. |
| 237 | * |
| 238 | * @param obj The mini object that caused the preroll. |
| 239 | * @return Gst::FLOW_OK if the preroll completed and processing can |
| 240 | * continue. Any other return value should be returned from the render vmethod. |
| 241 | */ |
| 242 | Gst::FlowReturn do_preroll(const Glib::RefPtr<Gst::MiniObject>& obj); |
| 243 | |
| 244 | /** If the Gst::BaseSinkClass.render() method performs its own synchronisation |
| 245 | * against the clock it must unblock when going from PLAYING to the PAUSED state |
| 246 | * and call this method before continuing to render the remaining data. |
| 247 | * |
| 248 | * This function will block until a state change to PLAYING happens (in which |
| 249 | * case this function returns Gst::FLOW_OK) or the processing must be stopped due |
| 250 | * to a state change to READY or a FLUSH event (in which case this function |
| 251 | * returns Gst::FLOW_FLUSHING). |
| 252 | * |
| 253 | * This function should only be called with the PREROLL_LOCK held, like in the |
| 254 | * render function. |
| 255 | * |
| 256 | * @return Gst::FLOW_OK if the preroll completed and processing can |
| 257 | * continue. Any other return value should be returned from the render vmethod. |
| 258 | */ |
| 259 | Gst::FlowReturn wait_preroll(); |
| 260 | |
| 261 | /** This function will block until @a time is reached. It is usually called by |
| 262 | * subclasses that use their own internal synchronisation. |
| 263 | * |
| 264 | * If @a time is not valid, no synchronisation is done and Gst::CLOCK_BADTIME is |
| 265 | * returned. Likewise, if synchronisation is disabled in the element or there |
| 266 | * is no clock, no synchronisation is done and Gst::CLOCK_BADTIME is returned. |
| 267 | * |
| 268 | * This function should only be called with the PREROLL_LOCK held, like when |
| 269 | * receiving an EOS event in the Gst::BaseSinkClass.event() vmethod or when |
| 270 | * receiving a buffer in |
| 271 | * the Gst::BaseSinkClass.render() vmethod. |
| 272 | * |
| 273 | * The @a time argument should be the running_time of when this method should |
| 274 | * return and is not adjusted with any latency or offset configured in the |
| 275 | * sink. |
| 276 | * |
| 277 | * @param time The running_time to be reached. |
| 278 | * @param jitter The jitter to be filled with time diff, or <tt>nullptr</tt>. |
| 279 | * @return Gst::ClockReturn. |
| 280 | */ |
| 281 | Gst::ClockReturn wait_clock(Gst::ClockTime time, Gst::ClockTimeDiff& jitter); |
| 282 | |
| 283 | /// A wait_clock() convenience overload. |
| 284 | Gst::ClockReturn wait_clock(Gst::ClockTime time); |
| 285 | |
| 286 | /** This function will wait for preroll to complete and will then block until @a time |
| 287 | * is reached. It is usually called by subclasses that use their own internal |
| 288 | * synchronisation but want to let some synchronization (like EOS) be handled |
| 289 | * by the base class. |
| 290 | * |
| 291 | * This function should only be called with the PREROLL_LOCK held (like when |
| 292 | * receiving an EOS event in the signal_event() vmethod or when handling buffers in |
| 293 | * signal_render()). |
| 294 | * |
| 295 | * The @a time argument should be the running_time of when the timeout should happen |
| 296 | * and will be adjusted with any latency and offset configured in the sink. |
| 297 | * |
| 298 | * @param time The running_time to be reached. |
| 299 | * @param jitter The jitter to be filled with time diff, or <tt>nullptr</tt>. |
| 300 | * @return Gst::FlowReturn. |
| 301 | */ |
| 302 | Gst::FlowReturn wait(Gst::ClockTime time, Gst::ClockTimeDiff& jitter); |
| 303 | |
| 304 | /// A wait() convenience overload. |
| 305 | Gst::FlowReturn wait(Gst::ClockTime time); |
| 306 | |
| 307 | |
| 308 | /** Configures @a sink to synchronize on the clock or not. When |
| 309 | * @a sync is <tt>false</tt>, incoming samples will be played as fast as |
| 310 | * possible. If @a sync is <tt>true</tt>, the timestamps of the incoming |
| 311 | * buffers will be used to schedule the exact render time of its |
| 312 | * contents. |
| 313 | * |
| 314 | * @param sync The new sync value. |
| 315 | */ |
| 316 | void set_sync(bool sync); |
| 317 | |
| 318 | /** Checks if @a sink is currently configured to synchronize against the |
| 319 | * clock. |
| 320 | * |
| 321 | * @return <tt>true</tt> if the sink is configured to synchronize against the clock. |
| 322 | */ |
| 323 | bool get_sync() const; |
| 324 | |
| 325 | |
| 326 | /** Sets the new max lateness value to @a max_lateness. This value is |
| 327 | * used to decide if a buffer should be dropped or not based on the |
| 328 | * buffer timestamp and the current clock time. A value of -1 means |
| 329 | * an unlimited time. |
| 330 | * |
| 331 | * @param max_lateness The new max lateness value. |
| 332 | */ |
| 333 | void set_max_lateness(gint64 max_lateness); |
| 334 | |
| 335 | /** Gets the max lateness value. See gst_base_sink_set_max_lateness for |
| 336 | * more details. |
| 337 | * |
| 338 | * @return The maximum time in nanoseconds that a buffer can be late |
| 339 | * before it is dropped and not rendered. A value of -1 means an |
| 340 | * unlimited time. |
| 341 | */ |
| 342 | gint64 get_max_lateness() const; |
| 343 | |
| 344 | |
| 345 | /** Configures @a sink to send Quality-of-Service events upstream. |
| 346 | * |
| 347 | * @param enabled The new qos value. |
| 348 | */ |
| 349 | void set_qos_enabled(bool enabled); |
| 350 | |
| 351 | /** Checks if @a sink is currently configured to send Quality-of-Service events |
| 352 | * upstream. |
| 353 | * |
| 354 | * @return <tt>true</tt> if the sink is configured to perform Quality-of-Service. |
| 355 | */ |
| 356 | bool is_qos_enabled() const; |
| 357 | |
| 358 | |
| 359 | /** Configures @a sink to perform all state changes asynchronously. When async is |
| 360 | * disabled, the sink will immediately go to PAUSED instead of waiting for a |
| 361 | * preroll buffer. This feature is useful if the sink does not synchronize |
| 362 | * against the clock or when it is dealing with sparse streams. |
| 363 | * |
| 364 | * @param enabled The new async value. |
| 365 | */ |
| 366 | void set_async_enabled(bool enabled); |
| 367 | |
| 368 | /** Checks if @a sink is currently configured to perform asynchronous state |
| 369 | * changes to PAUSED. |
| 370 | * |
| 371 | * @return <tt>true</tt> if the sink is configured to perform asynchronous state |
| 372 | * changes. |
| 373 | */ |
| 374 | bool is_async_enabled() const; |
| 375 | |
| 376 | |
| 377 | /** Adjust the synchronisation of @a sink with @a offset. A negative value will |
| 378 | * render buffers earlier than their timestamp. A positive value will delay |
| 379 | * rendering. This function can be used to fix playback of badly timestamped |
| 380 | * buffers. |
| 381 | * |
| 382 | * @param offset The new offset. |
| 383 | */ |
| 384 | void set_ts_offset(Gst::ClockTimeDiff offset); |
| 385 | |
| 386 | /** Get the synchronisation offset of @a sink. |
| 387 | * |
| 388 | * @return The synchronisation offset. |
| 389 | */ |
| 390 | Gst::ClockTimeDiff get_ts_offset() const; |
| 391 | |
| 392 | |
| 393 | /** Set the render delay in @a sink to @a delay. The render delay is the time |
| 394 | * between actual rendering of a buffer and its synchronisation time. Some |
| 395 | * devices might delay media rendering which can be compensated for with this |
| 396 | * function. |
| 397 | * |
| 398 | * After calling this function, this sink will report additional latency and |
| 399 | * other sinks will adjust their latency to delay the rendering of their media. |
| 400 | * |
| 401 | * This function is usually called by subclasses. |
| 402 | * |
| 403 | * @param delay The new delay. |
| 404 | */ |
| 405 | void set_render_delay(Gst::ClockTime delay); |
| 406 | |
| 407 | /** Get the render delay of @a sink. see set_render_delay() for more |
| 408 | * information about the render delay. |
| 409 | * |
| 410 | * @return The render delay of @a sink. |
| 411 | */ |
| 412 | Gst::ClockTime get_render_delay() const; |
| 413 | |
| 414 | |
| 415 | /** Set the number of bytes that the sink will pull when it is operating in pull |
| 416 | * mode. |
| 417 | * |
| 418 | * @param blocksize The blocksize in bytes. |
| 419 | */ |
| 420 | void set_blocksize(guint blocksize); |
| 421 | |
| 422 | /** Get the number of bytes that the sink will pull when it is operating in pull |
| 423 | * mode. |
| 424 | * |
| 425 | * @return The number of bytes @a sink will pull in pull mode. |
| 426 | */ |
| 427 | guint get_blocksize() const; |
| 428 | |
| 429 | |
| 430 | /** Get the time that will be inserted between frames to control the |
| 431 | * maximum buffers per second. |
| 432 | * |
| 433 | * @return The number of nanoseconds @a sink will put between frames. |
| 434 | */ |
| 435 | guint64 get_throttle_time() const; |
| 436 | |
| 437 | /** Set the time that will be inserted between rendered buffers. This |
| 438 | * can be used to control the maximum buffers per second that the sink |
| 439 | * will render. |
| 440 | * |
| 441 | * @param throttle The throttle time in nanoseconds. |
| 442 | */ |
| 443 | void set_throttle_time(guint64 throttle); |
| 444 | |
| 445 | |
| 446 | /** Get the last sample that arrived in the sink and was used for preroll or for |
| 447 | * rendering. This property can be used to generate thumbnails. |
| 448 | * |
| 449 | * The Gst::Caps on the sample can be used to determine the type of the buffer. |
| 450 | * |
| 451 | * Free-function: gst_sample_unref |
| 452 | * |
| 453 | * @return A Gst::Sample. gst_sample_unref() after |
| 454 | * usage. This function returns <tt>nullptr</tt> when no buffer has arrived in the |
| 455 | * sink yet or when the sink is not in PAUSED or PLAYING. |
| 456 | */ |
| 457 | Glib::RefPtr<Gst::Sample> get_last_sample() const; |
| 458 | |
| 459 | |
| 460 | /** Set the maximum amount of bits per second that the sink will render. |
| 461 | * |
| 462 | * @param max_bitrate The max_bitrate in bits per second. |
| 463 | */ |
| 464 | void set_max_bitrate(guint64 max_bitrate); |
| 465 | |
| 466 | /** Get the maximum amount of bits per second that the sink will render. |
| 467 | * |
| 468 | * @return The maximum number of bits per second @a sink will render. |
| 469 | */ |
| 470 | guint64 get_max_bitrate() const; |
| 471 | |
| 472 | |
| 473 | /** Configures @a sink to store the last received sample in the last-sample |
| 474 | * property. |
| 475 | * |
| 476 | * @param enabled The new enable-last-sample value. |
| 477 | */ |
| 478 | void set_last_sample_enabled(bool enabled); |
| 479 | |
| 480 | /** Checks if @a sink is currently configured to store the last received sample in |
| 481 | * the last-sample property. |
| 482 | * |
| 483 | * @return <tt>true</tt> if the sink is configured to store the last received sample. |
| 484 | */ |
| 485 | bool is_last_sample_enabled() const; |
| 486 | |
| 487 | /** Gets the sink Gst::Pad object of the element. |
| 488 | */ |
| 489 | Glib::RefPtr<Gst::Pad> get_sink_pad(); |
| 490 | Glib::RefPtr<const Gst::Pad> get_sink_pad() const; |
| 491 | |
| 492 | // TODO: wrap preroll? |
| 493 | |
| 494 | /** Go asynchronously to PAUSED. |
| 495 | * |
| 496 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 497 | * or receive notification when the value of the property changes. |
| 498 | */ |
| 499 | Glib::PropertyProxy< bool > property_async() ; |
| 500 | |
| 501 | /** Go asynchronously to PAUSED. |
| 502 | * |
| 503 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 504 | * or receive notification when the value of the property changes. |
| 505 | */ |
| 506 | Glib::PropertyProxy_ReadOnly< bool > property_async() const; |
| 507 | |
| 508 | /** Maximum number of nanoseconds that a buffer can be late before it is dropped (-1 unlimited). |
| 509 | * |
| 510 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 511 | * or receive notification when the value of the property changes. |
| 512 | */ |
| 513 | Glib::PropertyProxy< gint64 > property_max_lateness() ; |
| 514 | |
| 515 | /** Maximum number of nanoseconds that a buffer can be late before it is dropped (-1 unlimited). |
| 516 | * |
| 517 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 518 | * or receive notification when the value of the property changes. |
| 519 | */ |
| 520 | Glib::PropertyProxy_ReadOnly< gint64 > property_max_lateness() const; |
| 521 | |
| 522 | /** Generate Quality-of-Service events upstream. |
| 523 | * |
| 524 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 525 | * or receive notification when the value of the property changes. |
| 526 | */ |
| 527 | Glib::PropertyProxy< bool > property_qos() ; |
| 528 | |
| 529 | /** Generate Quality-of-Service events upstream. |
| 530 | * |
| 531 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 532 | * or receive notification when the value of the property changes. |
| 533 | */ |
| 534 | Glib::PropertyProxy_ReadOnly< bool > property_qos() const; |
| 535 | |
| 536 | /** Sync on the clock. |
| 537 | * |
| 538 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 539 | * or receive notification when the value of the property changes. |
| 540 | */ |
| 541 | Glib::PropertyProxy< bool > property_sync() ; |
| 542 | |
| 543 | /** Sync on the clock. |
| 544 | * |
| 545 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 546 | * or receive notification when the value of the property changes. |
| 547 | */ |
| 548 | Glib::PropertyProxy_ReadOnly< bool > property_sync() const; |
| 549 | |
| 550 | /** Timestamp offset in nanoseconds. |
| 551 | * |
| 552 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 553 | * or receive notification when the value of the property changes. |
| 554 | */ |
| 555 | Glib::PropertyProxy< gint64 > property_ts_offset() ; |
| 556 | |
| 557 | /** Timestamp offset in nanoseconds. |
| 558 | * |
| 559 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 560 | * or receive notification when the value of the property changes. |
| 561 | */ |
| 562 | Glib::PropertyProxy_ReadOnly< gint64 > property_ts_offset() const; |
| 563 | |
| 564 | /** Additional render delay of the sink in nanoseconds. |
| 565 | * |
| 566 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 567 | * or receive notification when the value of the property changes. |
| 568 | */ |
| 569 | Glib::PropertyProxy< guint64 > property_render_delay() ; |
| 570 | |
| 571 | /** Additional render delay of the sink in nanoseconds. |
| 572 | * |
| 573 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 574 | * or receive notification when the value of the property changes. |
| 575 | */ |
| 576 | Glib::PropertyProxy_ReadOnly< guint64 > property_render_delay() const; |
| 577 | |
| 578 | /** The time to keep between rendered buffers (0 = disabled). |
| 579 | * |
| 580 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 581 | * or receive notification when the value of the property changes. |
| 582 | */ |
| 583 | Glib::PropertyProxy< guint64 > property_throttle_time() ; |
| 584 | |
| 585 | /** The time to keep between rendered buffers (0 = disabled). |
| 586 | * |
| 587 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 588 | * or receive notification when the value of the property changes. |
| 589 | */ |
| 590 | Glib::PropertyProxy_ReadOnly< guint64 > property_throttle_time() const; |
| 591 | |
| 592 | /** Size in bytes to pull per buffer (0 = default). |
| 593 | * |
| 594 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 595 | * or receive notification when the value of the property changes. |
| 596 | */ |
| 597 | Glib::PropertyProxy< guint > property_blocksize() ; |
| 598 | |
| 599 | /** Size in bytes to pull per buffer (0 = default). |
| 600 | * |
| 601 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 602 | * or receive notification when the value of the property changes. |
| 603 | */ |
| 604 | Glib::PropertyProxy_ReadOnly< guint > property_blocksize() const; |
| 605 | |
| 606 | /** The last sample received in the sink. |
| 607 | * |
| 608 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 609 | * or receive notification when the value of the property changes. |
| 610 | */ |
| 611 | Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gst::Sample> > property_last_sample() const; |
| 612 | |
| 613 | |
| 614 | /** Enable the last-sample property. |
| 615 | * |
| 616 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 617 | * or receive notification when the value of the property changes. |
| 618 | */ |
| 619 | Glib::PropertyProxy< bool > property_enable_last_sample() ; |
| 620 | |
| 621 | /** Enable the last-sample property. |
| 622 | * |
| 623 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 624 | * or receive notification when the value of the property changes. |
| 625 | */ |
| 626 | Glib::PropertyProxy_ReadOnly< bool > property_enable_last_sample() const; |
| 627 | |
| 628 | /** The maximum bits per second to render (0 = disabled). |
| 629 | * |
| 630 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 631 | * or receive notification when the value of the property changes. |
| 632 | */ |
| 633 | Glib::PropertyProxy< guint64 > property_max_bitrate() ; |
| 634 | |
| 635 | /** The maximum bits per second to render (0 = disabled). |
| 636 | * |
| 637 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 638 | * or receive notification when the value of the property changes. |
| 639 | */ |
| 640 | Glib::PropertyProxy_ReadOnly< guint64 > property_max_bitrate() const; |
| 641 | |
| 642 | |
| 643 | /** Called to get sink pad caps from the subclass. |
| 644 | */ |
| 645 | virtual Glib::RefPtr<Gst::Caps> get_caps_vfunc(const Glib::RefPtr<Gst::Caps>& caps) const; |
| 646 | |
| 647 | |
| 648 | /** Notify subclass of changed caps. |
| 649 | */ |
| 650 | virtual bool set_caps_vfunc(const Glib::RefPtr<Gst::Caps>& caps); |
| 651 | |
| 652 | |
| 653 | /** Called to get the start and end times for synchronising the passed buffer |
| 654 | * to the clock. |
| 655 | */ |
| 656 | virtual void get_times_vfunc(const Glib::RefPtr<Gst::Buffer>& buffer, Gst::ClockTime& start, Gst::ClockTime& end) const; |
| 657 | |
| 658 | |
| 659 | /** Start processing. Ideal for opening resources in the subclass. |
| 660 | */ |
| 661 | virtual bool start_vfunc(); |
| 662 | |
| 663 | |
| 664 | /** Stop processing. Subclasses should use this to close resources. |
| 665 | */ |
| 666 | virtual bool stop_vfunc(); |
| 667 | |
| 668 | |
| 669 | /** Unlock any pending access to the resource. Subclasses should unblock any |
| 670 | * blocked function ASAP. |
| 671 | */ |
| 672 | virtual bool unlock_vfunc(); |
| 673 | |
| 674 | |
| 675 | /** Override this to handle events arriving on the sink pad. |
| 676 | */ |
| 677 | virtual bool event_vfunc(const Glib::RefPtr<Gst::Event>& event); |
| 678 | |
| 679 | |
| 680 | /** Override this to implement custom logic to wait for the event time (for events |
| 681 | * like EOS and GAP). Subclasses should always first chain up to the default |
| 682 | * implementation. |
| 683 | */ |
| 684 | virtual FlowReturn wait_event_vfunc(const Glib::RefPtr<Gst::Event>& event); |
| 685 | |
| 686 | |
| 687 | /** Called to present the preroll buffer if desired. |
| 688 | */ |
| 689 | virtual FlowReturn preroll_vfunc(const Glib::RefPtr<Gst::Buffer>& buffer); |
| 690 | |
| 691 | |
| 692 | /** Called when a buffer should be presented or output, at the correct moment |
| 693 | * if the Gst::BaseSink has been set to sync to the clock. |
| 694 | */ |
| 695 | virtual FlowReturn render_vfunc(const Glib::RefPtr<Gst::Buffer>& buffer); |
| 696 | |
| 697 | |
| 698 | /** Subclasses should override this when they need to perform special |
| 699 | * processing when changing to the PLAYING state asynchronously. Called with |
| 700 | * the OBJECT_LOCK held. |
| 701 | */ |
| 702 | |
| 703 | /** Subclasses should override this when they can provide an alternate method |
| 704 | * of spawning a thread to drive the pipeline in pull mode. Should start or |
| 705 | * stop the pulling thread, depending on the value of the "active" argument. |
| 706 | * Called after actually activating the sink pad in pull mode. The default |
| 707 | * implementation starts a task on the sink pad. |
| 708 | */ |
| 709 | virtual bool activate_pull_vfunc(bool active); |
| 710 | |
| 711 | |
| 712 | /** Only useful in pull mode, this vmethod will be called in response to |
| 713 | * Gst::Pad::fixate_caps() being called on the sink pad. Implement if you |
| 714 | * have ideas about what should be the default values for the caps you |
| 715 | * support. |
| 716 | */ |
| 717 | virtual Glib::RefPtr<Gst::Caps> fixate_vfunc(const Glib::RefPtr<Gst::Caps>& caps); |
| 718 | |
| 719 | |
| 720 | /** Clear the previous unlock request. Subclasses should clear any state they |
| 721 | * set during unlock_vfunc(), such as clearing command queues. |
| 722 | */ |
| 723 | virtual bool unlock_stop_vfunc(); |
| 724 | |
| 725 | |
| 726 | /// Render a BufferList. |
| 727 | /** Same as render but used with buffer lists instead of buffers. |
| 728 | */ |
| 729 | virtual FlowReturn render_list_vfunc(const Glib::RefPtr<Gst::BufferList>& buffer_list); |
| 730 | |
| 731 | |
| 732 | /** Called to prepare the buffer for render and preroll. |
| 733 | * This function is called before synchronisation is performed. |
| 734 | */ |
| 735 | virtual FlowReturn prepare_vfunc(const Glib::RefPtr<Gst::Buffer>& buffer); |
| 736 | |
| 737 | |
| 738 | /** Called to prepare the buffer list for render_list. |
| 739 | * This function is called before synchronisation is performed. |
| 740 | */ |
| 741 | virtual FlowReturn prepare_list_vfunc(const Glib::RefPtr<Gst::BufferList>& buffer_list); |
| 742 | |
| 743 | |
| 744 | // Cannot use query_vfunc because the name has been used in the Gst::Element class. |
| 745 | // We have to provide custom implementation, because query vfunc expects writable |
| 746 | // query object. |
| 747 | /** Perform a GstQuery on the element. |
| 748 | */ |
| 749 | virtual bool base_sink_query_vfunc(const Glib::RefPtr<Gst::Query>& query); |
| 750 | |
| 751 | /** Configure the allocation query. |
| 752 | */ |
| 753 | |
| 754 | |
| 755 | virtual bool propose_allocation_vfunc(const Glib::RefPtr<Gst::Query>& query); |
| 756 | |
| 757 | |
| 758 | protected: |
| 759 | |
| 760 | |
| 761 | public: |
| 762 | |
| 763 | public: |
| 764 | //C++ methods used to invoke GTK+ virtual functions: |
| 765 | |
| 766 | protected: |
| 767 | //GTK+ Virtual Functions (override these to change behaviour): |
| 768 | |
| 769 | //Default Signal Handlers:: |
| 770 | |
| 771 | |
| 772 | }; |
| 773 | |
| 774 | } // namespace Gst |
| 775 | |
| 776 | |
| 777 | namespace Glib |
| 778 | { |
| 779 | /** A Glib::wrap() method for this object. |
| 780 | * |
| 781 | * @param object The C instance. |
| 782 | * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
| 783 | * @result A C++ instance that wraps this C instance. |
| 784 | * |
| 785 | * @relates Gst::BaseSink |
| 786 | */ |
| 787 | Glib::RefPtr<Gst::BaseSink> wrap(GstBaseSink* object, bool take_copy = false); |
| 788 | } |
| 789 | |
| 790 | |
| 791 | #endif /* _GSTREAMERMM_BASESINK_H */ |
| 792 |