gstaudiostreamalign: Pass self as const pointer in getter functions

It was noticed in [1] that `GstAudioStreamAlign` is a simple boxed type
that is passed as const in the copy function, but not as such in the
getters. These functions turn out to be the only users of `const = true`
overrides in `gstreamer-rs`. Since there is no locking or other advanced
caching/sharing going on (as happens with miniobjects) these functions
can safely take self as const pointer.

[1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/683#note_783129

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1025>
This commit is contained in:
Marijn Suijten 2021-01-29 21:40:33 +01:00
parent 11e6f8da92
commit 9ab400e267
2 changed files with 13 additions and 10 deletions

View file

@ -172,7 +172,7 @@ gst_audio_stream_align_set_rate (GstAudioStreamAlign * align, gint rate)
* Since: 1.14
*/
gint
gst_audio_stream_align_get_rate (GstAudioStreamAlign * align)
gst_audio_stream_align_get_rate (const GstAudioStreamAlign * align)
{
g_return_val_if_fail (align != NULL, 0);
@ -208,7 +208,8 @@ gst_audio_stream_align_set_alignment_threshold (GstAudioStreamAlign *
* Since: 1.14
*/
GstClockTime
gst_audio_stream_align_get_alignment_threshold (GstAudioStreamAlign * align)
gst_audio_stream_align_get_alignment_threshold (const GstAudioStreamAlign *
align)
{
g_return_val_if_fail (align != NULL, 0);
@ -244,7 +245,7 @@ gst_audio_stream_align_set_discont_wait (GstAudioStreamAlign * align,
* Since: 1.14
*/
GstClockTime
gst_audio_stream_align_get_discont_wait (GstAudioStreamAlign * align)
gst_audio_stream_align_get_discont_wait (const GstAudioStreamAlign * align)
{
g_return_val_if_fail (align != NULL, 0);
@ -280,7 +281,8 @@ gst_audio_stream_align_mark_discont (GstAudioStreamAlign * align)
* Since: 1.14
*/
GstClockTime
gst_audio_stream_align_get_timestamp_at_discont (GstAudioStreamAlign * align)
gst_audio_stream_align_get_timestamp_at_discont (const GstAudioStreamAlign *
align)
{
g_return_val_if_fail (align != NULL, GST_CLOCK_TIME_NONE);
@ -299,7 +301,8 @@ gst_audio_stream_align_get_timestamp_at_discont (GstAudioStreamAlign * align)
* Since: 1.14
*/
guint64
gst_audio_stream_align_get_samples_since_discont (GstAudioStreamAlign * align)
gst_audio_stream_align_get_samples_since_discont (const GstAudioStreamAlign *
align)
{
g_return_val_if_fail (align != NULL, 0);

View file

@ -54,29 +54,29 @@ GST_AUDIO_API
void gst_audio_stream_align_set_rate (GstAudioStreamAlign * align,
gint rate);
GST_AUDIO_API
gint gst_audio_stream_align_get_rate (GstAudioStreamAlign * align);
gint gst_audio_stream_align_get_rate (const GstAudioStreamAlign * align);
GST_AUDIO_API
void gst_audio_stream_align_set_alignment_threshold (GstAudioStreamAlign * align,
GstClockTime alignment_threshold);
GST_AUDIO_API
GstClockTime gst_audio_stream_align_get_alignment_threshold (GstAudioStreamAlign * align);
GstClockTime gst_audio_stream_align_get_alignment_threshold (const GstAudioStreamAlign * align);
GST_AUDIO_API
void gst_audio_stream_align_set_discont_wait (GstAudioStreamAlign * align,
GstClockTime discont_wait);
GST_AUDIO_API
GstClockTime gst_audio_stream_align_get_discont_wait (GstAudioStreamAlign * align);
GstClockTime gst_audio_stream_align_get_discont_wait (const GstAudioStreamAlign * align);
GST_AUDIO_API
void gst_audio_stream_align_mark_discont (GstAudioStreamAlign * align);
GST_AUDIO_API
GstClockTime gst_audio_stream_align_get_timestamp_at_discont (GstAudioStreamAlign * align);
GstClockTime gst_audio_stream_align_get_timestamp_at_discont (const GstAudioStreamAlign * align);
GST_AUDIO_API
guint64 gst_audio_stream_align_get_samples_since_discont (GstAudioStreamAlign * align);
guint64 gst_audio_stream_align_get_samples_since_discont (const GstAudioStreamAlign * align);
GST_AUDIO_API
gboolean gst_audio_stream_align_process (GstAudioStreamAlign * align,