mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
TrackAudioTestSource: Move private variables to instance private
Add getter methods to get those variables Fixup documentation
This commit is contained in:
parent
5c757c1093
commit
b8493f8896
4 changed files with 50 additions and 20 deletions
|
@ -544,6 +544,8 @@ GESTrackAudioTestSource
|
|||
ges_track_audio_test_source_new
|
||||
ges_track_audio_test_source_set_freq
|
||||
ges_track_audio_test_source_set_volume
|
||||
ges_track_audio_test_source_get_freq
|
||||
ges_track_audio_test_source_get_volume
|
||||
<SUBSECTION Standard>
|
||||
GESTrackAudioTestSourceClass
|
||||
GESTrackAudioTestSourcePrivate
|
||||
|
|
|
@ -36,8 +36,8 @@ G_DEFINE_TYPE (GESTrackAudioTestSource, ges_track_audio_test_source,
|
|||
|
||||
struct _GESTrackAudioTestSourcePrivate
|
||||
{
|
||||
/* Dummy variable */
|
||||
void *nothing;
|
||||
gdouble freq;
|
||||
gdouble volume;
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -74,8 +74,8 @@ ges_track_audio_test_source_init (GESTrackAudioTestSource * self)
|
|||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||
GES_TYPE_TRACK_AUDIO_TEST_SOURCE, GESTrackAudioTestSourcePrivate);
|
||||
|
||||
self->freq = 440;
|
||||
self->volume = 0;
|
||||
self->priv->freq = 440;
|
||||
self->priv->volume = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -106,8 +106,8 @@ ges_track_audio_test_source_create_element (GESTrackObject * trksrc)
|
|||
|
||||
self = (GESTrackAudioTestSource *) trksrc;
|
||||
ret = gst_element_factory_make ("audiotestsrc", NULL);
|
||||
g_object_set (ret, "volume", (gdouble) self->volume, "freq", (gdouble)
|
||||
self->freq, NULL);
|
||||
g_object_set (ret, "volume", (gdouble) self->priv->volume, "freq", (gdouble)
|
||||
self->priv->freq, NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ ges_track_audio_test_source_set_freq (GESTrackAudioTestSource * self,
|
|||
{
|
||||
GstElement *element = ges_track_object_get_element (GES_TRACK_OBJECT (self));
|
||||
|
||||
self->freq = freq;
|
||||
self->priv->freq = freq;
|
||||
if (element)
|
||||
g_object_set (element, "freq", (gdouble) freq, NULL);
|
||||
}
|
||||
|
@ -129,11 +129,35 @@ ges_track_audio_test_source_set_volume (GESTrackAudioTestSource * self,
|
|||
{
|
||||
GstElement *element = ges_track_object_get_element (GES_TRACK_OBJECT (self));
|
||||
|
||||
self->volume = volume;
|
||||
self->priv->volume = volume;
|
||||
if (element)
|
||||
g_object_set (element, "volume", (gdouble) volume, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* ges_track_audio_test_source_get_freq:
|
||||
* @self: a #GESTrackAudioTestSource
|
||||
*
|
||||
* Returns: The current frequency of @self
|
||||
*/
|
||||
double
|
||||
ges_track_audio_test_source_get_freq (GESTrackAudioTestSource * self)
|
||||
{
|
||||
return self->priv->freq;
|
||||
}
|
||||
|
||||
/**
|
||||
* ges_track_audio_test_source_get_volume:
|
||||
* @self: a #GESTrackAudioTestSource
|
||||
*
|
||||
* Returns: The current volume of @self
|
||||
*/
|
||||
double
|
||||
ges_track_audio_test_source_get_volume (GESTrackAudioTestSource * self)
|
||||
{
|
||||
return self->priv->volume;
|
||||
}
|
||||
|
||||
GESTrackAudioTestSource *
|
||||
ges_track_audio_test_source_new (void)
|
||||
{
|
||||
|
|
|
@ -53,12 +53,9 @@ typedef struct _GESTrackAudioTestSourcePrivate GESTrackAudioTestSourcePrivate;
|
|||
*/
|
||||
|
||||
struct _GESTrackAudioTestSource {
|
||||
/*< private >*/
|
||||
GESTrackSource parent;
|
||||
|
||||
gdouble freq;
|
||||
gdouble volume;
|
||||
|
||||
/*< private >*/
|
||||
GESTrackAudioTestSourcePrivate *priv;
|
||||
|
||||
/* Padding for API extension */
|
||||
|
@ -75,14 +72,17 @@ struct _GESTrackAudioTestSourceClass {
|
|||
|
||||
GType ges_track_audio_test_source_get_type (void);
|
||||
|
||||
GESTrackAudioTestSource* ges_track_audio_test_source_new (void);
|
||||
|
||||
void ges_track_audio_test_source_set_freq(GESTrackAudioTestSource *self,
|
||||
gdouble freq);
|
||||
gdouble freq);
|
||||
|
||||
void ges_track_audio_test_source_set_volume(GESTrackAudioTestSource *self,
|
||||
gdouble volume);
|
||||
gdouble volume);
|
||||
|
||||
double ges_track_audio_test_source_get_freq(GESTrackAudioTestSource *self);
|
||||
double ges_track_audio_test_source_get_volume(GESTrackAudioTestSource *self);
|
||||
|
||||
GESTrackAudioTestSource* ges_track_audio_test_source_new (void);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _GES_TRACK_AUDIO_TEST_SOURCE */
|
||||
|
|
|
@ -168,8 +168,11 @@ GST_START_TEST (test_test_source_in_layer)
|
|||
assert_equals_float (freq, 440);
|
||||
assert_equals_float (volume, 0);
|
||||
|
||||
freq = ((GESTrackAudioTestSource *) trobj)->freq;
|
||||
volume = ((GESTrackAudioTestSource *) trobj)->volume;
|
||||
|
||||
freq = ges_track_audio_test_source_get_freq (
|
||||
GES_TRACK_AUDIO_TEST_SOURCE (trobj));
|
||||
volume = ges_track_audio_test_source_get_volume (
|
||||
GES_TRACK_AUDIO_TEST_SOURCE (trobj));
|
||||
g_assert (freq == 440);
|
||||
g_assert (volume == 0);
|
||||
|
||||
|
@ -180,9 +183,10 @@ GST_START_TEST (test_test_source_in_layer)
|
|||
assert_equals_float (freq, 2000);
|
||||
assert_equals_float (volume, 0.5);
|
||||
|
||||
freq = ((GESTrackAudioTestSource *) trobj)->freq;
|
||||
volume = ((GESTrackAudioTestSource *) trobj)->volume;
|
||||
|
||||
freq = ges_track_audio_test_source_get_freq (
|
||||
GES_TRACK_AUDIO_TEST_SOURCE (trobj));
|
||||
volume = ges_track_audio_test_source_get_volume (
|
||||
GES_TRACK_AUDIO_TEST_SOURCE (trobj));
|
||||
g_assert (freq == 2000);
|
||||
g_assert (volume == 0.5);
|
||||
|
||||
|
|
Loading…
Reference in a new issue