Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Content.MediaContent / Interop / Interop.VideoInformation.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17
18 using System;
19 using System.Runtime.InteropServices;
20 using Tizen.Content.MediaContent;
21
22 internal static partial class Interop
23 {
24     internal static partial class VideoInformation
25     {
26         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_destroy", CallingConvention = CallingConvention.Cdecl)]
27         internal static extern MediaContentError Destroy(IntPtr media);
28
29         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_clone", CallingConvention = CallingConvention.Cdecl)]
30         internal static extern MediaContentError Clone(out SafeVideoInformationHandle dst, SafeVideoInformationHandle src);
31
32         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_media_id", CallingConvention = CallingConvention.Cdecl)]
33         internal static extern MediaContentError GetMediaId(SafeVideoInformationHandle videoInformationHandle, out IntPtr mediaId);
34
35         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_album", CallingConvention = CallingConvention.Cdecl)]
36         internal static extern MediaContentError GetAlbum(SafeVideoInformationHandle videoInformationHandle, out IntPtr albumName);
37
38         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_artist", CallingConvention = CallingConvention.Cdecl)]
39         internal static extern MediaContentError GetArtist(SafeVideoInformationHandle videoInformationHandle, out IntPtr artistName);
40
41         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_album_artist", CallingConvention = CallingConvention.Cdecl)]
42         internal static extern MediaContentError GetAlbumArtist(SafeVideoInformationHandle videoInformationHandle, out IntPtr albumArtistName);
43
44         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_genre", CallingConvention = CallingConvention.Cdecl)]
45         internal static extern MediaContentError GetGenre(SafeVideoInformationHandle videoInformationHandle, out IntPtr genreName);
46
47         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_composer", CallingConvention = CallingConvention.Cdecl)]
48         internal static extern MediaContentError GetComposer(SafeVideoInformationHandle videoInformationHandle, out IntPtr composerName);
49
50         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_year", CallingConvention = CallingConvention.Cdecl)]
51         internal static extern MediaContentError GetYear(SafeVideoInformationHandle videoInformationHandle, out IntPtr year);
52
53         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_recorded_date", CallingConvention = CallingConvention.Cdecl)]
54         internal static extern MediaContentError GetRecordedDate(SafeVideoInformationHandle videoInformationHandle, out IntPtr recordedDate);
55
56         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_copyright", CallingConvention = CallingConvention.Cdecl)]
57         internal static extern MediaContentError GetCopyright(SafeVideoInformationHandle videoInformationHandle, out IntPtr copyright);
58
59         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_track_num", CallingConvention = CallingConvention.Cdecl)]
60         internal static extern MediaContentError GetTrackNum(SafeVideoInformationHandle videoInformationHandle, out IntPtr trackNum);
61
62         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_bit_rate", CallingConvention = CallingConvention.Cdecl)]
63         internal static extern MediaContentError GetBitRate(SafeVideoInformationHandle videoInformationHandle, out int bitRate);
64
65         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_duration", CallingConvention = CallingConvention.Cdecl)]
66         internal static extern MediaContentError GetDuration(SafeVideoInformationHandle videoInformationHandle, out int duration);
67
68         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_width", CallingConvention = CallingConvention.Cdecl)]
69         internal static extern MediaContentError GetWidth(SafeVideoInformationHandle videoInformationHandle, out int width);
70
71         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_height", CallingConvention = CallingConvention.Cdecl)]
72         internal static extern MediaContentError GetHeight(SafeVideoInformationHandle videoInformationHandle, out int width);
73
74         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_played_count", CallingConvention = CallingConvention.Cdecl)]
75         internal static extern MediaContentError GetPlayedCount(SafeVideoInformationHandle videoInformationHandle, out int playedCount);
76
77         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_played_time", CallingConvention = CallingConvention.Cdecl)]
78         internal static extern MediaContentError GetPlayedTime(SafeVideoInformationHandle videoInformationHandle, out int playedTime);
79
80         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_played_position", CallingConvention = CallingConvention.Cdecl)]
81         internal static extern MediaContentError GetPlayedPosition(SafeVideoInformationHandle videoInformationHandle, out int playedPosition);
82
83         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_set_played_count", CallingConvention = CallingConvention.Cdecl)]
84         internal static extern MediaContentError SetPlayedCount(SafeVideoInformationHandle videoInformationHandle, int playedCount);
85
86         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_set_played_time", CallingConvention = CallingConvention.Cdecl)]
87         internal static extern MediaContentError SetPlayedTime(SafeVideoInformationHandle videoInformationHandle, int playedTime);
88
89         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_set_played_position", CallingConvention = CallingConvention.Cdecl)]
90         internal static extern MediaContentError SetPlayedPosition(SafeVideoInformationHandle videoInformationHandle, int playedPosition);
91
92         [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_update_to_db", CallingConvention = CallingConvention.Cdecl)]
93         internal static extern MediaContentError UpdateToDB(IntPtr videoInformationHandle);
94
95         internal sealed class SafeVideoInformationHandle : SafeHandle
96         {
97             public SafeVideoInformationHandle()
98                 : base(IntPtr.Zero, true)
99             {
100             }
101
102             public override bool IsInvalid
103             {
104                 get { return this.handle == IntPtr.Zero; }
105             }
106
107             protected override bool ReleaseHandle()
108             {
109                 VideoInformation.Destroy(this.handle);
110                 this.SetHandle(IntPtr.Zero);
111                 return true;
112             }
113         }
114     }
115 }