codecs: Stop claiming constness for refcounted object
authorSeungha Yang <seungha@centricular.com>
Sun, 24 Oct 2021 13:07:38 +0000 (22:07 +0900)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Sun, 6 Feb 2022 17:17:22 +0000 (17:17 +0000)
It's almost pointless and makes little sense as subclass might
want to modify refcount of the object or so. And all subclasses
are already casting them to non-const version as well.
In a general sense, we need to avoid passing refcounted object
with const qualifier.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1238>

subprojects/gst-plugins-bad/gst-libs/gst/codecs/gsth264decoder.h
subprojects/gst-plugins-bad/gst-libs/gst/codecs/gstmpeg2decoder.h
subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h264dec.cpp
subprojects/gst-plugins-bad/sys/d3d11/gstd3d11mpeg2dec.cpp
subprojects/gst-plugins-bad/sys/nvcodec/gstnvh264dec.c
subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c
subprojects/gst-plugins-bad/sys/va/gstvah264dec.c
subprojects/gst-plugins-bad/sys/va/gstvampeg2dec.c

index a95d667..faf66de 100644 (file)
@@ -151,7 +151,7 @@ struct _GstH264DecoderClass
    * Since: 1.20
    */
   GstFlowReturn (*new_field_picture)  (GstH264Decoder * decoder,
-                                       const GstH264Picture * first_field,
+                                       GstH264Picture * first_field,
                                        GstH264Picture * second_field);
 
   /**
index de22be0..0e36084 100644 (file)
@@ -113,7 +113,7 @@ struct _GstMpeg2DecoderClass
    * Since: 1.20
    */
   GstFlowReturn (*new_field_picture)  (GstMpeg2Decoder * decoder,
-                                       const GstMpeg2Picture * first_field,
+                                       GstMpeg2Picture * first_field,
                                        GstMpeg2Picture * second_field);
 
   /**
index 6691a14..89fcedb 100644 (file)
@@ -146,8 +146,9 @@ static GstFlowReturn gst_d3d11_h264_dec_new_sequence (GstH264Decoder * decoder,
     const GstH264SPS * sps, gint max_dpb_size);
 static GstFlowReturn gst_d3d11_h264_dec_new_picture (GstH264Decoder * decoder,
     GstVideoCodecFrame * frame, GstH264Picture * picture);
-static GstFlowReturn gst_d3d11_h264_dec_new_field_picture (GstH264Decoder *
-    decoder, const GstH264Picture * first_field, GstH264Picture * second_field);
+static GstFlowReturn
+gst_d3d11_h264_dec_new_field_picture (GstH264Decoder * decoder,
+    GstH264Picture * first_field, GstH264Picture * second_field);
 static GstFlowReturn gst_d3d11_h264_dec_start_picture (GstH264Decoder * decoder,
     GstH264Picture * picture, GstH264Slice * slice, GstH264Dpb * dpb);
 static GstFlowReturn gst_d3d11_h264_dec_decode_slice (GstH264Decoder * decoder,
@@ -497,13 +498,12 @@ gst_d3d11_h264_dec_new_picture (GstH264Decoder * decoder,
 
 static GstFlowReturn
 gst_d3d11_h264_dec_new_field_picture (GstH264Decoder * decoder,
-    const GstH264Picture * first_field, GstH264Picture * second_field)
+    GstH264Picture * first_field, GstH264Picture * second_field)
 {
   GstD3D11H264Dec *self = GST_D3D11_H264_DEC (decoder);
   GstBuffer *view_buffer;
 
-  view_buffer = (GstBuffer *) gst_h264_picture_get_user_data ((GstH264Picture *)
-      first_field);
+  view_buffer = (GstBuffer *) gst_h264_picture_get_user_data (first_field);
 
   if (!view_buffer) {
     GST_WARNING_OBJECT (self, "First picture does not have output view buffer");
index fbdebfa..5d9e457 100644 (file)
@@ -123,9 +123,9 @@ static GstFlowReturn gst_d3d11_mpeg2_dec_new_sequence (GstMpeg2Decoder *
     const GstMpegVideoSequenceScalableExt * seq_scalable_ext);
 static GstFlowReturn gst_d3d11_mpeg2_dec_new_picture (GstMpeg2Decoder * decoder,
     GstVideoCodecFrame * frame, GstMpeg2Picture * picture);
-static GstFlowReturn gst_d3d11_mpeg2_dec_new_field_picture (GstMpeg2Decoder *
-    decoder, const GstMpeg2Picture * first_field,
-    GstMpeg2Picture * second_field);
+static GstFlowReturn
+gst_d3d11_mpeg2_dec_new_field_picture (GstMpeg2Decoder * decoder,
+    GstMpeg2Picture * first_field, GstMpeg2Picture * second_field);
 static GstFlowReturn gst_d3d11_mpeg2_dec_start_picture (GstMpeg2Decoder *
     decoder, GstMpeg2Picture * picture, GstMpeg2Slice * slice,
     GstMpeg2Picture * prev_picture, GstMpeg2Picture * next_picture);
@@ -438,13 +438,13 @@ gst_d3d11_mpeg2_dec_new_picture (GstMpeg2Decoder * decoder,
 
 static GstFlowReturn
 gst_d3d11_mpeg2_dec_new_field_picture (GstMpeg2Decoder * decoder,
-    const GstMpeg2Picture * first_field, GstMpeg2Picture * second_field)
+    GstMpeg2Picture * first_field, GstMpeg2Picture * second_field)
 {
   GstD3D11Mpeg2Dec *self = GST_D3D11_MPEG2_DEC (decoder);
   GstBuffer *view_buffer;
 
   view_buffer = (GstBuffer *)
-      gst_mpeg2_picture_get_user_data ((GstMpeg2Picture *) first_field);
+      gst_mpeg2_picture_get_user_data (first_field);
 
   if (!view_buffer) {
     GST_WARNING_OBJECT (self, "First picture does not have output view buffer");
index 5b81c94..c0b7c76 100644 (file)
@@ -141,8 +141,9 @@ static GstFlowReturn gst_nv_h264_dec_new_sequence (GstH264Decoder * decoder,
     const GstH264SPS * sps, gint max_dpb_size);
 static GstFlowReturn gst_nv_h264_dec_new_picture (GstH264Decoder * decoder,
     GstVideoCodecFrame * frame, GstH264Picture * picture);
-static GstFlowReturn gst_nv_h264_dec_new_field_picture (GstH264Decoder *
-    decoder, const GstH264Picture * first_field, GstH264Picture * second_field);
+static GstFlowReturn
+gst_nv_h264_dec_new_field_picture (GstH264Decoder * decoder,
+    GstH264Picture * first_field, GstH264Picture * second_field);
 static GstFlowReturn gst_nv_h264_dec_output_picture (GstH264Decoder *
     decoder, GstVideoCodecFrame * frame, GstH264Picture * picture);
 static GstFlowReturn gst_nv_h264_dec_start_picture (GstH264Decoder * decoder,
@@ -486,12 +487,12 @@ gst_nv_h264_dec_new_picture (GstH264Decoder * decoder,
 
 static GstFlowReturn
 gst_nv_h264_dec_new_field_picture (GstH264Decoder * decoder,
-    const GstH264Picture * first_field, GstH264Picture * second_field)
+    GstH264Picture * first_field, GstH264Picture * second_field)
 {
   GstNvDecoderFrame *nv_frame;
 
   nv_frame = (GstNvDecoderFrame *)
-      gst_h264_picture_get_user_data ((GstH264Picture *) first_field);
+      gst_h264_picture_get_user_data (first_field);
   if (!nv_frame) {
     GST_ERROR_OBJECT (decoder,
         "No decoder frame in the first picture %p", first_field);
index 9c7260b..cf0bee2 100644 (file)
@@ -1307,11 +1307,10 @@ gst_v4l2_codec_h264_dec_end_picture (GstH264Decoder * decoder,
 
 static GstFlowReturn
 gst_v4l2_codec_h264_dec_new_field_picture (GstH264Decoder * decoder,
-    const GstH264Picture * first_field, GstH264Picture * second_field)
+    GstH264Picture * first_field, GstH264Picture * second_field)
 {
   GstV4l2CodecH264Dec *self = GST_V4L2_CODEC_H264_DEC (decoder);
-  GstV4l2Request *request =
-      gst_h264_picture_get_user_data ((GstH264Picture *) first_field);
+  GstV4l2Request *request = gst_h264_picture_get_user_data (first_field);
 
   if (!request) {
     GST_WARNING_OBJECT (self,
index fddd8fb..80e95cc 100644 (file)
@@ -527,13 +527,13 @@ error:
 
 static GstFlowReturn
 gst_va_h264_dec_new_field_picture (GstH264Decoder * decoder,
-    const GstH264Picture * first_field, GstH264Picture * second_field)
+    GstH264Picture * first_field, GstH264Picture * second_field)
 {
   GstVaDecodePicture *first_pic, *second_pic;
   GstVaH264Dec *self = GST_VA_H264_DEC (decoder);
   GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
 
-  first_pic = gst_h264_picture_get_user_data ((GstH264Picture *) first_field);
+  first_pic = gst_h264_picture_get_user_data (first_field);
   if (!first_pic)
     return GST_FLOW_ERROR;
 
index 9c2f574..2a8de73 100644 (file)
@@ -324,13 +324,13 @@ error:
 
 static GstFlowReturn
 gst_va_mpeg2_dec_new_field_picture (GstMpeg2Decoder * decoder,
-    const GstMpeg2Picture * first_field, GstMpeg2Picture * second_field)
+    GstMpeg2Picture * first_field, GstMpeg2Picture * second_field)
 {
   GstVaDecodePicture *first_pic, *second_pic;
   GstVaMpeg2Dec *self = GST_VA_MPEG2_DEC (decoder);
   GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
 
-  first_pic = gst_mpeg2_picture_get_user_data ((GstMpeg2Picture *) first_field);
+  first_pic = gst_mpeg2_picture_get_user_data (first_field);
   if (!first_pic)
     return GST_FLOW_ERROR;