[MediaVision] Change string marshal logic (#4610)
authorHaesu Gwon <haesu.gwon@samsung.com>
Thu, 29 Sep 2022 07:21:46 +0000 (16:21 +0900)
committerGitHub <noreply@github.com>
Thu, 29 Sep 2022 07:21:46 +0000 (16:21 +0900)
src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Face.cs
src/Tizen.Multimedia.Vision/MediaVision/DeepLearningFaceRecognizer.cs

index dd013a19437ff7a0cb5bedb23c48bf6d3b339ff7..5babae13e628964a4dbb14781c37fc92067c216a 100755 (executable)
@@ -174,7 +174,7 @@ internal static partial class Interop
             internal static extern MediaVisionError Inference(IntPtr handle, IntPtr source);
 
             [DllImport(Libraries.MediaVisionFaceRecognition, EntryPoint = "mv_face_recognition_get_label")]
-            internal static extern MediaVisionError GetLabel(IntPtr handle, out string label);
+            internal static extern MediaVisionError GetLabel(IntPtr handle, out IntPtr label);
         }
     }
 }
index ab922c8cd774d7b8fc5a2aa982c91515fdaca765..2ee8b0e6a79beffff7acf5f8e4597e365d5d3b1a 100755 (executable)
@@ -15,6 +15,7 @@
  */
 
 using System;
+using System.Runtime.InteropServices;
 using InteropFace = Interop.MediaVision.FaceRecognition;
 
 namespace Tizen.Multimedia.Vision
@@ -138,9 +139,9 @@ namespace Tizen.Multimedia.Vision
                 ret.Validate("failed to recognize face");
             }
 
-            InteropFace.GetLabel(_handle, out string label).Validate("Failed to get label");
+            InteropFace.GetLabel(_handle, out IntPtr label).Validate("Failed to get label");
 
-            return new DeepLearningFaceRecognitionResult(label);
+            return new DeepLearningFaceRecognitionResult(Marshal.PtrToStringAnsi(label));
         }
 
         /// <summary>