2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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.
19 using System.Runtime.InteropServices;
20 using Tizen.Content.MediaContent;
22 internal static partial class Interop
24 internal static partial class ImageInformation
26 [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_destroy", CallingConvention = CallingConvention.Cdecl)]
27 internal static extern MediaContentError Destroy(IntPtr media);
29 [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_clone", CallingConvention = CallingConvention.Cdecl)]
30 internal static extern MediaContentError Clone(out SafeImageInformationHandle dst, SafeImageInformationHandle src);
32 [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_orientation", CallingConvention = CallingConvention.Cdecl)]
33 internal static extern MediaContentError GetOrientation(SafeImageInformationHandle imageInformationHandle, out MediaContentOrientation orientation);
35 [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_date_taken", CallingConvention = CallingConvention.Cdecl)]
36 internal static extern MediaContentError GetDateTaken(SafeImageInformationHandle imageInformationHandle, out IntPtr dateTaken);
38 [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_burst_id", CallingConvention = CallingConvention.Cdecl)]
39 internal static extern MediaContentError GetBurstId(SafeImageInformationHandle imageInformationHandle, out IntPtr burstId);
41 [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_exposure_time", CallingConvention = CallingConvention.Cdecl)]
42 internal static extern MediaContentError GetExposureTime(SafeImageInformationHandle imageInformationHandle, out IntPtr exposureTime);
44 [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_fnumber", CallingConvention = CallingConvention.Cdecl)]
45 internal static extern MediaContentError GetFNumber(SafeImageInformationHandle imageInformationHandle, out double fNumber);
47 [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_iso", CallingConvention = CallingConvention.Cdecl)]
48 internal static extern MediaContentError GetISO(SafeImageInformationHandle imageInformationHandle, out int iso);
50 [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_model", CallingConvention = CallingConvention.Cdecl)]
51 internal static extern MediaContentError GetModel(SafeImageInformationHandle imageInformationHandle, out IntPtr model);
53 [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_is_burst_shot", CallingConvention = CallingConvention.Cdecl)]
54 internal static extern MediaContentError IsBurstShot(SafeImageInformationHandle imageInformationHandle, out bool isBurstShot);
56 [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_set_orientation", CallingConvention = CallingConvention.Cdecl)]
57 internal static extern MediaContentError SetOrientation(SafeImageInformationHandle imageInformationHandle, MediaContentOrientation orientation);
59 [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_media_id", CallingConvention = CallingConvention.Cdecl)]
60 internal static extern MediaContentError GetMediaId(SafeImageInformationHandle imageInformationHandle, out IntPtr mediaId);
62 [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_width", CallingConvention = CallingConvention.Cdecl)]
63 internal static extern MediaContentError GetWidth(SafeImageInformationHandle imageInformationHandle, out int width);
65 [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_height", CallingConvention = CallingConvention.Cdecl)]
66 internal static extern MediaContentError GetHeight(SafeImageInformationHandle imageInformationHandle, out int width);
68 [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_update_to_db", CallingConvention = CallingConvention.Cdecl)]
69 internal static extern MediaContentError UpdateToDB(IntPtr imageInformationHandle);
71 internal sealed class SafeImageInformationHandle : SafeHandle
73 public SafeImageInformationHandle()
74 : base(IntPtr.Zero, true)
78 public override bool IsInvalid
80 get { return this.handle == IntPtr.Zero; }
83 protected override bool ReleaseHandle()
85 ImageInformation.Destroy(this.handle);
86 this.SetHandle(IntPtr.Zero);