[Camera] Fixed possible memory leak and Add some descriptions
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia / Interop / Interop.Recorder.cs
1 using System;
2 using System.Runtime.InteropServices;
3
4 namespace Tizen.Multimedia
5 {
6     internal static partial class Interop
7     {
8         internal static partial class Libc
9         {
10             [DllImport(Libraries.Libc, EntryPoint = "free")]
11             public static extern void Free(IntPtr userData);
12         }
13
14         internal static partial class Recorder
15         {
16             [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
17             internal delegate void RecorderErrorCallback(RecorderErrorCode error, RecorderState current, IntPtr userData);
18
19             [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
20             internal delegate void InterruptedCallback(RecorderPolicy policy, RecorderState previous, RecorderState current, IntPtr userData);
21
22             [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
23             internal delegate void RecordingLimitReachedCallback(RecordingLimitType type, IntPtr userData);
24
25             [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
26             internal delegate void RecordingProgressCallback(ulong elapsedTime, ulong fileSize, IntPtr userData);
27
28             [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
29             internal delegate void AudioStreamCallback(IntPtr stream, int size, AudioSampleType type, int channel, uint timeStamp, IntPtr userData);
30
31             [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
32             internal delegate void StatechangedCallback(RecorderState previous, RecorderState current, bool byPolicy, IntPtr userData);
33
34             [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
35             internal delegate void MuxedStreamCallback(IntPtr stream, int size, ulong offset, IntPtr userData);
36
37             [DllImport(Libraries.Recorder, EntryPoint = "recorder_create_audiorecorder")]
38             internal static extern RecorderError Create(out IntPtr handle);
39
40             [DllImport(Libraries.Recorder, EntryPoint = "recorder_create_videorecorder")]
41             internal static extern RecorderError CreateVideo(IntPtr cameraHandle, out IntPtr handle);
42
43             [DllImport(Libraries.Recorder, EntryPoint = "recorder_destroy")]
44             internal static extern RecorderError Destroy(IntPtr handle);
45
46             [DllImport(Libraries.Recorder, EntryPoint = "recorder_prepare")]
47             internal static extern RecorderError Prepare(IntPtr handle);
48
49             [DllImport(Libraries.Recorder, EntryPoint = "recorder_unprepare")]
50             internal static extern RecorderError Unprepare(IntPtr handle);
51
52             [DllImport(Libraries.Recorder, EntryPoint = "recorder_start")]
53             internal static extern RecorderError Start(IntPtr handle);
54
55             [DllImport(Libraries.Recorder, EntryPoint = "recorder_pause")]
56             internal static extern RecorderError Pause(IntPtr handle);
57
58             [DllImport(Libraries.Recorder, EntryPoint = "recorder_commit")]
59             internal static extern RecorderError Commit(IntPtr handle);
60
61             [DllImport(Libraries.Recorder, EntryPoint = "recorder_cancel")]
62             internal static extern RecorderError Cancel(IntPtr handle);
63
64             [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_state")]
65             internal static extern RecorderError GetState(IntPtr handle, out RecorderState state);
66
67             [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_sound_stream_info")]
68             internal static extern RecorderError SetAudioStreamPolicy(IntPtr handle, IntPtr streamInfoHandle);
69
70             [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_error_cb")]
71             internal static extern RecorderError SetErrorCallback(IntPtr handle, RecorderErrorCallback callback, IntPtr userData);
72
73             [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_error_cb")]
74             internal static extern RecorderError UnsetErrorCallback(IntPtr handle);
75
76             [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_interrupted_cb")]
77             internal static extern RecorderError SetInterruptedCallback(IntPtr handle, InterruptedCallback callback, IntPtr userData);
78
79             [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_interrupted_cb")]
80             internal static extern RecorderError UnsetInterruptedCallback(IntPtr handle);
81
82             [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_state_changed_cb")]
83             internal static extern RecorderError SetStateChangedCallback(IntPtr handle, StatechangedCallback callback, IntPtr userData);
84
85             [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_state_changed_cb")]
86             internal static extern RecorderError UnsetStateChangedCallback(IntPtr handle);
87
88             [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_recording_status_cb")]
89             internal static extern RecorderError SetRecordingProgressCallback(IntPtr handle, RecordingProgressCallback callback, IntPtr userData);
90
91             [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_recording_status_cb")]
92             internal static extern RecorderError UnsetRecordingProgressCallback(IntPtr handle);
93
94             [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_audio_stream_cb")]
95             internal static extern RecorderError SetAudioStreamCallback(IntPtr handle, AudioStreamCallback callback, IntPtr userData);
96
97             [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_audio_stream_cb")]
98             internal static extern RecorderError UnsetAudioStreamCallback(IntPtr handle);
99
100             [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_recording_limit_reached_cb")]
101             internal static extern RecorderError SetLimitReachedCallback(IntPtr handle, RecordingLimitReachedCallback callback, IntPtr userData);
102
103             [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_recording_limit_reached_cb")]
104             internal static extern RecorderError UnsetLimitReachedCallback(IntPtr handle);
105
106             [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_muxed_stream_cb")]
107             internal static extern RecorderError SetMuxedStreamCallback(IntPtr handle, MuxedStreamCallback callback, IntPtr userData);
108
109             [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_muxed_stream_cb")]
110             internal static extern RecorderError UnsetMuxedStreamCallback(IntPtr handle);
111         }
112     }
113 }