[NUI] Change all CallingConvention to `Cdecl`
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / VideoView.cs
index 7a3dfbf..d54c56c 100755 (executable)
@@ -130,8 +130,8 @@ namespace Tizen.NUI.BaseComponents
             return temp;
         }));
 
-        private FinishedCallbackDelegate _videoViewFinishedCallbackDelegate;
-        private EventHandler<FinishedEventArgs> _videoViewFinishedEventHandler;
+        private FinishedCallbackDelegate videoViewFinishedCallbackDelegate;
+        private EventHandler<FinishedEventArgs> videoViewFinishedEventHandler;
 
         /// <summary>
         /// Creates an initialized VideoView.
@@ -154,19 +154,6 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Hidden API (Inhouse API).
-        /// Using Uri class to provide safe sevice and secure API.
-        /// Creates an initialized VideoView.
-        /// If the string is empty, VideoView will not display anything.
-        /// </summary>
-        /// <param name="uri">The URI of the video resource to display.</param>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public VideoView(Uri uri) : this(Interop.VideoView.New((uri == null) ? String.Empty : uri.AbsoluteUri), true)
-        {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
-        /// <summary>
         /// Creates an initialized VideoView.<br />
         /// If the string is empty, VideoView will not display anything.<br />
         /// </summary>
@@ -191,7 +178,7 @@ namespace Tizen.NUI.BaseComponents
 
         /// <summary>
         /// Hidden API (Inhouse API).
-        /// Using Uri class to provide safe sevice and secure API.
+        /// Using Uri class to provide safe service and secure API.
         /// Creates an initialized VideoView.
         /// If the string is empty, VideoView will not display anything.
         /// </summary>
@@ -208,11 +195,11 @@ namespace Tizen.NUI.BaseComponents
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal VideoView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.VideoView.Upcast(cPtr), cMemoryOwn)
+        internal VideoView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
         {
         }
 
-        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         private delegate void FinishedCallbackDelegate(IntPtr data);
 
         /// <summary>
@@ -224,19 +211,19 @@ namespace Tizen.NUI.BaseComponents
         {
             add
             {
-                if (_videoViewFinishedEventHandler == null)
+                if (videoViewFinishedEventHandler == null)
                 {
-                    _videoViewFinishedCallbackDelegate = (OnFinished);
-                    FinishedSignal().Connect(_videoViewFinishedCallbackDelegate);
+                    videoViewFinishedCallbackDelegate = (OnFinished);
+                    FinishedSignal().Connect(videoViewFinishedCallbackDelegate);
                 }
-                _videoViewFinishedEventHandler += value;
+                videoViewFinishedEventHandler += value;
             }
             remove
             {
-                _videoViewFinishedEventHandler -= value;
-                if (_videoViewFinishedEventHandler == null && FinishedSignal().Empty() == false)
+                videoViewFinishedEventHandler -= value;
+                if (videoViewFinishedEventHandler == null && FinishedSignal().Empty() == false)
                 {
-                    FinishedSignal().Disconnect(_videoViewFinishedCallbackDelegate);
+                    FinishedSignal().Disconnect(videoViewFinishedCallbackDelegate);
                 }
             }
         }
@@ -396,6 +383,31 @@ namespace Tizen.NUI.BaseComponents
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
+        /// <summary>
+        /// Get native player handle.
+        /// <example>
+        /// How to get native player handle
+        /// <code>
+        /// VideoView videoView = new VideoView();
+        /// videoView.ResourceUrl = "some video path";
+        /// var handle = videoView.NativeHandle;
+        /// if(handle.IsInvalid == false)
+        /// {
+        ///     IntPtr nativeHandle = handle.DangerousGetHandle();
+        ///     // do something with nativeHandle
+        /// }
+        /// </code>
+        /// </example>
+        /// </summary>
+        /// <since_tizen> 9 </since_tizen>
+        public SafeHandle NativeHandle
+        {
+            get
+            {
+                return new NUI.SafeNativePlayerHandle(this);
+            }
+        }
+
         internal VideoViewSignal FinishedSignal()
         {
             VideoViewSignal ret = new VideoViewSignal(Interop.VideoView.FinishedSignal(SwigCPtr), false);
@@ -403,11 +415,6 @@ namespace Tizen.NUI.BaseComponents
             return ret;
         }
 
-        internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VideoView obj)
-        {
-            return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
-        }
-
         /// <summary>
         /// Dispose.
         /// </summary>
@@ -424,9 +431,9 @@ namespace Tizen.NUI.BaseComponents
             //You should not access any managed member here except static instance.
             //because the execution order of Finalizes is non-deterministic.
 
-            if (this != null && _videoViewFinishedCallbackDelegate != null)
+            if (this != null && videoViewFinishedCallbackDelegate != null)
             {
-                FinishedSignal().Disconnect(_videoViewFinishedCallbackDelegate);
+                FinishedSignal().Disconnect(videoViewFinishedCallbackDelegate);
             }
 
             base.Dispose(type);
@@ -442,15 +449,14 @@ namespace Tizen.NUI.BaseComponents
         // Callback for VideoView Finished signal
         private void OnFinished(IntPtr data)
         {
-            FinishedEventArgs e = new FinishedEventArgs();
-
-            // Populate all members of "e" (FinishedEventArgs) with real data
-            e.VideoView = Registry.GetManagedBaseHandleFromNativePtr(data) as VideoView;
-
-            if (_videoViewFinishedEventHandler != null)
+            if (videoViewFinishedEventHandler != null)
             {
+                FinishedEventArgs e = new FinishedEventArgs();
+
+                // Populate all members of "e" (FinishedEventArgs) with real data
+                e.VideoView = Registry.GetManagedBaseHandleFromNativePtr(data) as VideoView;
                 //here we send all data to user event handlers
-                _videoViewFinishedEventHandler(this, e);
+                videoViewFinishedEventHandler(this, e);
             }
         }
 
@@ -460,7 +466,7 @@ namespace Tizen.NUI.BaseComponents
         /// <since_tizen> 3 </since_tizen>
         public class FinishedEventArgs : EventArgs
         {
-            private VideoView _videoView;
+            private VideoView videoView;
 
             /// <summary>
             /// The view for video playback and display.
@@ -470,11 +476,11 @@ namespace Tizen.NUI.BaseComponents
             {
                 get
                 {
-                    return _videoView;
+                    return videoView;
                 }
                 set
                 {
-                    _videoView = value;
+                    videoView = value;
                 }
             }
         }
@@ -500,10 +506,11 @@ namespace Tizen.NUI.BaseComponents
     /// Contains and encapsulates Native Player handle.
     /// </summary>
     [EditorBrowsable(EditorBrowsableState.Never)]
+    [Obsolete("This has been deprecated in API9 and will be removed in API11. Use VideoView.NativeHandle instead.")]
     public class SafeNativePlayerHandle : SafeHandle
     {
         /// <summary>
-        /// Contructor, null handle is set.
+        /// Constructor, null handle is set.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public SafeNativePlayerHandle() : base(global::System.IntPtr.Zero, false)
@@ -511,7 +518,7 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Contructor, Native player handle is set to handle.
+        /// Constructor, Native player handle is set to handle.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public SafeNativePlayerHandle(VideoView videoView) : base(global::System.IntPtr.Zero, false)