update for child proxy api change

This commit is contained in:
Wim Taymans 2012-03-31 15:43:49 +02:00
parent 3d61d12e03
commit 068ee88862
7 changed files with 58 additions and 56 deletions

View file

@ -307,12 +307,12 @@ gst_iir_equalizer_band_get_type (void)
/* child proxy iface */
static GstObject *
static GObject *
gst_iir_equalizer_child_proxy_get_child_by_index (GstChildProxy * child_proxy,
guint index)
{
GstIirEqualizer *equ = GST_IIR_EQUALIZER (child_proxy);
GstObject *ret;
GObject *ret;
BANDS_LOCK (equ);
if (G_UNLIKELY (index >= equ->freq_band_count)) {
@ -320,7 +320,7 @@ gst_iir_equalizer_child_proxy_get_child_by_index (GstChildProxy * child_proxy,
g_return_val_if_fail (index < equ->freq_band_count, NULL);
}
ret = gst_object_ref (equ->bands[index]);
ret = g_object_ref (equ->bands[index]);
BANDS_UNLOCK (equ);
GST_LOG_OBJECT (equ, "return child[%d] %" GST_PTR_FORMAT, index, ret);
@ -653,15 +653,15 @@ gst_iir_equalizer_compute_frequencies (GstIirEqualizer * equ, guint new_count)
GST_DEBUG ("adding band[%d]=%p", i, equ->bands[i]);
gst_object_set_parent (GST_OBJECT (equ->bands[i]), GST_OBJECT (equ));
gst_child_proxy_child_added (GST_OBJECT (equ),
GST_OBJECT (equ->bands[i]));
gst_child_proxy_child_added (G_OBJECT (equ),
G_OBJECT (equ->bands[i]), name);
}
} else {
/* free unused bands */
for (i = new_count; i < old_count; i++) {
GST_DEBUG ("removing band[%d]=%p", i, equ->bands[i]);
gst_child_proxy_child_removed (GST_OBJECT (equ),
GST_OBJECT (equ->bands[i]));
gst_child_proxy_child_removed (G_OBJECT (equ),
G_OBJECT (equ->bands[i]), GST_OBJECT_NAME (equ->bands[i]));
gst_object_unparent (GST_OBJECT (equ->bands[i]));
equ->bands[i] = NULL;
}

View file

@ -150,34 +150,34 @@ gst_iir_equalizer_10bands_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_BAND0:
gst_child_proxy_set_property (GST_OBJECT (equ), "band0::gain", value);
gst_child_proxy_set_property (G_OBJECT (equ), "band0::gain", value);
break;
case PROP_BAND1:
gst_child_proxy_set_property (GST_OBJECT (equ), "band1::gain", value);
gst_child_proxy_set_property (G_OBJECT (equ), "band1::gain", value);
break;
case PROP_BAND2:
gst_child_proxy_set_property (GST_OBJECT (equ), "band2::gain", value);
gst_child_proxy_set_property (G_OBJECT (equ), "band2::gain", value);
break;
case PROP_BAND3:
gst_child_proxy_set_property (GST_OBJECT (equ), "band3::gain", value);
gst_child_proxy_set_property (G_OBJECT (equ), "band3::gain", value);
break;
case PROP_BAND4:
gst_child_proxy_set_property (GST_OBJECT (equ), "band4::gain", value);
gst_child_proxy_set_property (G_OBJECT (equ), "band4::gain", value);
break;
case PROP_BAND5:
gst_child_proxy_set_property (GST_OBJECT (equ), "band5::gain", value);
gst_child_proxy_set_property (G_OBJECT (equ), "band5::gain", value);
break;
case PROP_BAND6:
gst_child_proxy_set_property (GST_OBJECT (equ), "band6::gain", value);
gst_child_proxy_set_property (G_OBJECT (equ), "band6::gain", value);
break;
case PROP_BAND7:
gst_child_proxy_set_property (GST_OBJECT (equ), "band7::gain", value);
gst_child_proxy_set_property (G_OBJECT (equ), "band7::gain", value);
break;
case PROP_BAND8:
gst_child_proxy_set_property (GST_OBJECT (equ), "band8::gain", value);
gst_child_proxy_set_property (G_OBJECT (equ), "band8::gain", value);
break;
case PROP_BAND9:
gst_child_proxy_set_property (GST_OBJECT (equ), "band9::gain", value);
gst_child_proxy_set_property (G_OBJECT (equ), "band9::gain", value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -193,34 +193,34 @@ gst_iir_equalizer_10bands_get_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_BAND0:
gst_child_proxy_get_property (GST_OBJECT (equ), "band0::gain", value);
gst_child_proxy_get_property (G_OBJECT (equ), "band0::gain", value);
break;
case PROP_BAND1:
gst_child_proxy_get_property (GST_OBJECT (equ), "band1::gain", value);
gst_child_proxy_get_property (G_OBJECT (equ), "band1::gain", value);
break;
case PROP_BAND2:
gst_child_proxy_get_property (GST_OBJECT (equ), "band2::gain", value);
gst_child_proxy_get_property (G_OBJECT (equ), "band2::gain", value);
break;
case PROP_BAND3:
gst_child_proxy_get_property (GST_OBJECT (equ), "band3::gain", value);
gst_child_proxy_get_property (G_OBJECT (equ), "band3::gain", value);
break;
case PROP_BAND4:
gst_child_proxy_get_property (GST_OBJECT (equ), "band4::gain", value);
gst_child_proxy_get_property (G_OBJECT (equ), "band4::gain", value);
break;
case PROP_BAND5:
gst_child_proxy_get_property (GST_OBJECT (equ), "band5::gain", value);
gst_child_proxy_get_property (G_OBJECT (equ), "band5::gain", value);
break;
case PROP_BAND6:
gst_child_proxy_get_property (GST_OBJECT (equ), "band6::gain", value);
gst_child_proxy_get_property (G_OBJECT (equ), "band6::gain", value);
break;
case PROP_BAND7:
gst_child_proxy_get_property (GST_OBJECT (equ), "band7::gain", value);
gst_child_proxy_get_property (G_OBJECT (equ), "band7::gain", value);
break;
case PROP_BAND8:
gst_child_proxy_get_property (GST_OBJECT (equ), "band8::gain", value);
gst_child_proxy_get_property (G_OBJECT (equ), "band8::gain", value);
break;
case PROP_BAND9:
gst_child_proxy_get_property (GST_OBJECT (equ), "band9::gain", value);
gst_child_proxy_get_property (G_OBJECT (equ), "band9::gain", value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);

View file

@ -105,13 +105,13 @@ gst_iir_equalizer_3bands_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_BAND0:
gst_child_proxy_set_property (GST_OBJECT (equ), "band0::gain", value);
gst_child_proxy_set_property (G_OBJECT (equ), "band0::gain", value);
break;
case PROP_BAND1:
gst_child_proxy_set_property (GST_OBJECT (equ), "band1::gain", value);
gst_child_proxy_set_property (G_OBJECT (equ), "band1::gain", value);
break;
case PROP_BAND2:
gst_child_proxy_set_property (GST_OBJECT (equ), "band2::gain", value);
gst_child_proxy_set_property (G_OBJECT (equ), "band2::gain", value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -127,13 +127,13 @@ gst_iir_equalizer_3bands_get_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_BAND0:
gst_child_proxy_get_property (GST_OBJECT (equ), "band0::gain", value);
gst_child_proxy_get_property (G_OBJECT (equ), "band0::gain", value);
break;
case PROP_BAND1:
gst_child_proxy_get_property (GST_OBJECT (equ), "band1::gain", value);
gst_child_proxy_get_property (G_OBJECT (equ), "band1::gain", value);
break;
case PROP_BAND2:
gst_child_proxy_get_property (GST_OBJECT (equ), "band2::gain", value);
gst_child_proxy_get_property (G_OBJECT (equ), "band2::gain", value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);

View file

@ -1812,7 +1812,8 @@ gst_videomixer2_request_new_pad (GstElement * element,
/* add the pad to the element */
gst_element_add_pad (element, GST_PAD (mixpad));
gst_child_proxy_child_added (GST_OBJECT (mix), GST_OBJECT (mixpad));
gst_child_proxy_child_added (G_OBJECT (mix), G_OBJECT (mixpad),
GST_OBJECT_NAME (mixpad));
return GST_PAD (mixpad);
}
@ -1835,7 +1836,8 @@ gst_videomixer2_release_pad (GstElement * element, GstPad * pad)
mixpad = GST_VIDEO_MIXER2_PAD (pad);
mix->sinkpads = g_slist_remove (mix->sinkpads, pad);
gst_child_proxy_child_removed (GST_OBJECT (mix), GST_OBJECT (mixpad));
gst_child_proxy_child_removed (G_OBJECT (mix), G_OBJECT (mixpad),
GST_OBJECT_NAME (mixpad));
mix->numpads--;
update_caps = GST_VIDEO_INFO_FORMAT (&mix->info) != GST_VIDEO_FORMAT_UNKNOWN;
@ -1897,16 +1899,16 @@ gst_videomixer2_set_property (GObject * object,
}
/* GstChildProxy implementation */
static GstObject *
static GObject *
gst_videomixer2_child_proxy_get_child_by_index (GstChildProxy * child_proxy,
guint index)
{
GstVideoMixer2 *mix = GST_VIDEO_MIXER2 (child_proxy);
GstObject *obj;
GObject *obj;
GST_VIDEO_MIXER2_LOCK (mix);
if ((obj = g_slist_nth_data (mix->sinkpads, index)))
gst_object_ref (obj);
g_object_ref (obj);
GST_VIDEO_MIXER2_UNLOCK (mix);
return obj;
}

View file

@ -153,12 +153,12 @@ GST_START_TEST (test_equalizer_5bands_minus_24)
(equalizer)), 5);
for (i = 0; i < 5; i++) {
GstObject *band =
GObject *band =
gst_child_proxy_get_child_by_index (GST_CHILD_PROXY (equalizer), i);
fail_unless (band != NULL);
g_object_set (G_OBJECT (band), "gain", -24.0, NULL);
g_object_unref (G_OBJECT (band));
g_object_set (band, "gain", -24.0, NULL);
g_object_unref (band);
}
fail_unless (gst_element_set_state (equalizer,
@ -221,12 +221,12 @@ GST_START_TEST (test_equalizer_5bands_plus_12)
(equalizer)), 5);
for (i = 0; i < 5; i++) {
GstObject *band =
GObject *band =
gst_child_proxy_get_child_by_index (GST_CHILD_PROXY (equalizer), i);
fail_unless (band != NULL);
g_object_set (G_OBJECT (band), "gain", 12.0, NULL);
g_object_unref (G_OBJECT (band));
g_object_set (band, "gain", 12.0, NULL);
g_object_unref (band);
}
fail_unless (gst_element_set_state (equalizer,
@ -285,11 +285,11 @@ GST_START_TEST (test_equalizer_band_number_changing)
(equalizer)), 5);
for (i = 0; i < 5; i++) {
GstObject *band;
GObject *band;
band = gst_child_proxy_get_child_by_index (GST_CHILD_PROXY (equalizer), i);
fail_unless (band != NULL);
gst_object_unref (band);
g_object_unref (band);
}
g_object_set (G_OBJECT (equalizer), "num-bands", 10, NULL);
@ -297,11 +297,11 @@ GST_START_TEST (test_equalizer_band_number_changing)
(equalizer)), 10);
for (i = 0; i < 10; i++) {
GstObject *band;
GObject *band;
band = gst_child_proxy_get_child_by_index (GST_CHILD_PROXY (equalizer), i);
fail_unless (band != NULL);
gst_object_unref (band);
g_object_unref (band);
}
/* cleanup */

