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.
18 using System.Runtime.InteropServices;
19 using Tizen.Multimedia;
21 internal static partial class Interop
23 internal static partial class Recorder
25 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
26 internal delegate void RecorderErrorCallback(RecorderErrorCode error, RecorderState current, IntPtr userData);
28 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
29 internal delegate void InterruptedCallback(RecorderPolicy policy, RecorderState previous, RecorderState current, IntPtr userData);
31 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
32 internal delegate void RecordingLimitReachedCallback(RecordingLimitType type, IntPtr userData);
34 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
35 internal delegate void RecordingProgressCallback(ulong elapsedTime, ulong fileSize, IntPtr userData);
37 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
38 internal delegate void AudioStreamCallback(IntPtr stream, int size, AudioSampleType type, int channel, uint timeStamp, IntPtr userData);
40 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
41 internal delegate void StatechangedCallback(RecorderState previous, RecorderState current, bool byPolicy, IntPtr userData);
43 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
44 internal delegate void MuxedStreamCallback(IntPtr stream, int size, ulong offset, IntPtr userData);
46 [DllImport(Libraries.Recorder, EntryPoint = "recorder_create_audiorecorder")]
47 internal static extern RecorderError Create(out IntPtr handle);
49 [DllImport(Libraries.Recorder, EntryPoint = "recorder_create_videorecorder")]
50 internal static extern RecorderError CreateVideo(IntPtr cameraHandle, out IntPtr handle);
52 [DllImport(Libraries.Recorder, EntryPoint = "recorder_destroy")]
53 internal static extern RecorderError Destroy(IntPtr handle);
55 [DllImport(Libraries.Recorder, EntryPoint = "recorder_prepare")]
56 internal static extern RecorderError Prepare(IntPtr handle);
58 [DllImport(Libraries.Recorder, EntryPoint = "recorder_unprepare")]
59 internal static extern RecorderError Unprepare(IntPtr handle);
61 [DllImport(Libraries.Recorder, EntryPoint = "recorder_start")]
62 internal static extern RecorderError Start(IntPtr handle);
64 [DllImport(Libraries.Recorder, EntryPoint = "recorder_pause")]
65 internal static extern RecorderError Pause(IntPtr handle);
67 [DllImport(Libraries.Recorder, EntryPoint = "recorder_commit")]
68 internal static extern RecorderError Commit(IntPtr handle);
70 [DllImport(Libraries.Recorder, EntryPoint = "recorder_cancel")]
71 internal static extern RecorderError Cancel(IntPtr handle);
73 [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_state")]
74 internal static extern RecorderError GetState(IntPtr handle, out RecorderState state);
76 [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_sound_stream_info")]
77 internal static extern RecorderError SetAudioStreamPolicy(IntPtr handle, IntPtr streamInfoHandle);
79 [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_error_cb")]
80 internal static extern RecorderError SetErrorCallback(IntPtr handle, RecorderErrorCallback callback, IntPtr userData);
82 [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_error_cb")]
83 internal static extern RecorderError UnsetErrorCallback(IntPtr handle);
85 [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_interrupted_cb")]
86 internal static extern RecorderError SetInterruptedCallback(IntPtr handle, InterruptedCallback callback, IntPtr userData);
88 [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_interrupted_cb")]
89 internal static extern RecorderError UnsetInterruptedCallback(IntPtr handle);
91 [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_state_changed_cb")]
92 internal static extern RecorderError SetStateChangedCallback(IntPtr handle, StatechangedCallback callback, IntPtr userData);
94 [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_state_changed_cb")]
95 internal static extern RecorderError UnsetStateChangedCallback(IntPtr handle);
97 [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_recording_status_cb")]
98 internal static extern RecorderError SetRecordingProgressCallback(IntPtr handle, RecordingProgressCallback callback, IntPtr userData);
100 [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_recording_status_cb")]
101 internal static extern RecorderError UnsetRecordingProgressCallback(IntPtr handle);
103 [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_audio_stream_cb")]
104 internal static extern RecorderError SetAudioStreamCallback(IntPtr handle, AudioStreamCallback callback, IntPtr userData);
106 [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_audio_stream_cb")]
107 internal static extern RecorderError UnsetAudioStreamCallback(IntPtr handle);
109 [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_recording_limit_reached_cb")]
110 internal static extern RecorderError SetLimitReachedCallback(IntPtr handle, RecordingLimitReachedCallback callback, IntPtr userData);
112 [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_recording_limit_reached_cb")]
113 internal static extern RecorderError UnsetLimitReachedCallback(IntPtr handle);
115 [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_muxed_stream_cb")]
116 internal static extern RecorderError SetMuxedStreamCallback(IntPtr handle, MuxedStreamCallback callback, IntPtr userData);
118 [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_muxed_stream_cb")]
119 internal static extern RecorderError UnsetMuxedStreamCallback(IntPtr handle);