[gstreamermm] Gst::AudioBaseSink: wrap missing methods
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gstreamermm] Gst::AudioBaseSink: wrap missing methods
- Date: Sat, 23 Apr 2016 18:26:29 +0000 (UTC)
commit bb4ae20ce0b210ddd226539b09168abe88bb085c
Author: Marcin Kolny <marcin kolny gmail com>
Date: Sat Apr 23 15:17:47 2016 +0200
Gst::AudioBaseSink: wrap missing methods
* gstreamer/src/audiobasesink.{ccg|hg}: wrap AudioBaseSinkDiscontReason
enum, report_device_failure(), set_custom_slaving_callback() methods,
payload() virtual function.
* gstreamer/src/gst_vfuncs.defs: add definition of payload() virtual
function.
* tools/m4/convert_gst.m4: add conversion between newly wrapped enum.
gstreamer/src/audiobasesink.ccg | 44 ++++++++++++++++++++++++++++++++++-
gstreamer/src/audiobasesink.hg | 48 +++++++++++++++++++++++++++++++++++---
gstreamer/src/gst_vfuncs.defs | 8 ++++++
tools/m4/convert_gst.m4 | 1 +
4 files changed, 95 insertions(+), 6 deletions(-)
---
diff --git a/gstreamer/src/audiobasesink.ccg b/gstreamer/src/audiobasesink.ccg
index 82d69fb..a5161c6 100644
--- a/gstreamer/src/audiobasesink.ccg
+++ b/gstreamer/src/audiobasesink.ccg
@@ -1,6 +1,6 @@
/* gstreamermm - a C++ wrapper for gstreamer
*
- * Copyright 2008 The gstreamermm Development Team
+ * Copyright 2008-2016 The gstreamermm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,5 +17,45 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <gstreamermm/audiobasesink.h>
#include <gstreamermm/audioringbuffer.h>
+
+namespace Gst
+{
+
+extern "C"
+{
+
+static void AudioBaseSink_CustomSlaving_gstreamermm_callback(GstAudioBaseSink* sink, GstClockTime etime,
GstClockTime itime,
+ GstClockTimeDiff *requested_skew, GstAudioBaseSinkDiscontReason discont_reason, gpointer user_data)
+{
+ Gst::AudioBaseSink::SlotCustomSlaving* the_slot =
static_cast<Gst::AudioBaseSink::SlotCustomSlaving*>(user_data);
+ Glib::RefPtr<Gst::AudioBaseSink> sink_wrapper = Glib::wrap(sink, true);
+ try
+ {
+ (*the_slot)(sink_wrapper, static_cast<Gst::ClockTime>(etime), static_cast<Gst::ClockTime>(itime),
+ *requested_skew, static_cast<Gst::AudioBaseSinkDiscontReason>(discont_reason));
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+}
+
+static void AudioBaseSink_CustomSlaving_gstreamermm_callback_disconnect(gpointer data)
+{
+ Gst::AudioBaseSink::SlotCustomSlaving* the_slot =
static_cast<Gst::AudioBaseSink::SlotCustomSlaving*>(data);
+
+ if(the_slot)
+ delete the_slot;
+}
+
+}
+
+void AudioBaseSink::set_custom_slaving_callback(const SlotCustomSlaving& slot)
+{
+ SlotCustomSlaving *slot_copy = new SlotCustomSlaving(slot);
+
+ return gst_audio_base_sink_set_custom_slaving_callback(gobj(),
&AudioBaseSink_CustomSlaving_gstreamermm_callback, slot_copy,
&AudioBaseSink_CustomSlaving_gstreamermm_callback_disconnect);
+}
+
+}
diff --git a/gstreamer/src/audiobasesink.hg b/gstreamer/src/audiobasesink.hg
index 31e9f8a..7b6e57f 100644
--- a/gstreamer/src/audiobasesink.hg
+++ b/gstreamer/src/audiobasesink.hg
@@ -1,6 +1,6 @@
-/* gstreamermm - a C++ wrapper for gstreamer
+ /* gstreamermm - a C++ wrapper for gstreamer
*
- * Copyright 2008 The gstreamermm Development Team
+ * Copyright 2008-2016 The gstreamermm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,9 +17,9 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <gst/audio/audio.h>
#include <gst/audio/gstaudiobasesink.h>
#include <gstreamermm/basesink.h>
+
_PINCLUDE(gstreamermm/private/basesink_p.h)
_DEFS(gstreamermm,gst)
@@ -30,13 +30,14 @@ namespace Gst
class AudioRingBuffer;
_WRAP_ENUM(AudioBaseSinkSlaveMethod, GstAudioBaseSinkSlaveMethod)
+_WRAP_ENUM(AudioBaseSinkDiscontReason, GstAudioBaseSinkDiscontReason, NO_GTYPE)
/** The base class for audio sinks.
* This is the base class for audio sinks. Subclasses need to implement the
* create_ringbuffer_vfunc vmethod. This base class will then take care of
* writing samples to the audioringbuffer, synchronisation, clipping and flushing.
*
- * Last reviewed on 2006-09-27 (0.10.12).
+ * Last reviewed on 2016-04-23 (1.8.0).
*
* @ingroup GstBaseClasses
*/
@@ -45,6 +46,33 @@ class AudioBaseSink : public Gst::BaseSink
_CLASS_GOBJECT(AudioBaseSink, GstAudioBaseSink, GST_AUDIO_BASE_SINK, Gst::BaseSink, GstBaseSink)
public:
+ /** This slot is set with set_custom_slaving_callback()
+ * and is called during playback. It receives the current time of external and
+ * internal clocks, which the callback can then use to apply any custom
+ * slaving/synchronization schemes.
+ *
+ * The external clock is the sink's element clock, the internal one is the
+ * internal audio clock. The internal audio clock's calibration is applied to
+ * the timestamps before they are passed to the callback. The difference between
+ * etime and itime is the skew; how much internal and external clock lie apart
+ * from each other. A skew of 0 means both clocks are perfectly in sync.
+ * itime > etime means the external clock is going slower, while itime < etime
+ * means it is going faster than the internal clock. etime and itime are always
+ * valid timestamps, except for when a discontinuity happens.
+ *
+ * requested_skew is an output value the callback can write to. It informs the
+ * sink of whether or not it should move the playout pointer, and if so, by how
+ * much. This pointer is only nullptr if a discontinuity occurs; otherwise, it is
+ * safe to write to *requested_skew. The default skew is 0.
+ *
+ * The sink may experience discontinuities. If one happens, discont is TRUE,
+ * itime, etime are set to CLOCK_TIME_NONE, and requested_skew is nullptr.
+ * This makes it possible to reset custom clock slaving algorithms when a
+ * discontinuity happens.
+ *
+ */
+ typedef sigc::slot<void, const Glib::RefPtr<Gst::AudioBaseSink>&, Gst::ClockTime, Gst::ClockTime,
Gst::ClockTimeDiff&, Gst::AudioBaseSinkDiscontReason> SlotCustomSlaving;
+
/** Get the Gst::Clock of the Gst::AudioBaseSink.
*/
_MEMBER_GET_GOBJECT(provided_clock, provided_clock, Gst::Clock, GstClock*)
@@ -65,6 +93,11 @@ public:
_WRAP_METHOD(void set_alignment_threshold(Gst::ClockTime alignment_threshold),
gst_audio_base_sink_set_alignment_threshold)
_WRAP_METHOD(Gst::ClockTime get_alignment_threshold() const, gst_audio_base_sink_get_alignment_threshold)
+ _WRAP_METHOD(void report_device_failure(), gst_audio_base_sink_report_device_failure)
+
+ _WRAP_METHOD_DOCS_ONLY(gst_audio_base_sink_set_custom_slaving_callback)
+ void set_custom_slaving_callback(const SlotCustomSlaving& slot);
+
_WRAP_PROPERTY("alignment-threshold", guint64)
_WRAP_PROPERTY("buffer-time", gint64)
_WRAP_PROPERTY("can-activate-pull", bool)
@@ -77,6 +110,13 @@ public:
/** vfunc to create and return a Gst::AudioRingBuffer to write to.
*/
_WRAP_VFUNC(Glib::RefPtr<Gst::AudioRingBuffer> create_ring_buffer(), "create_ringbuffer")
+
+ /** vfunc to payload data in a format suitable to write to the sink. If no
+ * payloading is required, returns a reffed copy of the original
+ * buffer, else returns the payloaded buffer with all other metadata
+ * copied.
+ */
+ _WRAP_VFUNC(Glib::RefPtr<Gst::Buffer> payload(const Glib::RefPtr<Gst::Buffer>& buffer), "payload")
};
} // namespace Gst
diff --git a/gstreamer/src/gst_vfuncs.defs b/gstreamer/src/gst_vfuncs.defs
index 190e283..a64b5c7 100644
--- a/gstreamer/src/gst_vfuncs.defs
+++ b/gstreamer/src/gst_vfuncs.defs
@@ -127,6 +127,14 @@
(return-type "GstAudioRingBuffer*")
)
+(define-vfunc payload
+ (of-object "GstAudioBaseSink")
+ (return-type "GstBuffer*")
+ (parameters
+ '("GstBuffer*" "buffer")
+ )
+)
+
; GstAudioBaseSrc
(define-vfunc create_ringbuffer
diff --git a/tools/m4/convert_gst.m4 b/tools/m4/convert_gst.m4
index 73038c1..bcc087b 100644
--- a/tools/m4/convert_gst.m4
+++ b/tools/m4/convert_gst.m4
@@ -4,6 +4,7 @@ dnl Enums
_CONV_ENUM(Gst,AssocFlags)
_CONV_ENUM(Gst,AutoplugSelectResult)
_CONV_ENUM(Gst,AudioBaseSinkSlaveMethod)
+_CONV_ENUM(Gst,AudioBaseSinkDiscontReason)
_CONV_ENUM(Gst,AudioBaseSrcSlaveMethod)
_CONV_ENUM(Gst,BufferCopyFlags)
_CONV_ENUM(Gst,BufferFlags)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]