2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.ComponentModel;
19 using System.Runtime.InteropServices;
20 using Tizen.NUI.BaseComponents;
25 /// Contains and encapsulates Native Player handle.
27 internal class SafeNativePlayerHandle : SafeHandle
30 /// Initializes a new instance of SafeNativePlayerHandle referencing the given videoView.
32 internal SafeNativePlayerHandle(VideoView videoView) : base(global::System.IntPtr.Zero, false)
34 if (videoView != null)
36 SetHandle(videoView.GetNativePlayerHandle());
41 /// Null check if the handle is valid or not.
43 [EditorBrowsable(EditorBrowsableState.Never)]
44 public override bool IsInvalid
48 return handle == global::System.IntPtr.Zero;
52 /// Release handle itself.
54 /// <returns>true when released successfully.</returns>
55 [EditorBrowsable(EditorBrowsableState.Never)]
56 protected override bool ReleaseHandle()
58 SetHandle(global::System.IntPtr.Zero);