liveadder: Remove plugin, replace by compat subclass of audiomixer
authorOlivier Crête <olivier.crete@collabora.com>
Sun, 4 Oct 2015 23:55:36 +0000 (00:55 +0100)
committerOlivier Crête <olivier.crete@collabora.com>
Sun, 11 Oct 2015 10:04:38 +0000 (11:04 +0100)
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

index 3966a8f..d3ddcdf 100644 (file)
@@ -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;