Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia.Recorder / Interop / Interop.Recorder.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 using Tizen.Multimedia;
20
21 internal static partial class Interop
22 {
23     internal static partial class Recorder
24     {
25         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
26         internal delegate void RecorderErrorCallback(RecorderErrorCode error, RecorderState current, IntPtr userData);
27
28         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
29         internal delegate void InterruptedCallback(RecorderPolicy policy, RecorderState previous, RecorderState current, IntPtr userData);
30
31         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
32         internal delegate void RecordingLimitReachedCallback(RecordingLimitType type, IntPtr userData);
33
34         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
35         internal delegate void RecordingProgressCallback(ulong elapsedTime, ulong fileSize, IntPtr userData);
36
37         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
38         internal delegate void AudioStreamCallback(IntPtr stream, int size, AudioSampleType type, int channel, uint timeStamp, IntPtr userData);
39
40         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
41         internal delegate void StatechangedCallback(RecorderState previous, RecorderState current, bool byPolicy, IntPtr userData);
42
43         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
44         internal delegate void MuxedStreamCallback(IntPtr stream, int size, ulong offset, IntPtr userData);
45
46         [DllImport(Libraries.Recorder, EntryPoint = "recorder_create_audiorecorder")]
47         internal static extern RecorderError Create(out IntPtr handle);
48
49         [DllImport(Libraries.Recorder, EntryPoint = "recorder_create_videorecorder")]
50         internal static extern RecorderError CreateVideo(IntPtr cameraHandle, out IntPtr handle);
51
52         [DllImport(Libraries.Recorder, EntryPoint = "recorder_destroy")]
53         internal static extern RecorderError Destroy(IntPtr handle);
54
55         [DllImport(Libraries.Recorder, EntryPoint = "recorder_prepare")]
56         internal static extern RecorderError Prepare(IntPtr handle);
57
58         [DllImport(Libraries.Recorder, EntryPoint = "recorder_unprepare")]
59         internal static extern RecorderError Unprepare(IntPtr handle);
60
61         [DllImport(Libraries.Recorder, EntryPoint = "recorder_start")]
62         internal static extern RecorderError Start(IntPtr handle);
63
64         [DllImport(Libraries.Recorder, EntryPoint = "recorder_pause")]
65         internal static extern RecorderError Pause(IntPtr handle);
66
67         [DllImport(Libraries.Recorder, EntryPoint = "recorder_commit")]
68         internal static extern RecorderError Commit(IntPtr handle);
69
70         [DllImport(Libraries.Recorder, EntryPoint = "recorder_cancel")]
71         internal static extern RecorderError Cancel(IntPtr handle);
72
73         [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_state")]
74         internal static extern RecorderError GetState(IntPtr handle, out RecorderState state);
75
76         [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_sound_stream_info")]
77         internal static extern RecorderError SetAudioStreamPolicy(IntPtr handle, IntPtr streamInfoHandle);
78
79         [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_error_cb")]
80         internal static extern RecorderError SetErrorCallback(IntPtr handle, RecorderErrorCallback callback, IntPtr userData);
81
82         [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_error_cb")]
83         internal static extern RecorderError UnsetErrorCallback(IntPtr handle);
84
85         [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_interrupted_cb")]
86         internal static extern RecorderError SetInterruptedCallback(IntPtr handle, InterruptedCallback callback, IntPtr userData);
87
88         [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_interrupted_cb")]
89         internal static extern RecorderError UnsetInterruptedCallback(IntPtr handle);
90
91         [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_state_changed_cb")]
92         internal static extern RecorderError SetStateChangedCallback(IntPtr handle, StatechangedCallback callback, IntPtr userData);
93
94         [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_state_changed_cb")]
95         internal static extern RecorderError UnsetStateChangedCallback(IntPtr handle);
96
97         [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_recording_status_cb")]
98         internal static extern RecorderError SetRecordingProgressCallback(IntPtr handle, RecordingProgressCallback callback, IntPtr userData);
99
100         [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_recording_status_cb")]
101         internal static extern RecorderError UnsetRecordingProgressCallback(IntPtr handle);
102
103         [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_audio_stream_cb")]
104         internal static extern RecorderError SetAudioStreamCallback(IntPtr handle, AudioStreamCallback callback, IntPtr userData);
105
106         [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_audio_stream_cb")]
107         internal static extern RecorderError UnsetAudioStreamCallback(IntPtr handle);
108
109         [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_recording_limit_reached_cb")]
110         internal static extern RecorderError SetLimitReachedCallback(IntPtr handle, RecordingLimitReachedCallback callback, IntPtr userData);
111
112         [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_recording_limit_reached_cb")]
113         internal static extern RecorderError UnsetLimitReachedCallback(IntPtr handle);
114
115         [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_muxed_stream_cb")]
116         internal static extern RecorderError SetMuxedStreamCallback(IntPtr handle, MuxedStreamCallback callback, IntPtr userData);
117
118         [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_muxed_stream_cb")]
119         internal static extern RecorderError UnsetMuxedStreamCallback(IntPtr handle);
120     }
121 }