From 8cce2ccbf2865e910a40522550735e23fa5b6fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Mon, 5 Oct 2015 00:55:36 +0100 Subject: [PATCH] liveadder: Remove plugin, replace by compat subclass of audiomixer New subclass with a similar behaviour as the old liveadder, but a slightly different API as the latency is in nanoseconds, not milliseconds. Also, the new liveadder has a effective latency that is latency + output-buffer-duration. In practice, just setting a non-zero latency with the new audiomixer gives you the right behavior in 99% of the cases. --- gst/audiomixer/gstaudiomixer.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gst/audiomixer/gstaudiomixer.c b/gst/audiomixer/gstaudiomixer.c index 3966a8fc27..d3ddcdf4f9 100644 --- a/gst/audiomixer/gstaudiomixer.c +++ b/gst/audiomixer/gstaudiomixer.c @@ -781,6 +781,28 @@ gst_audiomixer_child_proxy_init (gpointer g_iface, gpointer iface_data) iface->get_children_count = gst_audiomixer_child_proxy_get_children_count; } +/* Empty liveadder alias with non-zero latency */ + +typedef GstAudioMixer GstLiveAdder; +typedef GstAudioMixerClass GstLiveAdderClass; + +static GType gst_live_adder_get_type (void); +#define GST_TYPE_LIVE_ADDER gst_live_adder_get_type () + +G_DEFINE_TYPE (GstLiveAdder, gst_live_adder, GST_TYPE_AUDIO_MIXER); + +static void +gst_live_adder_init (GstLiveAdder * self) +{ + g_object_set (self, "latency", 30 * GST_MSECOND, NULL); +} + +static void +gst_live_adder_class_init (GstLiveAdderClass * klass) +{ +} + + static gboolean plugin_init (GstPlugin * plugin) { @@ -791,6 +813,10 @@ plugin_init (GstPlugin * plugin) GST_TYPE_AUDIO_MIXER)) return FALSE; + if (!gst_element_register (plugin, "liveadder", GST_RANK_NONE, + GST_TYPE_LIVE_ADDER)) + return FALSE; + if (!gst_element_register (plugin, "audiointerleave", GST_RANK_NONE, GST_TYPE_AUDIO_INTERLEAVE)) return FALSE;