mediafoundation: Fix various string constness handling
authorSeungha Yang <seungha@centricular.com>
Fri, 15 Oct 2021 14:18:41 +0000 (23:18 +0900)
committerSeungha Yang <seungha@centricular.com>
Fri, 15 Oct 2021 14:38:48 +0000 (23:38 +0900)
... with fixing typo (g_strup -> g_strdup)

Constness needs to be explicit in C++ world otherwise compiler
would complain about that.

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

subprojects/gst-plugins-bad/sys/mediafoundation/gstmftransform.cpp
subprojects/gst-plugins-bad/sys/mediafoundation/gstmfutils.cpp
subprojects/gst-plugins-bad/sys/mediafoundation/gstmfvideoenc.cpp

index eee5e1c..4c3de11 100644 (file)
@@ -1059,7 +1059,7 @@ gst_mf_transform_close (GstMFTransform * object)
   return TRUE;
 }
 
-static gchar *
+static const gchar *
 gst_mf_transform_event_type_to_string (MediaEventType event)
 {
   switch (event) {
index bbb69d4..21bfeb2 100644 (file)
@@ -726,7 +726,7 @@ gst_mf_attribute_value_to_string (const GUID & guid, const PROPVARIANT & var)
       IsEqualGUID (guid, MF_MT_MINIMUM_DISPLAY_APERTURE) ||
       IsEqualGUID (guid, MF_MT_PAN_SCAN_APERTURE)) {
     /* FIXME: Not our usecase for now */
-    return g_strup ("Not parsed");
+    return g_strdup ("Not parsed");
   }
 
   switch (var.vt) {
index 66c48e1..72dd177 100644 (file)
@@ -1492,12 +1492,12 @@ gst_mf_video_enc_enum_internal (GstMFTransform * transform, GUID & subtype,
     {0, NULL},
   };
   GstMFVideoEncProfileMap *profile_to_check = NULL;
-  static gchar *h264_caps_str =
+  static const gchar *h264_caps_str =
       "video/x-h264, stream-format=(string) byte-stream, alignment=(string) au";
-  static gchar *hevc_caps_str =
+  static const gchar *hevc_caps_str =
       "video/x-h265, stream-format=(string) byte-stream, alignment=(string) au";
-  static gchar *vp9_caps_str = "video/x-vp9";
-  static gchar *codec_caps_str = NULL;
+  static const gchar *vp9_caps_str = "video/x-vp9";
+  const gchar *codec_caps_str = NULL;
 
   /* NOTE: depending on environment,
    * some enumerated h/w MFT might not be usable (e.g., multiple GPU case) */
@@ -1850,8 +1850,8 @@ gst_mf_video_enc_register_internal (GstPlugin * plugin, guint rank,
   GstMFVideoEncClassData *cdata;
   gboolean is_default = TRUE;
   gchar *device_name = NULL;
-  static gchar *type_name_prefix = NULL;
-  static gchar *feature_name_prefix = NULL;
+  const gchar *type_name_prefix = NULL;
+  const gchar *feature_name_prefix = NULL;
 
   if (IsEqualGUID (MFVideoFormat_H264, *subtype)) {
     type_name_prefix = "H264";