Release 4.0.0-preview1-00230
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia / Interop / Interop.MediaTool.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 using System;
18 using System.Runtime.InteropServices;
19
20 namespace Tizen.Multimedia
21 {
22     internal static partial class Interop
23     {
24         internal static class MediaPacket
25         {
26             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_create")]
27             internal static extern int Create(IntPtr format, IntPtr finalizeCb, IntPtr cbData, out IntPtr handle);
28
29             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_alloc")]
30             internal static extern int Alloc(IntPtr handle);
31
32             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_destroy")]
33             internal static extern int Destroy(IntPtr handle);
34
35             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_format")]
36             internal static extern int GetFormat(IntPtr handle, out IntPtr format);
37
38             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_buffer_data_ptr")]
39             internal static extern int GetBufferData(IntPtr handle, out IntPtr dataHandle);
40
41             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_buffer_size")]
42             internal static extern int GetBufferSize(IntPtr handle, out ulong size);
43
44             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_buffer_size")]
45             internal static extern int SetBufferSize(IntPtr handle, ulong size);
46
47             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_allocated_buffer_size")]
48             internal static extern int GetAllocatedBufferSize(IntPtr handle, out int size);
49
50             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_number_of_video_planes")]
51             internal static extern int GetNumberOfVideoPlanes(IntPtr handle, out uint num);
52
53             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_video_stride_width")]
54             internal static extern int GetVideoStrideWidth(IntPtr handle, int planeIndex, out int value);
55
56             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_video_stride_height")]
57             internal static extern int GetVideoStrideHeight(IntPtr handle, int planeIndex, out int value);
58
59             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_video_plane_data_ptr")]
60             internal static extern int GetVideoPlaneData(IntPtr handle, int planeIndex, out IntPtr dataHandle);
61
62             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_is_encoded")]
63             internal static extern int IsEncoded(IntPtr handle, out bool value);
64
65             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_flags")]
66             internal static extern int GetBufferFlags(IntPtr handle, out int value);
67
68             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_flags")]
69             internal static extern int SetBufferFlags(IntPtr handle, int value);
70
71             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_reset_flags")]
72             internal static extern int ResetBufferFlags(IntPtr handle);
73
74             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_pts")]
75             internal static extern int GetPts(IntPtr handle, out ulong value);
76
77             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_dts")]
78             internal static extern int GetDts(IntPtr handle, out ulong value);
79
80             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_pts")]
81             internal static extern int SetPts(IntPtr handle, ulong value);
82
83             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_dts")]
84             internal static extern int SetDts(IntPtr handle, ulong value);
85
86
87             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_extra")]
88             internal static extern int SetExtra(IntPtr handle, IntPtr value);
89
90             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_extra")]
91             internal static extern int GetExtra(IntPtr handle, out IntPtr value);
92         }
93
94         internal static class MediaFormat
95         {
96             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_create")]
97             internal static extern int Create(out IntPtr handle);
98
99             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_unref")]
100             internal static extern int Unref(IntPtr handle);
101
102             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_type")]
103             internal static extern int GetType(IntPtr handle, out int type);
104
105             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_container_mime")]
106             internal static extern int GetContainerMimeType(IntPtr handle, out int mimeType);
107
108             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_container_mime")]
109             internal static extern int SetContainerMimeType(IntPtr handle, int mimeType);
110
111             #region Video apis
112             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_video_info")]
113             internal static extern int GetVideoInfo(IntPtr handle, out int mimeType,
114                 out int width, out int height, out int averageBps, out int maxBps);
115
116             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_video_frame_rate")]
117             internal static extern int GetVideoFrameRate(IntPtr handle, out int frameRate);
118
119             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_mime")]
120             internal static extern int SetVideoMimeType(IntPtr handle, int value);
121
122             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_width")]
123             internal static extern int SetVideoWidth(IntPtr handle, int value);
124
125             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_height")]
126             internal static extern int SetVideoHeight(IntPtr handle, int value);
127
128             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_avg_bps")]
129             internal static extern int SetVideoAverageBps(IntPtr handle, int value);
130
131             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_frame_rate")]
132             internal static extern int SetVideoFrameRate(IntPtr handle, int value);
133             #endregion
134
135             #region Audio apis
136             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_audio_info")]
137             internal static extern int GetAudioInfo(IntPtr handle, out int mimeType,
138                 out int channel, out int sampleRate, out int bit, out int averageBps);
139
140             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_audio_aac_header_type")]
141             internal static extern int GetAudioAacType(IntPtr handle, out int aacType);
142
143             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_mime")]
144             internal static extern int SetAudioMimeType(IntPtr handle, int value);
145
146             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_channel")]
147             internal static extern int SetAudioChannel(IntPtr handle, int value);
148
149             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_samplerate")]
150             internal static extern int SetAudioSampleRate(IntPtr handle, int value);
151
152             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_bit")]
153             internal static extern int SetAudioBit(IntPtr handle, int value);
154
155             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_avg_bps")]
156             internal static extern int SetAudioAverageBps(IntPtr handle, int value);
157
158             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_aac_header_type")]
159             internal static extern int SetAudioAacType(IntPtr handle, int value);
160             #endregion
161
162             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_text_info")]
163             internal static extern int GetTextInfo(IntPtr handle, out int mimeType, out int textType);
164
165             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_text_mime")]
166             internal static extern int SetTextMimeType(IntPtr handle, int value);
167
168             [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_text_type")]
169             internal static extern int SetTextType(IntPtr handle, int value);
170         }
171     }
172 }