2 * empathy-gst-audio-src.c - Source for EmpathyGstAudioSrc
3 * Copyright (C) 2008 Collabora Ltd.
4 * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #include "empathy-audio-src.h"
27 G_DEFINE_TYPE(EmpathyGstAudioSrc, empathy_audio_src, GST_TYPE_BIN)
36 static guint signals[LAST_SIGNAL] = {0};
39 /* private structure */
40 typedef struct _EmpathyGstAudioSrcPrivate EmpathyGstAudioSrcPrivate;
42 struct _EmpathyGstAudioSrcPrivate
44 gboolean dispose_has_run;
48 #define EMPATHY_GST_AUDIO_SRC_GET_PRIVATE(o) \
49 (G_TYPE_INSTANCE_GET_PRIVATE ((o), EMPATHY_TYPE_GST_AUDIO_SRC, \
50 EmpathyGstAudioSrcPrivate))
53 empathy_audio_src_init (EmpathyGstAudioSrc *obj)
55 EmpathyGstAudioSrcPrivate *priv = EMPATHY_GST_AUDIO_SRC_GET_PRIVATE (obj);
56 //GstElement *resample;
59 /* allocate any data required by the object here */
60 //resample = gst_element_factory_make ("audioresample", NULL);
62 priv->src = gst_element_factory_make ("gconfaudiosrc", NULL);
64 //gst_bin_add_many (GST_BIN (obj), priv->src, resample, NULL);
65 gst_bin_add_many (GST_BIN (obj), priv->src, NULL);
66 //gst_element_link_many (priv->src, resample, NULL);
68 //src = gst_element_get_static_pad (resample, "src");
69 src = gst_element_get_static_pad (priv->src, "src");
71 ghost = gst_ghost_pad_new ("src", src);
72 gst_element_add_pad (GST_ELEMENT (obj), ghost);
74 gst_object_unref (G_OBJECT (src));
77 static void empathy_audio_src_dispose (GObject *object);
78 static void empathy_audio_src_finalize (GObject *object);
81 empathy_audio_src_class_init (EmpathyGstAudioSrcClass
82 *empathy_audio_src_class)
84 GObjectClass *object_class = G_OBJECT_CLASS (empathy_audio_src_class);
86 g_type_class_add_private (empathy_audio_src_class,
87 sizeof (EmpathyGstAudioSrcPrivate));
89 object_class->dispose = empathy_audio_src_dispose;
90 object_class->finalize = empathy_audio_src_finalize;
94 empathy_audio_src_dispose (GObject *object)
96 EmpathyGstAudioSrc *self = EMPATHY_GST_AUDIO_SRC (object);
97 EmpathyGstAudioSrcPrivate *priv = EMPATHY_GST_AUDIO_SRC_GET_PRIVATE (self);
99 if (priv->dispose_has_run)
102 priv->dispose_has_run = TRUE;
104 /* release any references held by the object here */
106 if (G_OBJECT_CLASS (empathy_audio_src_parent_class)->dispose)
107 G_OBJECT_CLASS (empathy_audio_src_parent_class)->dispose (object);
111 empathy_audio_src_finalize (GObject *object)
113 //EmpathyGstAudioSrc *self = EMPATHY_GST_AUDIO_SRC (object);
114 //EmpathyGstAudioSrcPrivate *priv = EMPATHY_GST_AUDIO_SRC_GET_PRIVATE (self);
116 /* free any data held directly by the object here */
118 G_OBJECT_CLASS (empathy_audio_src_parent_class)->finalize (object);
122 empathy_audio_src_new (void)
124 return GST_ELEMENT (g_object_new (EMPATHY_TYPE_GST_AUDIO_SRC, NULL));