mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01: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_new
|
||||||
ges_track_audio_test_source_set_freq
|
ges_track_audio_test_source_set_freq
|
||||||
ges_track_audio_test_source_set_volume
|
ges_track_audio_test_source_set_volume
|
||||||
|
ges_track_audio_test_source_get_freq
|
||||||
|
ges_track_audio_test_source_get_volume
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GESTrackAudioTestSourceClass
|
GESTrackAudioTestSourceClass
|
||||||
GESTrackAudioTestSourcePrivate
|
GESTrackAudioTestSourcePrivate
|
||||||
|
|
|
@ -36,8 +36,8 @@ G_DEFINE_TYPE (GESTrackAudioTestSource, ges_track_audio_test_source,
|
||||||
|
|
||||||
struct _GESTrackAudioTestSourcePrivate
|
struct _GESTrackAudioTestSourcePrivate
|
||||||
{
|
{
|
||||||
/* Dummy variable */
|
gdouble freq;
|
||||||
void *nothing;
|
gdouble volume;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -74,8 +74,8 @@ ges_track_audio_test_source_init (GESTrackAudioTestSource * self)
|
||||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||||
GES_TYPE_TRACK_AUDIO_TEST_SOURCE, GESTrackAudioTestSourcePrivate);
|
GES_TYPE_TRACK_AUDIO_TEST_SOURCE, GESTrackAudioTestSourcePrivate);
|
||||||
|
|
||||||
self->freq = 440;
|
self->priv->freq = 440;
|
||||||
self->volume = 0;
|
self->priv->volume = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -106,8 +106,8 @@ ges_track_audio_test_source_create_element (GESTrackObject * trksrc)
|
||||||
|
|
||||||
self = (GESTrackAudioTestSource *) trksrc;
|
self = (GESTrackAudioTestSource *) trksrc;
|
||||||
ret = gst_element_factory_make ("audiotestsrc", NULL);
|
ret = gst_element_factory_make ("audiotestsrc", NULL);
|
||||||
g_object_set (ret, "volume", (gdouble) self->volume, "freq", (gdouble)
|
g_object_set (ret, "volume", (gdouble) self->priv->volume, "freq", (gdouble)
|
||||||
self->freq, NULL);
|
self->priv->freq, NULL);
|
||||||
|
|
||||||
return ret;
|
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));
|
GstElement *element = ges_track_object_get_element (GES_TRACK_OBJECT (self));
|
||||||
|
|
||||||
self->freq = freq;
|
self->priv->freq = freq;
|
||||||
if (element)
|
if (element)
|
||||||
g_object_set (element, "freq", (gdouble) freq, NULL);
|
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));
|
GstElement *element = ges_track_object_get_element (GES_TRACK_OBJECT (self));
|
||||||
|
|
||||||
self->volume = volume;
|
self->priv->volume = volume;
|
||||||
if (element)
|
if (element)
|
||||||
g_object_set (element, "volume", (gdouble) volume, NULL);
|
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 *
|
GESTrackAudioTestSource *
|
||||||
ges_track_audio_test_source_new (void)
|
ges_track_audio_test_source_new (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,12 +53,9 @@ typedef struct _GESTrackAudioTestSourcePrivate GESTrackAudioTestSourcePrivate;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct _GESTrackAudioTestSource {
|
struct _GESTrackAudioTestSource {
|
||||||
/*< private >*/
|
|
||||||
GESTrackSource parent;
|
GESTrackSource parent;
|
||||||
|
|
||||||
gdouble freq;
|
/*< private >*/
|
||||||
gdouble volume;
|
|
||||||
|
|
||||||
GESTrackAudioTestSourcePrivate *priv;
|
GESTrackAudioTestSourcePrivate *priv;
|
||||||
|
|
||||||
/* Padding for API extension */
|
/* Padding for API extension */
|
||||||
|
@ -75,7 +72,6 @@ struct _GESTrackAudioTestSourceClass {
|
||||||
|
|
||||||
GType ges_track_audio_test_source_get_type (void);
|
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,
|
void ges_track_audio_test_source_set_freq(GESTrackAudioTestSource *self,
|
||||||
gdouble freq);
|
gdouble freq);
|
||||||
|
@ -83,6 +79,10 @@ void ges_track_audio_test_source_set_freq(GESTrackAudioTestSource *self,
|
||||||
void ges_track_audio_test_source_set_volume(GESTrackAudioTestSource *self,
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* _GES_TRACK_AUDIO_TEST_SOURCE */
|
#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 (freq, 440);
|
||||||
assert_equals_float (volume, 0);
|
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 (freq == 440);
|
||||||
g_assert (volume == 0);
|
g_assert (volume == 0);
|
||||||
|
|
||||||
|
@ -180,9 +183,10 @@ GST_START_TEST (test_test_source_in_layer)
|
||||||
assert_equals_float (freq, 2000);
|
assert_equals_float (freq, 2000);
|
||||||
assert_equals_float (volume, 0.5);
|
assert_equals_float (volume, 0.5);
|
||||||
|
|
||||||
freq = ((GESTrackAudioTestSource *) trobj)->freq;
|
freq = ges_track_audio_test_source_get_freq (
|
||||||
volume = ((GESTrackAudioTestSource *) trobj)->volume;
|
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 (freq == 2000);
|
||||||
g_assert (volume == 0.5);
|
g_assert (volume == 0.5);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue