gstaudiostreamalign: Pass self as const pointer in getter functions
authorMarijn Suijten <marijns95@gmail.com>
Fri, 29 Jan 2021 20:40:33 +0000 (21:40 +0100)
committerMarijn Suijten <marijns95@gmail.com>
Fri, 29 Jan 2021 20:42:47 +0000 (21:42 +0100)
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>

gst-libs/gst/audio/gstaudiostreamalign.c
gst-libs/gst/audio/gstaudiostreamalign.h

index 3eaa74b..ec4233d 100644 (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);
 
index 80b83f9..080e9ea 100644 (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,