| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | #ifndef _GSTREAMERMM_AUDIOBASESINK_H |
| 3 | #define _GSTREAMERMM_AUDIOBASESINK_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/audio/gstaudiobasesink.h> |
| 29 | #include <gstreamermm/basesink.h> |
| 30 | |
| 31 | |
| 32 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 33 | using GstAudioBaseSink = struct _GstAudioBaseSink; |
| 34 | using GstAudioBaseSinkClass = struct _GstAudioBaseSinkClass; |
| 35 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 36 | |
| 37 | |
| 38 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 39 | namespace Gst |
| 40 | { class AudioBaseSink_Class; } // namespace Gst |
| 41 | #endif //DOXYGEN_SHOULD_SKIP_THIS |
| 42 | |
| 43 | namespace Gst |
| 44 | { |
| 45 | |
| 46 | class AudioRingBuffer; |
| 47 | |
| 48 | /** @addtogroup gstreamermmEnums gstreamermm Enums and Flags */ |
| 49 | |
| 50 | /** |
| 51 | * @var AudioBaseSinkSlaveMethod AUDIO_BASE_SINK_SLAVE_RESAMPLE |
| 52 | * Resample to match the master clock. |
| 53 | * |
| 54 | * @var AudioBaseSinkSlaveMethod AUDIO_BASE_SINK_SLAVE_SKEW |
| 55 | * Adjust playout pointer when master clock |
| 56 | * drifts too much. |
| 57 | * |
| 58 | * @var AudioBaseSinkSlaveMethod AUDIO_BASE_SINK_SLAVE_NONE |
| 59 | * No adjustment is done. |
| 60 | * |
| 61 | * @var AudioBaseSinkSlaveMethod AUDIO_BASE_SINK_SLAVE_CUSTOM |
| 62 | * Use custom clock slaving algorithm (Since: 1.6). |
| 63 | * |
| 64 | * @enum AudioBaseSinkSlaveMethod |
| 65 | * |
| 66 | * Different possible clock slaving algorithms used when the internal audio |
| 67 | * clock is not selected as the pipeline master clock. |
| 68 | * |
| 69 | * @ingroup gstreamermmEnums |
| 70 | */ |
| 71 | enum AudioBaseSinkSlaveMethod |
| 72 | { |
| 73 | AUDIO_BASE_SINK_SLAVE_RESAMPLE, |
| 74 | AUDIO_BASE_SINK_SLAVE_SKEW, |
| 75 | AUDIO_BASE_SINK_SLAVE_NONE, |
| 76 | AUDIO_BASE_SINK_SLAVE_CUSTOM |
| 77 | }; |
| 78 | |
| 79 | } // namespace Gst |
| 80 | |
| 81 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 82 | namespace Glib |
| 83 | { |
| 84 | |
| 85 | template <> |
| 86 | class Value<Gst::AudioBaseSinkSlaveMethod> : public Glib::Value_Enum<Gst::AudioBaseSinkSlaveMethod> |
| 87 | { |
| 88 | public: |
| 89 | static GType value_type() G_GNUC_CONST; |
| 90 | }; |
| 91 | |
| 92 | } // namespace Glib |
| 93 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 94 | |
| 95 | namespace Gst |
| 96 | { |
| 97 | |
| 98 | /** |
| 99 | * @var AudioBaseSinkDiscontReason AUDIO_BASE_SINK_DISCONT_REASON_NO_DISCONT |
| 100 | * No discontinuity occurred. |
| 101 | * |
| 102 | * @var AudioBaseSinkDiscontReason AUDIO_BASE_SINK_DISCONT_REASON_NEW_CAPS |
| 103 | * New caps are set, causing renegotiotion. |
| 104 | * |
| 105 | * @var AudioBaseSinkDiscontReason AUDIO_BASE_SINK_DISCONT_REASON_FLUSH |
| 106 | * Samples have been flushed. |
| 107 | * |
| 108 | * @var AudioBaseSinkDiscontReason AUDIO_BASE_SINK_DISCONT_REASON_SYNC_LATENCY |
| 109 | * Sink was synchronized to the estimated latency (occurs during initialization). |
| 110 | * |
| 111 | * @var AudioBaseSinkDiscontReason AUDIO_BASE_SINK_DISCONT_REASON_ALIGNMENT |
| 112 | * Aligning buffers failed because the timestamps are too discontinuous. |
| 113 | * |
| 114 | * @var AudioBaseSinkDiscontReason AUDIO_BASE_SINK_DISCONT_REASON_DEVICE_FAILURE |
| 115 | * Audio output device experienced and recovered from an error but introduced latency in the process (see also @a Gst::AudioBaseSink::report_device_failure()). |
| 116 | * |
| 117 | * @enum AudioBaseSinkDiscontReason |
| 118 | * |
| 119 | * Different possible reasons for discontinuities. This enum is useful for the custom |
| 120 | * slave method. |
| 121 | * |
| 122 | * @ingroup gstreamermmEnums |
| 123 | */ |
| 124 | enum AudioBaseSinkDiscontReason |
| 125 | { |
| 126 | AUDIO_BASE_SINK_DISCONT_REASON_NO_DISCONT, |
| 127 | AUDIO_BASE_SINK_DISCONT_REASON_NEW_CAPS, |
| 128 | AUDIO_BASE_SINK_DISCONT_REASON_FLUSH, |
| 129 | AUDIO_BASE_SINK_DISCONT_REASON_SYNC_LATENCY, |
| 130 | AUDIO_BASE_SINK_DISCONT_REASON_ALIGNMENT, |
| 131 | AUDIO_BASE_SINK_DISCONT_REASON_DEVICE_FAILURE |
| 132 | }; |
| 133 | |
| 134 | |
| 135 | /** The base class for audio sinks. |
| 136 | * This is the base class for audio sinks. Subclasses need to implement the |
| 137 | * create_ringbuffer_vfunc vmethod. This base class will then take care of |
| 138 | * writing samples to the audioringbuffer, synchronisation, clipping and flushing. |
| 139 | * |
| 140 | * Last reviewed on 2016-04-23 (1.8.0). |
| 141 | * |
| 142 | * @ingroup GstBaseClasses |
| 143 | */ |
| 144 | |
| 145 | class AudioBaseSink : public Gst::BaseSink |
| 146 | { |
| 147 | |
| 148 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 149 | |
| 150 | public: |
| 151 | using CppObjectType = AudioBaseSink; |
| 152 | using CppClassType = AudioBaseSink_Class; |
| 153 | using BaseObjectType = GstAudioBaseSink; |
| 154 | using BaseClassType = GstAudioBaseSinkClass; |
| 155 | |
| 156 | // noncopyable |
| 157 | AudioBaseSink(const AudioBaseSink&) = delete; |
| 158 | AudioBaseSink& operator=(const AudioBaseSink&) = delete; |
| 159 | |
| 160 | private: friend class AudioBaseSink_Class; |
| 161 | static CppClassType audiobasesink_class_; |
| 162 | |
| 163 | protected: |
| 164 | explicit AudioBaseSink(const Glib::ConstructParams& construct_params); |
| 165 | explicit AudioBaseSink(GstAudioBaseSink* castitem); |
| 166 | |
| 167 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 168 | |
| 169 | public: |
| 170 | |
| 171 | AudioBaseSink(AudioBaseSink&& src) noexcept; |
| 172 | AudioBaseSink& operator=(AudioBaseSink&& src) noexcept; |
| 173 | |
| 174 | ~AudioBaseSink() noexcept override; |
| 175 | |
| 176 | /** Get the GType for this class, for use with the underlying GObject type system. |
| 177 | */ |
| 178 | static GType get_type() G_GNUC_CONST; |
| 179 | |
| 180 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 181 | |
| 182 | |
| 183 | static GType get_base_type() G_GNUC_CONST; |
| 184 | #endif |
| 185 | |
| 186 | ///Provides access to the underlying C GObject. |
| 187 | GstAudioBaseSink* gobj() { return reinterpret_cast<GstAudioBaseSink*>(gobject_); } |
| 188 | |
| 189 | ///Provides access to the underlying C GObject. |
| 190 | const GstAudioBaseSink* gobj() const { return reinterpret_cast<GstAudioBaseSink*>(gobject_); } |
| 191 | |
| 192 | ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. |
| 193 | GstAudioBaseSink* gobj_copy(); |
| 194 | |
| 195 | private: |
| 196 | |
| 197 | |
| 198 | public: |
| 199 | /** This slot is set with set_custom_slaving_callback() |
| 200 | * and is called during playback. It receives the current time of external and |
| 201 | * internal clocks, which the callback can then use to apply any custom |
| 202 | * slaving/synchronization schemes. |
| 203 | * |
| 204 | * The external clock is the sink's element clock, the internal one is the |
| 205 | * internal audio clock. The internal audio clock's calibration is applied to |
| 206 | * the timestamps before they are passed to the callback. The difference between |
| 207 | * etime and itime is the skew; how much internal and external clock lie apart |
| 208 | * from each other. A skew of 0 means both clocks are perfectly in sync. |
| 209 | * itime > etime means the external clock is going slower, while itime < etime |
| 210 | * means it is going faster than the internal clock. etime and itime are always |
| 211 | * valid timestamps, except for when a discontinuity happens. |
| 212 | * |
| 213 | * requested_skew is an output value the callback can write to. It informs the |
| 214 | * sink of whether or not it should move the playout pointer, and if so, by how |
| 215 | * much. This pointer is only nullptr if a discontinuity occurs; otherwise, it is |
| 216 | * safe to write to *requested_skew. The default skew is 0. |
| 217 | * |
| 218 | * The sink may experience discontinuities. If one happens, discont is TRUE, |
| 219 | * itime, etime are set to CLOCK_TIME_NONE, and requested_skew is nullptr. |
| 220 | * This makes it possible to reset custom clock slaving algorithms when a |
| 221 | * discontinuity happens. |
| 222 | * |
| 223 | */ |
| 224 | typedef sigc::slot<void, const Glib::RefPtr<Gst::AudioBaseSink>&, Gst::ClockTime, Gst::ClockTime, Gst::ClockTimeDiff&, Gst::AudioBaseSinkDiscontReason> SlotCustomSlaving; |
| 225 | |
| 226 | /** Get the Gst::Clock of the Gst::AudioBaseSink. |
| 227 | */ |
| 228 | Glib::RefPtr<Gst::Clock> get_provided_clock(); |
| 229 | Glib::RefPtr<const Gst::Clock> get_provided_clock() const; |
| 230 | |
| 231 | |
| 232 | /** Create and return the Gst::AudioRingBuffer for @a sink. This function will |
| 233 | * call the ::create_ringbuffer vmethod and will set @a sink as the parent of |
| 234 | * the returned buffer (see Gst::Object::set_parent()). |
| 235 | * |
| 236 | * @return The new ringbuffer of @a sink. |
| 237 | */ |
| 238 | Glib::RefPtr<Gst::AudioRingBuffer> create_ring_buffer(); |
| 239 | |
| 240 | /** Controls whether @a sink will provide a clock or not. If @a provide is <tt>true</tt>, |
| 241 | * Gst::Element::provide_clock() will return a clock that reflects the datarate |
| 242 | * of @a sink. If @a provide is <tt>false</tt>, Gst::Element::provide_clock() will return |
| 243 | * <tt>nullptr</tt>. |
| 244 | * |
| 245 | * @param provide New state. |
| 246 | */ |
| 247 | void set_provide_clock(bool provide); |
| 248 | |
| 249 | /** Queries whether @a sink will provide a clock or not. See also |
| 250 | * gst_audio_base_sink_set_provide_clock. |
| 251 | * |
| 252 | * @return <tt>true</tt> if @a sink will provide a clock. |
| 253 | */ |
| 254 | bool get_provide_clock() const; |
| 255 | |
| 256 | |
| 257 | /** Controls how clock slaving will be performed in @a sink. |
| 258 | * |
| 259 | * @param method The new slave method. |
| 260 | */ |
| 261 | void set_slave_method(Gst::AudioBaseSinkSlaveMethod method); |
| 262 | |
| 263 | /** Get the current slave method used by @a sink. |
| 264 | * |
| 265 | * @return The current slave method used by @a sink. |
| 266 | */ |
| 267 | Gst::AudioBaseSinkSlaveMethod get_slave_method() const; |
| 268 | |
| 269 | |
| 270 | /** Get the current drift tolerance, in microseconds, used by @a sink. |
| 271 | * |
| 272 | * @return The current drift tolerance used by @a sink. |
| 273 | */ |
| 274 | gint64 get_drift_tolerance() const; |
| 275 | |
| 276 | /** Controls the sink's drift tolerance. |
| 277 | * |
| 278 | * @param drift_tolerance The new drift tolerance in microseconds. |
| 279 | */ |
| 280 | void set_drift_tolerance(gint64 drift_tolerance); |
| 281 | |
| 282 | |
| 283 | /** Controls how long the sink will wait before creating a discontinuity. |
| 284 | * |
| 285 | * @param discont_wait The new discont wait in nanoseconds. |
| 286 | */ |
| 287 | void set_discont_wait(Gst::ClockTime discont_wait); |
| 288 | |
| 289 | /** Get the current discont wait, in nanoseconds, used by @a sink. |
| 290 | * |
| 291 | * @return The current discont wait used by @a sink. |
| 292 | */ |
| 293 | Gst::ClockTime get_discont_wait() const; |
| 294 | |
| 295 | |
| 296 | /** Controls the sink's alignment threshold. |
| 297 | * |
| 298 | * @param alignment_threshold The new alignment threshold in nanoseconds. |
| 299 | */ |
| 300 | void set_alignment_threshold(Gst::ClockTime alignment_threshold); |
| 301 | |
| 302 | /** Get the current alignment threshold, in nanoseconds, used by @a sink. |
| 303 | * |
| 304 | * @return The current alignment threshold used by @a sink. |
| 305 | */ |
| 306 | Gst::ClockTime get_alignment_threshold() const; |
| 307 | |
| 308 | |
| 309 | /** Informs this base class that the audio output device has failed for |
| 310 | * some reason, causing a discontinuity (for example, because the device |
| 311 | * recovered from the error, but lost all contents of its ring buffer). |
| 312 | * This function is typically called by derived classes, and is useful |
| 313 | * for the custom slave method. |
| 314 | */ |
| 315 | void report_device_failure(); |
| 316 | |
| 317 | |
| 318 | /** Sets the custom slaving callback. This callback will |
| 319 | * be invoked if the slave-method property is set to |
| 320 | * GST_AUDIO_BASE_SINK_SLAVE_CUSTOM and the audio sink |
| 321 | * receives and plays samples. |
| 322 | * |
| 323 | * Setting the callback to <tt>nullptr</tt> causes the sink to |
| 324 | * behave as if the GST_AUDIO_BASE_SINK_SLAVE_NONE |
| 325 | * method were used. |
| 326 | * |
| 327 | * @param slot A Gst::SlotAudioBaseSinkCustomSlaving. |
| 328 | * @param user_data User data passed to the callback. |
| 329 | * @param notify Called when user_data becomes unused. |
| 330 | */ |
| 331 | |
| 332 | void set_custom_slaving_callback(const SlotCustomSlaving& slot); |
| 333 | |
| 334 | /** Timestamp alignment threshold in nanoseconds. |
| 335 | * |
| 336 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 337 | * or receive notification when the value of the property changes. |
| 338 | */ |
| 339 | Glib::PropertyProxy< guint64 > property_alignment_threshold() ; |
| 340 | |
| 341 | /** Timestamp alignment threshold in nanoseconds. |
| 342 | * |
| 343 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 344 | * or receive notification when the value of the property changes. |
| 345 | */ |
| 346 | Glib::PropertyProxy_ReadOnly< guint64 > property_alignment_threshold() const; |
| 347 | |
| 348 | /** Size of audio buffer in microseconds, this is the minimum latency that the sink reports. |
| 349 | * |
| 350 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 351 | * or receive notification when the value of the property changes. |
| 352 | */ |
| 353 | Glib::PropertyProxy< gint64 > property_buffer_time() ; |
| 354 | |
| 355 | /** Size of audio buffer in microseconds, this is the minimum latency that the sink reports. |
| 356 | * |
| 357 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 358 | * or receive notification when the value of the property changes. |
| 359 | */ |
| 360 | Glib::PropertyProxy_ReadOnly< gint64 > property_buffer_time() const; |
| 361 | |
| 362 | /** Allow pull-based scheduling. |
| 363 | * |
| 364 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 365 | * or receive notification when the value of the property changes. |
| 366 | */ |
| 367 | Glib::PropertyProxy< bool > property_can_activate_pull() ; |
| 368 | |
| 369 | /** Allow pull-based scheduling. |
| 370 | * |
| 371 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 372 | * or receive notification when the value of the property changes. |
| 373 | */ |
| 374 | Glib::PropertyProxy_ReadOnly< bool > property_can_activate_pull() const; |
| 375 | |
| 376 | /** Window of time in nanoseconds to wait before creating a discontinuity. |
| 377 | * |
| 378 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 379 | * or receive notification when the value of the property changes. |
| 380 | */ |
| 381 | Glib::PropertyProxy< guint64 > property_discont_wait() ; |
| 382 | |
| 383 | /** Window of time in nanoseconds to wait before creating a discontinuity. |
| 384 | * |
| 385 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 386 | * or receive notification when the value of the property changes. |
| 387 | */ |
| 388 | Glib::PropertyProxy_ReadOnly< guint64 > property_discont_wait() const; |
| 389 | |
| 390 | /** Tolerance for clock drift in microseconds. |
| 391 | * |
| 392 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 393 | * or receive notification when the value of the property changes. |
| 394 | */ |
| 395 | Glib::PropertyProxy< gint64 > property_drift_tolerance() ; |
| 396 | |
| 397 | /** Tolerance for clock drift in microseconds. |
| 398 | * |
| 399 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 400 | * or receive notification when the value of the property changes. |
| 401 | */ |
| 402 | Glib::PropertyProxy_ReadOnly< gint64 > property_drift_tolerance() const; |
| 403 | |
| 404 | /** The minimum amount of data to write in each iteration in microseconds. |
| 405 | * |
| 406 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 407 | * or receive notification when the value of the property changes. |
| 408 | */ |
| 409 | Glib::PropertyProxy< gint64 > property_latency_time() ; |
| 410 | |
| 411 | /** The minimum amount of data to write in each iteration in microseconds. |
| 412 | * |
| 413 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 414 | * or receive notification when the value of the property changes. |
| 415 | */ |
| 416 | Glib::PropertyProxy_ReadOnly< gint64 > property_latency_time() const; |
| 417 | |
| 418 | /** Provide a clock to be used as the global pipeline clock. |
| 419 | * |
| 420 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 421 | * or receive notification when the value of the property changes. |
| 422 | */ |
| 423 | Glib::PropertyProxy< bool > property_provide_clock() ; |
| 424 | |
| 425 | /** Provide a clock to be used as the global pipeline clock. |
| 426 | * |
| 427 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 428 | * or receive notification when the value of the property changes. |
| 429 | */ |
| 430 | Glib::PropertyProxy_ReadOnly< bool > property_provide_clock() const; |
| 431 | |
| 432 | /** Algorithm used to match the rate of the masterclock. |
| 433 | * |
| 434 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 435 | * or receive notification when the value of the property changes. |
| 436 | */ |
| 437 | Glib::PropertyProxy< Gst::AudioBaseSinkSlaveMethod > property_slave_method() ; |
| 438 | |
| 439 | /** Algorithm used to match the rate of the masterclock. |
| 440 | * |
| 441 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 442 | * or receive notification when the value of the property changes. |
| 443 | */ |
| 444 | Glib::PropertyProxy_ReadOnly< Gst::AudioBaseSinkSlaveMethod > property_slave_method() const; |
| 445 | |
| 446 | |
| 447 | /** vfunc to create and return a Gst::AudioRingBuffer to write to. |
| 448 | */ |
| 449 | virtual Glib::RefPtr<Gst::AudioRingBuffer> create_ring_buffer_vfunc(); |
| 450 | |
| 451 | |
| 452 | /** vfunc to payload data in a format suitable to write to the sink. If no |
| 453 | * payloading is required, returns a reffed copy of the original |
| 454 | * buffer, else returns the payloaded buffer with all other metadata |
| 455 | * copied. |
| 456 | */ |
| 457 | virtual Glib::RefPtr<Gst::Buffer> payload_vfunc(const Glib::RefPtr<Gst::Buffer>& buffer); |
| 458 | |
| 459 | |
| 460 | public: |
| 461 | |
| 462 | public: |
| 463 | //C++ methods used to invoke GTK+ virtual functions: |
| 464 | |
| 465 | protected: |
| 466 | //GTK+ Virtual Functions (override these to change behaviour): |
| 467 | |
| 468 | //Default Signal Handlers:: |
| 469 | |
| 470 | |
| 471 | }; |
| 472 | |
| 473 | } // namespace Gst |
| 474 | |
| 475 | |
| 476 | namespace Glib |
| 477 | { |
| 478 | /** A Glib::wrap() method for this object. |
| 479 | * |
| 480 | * @param object The C instance. |
| 481 | * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
| 482 | * @result A C++ instance that wraps this C instance. |
| 483 | * |
| 484 | * @relates Gst::AudioBaseSink |
| 485 | */ |
| 486 | Glib::RefPtr<Gst::AudioBaseSink> wrap(GstAudioBaseSink* object, bool take_copy = false); |
| 487 | } |
| 488 | |
| 489 | |
| 490 | #endif /* _GSTREAMERMM_AUDIOBASESINK_H */ |
| 491 |