From: Simon Corsin Date: Wed, 3 Jul 2013 16:27:00 +0000 (+0200) Subject: testsource: Handle child properties as child properties X-Git-Tag: 1.19.3~493^2~1730 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7fcc6e4b08319d10852164981952f2c5edaa84e8;p=platform%2Fupstream%2Fgstreamer.git testsource: Handle child properties as child properties Makes $make check pass. Standardizes property handling. --- diff --git a/ges/ges-audio-test-source.c b/ges/ges-audio-test-source.c index 82b443cbd5..b2c918ece4 100644 --- a/ges/ges-audio-test-source.c +++ b/ges/ges-audio-test-source.c @@ -102,12 +102,15 @@ ges_audio_test_source_create_source (GESTrackElement * trksrc) { GESAudioTestSource *self; GstElement *ret; + const gchar *props[] = { "volume", "freq", NULL }; self = (GESAudioTestSource *) trksrc; ret = gst_element_factory_make ("audiotestsrc", NULL); g_object_set (ret, "volume", (gdouble) self->priv->volume, "freq", (gdouble) self->priv->freq, NULL); + ges_track_element_add_children_props (trksrc, ret, NULL, NULL, props); + return ret; } @@ -125,8 +128,14 @@ ges_audio_test_source_set_freq (GESAudioTestSource * self, gdouble freq) ges_track_element_get_element (GES_TRACK_ELEMENT (self)); self->priv->freq = freq; - if (element) - g_object_set (element, "freq", (gdouble) freq, NULL); + if (element) { + GValue val = { 0 }; + + g_value_init (&val, G_TYPE_DOUBLE); + g_value_set_double (&val, freq); + ges_track_element_set_child_property (GES_TRACK_ELEMENT (self), "freq", + &val); + } } /** @@ -143,8 +152,14 @@ ges_audio_test_source_set_volume (GESAudioTestSource * self, gdouble volume) ges_track_element_get_element (GES_TRACK_ELEMENT (self)); self->priv->volume = volume; - if (element) - g_object_set (element, "volume", (gdouble) volume, NULL); + if (element) { + GValue val = { 0 }; + + g_value_init (&val, G_TYPE_DOUBLE); + g_value_set_double (&val, volume); + ges_track_element_set_child_property (GES_TRACK_ELEMENT (self), "volume", + &val); + } } /** @@ -158,7 +173,10 @@ ges_audio_test_source_set_volume (GESAudioTestSource * self, gdouble volume) double ges_audio_test_source_get_freq (GESAudioTestSource * self) { - return self->priv->freq; + GValue val = { 0 }; + + ges_track_element_get_child_property (GES_TRACK_ELEMENT (self), "freq", &val); + return g_value_get_double (&val); } /** @@ -172,7 +190,11 @@ ges_audio_test_source_get_freq (GESAudioTestSource * self) double ges_audio_test_source_get_volume (GESAudioTestSource * self) { - return self->priv->volume; + GValue val = { 0 }; + + ges_track_element_get_child_property (GES_TRACK_ELEMENT (self), "volume", + &val); + return g_value_get_double (&val); } /** diff --git a/ges/ges-video-test-source.c b/ges/ges-video-test-source.c index 4a4dbe1b0f..b7405c1fb2 100644 --- a/ges/ges-video-test-source.c +++ b/ges/ges-video-test-source.c @@ -61,19 +61,20 @@ static GstElement * ges_video_test_source_create_source (GESTrackElement * self) { gint pattern; - GstElement *ret; - gchar *bin_desc; - + GstElement *testsrc, *capsfilter; + const gchar *props[] = { "pattern", NULL }; + testsrc = gst_element_factory_make ("videotestsrc", NULL); + capsfilter = gst_element_factory_make ("capsfilter", NULL); pattern = ((GESVideoTestSource *) self)->priv->pattern; - bin_desc = - g_strdup_printf - ("videotestsrc pattern=%i name=testsrc ! capsfilter caps=video/x-raw", - pattern); - ret = gst_parse_bin_from_description (bin_desc, TRUE, NULL); - g_free (bin_desc); - - return ret; + + g_object_set (testsrc, "pattern", pattern, NULL); + g_object_set (capsfilter, "caps", gst_caps_new_empty_simple ("video/x-raw"), + NULL); + + ges_track_element_add_children_props (self, testsrc, NULL, NULL, props); + + return create_bin ("videotestsrc", testsrc, capsfilter, NULL); } /** @@ -92,9 +93,14 @@ ges_video_test_source_set_pattern (GESVideoTestSource self->priv->pattern = pattern; - if (element) - gst_child_proxy_set (GST_CHILD_PROXY (element), "testsrc::pattern", - (gint) pattern, NULL); + if (element) { + GValue val = { 0 }; + + g_value_init (&val, GES_VIDEO_TEST_PATTERN_TYPE); + g_value_set_enum (&val, pattern); + ges_track_element_set_child_property (GES_TRACK_ELEMENT (self), "pattern", + &val); + } } /** @@ -108,7 +114,11 @@ ges_video_test_source_set_pattern (GESVideoTestSource GESVideoTestPattern ges_video_test_source_get_pattern (GESVideoTestSource * source) { - return source->priv->pattern; + GValue val = { 0 }; + + ges_track_element_get_child_property (GES_TRACK_ELEMENT (source), "pattern", + &val); + return g_value_get_enum (&val); } /**