View file

@ -188,7 +188,7 @@ main (int argc, char *argv[])
hbox = gtk_hbox_new (FALSE, 20);
for (i = 0; i < NBANDS; i++) {
GstObject *band;
GObject *band;
gdouble freq;
gdouble bw;
gdouble gain;
@ -197,9 +197,9 @@ main (int argc, char *argv[])
band = gst_child_proxy_get_child_by_index (GST_CHILD_PROXY (equalizer), i);
g_assert (band != NULL);
g_object_get (G_OBJECT (band), "freq", &freq, NULL);
g_object_get (G_OBJECT (band), "bandwidth", &bw, NULL);
g_object_get (G_OBJECT (band), "gain", &gain, NULL);
g_object_get (band, "freq", &freq, NULL);
g_object_get (band, "bandwidth", &bw, NULL);
g_object_get (band, "gain", &gain, NULL);
label = g_strdup_printf ("%d Hz", (int) (freq + 0.5));
frame = gtk_frame_new (label);

View file

@ -72,11 +72,11 @@ check_bus (GstClockTime max_wait_time)
static void
equalizer_set_band_value (GstElement * eq, guint band, gdouble val)
{
GstObject *child;
GObject *child;
child = gst_child_proxy_get_child_by_index (GST_CHILD_PROXY (eq), band);
g_object_set (child, "gain", val, NULL);
gst_object_unref (child);
g_object_unref (child);
g_print ("Band %2d: %.2f\n", band, val);
}
@ -84,12 +84,12 @@ static void
equalizer_set_all_band_values (GstElement * eq, guint num, gdouble val)
{
gint i;
GstObject *child;
GObject *child;
for (i = 0; i < num; i++) {
child = gst_child_proxy_get_child_by_index (GST_CHILD_PROXY (eq), i);
g_object_set (child, "gain", val, NULL);
gst_object_unref (child);
g_object_unref (child);
}
g_print ("All bands: %.2f\n", val);
}