summaryrefslogtreecommitdiffstats
path: root/src/polypmixer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/polypmixer.c')
-rw-r--r--src/polypmixer.c60
1 files changed, 56 insertions, 4 deletions
diff --git a/src/polypmixer.c b/src/polypmixer.c
index ef5a846..0b18325 100644
--- a/src/polypmixer.c
+++ b/src/polypmixer.c
@@ -37,14 +37,55 @@ enum {
GST_DEBUG_CATEGORY_EXTERN(polyp_debug);
#define GST_CAT_DEFAULT polyp_debug
-GST_IMPLEMENT_POLYPMIXER_CTRL_METHODS(GstPolypMixer, gst_polypmixer)
-GST_BOILERPLATE_WITH_INTERFACE(GstPolypMixer, gst_polypmixer, GstElement, GST_TYPE_ELEMENT, GstMixer, GST_TYPE_MIXER, gst_polypmixer)
-
static void gst_polypmixer_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_polypmixer_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static void gst_polypmixer_finalize(GObject *object);
static GstStateChangeReturn gst_polypmixer_change_state(GstElement *element, GstStateChange transition);
+static void gst_polypmixer_init_interfaces(GType type);
+
+GST_IMPLEMENT_POLYPMIXER_CTRL_METHODS(GstPolypMixer, gst_polypmixer)
+GST_IMPLEMENT_POLYPPROBE_METHODS(GstPolypMixer, gst_polypmixer)
+GST_BOILERPLATE_FULL(GstPolypMixer, gst_polypmixer, GstElement, GST_TYPE_ELEMENT, gst_polypmixer_init_interfaces)
+
+static gboolean gst_polypmixer_interface_supported(GstImplementsInterface* iface, GType interface_type) {
+ GstPolypMixer *this = GST_POLYPMIXER(iface);
+
+ if (interface_type == GST_TYPE_MIXER && this->mixer)
+ return TRUE;
+
+ if (interface_type == GST_TYPE_PROPERTY_PROBE && this->probe)
+ return TRUE;
+
+ return FALSE;
+}
+
+static void gst_polypmixer_implements_interface_init(GstImplementsInterfaceClass* klass) {
+ klass->supported = gst_polypmixer_interface_supported;
+}
+
+static void gst_polypmixer_init_interfaces(GType type) {
+ static const GInterfaceInfo implements_iface_info = {
+ (GInterfaceInitFunc) gst_polypmixer_implements_interface_init,
+ NULL,
+ NULL,
+ };
+ static const GInterfaceInfo mixer_iface_info = {
+ (GInterfaceInitFunc) gst_polypmixer_mixer_interface_init,
+ NULL,
+ NULL,
+ };
+ static const GInterfaceInfo probe_iface_info = {
+ (GInterfaceInitFunc) gst_polypmixer_property_probe_interface_init,
+ NULL,
+ NULL,
+ };
+
+ g_type_add_interface_static(type, GST_TYPE_IMPLEMENTS_INTERFACE, &implements_iface_info);
+ g_type_add_interface_static(type, GST_TYPE_MIXER, &mixer_iface_info);
+ g_type_add_interface_static(type, GST_TYPE_PROPERTY_PROBE, &probe_iface_info);
+}
+
static void gst_polypmixer_base_init(gpointer g_class) {
static const GstElementDetails details =
@@ -87,6 +128,8 @@ static void gst_polypmixer_init(GstPolypMixer *this, GstPolypMixerClass *g_class
this->mixer = NULL;
this->server = NULL;
this->device = NULL;
+
+ this->probe = gst_polypprobe_new(G_OBJECT_GET_CLASS(this), PROP_DEVICE, this->device, TRUE, TRUE);
}
static void gst_polypmixer_finalize(GObject *object) {
@@ -99,6 +142,11 @@ static void gst_polypmixer_finalize(GObject *object) {
gst_polypmixer_ctrl_free(this->mixer);
this->mixer = NULL;
}
+
+ if (this->probe) {
+ gst_polypprobe_free(this->probe);
+ this->probe = NULL;
+ }
G_OBJECT_CLASS(parent_class)->finalize(object);
}
@@ -120,6 +168,10 @@ static void gst_polypmixer_set_property(
case PROP_DEVICE:
g_free(this->device);
this->device = g_value_dup_string(value);
+
+ if (this->probe)
+ gst_polypprobe_set_server(this->probe, this->device);
+
break;
default:
@@ -149,7 +201,7 @@ static void gst_polypmixer_get_property(
case PROP_DEVICE_NAME:
if (this->mixer) {
- char *t = g_strdup_printf("[%s] %s", this->mixer->name, this->mixer->description);
+ char *t = g_strdup_printf("%s - %s [%s]", this->mixer->type == GST_POLYPMIXER_SINK ? "Playback" : "Capture", this->mixer->description, this->mixer->name);
g_value_set_string(value, t);
g_free(t);
} else