From: coderhyme Date: Thu, 18 May 2017 23:35:04 +0000 (+0900) Subject: Splitted the project into multiple module level projects. X-Git-Tag: submit/trunk/20170823.075128~94^2~70 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f6b949e96ea2e58833ed0e1e3132779301d9e0e7;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Splitted the project into multiple module level projects. Change-Id: I00d98be04af37007b72a21527028e379ddb2ccbb Signed-off-by: coderhyme --- diff --git a/Tizen.Multimedia.sln b/Tizen.Multimedia.sln index 4907a30..e6ff8f4 100644 --- a/Tizen.Multimedia.sln +++ b/Tizen.Multimedia.sln @@ -1,12 +1,32 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.6 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia", "Tizen.Multimedia\Tizen.Multimedia.csproj", "{0CE698B0-4849-4096-9D7F-30E611F50DAD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia", "Tizen.Multimedia\Tizen.Multimedia.csproj", "{0CE698B0-4849-4096-9D7F-30E611F50DAD}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.MediaCodec", "Tizen.Multimedia.MediaCodec\Tizen.Multimedia.MediaCodec.csproj", "{C74F30BE-BC8D-4D1A-84D6-F7255A6687BE}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.MediaPlayer", "Tizen.Multimedia.MediaPlayer\Tizen.Multimedia.MediaPlayer.csproj", "{4A913E20-F979-438A-9AD5-10FC83500B37}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.Radio", "Tizen.Multimedia.Radio\Tizen.Multimedia.Radio.csproj", "{51FCEC86-3091-4907-94FF-617307124B7A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.Recorder", "Tizen.Multimedia.Recorder\Tizen.Multimedia.Recorder.csproj", "{43292612-BB87-432D-B512-2CD97618F5D6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.StreamRecorder", "Tizen.Multimedia.StreamRecorder\Tizen.Multimedia.StreamRecorder.csproj", "{799D9285-21D5-4B2E-89A1-F5F42C6067ED}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.Camera", "Tizen.Multimedia.Camera\Tizen.Multimedia.Camera.csproj", "{70A0AF21-CF19-4C91-9F79-CF2F75560341}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.Remoting", "Tizen.Multimedia.Remoting\Tizen.Multimedia.Remoting.csproj", "{C9CAA864-1D46-451C-B818-C58F9C9CC18A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.Util", "Tizen.Multimedia.Util\Tizen.Multimedia.Util.csproj", "{35C35151-C16A-4473-95FF-E26F0205DFF4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.Vision", "Tizen.Multimedia.Vision\Tizen.Multimedia.Vision.csproj", "{443E3507-0F92-48B7-B0C4-0424928C3F72}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.Metadata", "Tizen.Multimedia.Metadata\Tizen.Multimedia.Metadata.csproj", "{C6138D98-B52D-448A-AE8B-36FAF55E6F93}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.AudioIO", "Tizen.Multimedia.AudioIO\Tizen.Multimedia.AudioIO.csproj", "{7C22F20F-8327-4DA5-952D-403C44FCC69B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +41,46 @@ Global {C74F30BE-BC8D-4D1A-84D6-F7255A6687BE}.Debug|Any CPU.Build.0 = Debug|Any CPU {C74F30BE-BC8D-4D1A-84D6-F7255A6687BE}.Release|Any CPU.ActiveCfg = Release|Any CPU {C74F30BE-BC8D-4D1A-84D6-F7255A6687BE}.Release|Any CPU.Build.0 = Release|Any CPU + {4A913E20-F979-438A-9AD5-10FC83500B37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A913E20-F979-438A-9AD5-10FC83500B37}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A913E20-F979-438A-9AD5-10FC83500B37}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A913E20-F979-438A-9AD5-10FC83500B37}.Release|Any CPU.Build.0 = Release|Any CPU + {51FCEC86-3091-4907-94FF-617307124B7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {51FCEC86-3091-4907-94FF-617307124B7A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {51FCEC86-3091-4907-94FF-617307124B7A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {51FCEC86-3091-4907-94FF-617307124B7A}.Release|Any CPU.Build.0 = Release|Any CPU + {43292612-BB87-432D-B512-2CD97618F5D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {43292612-BB87-432D-B512-2CD97618F5D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {43292612-BB87-432D-B512-2CD97618F5D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {43292612-BB87-432D-B512-2CD97618F5D6}.Release|Any CPU.Build.0 = Release|Any CPU + {799D9285-21D5-4B2E-89A1-F5F42C6067ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {799D9285-21D5-4B2E-89A1-F5F42C6067ED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {799D9285-21D5-4B2E-89A1-F5F42C6067ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {799D9285-21D5-4B2E-89A1-F5F42C6067ED}.Release|Any CPU.Build.0 = Release|Any CPU + {70A0AF21-CF19-4C91-9F79-CF2F75560341}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {70A0AF21-CF19-4C91-9F79-CF2F75560341}.Debug|Any CPU.Build.0 = Debug|Any CPU + {70A0AF21-CF19-4C91-9F79-CF2F75560341}.Release|Any CPU.ActiveCfg = Release|Any CPU + {70A0AF21-CF19-4C91-9F79-CF2F75560341}.Release|Any CPU.Build.0 = Release|Any CPU + {C9CAA864-1D46-451C-B818-C58F9C9CC18A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C9CAA864-1D46-451C-B818-C58F9C9CC18A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C9CAA864-1D46-451C-B818-C58F9C9CC18A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C9CAA864-1D46-451C-B818-C58F9C9CC18A}.Release|Any CPU.Build.0 = Release|Any CPU + {35C35151-C16A-4473-95FF-E26F0205DFF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {35C35151-C16A-4473-95FF-E26F0205DFF4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {35C35151-C16A-4473-95FF-E26F0205DFF4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {35C35151-C16A-4473-95FF-E26F0205DFF4}.Release|Any CPU.Build.0 = Release|Any CPU + {443E3507-0F92-48B7-B0C4-0424928C3F72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {443E3507-0F92-48B7-B0C4-0424928C3F72}.Debug|Any CPU.Build.0 = Debug|Any CPU + {443E3507-0F92-48B7-B0C4-0424928C3F72}.Release|Any CPU.ActiveCfg = Release|Any CPU + {443E3507-0F92-48B7-B0C4-0424928C3F72}.Release|Any CPU.Build.0 = Release|Any CPU + {C6138D98-B52D-448A-AE8B-36FAF55E6F93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C6138D98-B52D-448A-AE8B-36FAF55E6F93}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C6138D98-B52D-448A-AE8B-36FAF55E6F93}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C6138D98-B52D-448A-AE8B-36FAF55E6F93}.Release|Any CPU.Build.0 = Release|Any CPU + {7C22F20F-8327-4DA5-952D-403C44FCC69B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7C22F20F-8327-4DA5-952D-403C44FCC69B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7C22F20F-8327-4DA5-952D-403C44FCC69B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7C22F20F-8327-4DA5-952D-403C44FCC69B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/packaging/csapi-multimedia.spec b/packaging/csapi-multimedia.spec index c70f03b..365ee46 100755 --- a/packaging/csapi-multimedia.spec +++ b/packaging/csapi-multimedia.spec @@ -1,6 +1,6 @@ Name: csapi-multimedia Summary: Tizen Multimedia API for C# -Version: 1.0.0 +Version: 1.1.0 Release: 0 Group: Development/Libraries License: Apache-2.0 @@ -20,8 +20,18 @@ BuildRequires: elm-sharp-nuget BuildRequires: csapi-information-nuget %define Assemblies \ - Tizen.Multimedia 1.1.1 \ - Tizen.Multimedia.MediaCodec 1.0.0 + Tizen.Multimedia 1.2.0 \ + Tizen.Multimedia.AudioIO 1.0.0 \ + Tizen.Multimedia.Camera 1.0.0 \ + Tizen.Multimedia.MediaCodec 1.0.0 \ + Tizen.Multimedia.MediaPlayer 1.0.0 \ + Tizen.Multimedia.Metadata 1.0.0 \ + Tizen.Multimedia.Radio 1.0.0 \ + Tizen.Multimedia.Recorder 1.0.0 \ + Tizen.Multimedia.StreamRecorder 1.0.0 \ + Tizen.Multimedia.Remoting 1.0.0 \ + Tizen.Multimedia.Util 1.0.0 \ + Tizen.Multimedia.Vision 1.0.0 %description %{summary} diff --git a/src/Tizen.Multimedia/AudioIO/AudioCapture.cs b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioCapture.cs old mode 100755 new mode 100644 similarity index 99% rename from src/Tizen.Multimedia/AudioIO/AudioCapture.cs rename to src/Tizen.Multimedia.AudioIO/AudioIO/AudioCapture.cs index b3089e5..5b04996 --- a/src/Tizen.Multimedia/AudioIO/AudioCapture.cs +++ b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioCapture.cs @@ -40,8 +40,8 @@ namespace Tizen.Multimedia $"Valid sampleRate range is { MinSampleRate } <= x <= { MaxSampleRate }."); } - ValidationUtil.ValidateEnum(typeof(AudioChannel), channel); - ValidationUtil.ValidateEnum(typeof(AudioSampleType), sampleType); + ValidationUtil.ValidateEnum(typeof(AudioChannel), channel, nameof(channel)); + ValidationUtil.ValidateEnum(typeof(AudioSampleType), sampleType, nameof(sampleType)); SampleRate = sampleRate; Channel = channel; diff --git a/src/Tizen.Multimedia/AudioIO/AudioDataAvailableEventArgs.cs b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioDataAvailableEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/AudioIO/AudioDataAvailableEventArgs.cs rename to src/Tizen.Multimedia.AudioIO/AudioIO/AudioDataAvailableEventArgs.cs diff --git a/src/Tizen.Multimedia/AudioIO/AudioIOEnums.cs b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOEnums.cs old mode 100755 new mode 100644 similarity index 99% rename from src/Tizen.Multimedia/AudioIO/AudioIOEnums.cs rename to src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOEnums.cs index 03c4a19..bec87b0 --- a/src/Tizen.Multimedia/AudioIO/AudioIOEnums.cs +++ b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOEnums.cs @@ -60,8 +60,8 @@ namespace Tizen.Multimedia /// The stream is paused. /// Paused = 2 - } - + } + /// /// Enumeration for audio sample type. /// diff --git a/src/Tizen.Multimedia/AudioIO/AudioIOStateChangedEventArgs.cs b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOStateChangedEventArgs.cs similarity index 100% rename from src/Tizen.Multimedia/AudioIO/AudioIOStateChangedEventArgs.cs rename to src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOStateChangedEventArgs.cs diff --git a/src/Tizen.Multimedia/AudioIO/AudioIOUtil.cs b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOUtil.cs similarity index 100% rename from src/Tizen.Multimedia/AudioIO/AudioIOUtil.cs rename to src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOUtil.cs diff --git a/src/Tizen.Multimedia/AudioIO/AudioPlayback.cs b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioPlayback.cs old mode 100755 new mode 100644 similarity index 99% rename from src/Tizen.Multimedia/AudioIO/AudioPlayback.cs rename to src/Tizen.Multimedia.AudioIO/AudioIO/AudioPlayback.cs index 80aeaf3..7fca3c5 --- a/src/Tizen.Multimedia/AudioIO/AudioPlayback.cs +++ b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioPlayback.cs @@ -98,8 +98,8 @@ namespace Tizen.Multimedia $"Valid sampleRate range is { MinSampleRate } <= x <= { MaxSampleRate }."); } - ValidationUtil.ValidateEnum(typeof(AudioChannel), channel); - ValidationUtil.ValidateEnum(typeof(AudioSampleType), sampleType); + ValidationUtil.ValidateEnum(typeof(AudioChannel), channel, nameof(channel)); + ValidationUtil.ValidateEnum(typeof(AudioSampleType), sampleType, nameof(sampleType)); SampleRate = sampleRate; Channel = channel; diff --git a/src/Tizen.Multimedia/AudioIO/AudioPlaybackBufferAvailableEventArgs.cs b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioPlaybackBufferAvailableEventArgs.cs similarity index 100% rename from src/Tizen.Multimedia/AudioIO/AudioPlaybackBufferAvailableEventArgs.cs rename to src/Tizen.Multimedia.AudioIO/AudioIO/AudioPlaybackBufferAvailableEventArgs.cs diff --git a/src/Tizen.Multimedia.AudioIO/Interop/Interop.AudioIO.cs b/src/Tizen.Multimedia.AudioIO/Interop/Interop.AudioIO.cs new file mode 100644 index 0000000..1685489 --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/Interop/Interop.AudioIO.cs @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class AudioIO + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void AudioStreamCallback(IntPtr handle, uint nbytes, IntPtr userdata); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void AudioStateChangedCallback(IntPtr handle, int previous, int current, bool byPolicy, IntPtr userData); + + internal static partial class AudioInput + { + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_set_state_changed_cb")] + internal static extern int SetStateChangedCallback(IntPtr handle, AudioStateChangedCallback callback, IntPtr user_data); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_set_stream_cb")] + internal static extern int SetStreamCallback(IntPtr handle, AudioStreamCallback callback, IntPtr user_data); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_create")] + internal static extern int Create(int sampleRate, int channel, int type, out IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_set_sound_stream_info")] + internal static extern int SetStreamInfo(IntPtr handle, IntPtr streamInfoHandle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_prepare")] + internal static extern int Prepare(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_unprepare")] + internal static extern int Unprepare(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_pause")] + internal static extern int Pause(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_resume")] + internal static extern int Resume(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_flush")] + internal static extern int Flush(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_read")] + internal static extern int Read(IntPtr handle, byte[] buffer, int length); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_buffer_size")] + internal static extern int GetBufferSize(IntPtr handle, out int size); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_sample_rate")] + internal static extern int GetSampleRate(IntPtr handle, out int sampleRate); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_channel")] + internal static extern int GetChannel(IntPtr handle, out int channel); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_sample_type")] + internal static extern int GetSampleType(IntPtr handle, out int sampleType); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_peek")] + internal static extern int Peek(IntPtr handle, out IntPtr buffer, ref uint length); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_drop")] + internal static extern int Drop(IntPtr handle); + } + internal static partial class AudioOutput + { + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_set_state_changed_cb")] + internal static extern int SetStateChangedCallback(IntPtr handle, AudioStateChangedCallback callback, IntPtr user_data); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_set_stream_cb")] + internal static extern int SetStreamChangedCallback(IntPtr handle, AudioStreamCallback callback, IntPtr user_data); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_create_new")] + internal static extern int Create(int sampleRate, int channel, int type, out IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_drain")] + internal static extern int Drain(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_flush")] + internal static extern int Flush(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_buffer_size")] + internal static extern int GetBufferSize(IntPtr handle, out int size); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_channel")] + internal static extern int GetChannel(IntPtr handle, out int channel); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_sample_rate")] + internal static extern int GetSampleRate(IntPtr handle, out int sampleRate); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_sample_type")] + internal static extern int GetSampleType(IntPtr handle, out int sampleType); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_sound_type")] + internal static extern int GetSoundType(IntPtr handle, out int soundType); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_pause")] + internal static extern int Pause(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_prepare")] + internal static extern int Prepare(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_resume")] + internal static extern int Resume(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_set_sound_stream_info")] + internal static extern int SetStreamInfo(IntPtr handle, IntPtr streamInfoHandle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_unprepare")] + internal static extern int Unprepare(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_write")] + internal static extern int Write(IntPtr handle, byte[] buffer, uint length); + } + } +} diff --git a/src/Tizen.Multimedia/Utility/VideoFileFormat.cs b/src/Tizen.Multimedia.AudioIO/Interop/Interop.Libraries.cs old mode 100755 new mode 100644 similarity index 63% rename from src/Tizen.Multimedia/Utility/VideoFileFormat.cs rename to src/Tizen.Multimedia.AudioIO/Interop/Interop.Libraries.cs index 5afe29a..3469f9f --- a/src/Tizen.Multimedia/Utility/VideoFileFormat.cs +++ b/src/Tizen.Multimedia.AudioIO/Interop/Interop.Libraries.cs @@ -14,20 +14,12 @@ * limitations under the License. */ -namespace Tizen.Multimedia.Utility +internal static partial class Interop { - /// - /// Video file format - /// - public enum VideoFileFormat + internal static partial class Libraries { - /// - /// 3GP file - /// - ThreeGp = Interop.VideoFileFormat.Format3Gp, - /// - /// MP4 file - /// - Mp4 = Interop.VideoFileFormat.FormatMp4, + public const string AudioIO = "libcapi-media-audio-io.so.0"; + public const string WavPlayer = "libcapi-media-wav-player.so.0"; + public const string TonePlayer = "libcapi-media-tone-player.so.0"; } -} \ No newline at end of file +} diff --git a/src/Tizen.Multimedia.AudioIO/Interop/Interop.TonePlayer.cs b/src/Tizen.Multimedia.AudioIO/Interop/Interop.TonePlayer.cs new file mode 100644 index 0000000..17f8f0a --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/Interop/Interop.TonePlayer.cs @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class TonePlayer + { + [DllImport(Libraries.TonePlayer, EntryPoint = "tone_player_start_new")] + internal static extern int Start(ToneType tone, IntPtr streamInfoHandle, int durationMs, out int playerId); + + [DllImport(Libraries.TonePlayer, EntryPoint = "tone_player_stop")] + internal static extern int Stop(int PlayerId); + } +} + diff --git a/src/Tizen.Multimedia.AudioIO/Interop/Interop.WavPlayer.cs b/src/Tizen.Multimedia.AudioIO/Interop/Interop.WavPlayer.cs new file mode 100644 index 0000000..933b1de --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/Interop/Interop.WavPlayer.cs @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class WavPlayer + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void WavPlayerCompletedCallback(int playerId, IntPtr userData); + + [DllImport(Libraries.WavPlayer, EntryPoint = "wav_player_start_new")] + internal static extern int WavPlayerStart(string filePath, IntPtr streamInfoHandle, WavPlayerCompletedCallback completedCallback, + IntPtr userData, out int playerId); + + [DllImport(Libraries.WavPlayer, EntryPoint = "wav_player_stop")] + internal static extern int WavPlayerStop(int PlayerId); + } +} diff --git a/src/Tizen.Multimedia/Common/MultimediaDebug.cs b/src/Tizen.Multimedia.AudioIO/MultimediaDebug.cs similarity index 100% rename from src/Tizen.Multimedia/Common/MultimediaDebug.cs rename to src/Tizen.Multimedia.AudioIO/MultimediaDebug.cs diff --git a/src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.csproj b/src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.csproj new file mode 100644 index 0000000..160a0f9 --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.csproj @@ -0,0 +1,20 @@ + + + netstandard1.3 + True + True + Tizen.Multimedia.AudioIO.snk + true + True + False + + + + + + + + + + + diff --git a/src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.nuspec b/src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.nuspec new file mode 100644 index 0000000..2eb57cb --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.nuspec @@ -0,0 +1,18 @@ + + + + Tizen.Multimedia.AudioIO + $version$ + Samsung Electronics + false + https://www.apache.org/licenses/LICENSE-2.0 + https://www.tizen.org/ + https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png + © Samsung Electronics Co., Ltd All Rights Reserved + Provides the Multimedia AudioIO API for Tizen.Net + + + + + + diff --git a/src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.snk b/src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.snk new file mode 100644 index 0000000..fbfec4b Binary files /dev/null and b/src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.snk differ diff --git a/src/Tizen.Multimedia/TonePlayer/TonePlayer.cs b/src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayer.cs old mode 100755 new mode 100644 similarity index 99% rename from src/Tizen.Multimedia/TonePlayer/TonePlayer.cs rename to src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayer.cs index f9289f9..091ba9c --- a/src/Tizen.Multimedia/TonePlayer/TonePlayer.cs +++ b/src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayer.cs @@ -18,7 +18,7 @@ using System; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; - + namespace Tizen.Multimedia { static internal class TonePlayerLog diff --git a/src/Tizen.Multimedia/TonePlayer/TonePlayerEnums.cs b/src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayerEnums.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/TonePlayer/TonePlayerEnums.cs rename to src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayerEnums.cs diff --git a/src/Tizen.Multimedia/TonePlayer/TonePlayerErrorFactory.cs b/src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayerErrorFactory.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/TonePlayer/TonePlayerErrorFactory.cs rename to src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayerErrorFactory.cs diff --git a/src/Tizen.Multimedia.AudioIO/ValdiationUtil.cs b/src/Tizen.Multimedia.AudioIO/ValdiationUtil.cs new file mode 100644 index 0000000..d896ced --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/ValdiationUtil.cs @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + internal static class ValidationUtil + { + internal static void ValidateEnum(Type enumType, object value, string paramName) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Invalid { enumType.Name } value : { value }", paramName); + } + } + } +} diff --git a/src/Tizen.Multimedia/WavPlayer/WavPlayer.cs b/src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayer.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/WavPlayer/WavPlayer.cs rename to src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayer.cs diff --git a/src/Tizen.Multimedia/WavPlayer/WavPlayerErrorFactory.cs b/src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayerErrorFactory.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/WavPlayer/WavPlayerErrorFactory.cs rename to src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayerErrorFactory.cs diff --git a/src/Tizen.Multimedia/Camera/Camera.cs b/src/Tizen.Multimedia.Camera/Camera/Camera.cs old mode 100755 new mode 100644 similarity index 88% rename from src/Tizen.Multimedia/Camera/Camera.cs rename to src/Tizen.Multimedia.Camera/Camera/Camera.cs index f39c581..d1b176c --- a/src/Tizen.Multimedia/Camera/Camera.cs +++ b/src/Tizen.Multimedia.Camera/Camera/Camera.cs @@ -20,6 +20,8 @@ using System.Diagnostics; using System.Linq; using System.Runtime.InteropServices; using System.Threading; +using static Interop; +using Native = Interop.Camera; namespace Tizen.Multimedia { @@ -55,7 +57,7 @@ namespace Tizen.Multimedia /// public Camera(CameraDevice device) { - CameraErrorFactory.ThrowIfError(Interop.Camera.Create((int)device, out _handle), + CameraErrorFactory.ThrowIfError(Native.Create((int)device, out _handle), "Failed to create camera instance"); Feature = new CameraFeatures(this); @@ -75,6 +77,8 @@ namespace Tizen.Multimedia Dispose(false); } + public IntPtr Handle => GetHandle(); + internal IntPtr GetHandle() { ValidateNotDisposed(); @@ -102,7 +106,7 @@ namespace Tizen.Multimedia if (_handle != IntPtr.Zero) { - Interop.Camera.Destroy(_handle); + Native.Destroy(_handle); _handle = IntPtr.Zero; } @@ -146,53 +150,53 @@ namespace Tizen.Multimedia /// Event that occurs when an camera is interrupted by policy. /// public event EventHandler Interrupted; - private Interop.Camera.InterruptedCallback _interruptedCallback; + private Native.InterruptedCallback _interruptedCallback; /// /// Event that occurs when there is an asynchronous error. /// public event EventHandler ErrorOccurred; - private Interop.Camera.ErrorCallback _errorCallback; + private Native.ErrorCallback _errorCallback; /// /// Event that occurs when the auto focus state is changed. /// public event EventHandler FocusStateChanged; - private Interop.Camera.FocusStateChangedCallback _focusStateChangedCallback; + private Native.FocusStateChangedCallback _focusStateChangedCallback; /// /// Event that occurs when a face is detected in preview frame. /// public event EventHandler FaceDetected; - private Interop.Camera.FaceDetectedCallback _faceDetectedCallback; + private Native.FaceDetectedCallback _faceDetectedCallback; /// /// Event that occurs during capture of image. /// public event EventHandler Capturing; - private Interop.Camera.CapturingCallback _capturingCallback; + private Native.CapturingCallback _capturingCallback; /// /// Event that occurs after the capture of the image. /// public event EventHandler CaptureCompleted; - private Interop.Camera.CaptureCompletedCallback _captureCompletedCallback; + private Native.CaptureCompletedCallback _captureCompletedCallback; /// /// Event that occurs when there is change in HDR capture progress. /// Check whether HdrCapture feature is supported or not before add this EventHandler. /// public event EventHandler HdrCaptureProgress; - private Interop.Camera.HdrCaptureProgressCallback _hdrCaptureProgressCallback; + private Native.HdrCaptureProgressCallback _hdrCaptureProgressCallback; /// /// Event that occurs when camera state is changed. /// public event EventHandler StateChanged; - private Interop.Camera.StateChangedCallback _stateChangedCallback; + private Native.StateChangedCallback _stateChangedCallback; #region DeviceStateChanged callback - internal static Interop.Camera.DeviceStateChangedCallback _deviceStateChangedCallback; + internal static Native.DeviceStateChangedCallback _deviceStateChangedCallback; public static event EventHandler _deviceStateChanged; public static object _deviceStateChangedEventLock = new object(); @@ -201,7 +205,7 @@ namespace Tizen.Multimedia /// User doesn't need to create camera instance. /// This static EventHandler calls platform function every time because each callback function have to remain its own callbackId. /// - /// Callback of type . + /// Callback of type . /// The Id of registered callback. /// In case of any invalid operations /// In case of this feature is not supported @@ -218,7 +222,7 @@ namespace Tizen.Multimedia { _deviceStateChanged?.Invoke(null, new CameraDeviceStateChangedEventArgs(device, state)); }; - CameraErrorFactory.ThrowIfError(Interop.Camera.SetDeviceStateChangedCallback(_deviceStateChangedCallback, IntPtr.Zero, out callbackId), + CameraErrorFactory.ThrowIfError(Native.SetDeviceStateChangedCallback(_deviceStateChangedCallback, IntPtr.Zero, out callbackId), "Failed to set interrupt callback"); // Keep current callbackId and EventHandler pair to remove EventHandler later. @@ -239,7 +243,7 @@ namespace Tizen.Multimedia _callbackIdInfo.TryGetValue(value, out callbackId); Log.Info(CameraLog.Tag, "remove callbackId " + callbackId.ToString()); - CameraErrorFactory.ThrowIfError(Interop.Camera.UnsetDeviceStateChangedCallback(callbackId), + CameraErrorFactory.ThrowIfError(Native.UnsetDeviceStateChangedCallback(callbackId), "Unsetting media packet preview callback failed"); _callbackIdInfo.Remove(value); @@ -254,7 +258,7 @@ namespace Tizen.Multimedia #endregion DeviceStateChanged callback #region Preview EventHandler - private Interop.Camera.PreviewCallback _previewCallback; + private Native.PreviewCallback _previewCallback; private event EventHandler _preview; private object _previewEventLock = new object(); /// @@ -284,7 +288,7 @@ namespace Tizen.Multimedia if (_preview == null) { - CameraErrorFactory.ThrowIfError(Interop.Camera.UnsetPreviewCallback(_handle), + CameraErrorFactory.ThrowIfError(Native.UnsetPreviewCallback(_handle), "Unsetting preview callback failed"); _previewCallback = null; } @@ -294,7 +298,7 @@ namespace Tizen.Multimedia #endregion Preview EventHandler #region MediaPacketPreview EventHandler - private Interop.Camera.MediaPacketPreviewCallback _mediaPacketPreviewCallback; + private Native.MediaPacketPreviewCallback _mediaPacketPreviewCallback; private EventHandler _mediaPacketPreview; private object _mediaPacketPreviewEventLock = new object(); @@ -325,7 +329,7 @@ namespace Tizen.Multimedia if (_mediaPacketPreview == null) { - CameraErrorFactory.ThrowIfError(Interop.Camera.UnsetMediaPacketPreviewCallback(_handle), + CameraErrorFactory.ThrowIfError(Native.UnsetMediaPacketPreviewCallback(_handle), "Unsetting media packet preview callback failed"); _mediaPacketPreviewCallback = null; } @@ -358,7 +362,7 @@ namespace Tizen.Multimedia { if (display == null) { - return Interop.CameraDisplay.SetTarget(GetHandle(), DisplayType.None, IntPtr.Zero); + return CameraDisplay.SetTarget(GetHandle(), DisplayType.None, IntPtr.Zero); } return display.ApplyTo(this); @@ -422,7 +426,7 @@ namespace Tizen.Multimedia Debug.Assert(Enum.IsDefined(typeof(DisplayType), type)); - return Interop.CameraDisplay.SetTarget(GetHandle(), type, evasObject); + return CameraDisplay.SetTarget(GetHandle(), type, evasObject); } /// @@ -437,7 +441,7 @@ namespace Tizen.Multimedia ValidateNotDisposed(); CameraState val = CameraState.None; - CameraErrorFactory.ThrowIfError(Interop.Camera.GetState(_handle, out val), + CameraErrorFactory.ThrowIfError(Native.GetState(_handle, out val), "Failed to get camera state"); return val; @@ -460,7 +464,7 @@ namespace Tizen.Multimedia bool val = false; - CameraErrorFactory.ThrowIfError(Interop.Camera.GetDisplayReuseHint(_handle, out val), + CameraErrorFactory.ThrowIfError(Native.GetDisplayReuseHint(_handle, out val), "Failed to get camera display reuse hint"); return val; @@ -470,7 +474,7 @@ namespace Tizen.Multimedia { ValidateState(CameraState.Preview); - CameraErrorFactory.ThrowIfError(Interop.Camera.SetDisplayReuseHint(_handle, value), + CameraErrorFactory.ThrowIfError(Native.SetDisplayReuseHint(_handle, value), "Failed to set display reuse hint."); } } @@ -488,7 +492,7 @@ namespace Tizen.Multimedia CameraFacingDirection val = 0; - CameraErrorFactory.ThrowIfError(Interop.Camera.GetFacingDirection(_handle, out val), + CameraErrorFactory.ThrowIfError(Native.GetFacingDirection(_handle, out val), "Failed to get camera direction"); return val; @@ -509,7 +513,7 @@ namespace Tizen.Multimedia int val = 0; - CameraErrorFactory.ThrowIfError(Interop.Camera.GetDeviceCount(_handle, out val), + CameraErrorFactory.ThrowIfError(Native.GetDeviceCount(_handle, out val), "Failed to get camera device count"); return val; @@ -539,7 +543,7 @@ namespace Tizen.Multimedia { ValidateState(CameraState.Created, CameraState.Preview); - CameraErrorFactory.ThrowIfError(Interop.Camera.ChangeDevice(_handle, (int)device), + CameraErrorFactory.ThrowIfError(Native.ChangeDevice(_handle, (int)device), "Failed to change the camera device"); } @@ -558,7 +562,7 @@ namespace Tizen.Multimedia { int val = 0; - CameraErrorFactory.ThrowIfError(Interop.Camera.GetDeviceState(device, out val), + CameraErrorFactory.ThrowIfError(Native.GetDeviceState(device, out val), "Failed to get the camera device state."); return (CameraDeviceState)val; @@ -579,7 +583,7 @@ namespace Tizen.Multimedia { CameraFlashState val = CameraFlashState.NotUsed; - CameraErrorFactory.ThrowIfError(Interop.Camera.GetFlashState(device, out val), + CameraErrorFactory.ThrowIfError(Native.GetFlashState(device, out val), "Failed to get camera flash state"); return val; @@ -605,7 +609,7 @@ namespace Tizen.Multimedia { ValidateState(CameraState.Created, CameraState.Captured); - CameraErrorFactory.ThrowIfError(Interop.Camera.StartPreview(_handle), + CameraErrorFactory.ThrowIfError(Native.StartPreview(_handle), "Failed to start the camera preview."); // Update by StateChangedCallback can be delayed for dozens of milliseconds. @@ -627,7 +631,7 @@ namespace Tizen.Multimedia { ValidateState(CameraState.Preview); - CameraErrorFactory.ThrowIfError(Interop.Camera.StopPreview(_handle), + CameraErrorFactory.ThrowIfError(Native.StopPreview(_handle), "Failed to stop the camera preview."); SetState(CameraState.Created); @@ -655,7 +659,7 @@ namespace Tizen.Multimedia { ValidateState(CameraState.Preview); - CameraErrorFactory.ThrowIfError(Interop.Camera.StartCapture(_handle, _capturingCallback, _captureCompletedCallback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(Native.StartCapture(_handle, _capturingCallback, _captureCompletedCallback, IntPtr.Zero), "Failed to start the camera capture."); SetState(CameraState.Capturing); @@ -705,13 +709,13 @@ namespace Tizen.Multimedia { cancellationToken.Register(() => { - CameraErrorFactory.ThrowIfError(Interop.Camera.StopContinuousCapture(_handle), + CameraErrorFactory.ThrowIfError(Native.StopContinuousCapture(_handle), "Failed to cancel the continuous capture"); SetState(CameraState.Captured); }); } - CameraErrorFactory.ThrowIfError(Interop.Camera.StartContinuousCapture(_handle, count, interval, + CameraErrorFactory.ThrowIfError(Native.StartContinuousCapture(_handle, count, interval, _capturingCallback, _captureCompletedCallback, IntPtr.Zero), "Failed to start the continuous capture."); SetState(CameraState.Capturing); @@ -737,7 +741,7 @@ namespace Tizen.Multimedia { ValidateState(CameraState.Preview, CameraState.Captured); - CameraErrorFactory.ThrowIfError(Interop.Camera.StartFocusing(_handle, continuous), + CameraErrorFactory.ThrowIfError(Native.StartFocusing(_handle, continuous), "Failed to cancel the camera focus."); } @@ -756,7 +760,7 @@ namespace Tizen.Multimedia { ValidateState(CameraState.Preview, CameraState.Captured); - CameraErrorFactory.ThrowIfError(Interop.Camera.CancelFocusing(_handle), + CameraErrorFactory.ThrowIfError(Native.CancelFocusing(_handle), "Failed to cancel the camera focus."); } @@ -788,12 +792,12 @@ namespace Tizen.Multimedia for (int i = 0; i < count; i++) { result.Add(new FaceDetectionData(current)); - current = IntPtr.Add(current, Marshal.SizeOf()); + current = IntPtr.Add(current, Marshal.SizeOf()); } FaceDetected?.Invoke(this, new FaceDetectedEventArgs(result)); }; - CameraErrorFactory.ThrowIfError(Interop.Camera.StartFaceDetection(_handle, _faceDetectedCallback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(Native.StartFaceDetection(_handle, _faceDetectedCallback, IntPtr.Zero), "Failed to start face detection"); } @@ -814,7 +818,7 @@ namespace Tizen.Multimedia throw new InvalidOperationException("The face detection is not started."); } - CameraErrorFactory.ThrowIfError(Interop.Camera.StopFaceDetection(_handle), + CameraErrorFactory.ThrowIfError(Native.StopFaceDetection(_handle), "Failed to stop the face detection."); _faceDetectedCallback = null; @@ -852,7 +856,7 @@ namespace Tizen.Multimedia { Interrupted?.Invoke(this, new CameraInterruptedEventArgs(policy, previous, current)); }; - CameraErrorFactory.ThrowIfError(Interop.Camera.SetInterruptedCallback(_handle, _interruptedCallback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(Native.SetInterruptedCallback(_handle, _interruptedCallback, IntPtr.Zero), "Failed to set interrupt callback"); } @@ -862,7 +866,7 @@ namespace Tizen.Multimedia { ErrorOccurred?.Invoke(this, new CameraErrorOccurredEventArgs(error, current)); }; - CameraErrorFactory.ThrowIfError(Interop.Camera.SetErrorCallback(_handle, _errorCallback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(Native.SetErrorCallback(_handle, _errorCallback, IntPtr.Zero), "Setting error callback failed"); } @@ -874,7 +878,7 @@ namespace Tizen.Multimedia Log.Info(CameraLog.Tag, "Camera state changed " + previous.ToString() + " -> " + current.ToString()); StateChanged?.Invoke(this, new CameraStateChangedEventArgs(previous, current, byPolicy)); }; - CameraErrorFactory.ThrowIfError(Interop.Camera.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(Native.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero), "Setting state changed callback failed"); } @@ -884,7 +888,7 @@ namespace Tizen.Multimedia { FocusStateChanged?.Invoke(this, new CameraFocusStateChangedEventArgs(state)); }; - CameraErrorFactory.ThrowIfError(Interop.Camera.SetFocusStateChangedCallback(_handle, _focusStateChangedCallback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(Native.SetFocusStateChangedCallback(_handle, _focusStateChangedCallback, IntPtr.Zero), "Setting focus changed callback failed"); } @@ -897,7 +901,7 @@ namespace Tizen.Multimedia { HdrCaptureProgress?.Invoke(this, new HdrCaptureProgressEventArgs(percent)); }; - CameraErrorFactory.ThrowIfError(Interop.Camera.SetHdrCaptureProgressCallback(_handle, _hdrCaptureProgressCallback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(Native.SetHdrCaptureProgressCallback(_handle, _hdrCaptureProgressCallback, IntPtr.Zero), "Setting Hdr capture progress callback failed"); } } @@ -908,7 +912,7 @@ namespace Tizen.Multimedia { _preview?.Invoke(this, new PreviewEventArgs(new PreviewData(frame))); }; - CameraErrorFactory.ThrowIfError(Interop.Camera.SetPreviewCallback(_handle, _previewCallback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(Native.SetPreviewCallback(_handle, _previewCallback, IntPtr.Zero), "Setting preview callback failed"); } @@ -928,7 +932,7 @@ namespace Tizen.Multimedia packet.Dispose(); } }; - CameraErrorFactory.ThrowIfError(Interop.Camera.SetMediaPacketPreviewCallback(_handle, _mediaPacketPreviewCallback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(Native.SetMediaPacketPreviewCallback(_handle, _mediaPacketPreviewCallback, IntPtr.Zero), "Setting media packet preview callback failed"); } #endregion Callback registrations diff --git a/src/Tizen.Multimedia/Camera/CameraCapturingEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/CameraCapturingEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Camera/CameraCapturingEventArgs.cs rename to src/Tizen.Multimedia.Camera/Camera/CameraCapturingEventArgs.cs diff --git a/src/Tizen.Multimedia/Camera/CameraDeviceStateChangedEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/CameraDeviceStateChangedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Camera/CameraDeviceStateChangedEventArgs.cs rename to src/Tizen.Multimedia.Camera/Camera/CameraDeviceStateChangedEventArgs.cs diff --git a/src/Tizen.Multimedia/Camera/CameraDisplaySettings.cs b/src/Tizen.Multimedia.Camera/Camera/CameraDisplaySettings.cs similarity index 79% rename from src/Tizen.Multimedia/Camera/CameraDisplaySettings.cs rename to src/Tizen.Multimedia.Camera/Camera/CameraDisplaySettings.cs index c0ab7fa..c7622e9 100644 --- a/src/Tizen.Multimedia/Camera/CameraDisplaySettings.cs +++ b/src/Tizen.Multimedia.Camera/Camera/CameraDisplaySettings.cs @@ -14,7 +14,7 @@ * limitations under the License. */ -using System; +using Native = Interop.CameraDisplay; namespace Tizen.Multimedia { @@ -43,7 +43,7 @@ namespace Tizen.Multimedia { CameraDisplayMode val = CameraDisplayMode.LetterBox; - CameraErrorFactory.ThrowIfError(Interop.CameraDisplay.GetMode(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetMode(_camera.GetHandle(), out val), "Failed to get camera display mode"); return val; @@ -51,7 +51,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraDisplay.SetMode(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetMode(_camera.GetHandle(), value), "Failed to set camera display mode."); } } @@ -67,7 +67,7 @@ namespace Tizen.Multimedia { bool val = false; - CameraErrorFactory.ThrowIfError(Interop.CameraDisplay.GetVisible(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetVisible(_camera.GetHandle(), out val), "Failed to get visible value"); return val; @@ -75,7 +75,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraDisplay.SetVisible(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetVisible(_camera.GetHandle(), value), "Failed to set display visible."); } } @@ -94,7 +94,7 @@ namespace Tizen.Multimedia { CameraRotation val = CameraRotation.None; - CameraErrorFactory.ThrowIfError(Interop.CameraDisplay.GetRotation(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetRotation(_camera.GetHandle(), out val), "Failed to get display rotation"); return val; @@ -102,7 +102,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraDisplay.SetRotation(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetRotation(_camera.GetHandle(), value), "Failed to set display rotation."); } } @@ -121,7 +121,7 @@ namespace Tizen.Multimedia { CameraFlip val = CameraFlip.None; - CameraErrorFactory.ThrowIfError(Interop.CameraDisplay.GetFlip(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out val), "Failed to get display flip"); return val; @@ -129,7 +129,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraDisplay.SetFlip(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value), "Failed to set display flip."); } } @@ -147,7 +147,7 @@ namespace Tizen.Multimedia int width = 0; int height = 0; - CameraErrorFactory.ThrowIfError(Interop.CameraDisplay.GetRoiArea(_camera.GetHandle(), out x, out y, out width, out height), + CameraErrorFactory.ThrowIfError(Native.GetRoiArea(_camera.GetHandle(), out x, out y, out width, out height), "Failed to get display roi area"); return new Rectangle(x, y, width, height); @@ -155,7 +155,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraDisplay.SetRoiArea(_camera.GetHandle(), + CameraErrorFactory.ThrowIfError(Native.SetRoiArea(_camera.GetHandle(), value.X, value.Y, value.Width, value.Height), "Failed to set display roi area."); } } diff --git a/src/Tizen.Multimedia/Camera/CameraEnums.cs b/src/Tizen.Multimedia.Camera/Camera/CameraEnums.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Camera/CameraEnums.cs rename to src/Tizen.Multimedia.Camera/Camera/CameraEnums.cs diff --git a/src/Tizen.Multimedia/Camera/CameraErrorFactory.cs b/src/Tizen.Multimedia.Camera/Camera/CameraErrorFactory.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Camera/CameraErrorFactory.cs rename to src/Tizen.Multimedia.Camera/Camera/CameraErrorFactory.cs diff --git a/src/Tizen.Multimedia/Camera/CameraErrorOccurredEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/CameraErrorOccurredEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Camera/CameraErrorOccurredEventArgs.cs rename to src/Tizen.Multimedia.Camera/Camera/CameraErrorOccurredEventArgs.cs diff --git a/src/Tizen.Multimedia/Camera/CameraException.cs b/src/Tizen.Multimedia.Camera/Camera/CameraException.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Camera/CameraException.cs rename to src/Tizen.Multimedia.Camera/Camera/CameraException.cs diff --git a/src/Tizen.Multimedia/Camera/CameraFeatures.cs b/src/Tizen.Multimedia.Camera/Camera/CameraFeatures.cs old mode 100755 new mode 100644 similarity index 81% rename from src/Tizen.Multimedia/Camera/CameraFeatures.cs rename to src/Tizen.Multimedia.Camera/Camera/CameraFeatures.cs index 374b7f4..1af0ad3 --- a/src/Tizen.Multimedia/Camera/CameraFeatures.cs +++ b/src/Tizen.Multimedia.Camera/Camera/CameraFeatures.cs @@ -16,8 +16,8 @@ using System; using System.Collections.Generic; -using Tizen.Internals.Errors; - +using NativeFeatures = Interop.CameraFeatures; +using NativeSettings = Interop.CameraSettings; namespace Tizen.Multimedia { @@ -54,19 +54,19 @@ namespace Tizen.Multimedia { _camera = camera; - IsFaceDetectionSupported = IsFeatureSupported(Interop.CameraFeatures.IsFaceDetectionSupported); - IsMediaPacketPreviewCallbackSupported = IsFeatureSupported(Interop.CameraFeatures.IsMediaPacketPreviewCallbackSupported); - IsZeroShutterLagSupported = IsFeatureSupported(Interop.CameraFeatures.IsZeroShutterLagSupported); - IsContinuousCaptureSupported = IsFeatureSupported(Interop.CameraFeatures.IsContinuousCaptureSupported); - IsHdrCaptureSupported = IsFeatureSupported(Interop.CameraFeatures.IsHdrCaptureSupported); - IsAntiShakeSupported = IsFeatureSupported(Interop.CameraFeatures.IsAntiShakeSupported); - IsVideoStabilizationSupported = IsFeatureSupported(Interop.CameraFeatures.IsVideoStabilizationSupported); - IsAutoContrastSupported = IsFeatureSupported(Interop.CameraFeatures.IsAutoContrastSupported); - IsBrigtnessSupported = CheckRangeValid(Interop.CameraSettings.GetBrightnessRange); - IsExposureSupported = CheckRangeValid(Interop.CameraSettings.GetExposureRange); - IsZoomSupported = CheckRangeValid(Interop.CameraSettings.GetZoomRange); - IsPanSupported = CheckRangeValid(Interop.CameraSettings.GetPanRange); - IsTiltSupported = CheckRangeValid(Interop.CameraSettings.GetTiltRange); + IsFaceDetectionSupported = IsFeatureSupported(NativeFeatures.IsFaceDetectionSupported); + IsMediaPacketPreviewCallbackSupported = IsFeatureSupported(NativeFeatures.IsMediaPacketPreviewCallbackSupported); + IsZeroShutterLagSupported = IsFeatureSupported(NativeFeatures.IsZeroShutterLagSupported); + IsContinuousCaptureSupported = IsFeatureSupported(NativeFeatures.IsContinuousCaptureSupported); + IsHdrCaptureSupported = IsFeatureSupported(NativeFeatures.IsHdrCaptureSupported); + IsAntiShakeSupported = IsFeatureSupported(NativeFeatures.IsAntiShakeSupported); + IsVideoStabilizationSupported = IsFeatureSupported(NativeFeatures.IsVideoStabilizationSupported); + IsAutoContrastSupported = IsFeatureSupported(NativeFeatures.IsAutoContrastSupported); + IsBrigtnessSupported = CheckRangeValid(NativeSettings.GetBrightnessRange); + IsExposureSupported = CheckRangeValid(NativeSettings.GetExposureRange); + IsZoomSupported = CheckRangeValid(NativeSettings.GetZoomRange); + IsPanSupported = CheckRangeValid(NativeSettings.GetPanRange); + IsTiltSupported = CheckRangeValid(NativeSettings.GetTiltRange); } private bool IsFeatureSupported(IsSupportedDelegate func) @@ -181,12 +181,12 @@ namespace Tizen.Multimedia { _previewResolutions = new List(); - Interop.CameraFeatures.PreviewResolutionCallback callback = (int width, int height, IntPtr userData) => + NativeFeatures.PreviewResolutionCallback callback = (int width, int height, IntPtr userData) => { _previewResolutions.Add(new Size(width, height)); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedPreviewResolutions(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedPreviewResolutions(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported preview resolutions"); } catch @@ -217,12 +217,12 @@ namespace Tizen.Multimedia { _cameraResolutions = new List(); - Interop.CameraFeatures.CaptureResolutionCallback callback = (int width, int height, IntPtr userData) => + NativeFeatures.CaptureResolutionCallback callback = (int width, int height, IntPtr userData) => { _cameraResolutions.Add(new Size(width, height)); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedCaptureResolutions(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedCaptureResolutions(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported capture resolutions"); } catch @@ -253,12 +253,12 @@ namespace Tizen.Multimedia { _captureFormats = new List(); - Interop.CameraFeatures.CaptureFormatCallback callback = (CameraPixelFormat format, IntPtr userData) => + NativeFeatures.CaptureFormatCallback callback = (CameraPixelFormat format, IntPtr userData) => { _captureFormats.Add(format); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedCapturePixelFormats(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedCapturePixelFormats(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported capture formats."); } catch @@ -289,12 +289,12 @@ namespace Tizen.Multimedia { _previewFormats = new List(); - Interop.CameraFeatures.PreviewFormatCallback callback = (CameraPixelFormat format, IntPtr userData) => + NativeFeatures.PreviewFormatCallback callback = (CameraPixelFormat format, IntPtr userData) => { _previewFormats.Add(format); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedPreviewPixelFormats(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedPreviewPixelFormats(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported preview formats."); } catch @@ -325,12 +325,12 @@ namespace Tizen.Multimedia { _fps = new List(); - Interop.CameraFeatures.FpsCallback callback = (CameraFps fps, IntPtr userData) => + NativeFeatures.FpsCallback callback = (CameraFps fps, IntPtr userData) => { _fps.Add(fps); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedPreviewFps(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedPreviewFps(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported camera fps"); } catch @@ -359,12 +359,12 @@ namespace Tizen.Multimedia { _fpsByResolution = new List(); - Interop.CameraFeatures.FpsByResolutionCallback callback = (CameraFps fps, IntPtr userData) => + NativeFeatures.FpsByResolutionCallback callback = (CameraFps fps, IntPtr userData) => { _fpsByResolution.Add(fps); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedPreviewFpsByResolution(_camera.GetHandle(), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedPreviewFpsByResolution(_camera.GetHandle(), width, height, callback, IntPtr.Zero), "Failed to get the supported fps by resolutions."); } catch @@ -406,12 +406,12 @@ namespace Tizen.Multimedia { _autoFocusModes = new List(); - Interop.CameraFeatures.AfModeCallback callback = (CameraAutoFocusMode mode, IntPtr userData) => + NativeFeatures.AfModeCallback callback = (CameraAutoFocusMode mode, IntPtr userData) => { _autoFocusModes.Add(mode); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedAfModes(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedAfModes(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported Auto focus modes."); } catch @@ -442,12 +442,12 @@ namespace Tizen.Multimedia { _exposureModes = new List(); - Interop.CameraFeatures.ExposureModeCallback callback = (CameraExposureMode mode, IntPtr userData) => + NativeFeatures.ExposureModeCallback callback = (CameraExposureMode mode, IntPtr userData) => { _exposureModes.Add(mode); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedExposureModes(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedExposureModes(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported Exposure modes."); } catch @@ -478,12 +478,12 @@ namespace Tizen.Multimedia { _isoLevels = new List(); - Interop.CameraFeatures.IsoCallback callback = (CameraIsoLevel iso, IntPtr userData) => + NativeFeatures.IsoCallback callback = (CameraIsoLevel iso, IntPtr userData) => { _isoLevels.Add(iso); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedIso(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedIso(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported Iso levels."); } catch @@ -514,12 +514,12 @@ namespace Tizen.Multimedia { _theaterModes = new List(); - Interop.CameraFeatures.TheaterModeCallback callback = (CameraTheaterMode theaterMode, IntPtr userData) => + NativeFeatures.TheaterModeCallback callback = (CameraTheaterMode theaterMode, IntPtr userData) => { _theaterModes.Add(theaterMode); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedTheaterModes(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedTheaterModes(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported theater modes."); } catch @@ -550,12 +550,12 @@ namespace Tizen.Multimedia { _whitebalances = new List(); - Interop.CameraFeatures.WhitebalanceCallback callback = (CameraWhiteBalance whiteBalance, IntPtr userData) => + NativeFeatures.WhitebalanceCallback callback = (CameraWhiteBalance whiteBalance, IntPtr userData) => { _whitebalances.Add(whiteBalance); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedWhitebalance(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedWhitebalance(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported white balance."); } catch @@ -586,12 +586,12 @@ namespace Tizen.Multimedia { _flashModes = new List(); - Interop.CameraFeatures.FlashModeCallback callback = (CameraFlashMode flashMode, IntPtr userData) => + NativeFeatures.FlashModeCallback callback = (CameraFlashMode flashMode, IntPtr userData) => { _flashModes.Add(flashMode); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedFlashModes(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedFlashModes(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported flash modes."); } catch @@ -622,12 +622,12 @@ namespace Tizen.Multimedia { _sceneModes = new List(); - Interop.CameraFeatures.SceneModeCallback callback = (CameraSceneMode sceneMode, IntPtr userData) => + NativeFeatures.SceneModeCallback callback = (CameraSceneMode sceneMode, IntPtr userData) => { _sceneModes.Add(sceneMode); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedSceneModes(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedSceneModes(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported scene modes."); } catch @@ -658,12 +658,12 @@ namespace Tizen.Multimedia { _effectModes = new List(); - Interop.CameraFeatures.EffectCallback callback = (CameraEffectMode effect, IntPtr userData) => + NativeFeatures.EffectCallback callback = (CameraEffectMode effect, IntPtr userData) => { _effectModes.Add(effect); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedEffects(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedEffects(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported camera effects."); } catch @@ -694,12 +694,12 @@ namespace Tizen.Multimedia { _streamRotations = new List(); - Interop.CameraFeatures.StreamRotationCallback callback = (CameraRotation streamRotation, IntPtr userData) => + NativeFeatures.StreamRotationCallback callback = (CameraRotation streamRotation, IntPtr userData) => { _streamRotations.Add(streamRotation); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedStreamRotations(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedStreamRotations(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported camera rotations."); } catch @@ -730,12 +730,12 @@ namespace Tizen.Multimedia { _streamFlips = new List(); - Interop.CameraFeatures.StreamFlipCallback callback = (CameraFlip streamFlip, IntPtr userData) => + NativeFeatures.StreamFlipCallback callback = (CameraFlip streamFlip, IntPtr userData) => { _streamFlips.Add(streamFlip); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedStreamFlips(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedStreamFlips(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported camera flips."); } catch @@ -766,12 +766,12 @@ namespace Tizen.Multimedia { _ptzTypes = new List(); - Interop.CameraFeatures.PtzTypeCallback callback = (CameraPtzType ptzType, IntPtr userData) => + NativeFeatures.PtzTypeCallback callback = (CameraPtzType ptzType, IntPtr userData) => { _ptzTypes.Add(ptzType); return true; }; - CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedPtzTypes(_camera.GetHandle(), callback, IntPtr.Zero), + CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedPtzTypes(_camera.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported Ptz types."); } catch diff --git a/src/Tizen.Multimedia/Camera/CameraFocusStateChangedEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/CameraFocusStateChangedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Camera/CameraFocusStateChangedEventArgs.cs rename to src/Tizen.Multimedia.Camera/Camera/CameraFocusStateChangedEventArgs.cs diff --git a/src/Tizen.Multimedia/Camera/CameraInterruptedEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/CameraInterruptedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Camera/CameraInterruptedEventArgs.cs rename to src/Tizen.Multimedia.Camera/Camera/CameraInterruptedEventArgs.cs diff --git a/src/Tizen.Multimedia/Camera/CameraSettings.cs b/src/Tizen.Multimedia.Camera/Camera/CameraSettings.cs old mode 100755 new mode 100644 similarity index 79% rename from src/Tizen.Multimedia/Camera/CameraSettings.cs rename to src/Tizen.Multimedia.Camera/Camera/CameraSettings.cs index 9a8845a..9dbec8d --- a/src/Tizen.Multimedia/Camera/CameraSettings.cs +++ b/src/Tizen.Multimedia.Camera/Camera/CameraSettings.cs @@ -15,8 +15,9 @@ */ using System; -using System.Linq; using System.Runtime.InteropServices; +using Native = Interop.CameraSettings; +using static Interop.Camera; namespace Tizen.Multimedia { @@ -39,12 +40,12 @@ namespace Tizen.Multimedia { _camera = camera; - _contrastRange = GetRange(Interop.CameraSettings.GetContrastRange); - _brightnessRange = GetRange(Interop.CameraSettings.GetBrightnessRange); - _exposureRange = GetRange(Interop.CameraSettings.GetExposureRange); - _zoomRange = GetRange(Interop.CameraSettings.GetZoomRange); - _panRange = GetRange(Interop.CameraSettings.GetPanRange); - _tiltRange = GetRange(Interop.CameraSettings.GetTiltRange); + _contrastRange = GetRange(Native.GetContrastRange); + _brightnessRange = GetRange(Native.GetBrightnessRange); + _exposureRange = GetRange(Native.GetExposureRange); + _zoomRange = GetRange(Native.GetZoomRange); + _panRange = GetRange(Native.GetPanRange); + _tiltRange = GetRange(Native.GetTiltRange); } private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max); @@ -81,7 +82,7 @@ namespace Tizen.Multimedia /// The camera already has been disposed. public void SetAutoFocusArea(int x, int y) { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetAutoFocusArea(_camera.GetHandle(), x, y), + CameraErrorFactory.ThrowIfError(Native.SetAutoFocusArea(_camera.GetHandle(), x, y), "Failed to set the autofocus area."); } @@ -100,7 +101,7 @@ namespace Tizen.Multimedia /// The camera already has been disposed. public void SetAutoFocusArea(Point pos) { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetAutoFocusArea(_camera.GetHandle(), pos.X, pos.Y), + CameraErrorFactory.ThrowIfError(Native.SetAutoFocusArea(_camera.GetHandle(), pos.X, pos.Y), "Failed to set the autofocus area."); } @@ -113,7 +114,7 @@ namespace Tizen.Multimedia /// The camera already has been disposed. public void ClearFocusArea() { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.ClearAutoFocusArea(_camera.GetHandle()), + CameraErrorFactory.ThrowIfError(Native.ClearAutoFocusArea(_camera.GetHandle()), "Failed to clear the autofocus area."); } @@ -131,7 +132,7 @@ namespace Tizen.Multimedia { CameraAutoFocusMode val = CameraAutoFocusMode.None; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetAutoFocusMode(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetAutoFocusMode(_camera.GetHandle(), out val), "Failed to get camera autofocus mode"); return val; @@ -139,7 +140,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetAutoFocusMode(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetAutoFocusMode(_camera.GetHandle(), value), "Failed to set camera autofocus mode."); } } @@ -159,7 +160,7 @@ namespace Tizen.Multimedia { int val = 0; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetContrast(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetContrast(_camera.GetHandle(), out val), "Failed to get camera contrast value"); return val; @@ -167,7 +168,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetContrast(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetContrast(_camera.GetHandle(), value), "Failed to set camera contrast value."); } } @@ -186,7 +187,7 @@ namespace Tizen.Multimedia { bool val = false; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.IsEnabledAutoContrast(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.IsEnabledAutoContrast(_camera.GetHandle(), out val), "Failed to get camera auto contrast"); return val; @@ -194,7 +195,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.EnableAutoContrast(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.EnableAutoContrast(_camera.GetHandle(), value), "Failed to set camera enable auto contrast."); } } @@ -233,7 +234,7 @@ namespace Tizen.Multimedia { int val = 0; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetBrightness(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetBrightness(_camera.GetHandle(), out val), "Failed to get camera brightness value"); return val; @@ -241,7 +242,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetBrightness(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetBrightness(_camera.GetHandle(), value), "Failed to set camera brightness value."); } } @@ -281,7 +282,7 @@ namespace Tizen.Multimedia { int val = 0; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetExposure(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetExposure(_camera.GetHandle(), out val), "Failed to get camera exposure value"); return val; @@ -289,7 +290,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetExposure(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetExposure(_camera.GetHandle(), value), "Failed to set camera exposure value."); } } @@ -308,7 +309,7 @@ namespace Tizen.Multimedia { CameraExposureMode val = CameraExposureMode.Off; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetExposureMode(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetExposureMode(_camera.GetHandle(), out val), "Failed to get camera exposure mode"); return val; @@ -316,7 +317,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetExposureMode(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetExposureMode(_camera.GetHandle(), value), "Failed to set camera exposure mode."); } } @@ -357,7 +358,7 @@ namespace Tizen.Multimedia { int val = 0; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetZoom(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetZoom(_camera.GetHandle(), out val), "Failed to get zoom level"); return val; @@ -365,7 +366,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetZoom(_camera.GetHandle(), (int)value), + CameraErrorFactory.ThrowIfError(Native.SetZoom(_camera.GetHandle(), (int)value), "Failed to set zoom level."); } } @@ -405,7 +406,7 @@ namespace Tizen.Multimedia { CameraWhiteBalance val = CameraWhiteBalance.None; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetWhiteBalance(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetWhiteBalance(_camera.GetHandle(), out val), "Failed to get camera whitebalance"); return val; @@ -413,7 +414,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetWhitebalance(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetWhitebalance(_camera.GetHandle(), value), "Failed to set camera whitebalance."); } } @@ -432,7 +433,7 @@ namespace Tizen.Multimedia { CameraIsoLevel val = CameraIsoLevel.Auto; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetIso(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetIso(_camera.GetHandle(), out val), "Failed to get camera Iso level"); return val; @@ -440,7 +441,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetIso(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetIso(_camera.GetHandle(), value), "Failed to set camera Iso level."); } } @@ -459,7 +460,7 @@ namespace Tizen.Multimedia { int val = 0; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetImageQuality(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetImageQuality(_camera.GetHandle(), out val), "Failed to get image quality"); return val; @@ -467,7 +468,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetImageQuality(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetImageQuality(_camera.GetHandle(), value), "Failed to set image quality."); } } @@ -484,7 +485,7 @@ namespace Tizen.Multimedia { CameraFps val = CameraFps.Auto; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetPreviewFps(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetPreviewFps(_camera.GetHandle(), out val), "Failed to get camera preview fps"); return val; @@ -492,7 +493,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetPreviewFps(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetPreviewFps(_camera.GetHandle(), value), "Failed to set preview fps."); } } @@ -512,7 +513,7 @@ namespace Tizen.Multimedia int width = 0; int height = 0; - CameraErrorFactory.ThrowIfError(Interop.Camera.GetPreviewResolution(_camera.GetHandle(), out width, out height), + CameraErrorFactory.ThrowIfError(GetPreviewResolution(_camera.GetHandle(), out width, out height), "Failed to get camera preview resolution"); return new Size(width, height); @@ -520,7 +521,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.Camera.SetPreviewResolution(_camera.GetHandle(), value.Width, value.Height), + CameraErrorFactory.ThrowIfError(SetPreviewResolution(_camera.GetHandle(), value.Width, value.Height), "Failed to set preview resolution."); } } @@ -540,7 +541,7 @@ namespace Tizen.Multimedia int width = 0; int height = 0; - CameraErrorFactory.ThrowIfError(Interop.Camera.GetRecommendedPreviewResolution(_camera.GetHandle(), out width, out height), + CameraErrorFactory.ThrowIfError(GetRecommendedPreviewResolution(_camera.GetHandle(), out width, out height), "Failed to get recommended preview resolution"); return new Size(width, height); @@ -559,7 +560,7 @@ namespace Tizen.Multimedia { CameraPixelFormat val = 0; - CameraErrorFactory.ThrowIfError(Interop.Camera.GetPreviewPixelFormat(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(GetPreviewPixelFormat(_camera.GetHandle(), out val), "Failed to get preview format"); return val; @@ -567,7 +568,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.Camera.SetPreviewPixelFormat(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(SetPreviewPixelFormat(_camera.GetHandle(), value), "Failed to set preview format."); } } @@ -587,7 +588,7 @@ namespace Tizen.Multimedia int width = 0; int height = 0; - CameraErrorFactory.ThrowIfError(Interop.Camera.GetCaptureResolution(_camera.GetHandle(), out width, out height), + CameraErrorFactory.ThrowIfError(GetCaptureResolution(_camera.GetHandle(), out width, out height), "Failed to get camera capture resolution"); return new Size(width, height); @@ -597,7 +598,7 @@ namespace Tizen.Multimedia { Size res = value; - CameraErrorFactory.ThrowIfError(Interop.Camera.SetCaptureResolution(_camera.GetHandle(), res.Width, res.Height), + CameraErrorFactory.ThrowIfError(SetCaptureResolution(_camera.GetHandle(), res.Width, res.Height), "Failed to set capture resolution."); } } @@ -614,7 +615,7 @@ namespace Tizen.Multimedia { CameraPixelFormat val = CameraPixelFormat.Invalid; - CameraErrorFactory.ThrowIfError(Interop.Camera.GetCaptureFormat(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(GetCaptureFormat(_camera.GetHandle(), out val), "Failed to get camera capture formats"); return val; @@ -622,7 +623,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.Camera.SetCaptureFormat(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(SetCaptureFormat(_camera.GetHandle(), value), "Failed to set capture format."); } } @@ -639,7 +640,7 @@ namespace Tizen.Multimedia { int val = 0; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetBitrate(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetBitrate(_camera.GetHandle(), out val), "Failed to get preview bitrate"); return val; @@ -647,7 +648,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetBitrate(_camera.GetHandle(), (int)value), + CameraErrorFactory.ThrowIfError(Native.SetBitrate(_camera.GetHandle(), (int)value), "Failed to set encoded preview bitrate."); } } @@ -662,7 +663,7 @@ namespace Tizen.Multimedia { int val = 0; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetGopInterval(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetGopInterval(_camera.GetHandle(), out val), "Failed to get preview gop interval"); return val; @@ -670,7 +671,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetGopInterval(_camera.GetHandle(), (int)value), + CameraErrorFactory.ThrowIfError(Native.SetGopInterval(_camera.GetHandle(), (int)value), "Failed to set encoded preview gop intervals."); } } @@ -694,7 +695,7 @@ namespace Tizen.Multimedia { CameraTheaterMode val = CameraTheaterMode.Disable; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetTheaterMode(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetTheaterMode(_camera.GetHandle(), out val), "Failed to get camera theater mode"); return val; @@ -702,7 +703,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetTheaterMode(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetTheaterMode(_camera.GetHandle(), value), "Failed to set camera theater mode."); } } @@ -721,7 +722,7 @@ namespace Tizen.Multimedia { CameraEffectMode val = CameraEffectMode.None; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetEffect(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetEffect(_camera.GetHandle(), out val), "Failed to get camera effect"); return val; @@ -729,7 +730,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetEffect(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetEffect(_camera.GetHandle(), value), "Failed to set camera effect."); } } @@ -748,7 +749,7 @@ namespace Tizen.Multimedia { CameraSceneMode val = CameraSceneMode.Normal; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetSceneMode(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetSceneMode(_camera.GetHandle(), out val), "Failed to get camera scene mode"); return val; @@ -756,7 +757,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetSceneMode(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetSceneMode(_camera.GetHandle(), value), "Failed to set camera scene mode."); } } @@ -775,7 +776,7 @@ namespace Tizen.Multimedia { CameraFlashMode val = CameraFlashMode.Off; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetFlashMode(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetFlashMode(_camera.GetHandle(), out val), "Failed to get camera flash mode"); return val; @@ -783,7 +784,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetFlashMode(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetFlashMode(_camera.GetHandle(), value), "Failed to set camera flash mode."); } } @@ -798,7 +799,7 @@ namespace Tizen.Multimedia { int val = 0; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetLensOrientation(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetLensOrientation(_camera.GetHandle(), out val), "Failed to get camera lens orientation"); return val; @@ -816,7 +817,7 @@ namespace Tizen.Multimedia { CameraRotation val = CameraRotation.None; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetStreamRotation(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetStreamRotation(_camera.GetHandle(), out val), "Failed to get camera stream rotation"); return val; @@ -824,7 +825,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetStreamRotation(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetStreamRotation(_camera.GetHandle(), value), "Failed to set camera stream rotation."); } } @@ -840,7 +841,7 @@ namespace Tizen.Multimedia { CameraFlip val = CameraFlip.None; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetFlip(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out val), "Failed to get camera stream flip"); return val; @@ -848,7 +849,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetFlip(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value), "Failed to set camera flip."); } } @@ -872,7 +873,7 @@ namespace Tizen.Multimedia { CameraHdrMode val = 0; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetHdrMode(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetHdrMode(_camera.GetHandle(), out val), "Failed to get camera hdr mode"); return val; @@ -880,7 +881,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetHdrMode(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetHdrMode(_camera.GetHandle(), value), "Failed to set camera hdr mode."); } } @@ -896,7 +897,7 @@ namespace Tizen.Multimedia { bool val = false; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.IsEnabledAntiShake(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.IsEnabledAntiShake(_camera.GetHandle(), out val), "Failed to get camera anti shake value"); return val; @@ -904,7 +905,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.EnableAntiShake(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.EnableAntiShake(_camera.GetHandle(), value), "Failed to set camera anti shake value."); } } @@ -927,7 +928,7 @@ namespace Tizen.Multimedia { bool val = false; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.IsEnabledVideoStabilization(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.IsEnabledVideoStabilization(_camera.GetHandle(), out val), "Failed to get camera video stabilization"); return val; @@ -935,7 +936,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.EnableVideoStabilization(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.EnableVideoStabilization(_camera.GetHandle(), value), "Failed to set camera video stabilization."); } } @@ -952,7 +953,7 @@ namespace Tizen.Multimedia { set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.DisableShutterSound(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.DisableShutterSound(_camera.GetHandle(), value), "Failed to set disable shutter sound."); } } @@ -967,7 +968,7 @@ namespace Tizen.Multimedia { set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetPtzType(_camera.GetHandle(), (int)value), + CameraErrorFactory.ThrowIfError(Native.SetPtzType(_camera.GetHandle(), (int)value), "Failed to set camera ptz type."); } } @@ -984,7 +985,7 @@ namespace Tizen.Multimedia /// The camera already has been disposed. public void SetPan(CameraPtzMoveType type, int panStep) { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetPan(_camera.GetHandle(), type, panStep), + CameraErrorFactory.ThrowIfError(Native.SetPan(_camera.GetHandle(), type, panStep), "Failed to set the camera pan type."); } @@ -1000,7 +1001,7 @@ namespace Tizen.Multimedia { int val = 0; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetPan(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetPan(_camera.GetHandle(), out val), "Failed to get the camera pan step."); return val; @@ -1018,7 +1019,7 @@ namespace Tizen.Multimedia /// The camera already has been disposed. public void SetTilt(CameraPtzMoveType type, int tiltStep) { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetTilt(_camera.GetHandle(), type, tiltStep), + CameraErrorFactory.ThrowIfError(Native.SetTilt(_camera.GetHandle(), type, tiltStep), "Failed to set the camera tilt type\t."); } @@ -1034,7 +1035,7 @@ namespace Tizen.Multimedia { int val = 0; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetTilt(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetTilt(_camera.GetHandle(), out val), "Failed to set the camera current position."); return val; @@ -1091,7 +1092,7 @@ namespace Tizen.Multimedia { bool val = false; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.IsEnabledTag(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.IsEnabledTag(_camera.GetHandle(), out val), "Failed to get camera enable tag"); return val; @@ -1099,7 +1100,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.EnableTag(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.EnableTag(_camera.GetHandle(), value), "Failed to set camera enable tag."); } } @@ -1115,20 +1116,20 @@ namespace Tizen.Multimedia IntPtr val = IntPtr.Zero; try { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetImageDescription(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetImageDescription(_camera.GetHandle(), out val), "Failed to get image description"); return Marshal.PtrToStringAnsi(val); } finally { - Interop.Libc.Free(val); + LibcSupport.Free(val); } } set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetImageDescription(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetImageDescription(_camera.GetHandle(), value), "Failed to set image description."); } } @@ -1145,20 +1146,20 @@ namespace Tizen.Multimedia try { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetTagSoftware(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetTagSoftware(_camera.GetHandle(), out val), "Failed to get tag software"); return Marshal.PtrToStringAnsi(val); } finally { - Interop.Libc.Free(val); + LibcSupport.Free(val); } } set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetTagSoftware(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetTagSoftware(_camera.GetHandle(), value), "Failed to set tag software."); } } @@ -1175,7 +1176,7 @@ namespace Tizen.Multimedia double longitude = 0.0; double altitude = 0.0; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetGeotag(_camera.GetHandle(), out latitude, out longitude, out altitude), + CameraErrorFactory.ThrowIfError(Native.GetGeotag(_camera.GetHandle(), out latitude, out longitude, out altitude), "Failed to get tag"); return new Location(latitude, longitude, altitude); @@ -1183,7 +1184,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetGeotag(_camera.GetHandle(), + CameraErrorFactory.ThrowIfError(Native.SetGeotag(_camera.GetHandle(), value.Latitude, value.Longitude, value.Altitude), "Failed to set geo tag."); } } @@ -1197,7 +1198,7 @@ namespace Tizen.Multimedia /// The camera already has been disposed. public void RemoveGeoTag() { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.RemoveGeotag(_camera.GetHandle()), + CameraErrorFactory.ThrowIfError(Native.RemoveGeotag(_camera.GetHandle()), "Failed to remove the geotag\t."); } @@ -1211,7 +1212,7 @@ namespace Tizen.Multimedia { CameraTagOrientation val = 0; - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.GetTagOrientation(_camera.GetHandle(), out val), + CameraErrorFactory.ThrowIfError(Native.GetTagOrientation(_camera.GetHandle(), out val), "Failed to get camera tag orientation"); return val; @@ -1219,7 +1220,7 @@ namespace Tizen.Multimedia set { - CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetTagOrientation(_camera.GetHandle(), value), + CameraErrorFactory.ThrowIfError(Native.SetTagOrientation(_camera.GetHandle(), value), "Failed to set camera tag orientation."); } } diff --git a/src/Tizen.Multimedia/Camera/CameraStateChangedEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/CameraStateChangedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Camera/CameraStateChangedEventArgs.cs rename to src/Tizen.Multimedia.Camera/Camera/CameraStateChangedEventArgs.cs diff --git a/src/Tizen.Multimedia/Camera/DoublePlane.cs b/src/Tizen.Multimedia.Camera/Camera/DoublePlane.cs old mode 100755 new mode 100644 similarity index 93% rename from src/Tizen.Multimedia/Camera/DoublePlane.cs rename to src/Tizen.Multimedia.Camera/Camera/DoublePlane.cs index 087cd23..a3ad1a6 --- a/src/Tizen.Multimedia/Camera/DoublePlane.cs +++ b/src/Tizen.Multimedia.Camera/Camera/DoublePlane.cs @@ -15,6 +15,7 @@ */ using System.Runtime.InteropServices; +using static Interop.Camera; namespace Tizen.Multimedia { @@ -23,7 +24,7 @@ namespace Tizen.Multimedia /// public class DoublePlane : IPreviewPlane { - internal DoublePlane(Interop.Camera.DoublePlaneStruct unmanaged) + internal DoublePlane(DoublePlaneStruct unmanaged) { Y = new byte[unmanaged.YLength]; UV = new byte[unmanaged.UVLength]; diff --git a/src/Tizen.Multimedia/Camera/EncodedPlane.cs b/src/Tizen.Multimedia.Camera/Camera/EncodedPlane.cs old mode 100755 new mode 100644 similarity index 92% rename from src/Tizen.Multimedia/Camera/EncodedPlane.cs rename to src/Tizen.Multimedia.Camera/Camera/EncodedPlane.cs index 76db75c..40ac360 --- a/src/Tizen.Multimedia/Camera/EncodedPlane.cs +++ b/src/Tizen.Multimedia.Camera/Camera/EncodedPlane.cs @@ -15,6 +15,7 @@ */ using System.Runtime.InteropServices; +using static Interop.Camera; namespace Tizen.Multimedia { @@ -23,7 +24,7 @@ namespace Tizen.Multimedia /// public class EncodedPlane : IPreviewPlane { - internal EncodedPlane(Interop.Camera.EncodedPlaneStruct unmanagedData) + internal EncodedPlane(EncodedPlaneStruct unmanagedData) { Data = new byte[unmanagedData.DataLength]; Marshal.Copy(unmanagedData.Data, Data, 0, (int)unmanagedData.DataLength); diff --git a/src/Tizen.Multimedia/Camera/FaceDetectedEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/FaceDetectedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Camera/FaceDetectedEventArgs.cs rename to src/Tizen.Multimedia.Camera/Camera/FaceDetectedEventArgs.cs diff --git a/src/Tizen.Multimedia/Camera/FaceDetectionData.cs b/src/Tizen.Multimedia.Camera/Camera/FaceDetectionData.cs old mode 100755 new mode 100644 similarity index 94% rename from src/Tizen.Multimedia/Camera/FaceDetectionData.cs rename to src/Tizen.Multimedia.Camera/Camera/FaceDetectionData.cs index b4393b2..2e912f2 --- a/src/Tizen.Multimedia/Camera/FaceDetectionData.cs +++ b/src/Tizen.Multimedia.Camera/Camera/FaceDetectionData.cs @@ -16,6 +16,7 @@ using System; using System.Runtime.InteropServices; +using static Interop.Camera; namespace Tizen.Multimedia { @@ -26,7 +27,7 @@ namespace Tizen.Multimedia { internal FaceDetectionData(IntPtr ptr) { - var unmanagedStruct = Marshal.PtrToStructure(ptr); + var unmanagedStruct = Marshal.PtrToStructure(ptr); Id = unmanagedStruct.Id; Score = unmanagedStruct.Score; diff --git a/src/Tizen.Multimedia/Camera/HdrCaptureProgressEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/HdrCaptureProgressEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Camera/HdrCaptureProgressEventArgs.cs rename to src/Tizen.Multimedia.Camera/Camera/HdrCaptureProgressEventArgs.cs diff --git a/src/Tizen.Multimedia/Camera/IPreviewPlane.cs b/src/Tizen.Multimedia.Camera/Camera/IPreviewPlane.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Camera/IPreviewPlane.cs rename to src/Tizen.Multimedia.Camera/Camera/IPreviewPlane.cs diff --git a/src/Tizen.Multimedia/Camera/ImageData.cs b/src/Tizen.Multimedia.Camera/Camera/ImageData.cs old mode 100755 new mode 100644 similarity index 95% rename from src/Tizen.Multimedia/Camera/ImageData.cs rename to src/Tizen.Multimedia.Camera/Camera/ImageData.cs index 6277e3a..26885c1 --- a/src/Tizen.Multimedia/Camera/ImageData.cs +++ b/src/Tizen.Multimedia.Camera/Camera/ImageData.cs @@ -17,6 +17,7 @@ using System; using System.Diagnostics; using System.Runtime.InteropServices; +using static Interop.Camera; namespace Tizen.Multimedia { @@ -27,7 +28,7 @@ namespace Tizen.Multimedia { internal ImageData(IntPtr ptr) { - var unmanagedStruct = Marshal.PtrToStructure(ptr); + var unmanagedStruct = Marshal.PtrToStructure(ptr); Format = unmanagedStruct.Format; Width = unmanagedStruct.Width; diff --git a/src/Tizen.Multimedia/Camera/Location.cs b/src/Tizen.Multimedia.Camera/Camera/Location.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Camera/Location.cs rename to src/Tizen.Multimedia.Camera/Camera/Location.cs diff --git a/src/Tizen.Multimedia/Camera/MediaPacketPreviewEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/MediaPacketPreviewEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Camera/MediaPacketPreviewEventArgs.cs rename to src/Tizen.Multimedia.Camera/Camera/MediaPacketPreviewEventArgs.cs diff --git a/src/Tizen.Multimedia/Camera/PreviewData.cs b/src/Tizen.Multimedia.Camera/Camera/PreviewData.cs similarity index 98% rename from src/Tizen.Multimedia/Camera/PreviewData.cs rename to src/Tizen.Multimedia.Camera/Camera/PreviewData.cs index 76b7828..7a23e90 100644 --- a/src/Tizen.Multimedia/Camera/PreviewData.cs +++ b/src/Tizen.Multimedia.Camera/Camera/PreviewData.cs @@ -17,7 +17,7 @@ using System; using System.Diagnostics; using System.Runtime.InteropServices; -using static Tizen.Multimedia.Interop.Camera; +using static Interop.Camera; namespace Tizen.Multimedia { diff --git a/src/Tizen.Multimedia/Camera/PreviewEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/PreviewEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Camera/PreviewEventArgs.cs rename to src/Tizen.Multimedia.Camera/Camera/PreviewEventArgs.cs diff --git a/src/Tizen.Multimedia/Camera/SinglePlane.cs b/src/Tizen.Multimedia.Camera/Camera/SinglePlane.cs old mode 100755 new mode 100644 similarity index 92% rename from src/Tizen.Multimedia/Camera/SinglePlane.cs rename to src/Tizen.Multimedia.Camera/Camera/SinglePlane.cs index bd402e2..4273405 --- a/src/Tizen.Multimedia/Camera/SinglePlane.cs +++ b/src/Tizen.Multimedia.Camera/Camera/SinglePlane.cs @@ -15,6 +15,7 @@ */ using System.Runtime.InteropServices; +using static Interop.Camera; namespace Tizen.Multimedia { @@ -23,7 +24,7 @@ namespace Tizen.Multimedia /// public class SinglePlane : IPreviewPlane { - internal SinglePlane(Interop.Camera.SinglePlaneStruct unmanaged) + internal SinglePlane(SinglePlaneStruct unmanaged) { Data = new byte[unmanaged.DataLength]; Marshal.Copy(unmanaged.Data, Data, 0, (int)unmanaged.DataLength); diff --git a/src/Tizen.Multimedia/Camera/TriplePlane.cs b/src/Tizen.Multimedia.Camera/Camera/TriplePlane.cs old mode 100755 new mode 100644 similarity index 94% rename from src/Tizen.Multimedia/Camera/TriplePlane.cs rename to src/Tizen.Multimedia.Camera/Camera/TriplePlane.cs index 481b629..4464e37 --- a/src/Tizen.Multimedia/Camera/TriplePlane.cs +++ b/src/Tizen.Multimedia.Camera/Camera/TriplePlane.cs @@ -15,6 +15,7 @@ */ using System.Runtime.InteropServices; +using static Interop.Camera; namespace Tizen.Multimedia { @@ -23,7 +24,7 @@ namespace Tizen.Multimedia /// public class TriplePlane : IPreviewPlane { - internal TriplePlane(Interop.Camera.TriplePlaneStruct unmanaged) + internal TriplePlane(TriplePlaneStruct unmanaged) { Y = new byte[unmanaged.YLength]; U = new byte[unmanaged.ULength]; diff --git a/src/Tizen.Multimedia.Camera/Interop/Interop.Camera.cs b/src/Tizen.Multimedia.Camera/Interop/Interop.Camera.cs new file mode 100644 index 0000000..acee380 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Interop/Interop.Camera.cs @@ -0,0 +1,273 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class Camera + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void FaceDetectedCallback(IntPtr faces, int count, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void StateChangedCallback(CameraState previous, CameraState current, bool byPolicy, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void InterruptedCallback(CameraPolicy policy, CameraState previous, CameraState current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void FocusStateChangedCallback(CameraFocusState state, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ErrorCallback(CameraErrorCode error, CameraState current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void CapturingCallback(IntPtr image, IntPtr postview, IntPtr thumbnail, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void CaptureCompletedCallback(IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PreviewCallback(IntPtr frame, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MediaPacketPreviewCallback(IntPtr mediaPacketHandle, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void HdrCaptureProgressCallback(int percent, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DeviceStateChangedCallback(CameraDevice device, CameraDeviceState state, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_create")] + internal static extern CameraError Create(int device, out IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_change_device")] + internal static extern CameraError ChangeDevice(IntPtr handle, int device); + + [DllImport(Libraries.Camera, EntryPoint = "camera_destroy")] + internal static extern CameraError Destroy(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_device_count")] + internal static extern CameraError GetDeviceCount(IntPtr handle, out int count); + + [DllImport(Libraries.Camera, EntryPoint = "camera_start_preview")] + internal static extern CameraError StartPreview(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_stop_preview")] + internal static extern CameraError StopPreview(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_device_state")] + internal static extern CameraError GetDeviceState(CameraDevice device, out int state); + + [DllImport(Libraries.Camera, EntryPoint = "camera_start_capture")] + internal static extern CameraError StartCapture(IntPtr handle, CapturingCallback captureCallback, + CaptureCompletedCallback completedCallback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_start_continuous_capture")] + internal static extern CameraError StartContinuousCapture(IntPtr handle, int count, int interval, + CapturingCallback captureCallback, CaptureCompletedCallback completedCallback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_stop_continuous_capture")] + internal static extern CameraError StopContinuousCapture(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_state")] + internal static extern CameraError GetState(IntPtr handle, out CameraState state); + + [DllImport(Libraries.Camera, EntryPoint = "camera_start_focusing")] + internal static extern CameraError StartFocusing(IntPtr handle, bool continuous); + + [DllImport(Libraries.Camera, EntryPoint = "camera_cancel_focusing")] + internal static extern CameraError CancelFocusing(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_preview_resolution")] + internal static extern CameraError SetPreviewResolution(IntPtr handle, int width, int height); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_preview_resolution")] + internal static extern CameraError GetPreviewResolution(IntPtr handle, out int width, out int height); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_recommended_preview_resolution")] + internal static extern CameraError GetRecommendedPreviewResolution(IntPtr handle, out int width, out int height); + + [DllImport(Libraries.Camera, EntryPoint = "camera_start_face_detection")] + internal static extern CameraError StartFaceDetection(IntPtr handle, FaceDetectedCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_stop_face_detection")] + internal static extern CameraError StopFaceDetection(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_display_reuse_hint")] + internal static extern CameraError SetDisplayReuseHint(IntPtr handle, bool hint); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_display_reuse_hint")] + internal static extern CameraError GetDisplayReuseHint(IntPtr handle, out bool hint); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_capture_resolution")] + internal static extern CameraError SetCaptureResolution(IntPtr handle, int width, int height); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_capture_resolution")] + internal static extern CameraError GetCaptureResolution(IntPtr handle, out int width, out int height); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_capture_format")] + internal static extern CameraError SetCaptureFormat(IntPtr handle, CameraPixelFormat format); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_capture_format")] + internal static extern CameraError GetCaptureFormat(IntPtr handle, out CameraPixelFormat format); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_preview_format")] + internal static extern CameraError SetPreviewPixelFormat(IntPtr handle, CameraPixelFormat format); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_preview_format")] + internal static extern CameraError GetPreviewPixelFormat(IntPtr handle, out CameraPixelFormat format); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_facing_direction")] + internal static extern CameraError GetFacingDirection(IntPtr handle, out CameraFacingDirection direction); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_flash_state")] + internal static extern CameraError GetFlashState(CameraDevice device, out CameraFlashState state); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_preview_cb")] + internal static extern CameraError SetPreviewCallback(IntPtr handle, PreviewCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_unset_preview_cb")] + internal static extern CameraError UnsetPreviewCallback(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_media_packet_preview_cb")] + internal static extern CameraError SetMediaPacketPreviewCallback(IntPtr handle, MediaPacketPreviewCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_unset_media_packet_preview_cb")] + internal static extern CameraError UnsetMediaPacketPreviewCallback(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_state_changed_cb")] + internal static extern CameraError SetStateChangedCallback(IntPtr handle, StateChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_add_device_state_changed_cb")] + internal static extern CameraError SetDeviceStateChangedCallback(DeviceStateChangedCallback callback, IntPtr userData, out int callbackId); + + [DllImport(Libraries.Camera, EntryPoint = "camera_unset_state_changed_cb")] + internal static extern CameraError UnsetStateChangedCallback(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_remove_device_state_changed_cb")] + internal static extern CameraError UnsetDeviceStateChangedCallback(int cbId); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_interrupted_cb")] + internal static extern CameraError SetInterruptedCallback(IntPtr handle, InterruptedCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_unset_interrupted_cb")] + internal static extern CameraError UnsetInterruptedCallback(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_focus_changed_cb")] + internal static extern CameraError SetFocusStateChangedCallback(IntPtr handle, FocusStateChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_unset_focus_changed_cb")] + internal static extern CameraError UnsetFocusChangedCallback(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_error_cb")] + internal static extern CameraError SetErrorCallback(IntPtr handle, ErrorCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_unset_error_cb")] + internal static extern CameraError UnsetErrorCallback(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_hdr_capture_progress_cb")] + internal static extern CameraError SetHdrCaptureProgressCallback(IntPtr handle, HdrCaptureProgressCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_unset_hdr_capture_progress_cb")] + internal static extern CameraError UnsetHdrCaptureProgressCallback(IntPtr handle); + + [StructLayout(LayoutKind.Sequential)] + internal struct ImageDataStruct + { + internal IntPtr Data; + internal uint DataLength; + internal int Width; + internal int Height; + internal CameraPixelFormat Format; + internal IntPtr Exif; + internal uint ExifLength; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct DetectedFaceStruct + { + internal int Id; + internal int Score; + internal int X; + internal int Y; + internal int Width; + internal int Height; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SinglePlaneStruct + { + internal IntPtr Data; + internal uint DataLength; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct DoublePlaneStruct + { + internal IntPtr Y; + internal IntPtr UV; + internal uint YLength; + internal uint UVLength; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct TriplePlaneStruct + { + internal IntPtr Y; + internal IntPtr U; + internal IntPtr V; + internal uint YLength; + internal uint ULength; + internal uint VLength; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct EncodedPlaneStruct + { + internal IntPtr Data; + internal uint DataLength; + } + + [StructLayout(LayoutKind.Explicit)] + internal struct PreviewPlaneStruct + { + [FieldOffsetAttribute(0)] + internal SinglePlaneStruct SinglePlane; + [FieldOffsetAttribute(0)] + internal DoublePlaneStruct DoublePlane; + [FieldOffsetAttribute(0)] + internal TriplePlaneStruct TriplePlane; + [FieldOffsetAttribute(0)] + internal EncodedPlaneStruct EncodedPlane; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CameraPreviewDataStruct + { + internal CameraPixelFormat Format; + internal int Width; + internal int Height; + internal int NumOfPlanes; + internal uint TimeStamp; + internal PreviewPlaneStruct Plane; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Camera/Interop/Interop.CameraDisplay.cs b/src/Tizen.Multimedia.Camera/Interop/Interop.CameraDisplay.cs new file mode 100644 index 0000000..6f88d4a --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Interop/Interop.CameraDisplay.cs @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class CameraDisplay + { + [DllImport(Libraries.Camera, EntryPoint = "camera_get_display_mode")] + internal static extern CameraError GetMode(IntPtr handle, out CameraDisplayMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_display_mode")] + internal static extern CameraError SetMode(IntPtr handle, CameraDisplayMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_is_display_visible")] + internal static extern CameraError GetVisible(IntPtr handle, out bool visible); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_display_visible")] + internal static extern CameraError SetVisible(IntPtr handle, bool visible); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_display_rotation")] + internal static extern CameraError GetRotation(IntPtr handle, out CameraRotation rotation); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_display_rotation")] + internal static extern CameraError SetRotation(IntPtr handle, CameraRotation rotation); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_display_flip")] + internal static extern CameraError GetFlip(IntPtr handle, out CameraFlip flip); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_display_flip")] + internal static extern CameraError SetFlip(IntPtr handle, CameraFlip flip); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_display_roi_area")] + internal static extern CameraError GetRoiArea(IntPtr handle, out int x, out int y, out int width, out int height); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_display_roi_area")] + internal static extern CameraError SetRoiArea(IntPtr handle, int x, int y, int width, int height); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_display")] + internal static extern CameraError SetTarget(IntPtr handle, DisplayType displayType, IntPtr displayHandle); + } +} diff --git a/src/Tizen.Multimedia.Camera/Interop/Interop.CameraFeatures.cs b/src/Tizen.Multimedia.Camera/Interop/Interop.CameraFeatures.cs new file mode 100644 index 0000000..f2e34de --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Interop/Interop.CameraFeatures.cs @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class CameraFeatures + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PreviewResolutionCallback(int Width, int Height, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool CaptureResolutionCallback(int Width, int Height, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool CaptureFormatCallback(CameraPixelFormat format, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PreviewFormatCallback(CameraPixelFormat format, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool FpsCallback(CameraFps fps, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool FpsByResolutionCallback(CameraFps fps, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AfModeCallback(CameraAutoFocusMode mode, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ExposureModeCallback(CameraExposureMode mode, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool IsoCallback(CameraIsoLevel iso, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool TheaterModeCallback(CameraTheaterMode mode, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool WhitebalanceCallback(CameraWhiteBalance whitebalance, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool EffectCallback(CameraEffectMode effect, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SceneModeCallback(CameraSceneMode mode, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool FlashModeCallback(CameraFlashMode mode, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool StreamRotationCallback(CameraRotation rotation, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool StreamFlipCallback(CameraFlip flip, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PtzTypeCallback(CameraPtzType type, IntPtr userData); + + + [DllImport(Libraries.Camera, EntryPoint = "camera_is_supported_continuous_capture")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsContinuousCaptureSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_is_supported_face_detection")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsFaceDetectionSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_is_supported_zero_shutter_lag")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsZeroShutterLagSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_is_supported_media_packet_preview_cb")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsMediaPacketPreviewCallbackSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_supported_hdr_capture")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsHdrCaptureSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_supported_anti_shake")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsAntiShakeSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_supported_video_stabilization")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsVideoStabilizationSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_supported_auto_contrast")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsAutoContrastSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_preview_resolution")] + internal static extern CameraError SupportedPreviewResolutions(IntPtr handle, PreviewResolutionCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_capture_resolution")] + internal static extern CameraError SupportedCaptureResolutions(IntPtr handle, CaptureResolutionCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_capture_format")] + internal static extern CameraError SupportedCapturePixelFormats(IntPtr handle, CaptureFormatCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_preview_format")] + internal static extern CameraError SupportedPreviewPixelFormats(IntPtr handle, PreviewFormatCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_fps")] + internal static extern CameraError SupportedPreviewFps(IntPtr handle, FpsCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_fps_by_resolution")] + internal static extern CameraError SupportedPreviewFpsByResolution(IntPtr handle, int width, int height, FpsByResolutionCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_af_mode")] + internal static extern CameraError SupportedAfModes(IntPtr handle, AfModeCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_exposure_mode")] + internal static extern CameraError SupportedExposureModes(IntPtr handle, ExposureModeCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_iso")] + internal static extern CameraError SupportedIso(IntPtr handle, IsoCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_theater_mode")] + internal static extern CameraError SupportedTheaterModes(IntPtr handle, TheaterModeCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_whitebalance")] + internal static extern CameraError SupportedWhitebalance(IntPtr handle, WhitebalanceCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_effect")] + internal static extern CameraError SupportedEffects(IntPtr handle, EffectCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_scene_mode")] + internal static extern CameraError SupportedSceneModes(IntPtr handle, SceneModeCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_flash_mode")] + internal static extern CameraError SupportedFlashModes(IntPtr handle, FlashModeCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_stream_rotation")] + internal static extern CameraError SupportedStreamRotations(IntPtr handle, StreamRotationCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_stream_flip")] + internal static extern CameraError SupportedStreamFlips(IntPtr handle, StreamFlipCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_ptz_type")] + internal static extern CameraError SupportedPtzTypes(IntPtr handle, PtzTypeCallback callback, IntPtr userData); + } +} diff --git a/src/Tizen.Multimedia.Camera/Interop/Interop.CameraSettings.cs b/src/Tizen.Multimedia.Camera/Interop/Interop.CameraSettings.cs new file mode 100644 index 0000000..73d0ccf --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Interop/Interop.CameraSettings.cs @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class CameraSettings + { + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_preview_fps")] + internal static extern CameraError SetPreviewFps(IntPtr handle, CameraFps fps); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_preview_fps")] + internal static extern CameraError GetPreviewFps(IntPtr handle, out CameraFps fps); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_image_quality")] + internal static extern CameraError SetImageQuality(IntPtr handle, int quality); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_image_quality")] + internal static extern CameraError GetImageQuality(IntPtr handle, out int quality); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_encoded_preview_bitrate")] + internal static extern CameraError SetBitrate(IntPtr handle, int bitrate); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_encoded_preview_bitrate")] + internal static extern CameraError GetBitrate(IntPtr handle, out int bitrate); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_encoded_preview_gop_interval")] + internal static extern CameraError SetGopInterval(IntPtr handle, int interval); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_encoded_preview_gop_interval")] + internal static extern CameraError GetGopInterval(IntPtr handle, out int interval); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_zoom")] + internal static extern CameraError SetZoom(IntPtr handle, int zoom); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_zoom")] + internal static extern CameraError GetZoom(IntPtr handle, out int zoom); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_zoom_range")] + internal static extern CameraError GetZoomRange(IntPtr handle, out int min, out int max); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_af_mode")] + internal static extern CameraError SetAutoFocusMode(IntPtr handle, CameraAutoFocusMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_af_mode")] + internal static extern CameraError GetAutoFocusMode(IntPtr handle, out CameraAutoFocusMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_af_area")] + internal static extern CameraError SetAutoFocusArea(IntPtr handle, int x, int y); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_clear_af_area")] + internal static extern CameraError ClearAutoFocusArea(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_exposure_mode")] + internal static extern CameraError SetExposureMode(IntPtr handle, CameraExposureMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_exposure_mode")] + internal static extern CameraError GetExposureMode(IntPtr handle, out CameraExposureMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_exposure")] + internal static extern CameraError SetExposure(IntPtr handle, int value); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_exposure")] + internal static extern CameraError GetExposure(IntPtr handle, out int value); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_exposure_range")] + internal static extern CameraError GetExposureRange(IntPtr handle, out int min, out int max); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_iso")] + internal static extern CameraError SetIso(IntPtr handle, CameraIsoLevel iso); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_iso")] + internal static extern CameraError GetIso(IntPtr handle, out CameraIsoLevel iso); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_theater_mode")] + internal static extern CameraError SetTheaterMode(IntPtr handle, CameraTheaterMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_theater_mode")] + internal static extern CameraError GetTheaterMode(IntPtr handle, out CameraTheaterMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_brightness")] + internal static extern CameraError SetBrightness(IntPtr handle, int level); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_brightness")] + internal static extern CameraError GetBrightness(IntPtr handle, out int level); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_brightness_range")] + internal static extern CameraError GetBrightnessRange(IntPtr handle, out int min, out int max); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_contrast")] + internal static extern CameraError SetContrast(IntPtr handle, int level); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_contrast")] + internal static extern CameraError GetContrast(IntPtr handle, out int level); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_contrast_range")] + internal static extern CameraError GetContrastRange(IntPtr handle, out int min, out int max); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_whitebalance")] + internal static extern CameraError SetWhitebalance(IntPtr handle, CameraWhiteBalance level); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_whitebalance")] + internal static extern CameraError GetWhiteBalance(IntPtr handle, out CameraWhiteBalance level); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_effect")] + internal static extern CameraError SetEffect(IntPtr handle, CameraEffectMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_effect")] + internal static extern CameraError GetEffect(IntPtr handle, out CameraEffectMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_scene_mode")] + internal static extern CameraError SetSceneMode(IntPtr handle, CameraSceneMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_scene_mode")] + internal static extern CameraError GetSceneMode(IntPtr handle, out CameraSceneMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_tag")] + internal static extern CameraError EnableTag(IntPtr handle, bool enable); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_enabled_tag")] + internal static extern CameraError IsEnabledTag(IntPtr handle, out bool enabled); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tag_image_description")] + internal static extern CameraError SetImageDescription(IntPtr handle, string description); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tag_image_description")] + internal static extern CameraError GetImageDescription(IntPtr handle, out IntPtr description); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tag_software")] + internal static extern CameraError SetTagSoftware(IntPtr handle, string software); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tag_software")] + internal static extern CameraError GetTagSoftware(IntPtr handle, out IntPtr software); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tag_orientation")] + internal static extern CameraError SetTagOrientation(IntPtr handle, CameraTagOrientation orientation); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tag_orientation")] + internal static extern CameraError GetTagOrientation(IntPtr handle, out CameraTagOrientation orientation); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_geotag")] + internal static extern CameraError SetGeotag(IntPtr handle, double latitude, double longtitude, double altitude); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_geotag")] + internal static extern CameraError GetGeotag(IntPtr handle, out double latitude, out double longtitude, out double altitude); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_remove_geotag")] + internal static extern CameraError RemoveGeotag(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_flash_mode")] + internal static extern CameraError SetFlashMode(IntPtr handle, CameraFlashMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_flash_mode")] + internal static extern CameraError GetFlashMode(IntPtr handle, out CameraFlashMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_lens_orientation")] + internal static extern CameraError GetLensOrientation(IntPtr handle, out int angle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_stream_rotation")] + internal static extern CameraError SetStreamRotation(IntPtr handle, CameraRotation mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_stream_rotation")] + internal static extern CameraError GetStreamRotation(IntPtr handle, out CameraRotation mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_stream_flip")] + internal static extern CameraError SetFlip(IntPtr handle, CameraFlip flip); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_stream_flip")] + internal static extern CameraError GetFlip(IntPtr handle, out CameraFlip flip); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_hdr_mode")] + internal static extern CameraError SetHdrMode(IntPtr handle, CameraHdrMode hdr); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_hdr_mode")] + internal static extern CameraError GetHdrMode(IntPtr handle, out CameraHdrMode hdr); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_anti_shake")] + internal static extern CameraError EnableAntiShake(IntPtr handle, bool enable); + + [DllImport(Libraries.Camera, EntryPoint = " camera_attr_is_enabled_anti_shake")] + internal static extern CameraError IsEnabledAntiShake(IntPtr handle, out bool enabled); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_video_stabilization")] + internal static extern CameraError EnableVideoStabilization(IntPtr handle, bool enable); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_enabled_video_stabilization")] + internal static extern CameraError IsEnabledVideoStabilization(IntPtr handle, out bool enabled); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_auto_contrast")] + internal static extern CameraError EnableAutoContrast(IntPtr handle, bool enable); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_enabled_auto_contrast")] + internal static extern CameraError IsEnabledAutoContrast(IntPtr handle, out bool enabled); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_disable_shutter_sound")] + internal static extern CameraError DisableShutterSound(IntPtr handle, bool disable); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_pan")] + internal static extern CameraError SetPan(IntPtr handle, CameraPtzMoveType type, int step); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_pan")] + internal static extern CameraError GetPan(IntPtr handle, out int step); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_pan_range")] + internal static extern CameraError GetPanRange(IntPtr handle, out int min, out int max); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tilt")] + internal static extern CameraError SetTilt(IntPtr handle, CameraPtzMoveType type, int step); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tilt")] + internal static extern CameraError GetTilt(IntPtr handle, out int step); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tilt_range")] + internal static extern CameraError GetTiltRange(IntPtr handle, out int min, out int max); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_ptz_type")] + internal static extern CameraError SetPtzType(IntPtr handle, int type); + } +} diff --git a/src/Tizen.Multimedia.Camera/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.Camera/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..624807e --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Camera = "libcapi-media-camera.so.0"; + } +} diff --git a/src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.csproj b/src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.csproj new file mode 100644 index 0000000..311014e --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.csproj @@ -0,0 +1,20 @@ + + + netstandard1.3 + True + True + Tizen.Multimedia.Camera.snk + true + True + False + + + + + + + + + + + diff --git a/src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.nuspec b/src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.nuspec new file mode 100644 index 0000000..085a022 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.nuspec @@ -0,0 +1,18 @@ + + + + Tizen.Multimedia.Camera + $version$ + Samsung Electronics + false + https://www.apache.org/licenses/LICENSE-2.0 + https://www.tizen.org/ + https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png + © Samsung Electronics Co., Ltd All Rights Reserved + Provides the Multimedia Camera API for Tizen.Net + + + + + + diff --git a/src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.snk b/src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.snk new file mode 100644 index 0000000..c70e477 Binary files /dev/null and b/src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.snk differ diff --git a/src/Tizen.Multimedia.MediaCodec/Tizen.Multimedia.MediaCodec.nuspec b/src/Tizen.Multimedia.MediaCodec/Tizen.Multimedia.MediaCodec.nuspec index 0280114..055c8f7 100644 --- a/src/Tizen.Multimedia.MediaCodec/Tizen.Multimedia.MediaCodec.nuspec +++ b/src/Tizen.Multimedia.MediaCodec/Tizen.Multimedia.MediaCodec.nuspec @@ -12,7 +12,6 @@ Provides the Multimedia MediaCodec API for Tizen.Net - diff --git a/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..e3a6800 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Libraries.cs @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Player = "libcapi-media-player.so.0"; + } +} + diff --git a/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs new file mode 100644 index 0000000..d49ec44 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs @@ -0,0 +1,320 @@ +using System; +using System.Runtime.InteropServices; +using Tizen; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class NativePlayer + { + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PlaybackCompletedCallback(IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PlaybackInterruptedCallback(PlaybackInterruptionReason code, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PlaybackErrorCallback(int code, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void VideoFrameDecodedCallback(IntPtr packetHandle, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SubtitleUpdatedCallback(uint duration, string text, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void BufferingProgressCallback(int percent, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void VideoStreamChangedCallback(int width, int height, int fps, int bitrate, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MediaStreamBufferStatusCallback(MediaStreamBufferStatus status, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MediaStreamSeekCallback(ulong offset, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void VideoCaptureCallback(IntPtr data, int width, int height, uint size, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PrepareCallback(IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SeekCompletedCallback(IntPtr userData); + + + [DllImport(Libraries.Player, EntryPoint = "player_create")] + internal static extern PlayerErrorCode Create(out PlayerHandle player); + + [DllImport(Libraries.Player, EntryPoint = "player_destroy")] + internal static extern PlayerErrorCode Destroy(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_prepare")] + internal static extern PlayerErrorCode Prepare(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_unprepare")] + internal static extern PlayerErrorCode Unprepare(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_uri")] + internal static extern PlayerErrorCode SetUri(IntPtr player, string uri); + + [DllImport(Libraries.Player, EntryPoint = "player_set_display")] + internal static extern PlayerErrorCode SetDisplay(IntPtr player, DisplayType type, IntPtr display); + + [DllImport(Libraries.Player, EntryPoint = "player_start")] + internal static extern PlayerErrorCode Start(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_stop")] + internal static extern PlayerErrorCode Stop(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_pause")] + internal static extern PlayerErrorCode Pause(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_memory_buffer")] + internal static extern PlayerErrorCode SetMemoryBuffer(IntPtr player, byte[] data, int size); + + [DllImport(Libraries.Player, EntryPoint = "player_get_state")] + internal static extern PlayerErrorCode GetState(IntPtr player, out int state); + + [DllImport(Libraries.Player, EntryPoint = "player_set_volume")] + internal static extern PlayerErrorCode SetVolume(IntPtr player, float left, float right); + + [DllImport(Libraries.Player, EntryPoint = "player_get_volume")] + internal static extern PlayerErrorCode GetVolume(IntPtr player, out float left, out float right); + + [DllImport(Libraries.Player, EntryPoint = "player_set_sound_stream_info")] + internal static extern PlayerErrorCode SetAudioPolicyInfo(IntPtr player, IntPtr streamInfo); + + [DllImport(Libraries.Player, EntryPoint = "player_set_audio_latency_mode")] + internal static extern PlayerErrorCode SetAudioLatencyMode(IntPtr player, AudioLatencyMode latencyMode); + + [DllImport(Libraries.Player, EntryPoint = "player_get_audio_latency_mode")] + internal static extern PlayerErrorCode GetAudioLatencyMode(IntPtr player, out AudioLatencyMode latencyMode); + + [DllImport(Libraries.Player, EntryPoint = "player_get_play_position")] + internal static extern PlayerErrorCode GetPlayPosition(IntPtr player, out int millisecond); + + [DllImport(Libraries.Player, EntryPoint = "player_set_play_position")] + internal static extern PlayerErrorCode SetPlayPosition(IntPtr player, int millisecond, + bool accurate, SeekCompletedCallback cb, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_set_mute")] + internal static extern PlayerErrorCode SetMute(IntPtr player, bool muted); + + [DllImport(Libraries.Player, EntryPoint = "player_is_muted")] + internal static extern PlayerErrorCode IsMuted(IntPtr player, out bool muted); + + [DllImport(Libraries.Player, EntryPoint = "player_set_looping")] + internal static extern PlayerErrorCode SetLooping(IntPtr player, bool looping); + + [DllImport(Libraries.Player, EntryPoint = "player_is_looping")] + internal static extern PlayerErrorCode IsLooping(IntPtr player, out bool looping); + + [DllImport(Libraries.Player, EntryPoint = "player_set_completed_cb")] + internal static extern PlayerErrorCode SetCompletedCb(IntPtr player, + PlaybackCompletedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_completed_cb")] + internal static extern PlayerErrorCode UnsetCompletedCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_interrupted_cb")] + internal static extern PlayerErrorCode SetInterruptedCb(IntPtr player, + PlaybackInterruptedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_interrupted_cb")] + internal static extern PlayerErrorCode UnsetInterruptedCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_error_cb")] + internal static extern PlayerErrorCode SetErrorCb(IntPtr player, PlaybackErrorCallback callback, + IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_error_cb")] + internal static extern PlayerErrorCode UnsetErrorCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_capture_video")] + internal static extern PlayerErrorCode CaptureVideo(IntPtr player, VideoCaptureCallback callback, + IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_set_media_packet_video_frame_decoded_cb")] + internal static extern PlayerErrorCode SetVideoFrameDecodedCb(IntPtr player, VideoFrameDecodedCallback callback, + IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_media_packet_video_frame_decoded_cb")] + internal static extern PlayerErrorCode UnsetVideoFrameDecodedCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_streaming_cookie")] + internal static extern PlayerErrorCode SetStreamingCookie(IntPtr player, string cookie, int size); + + [DllImport(Libraries.Player, EntryPoint = "player_set_streaming_user_agent")] + internal static extern PlayerErrorCode SetStreamingUserAgent(IntPtr player, string userAgent, int size); + + [DllImport(Libraries.Player, EntryPoint = "player_get_streaming_download_progress")] + internal static extern PlayerErrorCode GetStreamingDownloadProgress(IntPtr player, out int start, out int current); + + [DllImport(Libraries.Player, EntryPoint = "player_set_buffering_cb")] + internal static extern PlayerErrorCode SetBufferingCb(IntPtr player, + BufferingProgressCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_buffering_cb")] + internal static extern PlayerErrorCode UnsetBufferingCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_playback_rate")] + internal static extern PlayerErrorCode SetPlaybackRate(IntPtr player, float rate); + + [DllImport(Libraries.Player, EntryPoint = "player_push_media_stream")] + internal static extern PlayerErrorCode PushMediaStream(IntPtr player, IntPtr packet); + + [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_info")] + internal static extern PlayerErrorCode SetMediaStreamInfo(IntPtr player, int type, IntPtr format); + + [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_buffer_status_cb")] + internal static extern PlayerErrorCode SetMediaStreamBufferStatusCb(IntPtr player, StreamType type, + MediaStreamBufferStatusCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_media_stream_buffer_status_cb")] + internal static extern PlayerErrorCode UnsetMediaStreamBufferStatusCb(IntPtr player, int type); + + [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_seek_cb")] + internal static extern PlayerErrorCode SetMediaStreamSeekCb(IntPtr player, StreamType type, + MediaStreamSeekCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_media_stream_seek_cb")] + internal static extern PlayerErrorCode UnsetMediaStreamSeekCb(IntPtr player, int type); + + [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_buffer_max_size")] + internal static extern PlayerErrorCode SetMediaStreamBufferMaxSize(IntPtr player, StreamType type, ulong maxSize); + + [DllImport(Libraries.Player, EntryPoint = "player_get_media_stream_buffer_max_size")] + internal static extern PlayerErrorCode GetMediaStreamBufferMaxSize(IntPtr player, StreamType type, out ulong maxSize); + + [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_buffer_min_threshold")] + internal static extern PlayerErrorCode SetMediaStreamBufferMinThreshold(IntPtr player, StreamType type, uint percent); + + [DllImport(Libraries.Player, EntryPoint = "player_get_media_stream_buffer_min_threshold")] + internal static extern PlayerErrorCode GetMediaStreamBufferMinThreshold(IntPtr player, int type, out uint percent); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_bands_count")] + internal static extern PlayerErrorCode AudioEffectGetEqualizerBandsCount(IntPtr player, out int count); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_set_equalizer_band_level")] + internal static extern PlayerErrorCode AudioEffectSetEqualizerBandLevel(IntPtr player, int index, int level); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_band_level")] + internal static extern PlayerErrorCode AudioEffectGetEqualizerBandLevel(IntPtr player, int index, out int level); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_set_equalizer_all_bands")] + internal static extern PlayerErrorCode AudioEffectSetEqualizerAllBands(IntPtr player, out int band_levels, int length); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_level_range")] + internal static extern PlayerErrorCode AudioEffectGetEqualizerLevelRange(IntPtr player, out int min, out int max); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_band_frequency")] + internal static extern PlayerErrorCode AudioEffectGetEqualizerBandFrequency(IntPtr player, int index, out int frequency); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_band_frequency_range")] + internal static extern PlayerErrorCode AudioEffectGetEqualizerBandFrequencyRange(IntPtr player, int index, out int range); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_equalizer_clear")] + internal static extern PlayerErrorCode AudioEffectEqualizerClear(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_equalizer_is_available")] + internal static extern PlayerErrorCode AudioEffectEqualizerIsAvailable(IntPtr player, out bool available); + + [DllImport(Libraries.Player, EntryPoint = "player_set_display_mode")] + internal static extern PlayerErrorCode SetDisplayMode(IntPtr player, PlayerDisplayMode mode); + + [DllImport(Libraries.Player, EntryPoint = "player_get_display_mode")] + internal static extern PlayerErrorCode GetDisplayMode(IntPtr player, out int mode); + + [DllImport(Libraries.Player, EntryPoint = "player_set_display_visible")] + internal static extern PlayerErrorCode SetDisplayVisible(IntPtr player, bool visible); + + [DllImport(Libraries.Player, EntryPoint = "player_is_display_visible")] + internal static extern PlayerErrorCode IsDisplayVisible(IntPtr player, out bool visible); + + [DllImport(Libraries.Player, EntryPoint = "player_set_display_rotation")] + internal static extern PlayerErrorCode SetDisplayRotation(IntPtr player, PlayerDisplayRotation rotation); + + [DllImport(Libraries.Player, EntryPoint = "player_get_display_rotation")] + internal static extern PlayerErrorCode GetDisplayRotation(IntPtr player, out int rotation); + + [DllImport(Libraries.Player, EntryPoint = "player_set_display_roi_area")] + internal static extern PlayerErrorCode SetDisplayRoi(IntPtr player, int x, int y, int width, int height); + + [DllImport(Libraries.Player, EntryPoint = "player_get_content_info")] + internal static extern PlayerErrorCode GetContentInfo(IntPtr player, StreamMetadataKey key, out IntPtr value); + + [DllImport(Libraries.Player, EntryPoint = "player_get_codec_info")] + internal static extern PlayerErrorCode GetCodecInfo(IntPtr player, out IntPtr audioCodec, out IntPtr videoCodec); + + [DllImport(Libraries.Player, EntryPoint = "player_get_audio_stream_info")] + internal static extern PlayerErrorCode GetAudioStreamInfo(IntPtr player, out int sampleRate, out int channel, out int bitRate); + + [DllImport(Libraries.Player, EntryPoint = "player_get_video_stream_info")] + internal static extern PlayerErrorCode GetVideoStreamInfo(IntPtr player, out int fps, out int bitRate); + + [DllImport(Libraries.Player, EntryPoint = "player_get_album_art")] + internal static extern PlayerErrorCode GetAlbumArt(IntPtr player, out IntPtr albumArt, out int size); + + [DllImport(Libraries.Player, EntryPoint = "player_get_video_size")] + internal static extern PlayerErrorCode GetVideoSize(IntPtr player, out int width, out int height); + + [DllImport(Libraries.Player, EntryPoint = "player_get_duration")] + internal static extern PlayerErrorCode GetDuration(IntPtr player, out int duration); + + [DllImport(Libraries.Player, EntryPoint = "player_set_subtitle_path")] + internal static extern PlayerErrorCode SetSubtitlePath(IntPtr player, string path); + + [DllImport(Libraries.Player, EntryPoint = "player_set_subtitle_updated_cb")] + internal static extern PlayerErrorCode SetSubtitleUpdatedCb(IntPtr player, + SubtitleUpdatedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_subtitle_updated_cb")] + internal static extern PlayerErrorCode UnsetSubtitleUpdatedCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_subtitle_position_offset")] + internal static extern PlayerErrorCode SetSubtitlePositionOffset(IntPtr player, int millisecond); + + [DllImport(Libraries.Player, EntryPoint = "player_set_video_stream_changed_cb")] + internal static extern PlayerErrorCode SetVideoStreamChangedCb(IntPtr player, + VideoStreamChangedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_video_stream_changed_cb")] + internal static extern PlayerErrorCode UnsetVideoStreamChangedCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_get_track_count")] + internal static extern PlayerErrorCode GetTrackCount(IntPtr player, int type, out int count); + + [DllImport(Libraries.Player, EntryPoint = "player_select_track")] + internal static extern PlayerErrorCode SelectTrack(IntPtr player, int type, int index); + + [DllImport(Libraries.Player, EntryPoint = "player_get_current_track")] + internal static extern PlayerErrorCode GetCurrentTrack(IntPtr player, int type, out int index); + + [DllImport(Libraries.Player, EntryPoint = "player_get_track_language_code")] + internal static extern PlayerErrorCode GetTrackLanguageCode(IntPtr player, int type, int index, out IntPtr code); + } + + internal class PlayerHandle : SafeHandle + { + protected PlayerHandle() : base(IntPtr.Zero, true) + { + } + + public override bool IsInvalid => handle == IntPtr.Zero; + + protected override bool ReleaseHandle() + { + var ret = NativePlayer.Destroy(handle); + if (ret != PlayerErrorCode.None) + { + Log.Debug(GetType().FullName, $"Failed to release native {GetType().Name}"); + return false; + } + + return true; + } + } +} diff --git a/src/Tizen.Multimedia/Player/AudioEffect.cs b/src/Tizen.Multimedia.MediaPlayer/Player/AudioEffect.cs similarity index 91% rename from src/Tizen.Multimedia/Player/AudioEffect.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/AudioEffect.cs index db7b693..9886551 100644 --- a/src/Tizen.Multimedia/Player/AudioEffect.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/AudioEffect.cs @@ -14,6 +14,7 @@ * limitations under the License. */ using System; +using static Interop; namespace Tizen.Multimedia { @@ -30,7 +31,7 @@ namespace Tizen.Multimedia bool available = false; - Interop.Player.AudioEffectEqualizerIsAvailable(Player.Handle, out available). + NativePlayer.AudioEffectEqualizerIsAvailable(Player.Handle, out available). ThrowIfFailed("Failed to initialize the AudioEffect"); IsAvailable = available; @@ -41,12 +42,12 @@ namespace Tizen.Multimedia } int count = 0; - Interop.Player.AudioEffectGetEqualizerBandsCount(Player.Handle, out count). + NativePlayer.AudioEffectGetEqualizerBandsCount(Player.Handle, out count). ThrowIfFailed("Failed to initialize the AudioEffect"); int min = 0; int max = 0; - Interop.Player.AudioEffectGetEqualizerLevelRange(Player.Handle, out min, out max). + NativePlayer.AudioEffectGetEqualizerLevelRange(Player.Handle, out min, out max). ThrowIfFailed("Failed to initialize the AudioEffect"); Count = count; @@ -97,7 +98,7 @@ namespace Tizen.Multimedia Log.Debug(PlayerLog.Tag, PlayerLog.Enter); Player.ValidateNotDisposed(); - Interop.Player.AudioEffectEqualizerClear(Player.Handle). + NativePlayer.AudioEffectEqualizerClear(Player.Handle). ThrowIfFailed("Failed to clear equalizer effect"); Log.Debug(PlayerLog.Tag, PlayerLog.Leave); } diff --git a/src/Tizen.Multimedia/Player/BufferingProgressChangedEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/BufferingProgressChangedEventArgs.cs similarity index 100% rename from src/Tizen.Multimedia/Player/BufferingProgressChangedEventArgs.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/BufferingProgressChangedEventArgs.cs diff --git a/src/Tizen.Multimedia/Player/CapturedFrame.cs b/src/Tizen.Multimedia.MediaPlayer/Player/CapturedFrame.cs similarity index 100% rename from src/Tizen.Multimedia/Player/CapturedFrame.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/CapturedFrame.cs diff --git a/src/Tizen.Multimedia/Player/DownloadProgress.cs b/src/Tizen.Multimedia.MediaPlayer/Player/DownloadProgress.cs similarity index 100% rename from src/Tizen.Multimedia/Player/DownloadProgress.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/DownloadProgress.cs diff --git a/src/Tizen.Multimedia/Player/EqualizerBand.cs b/src/Tizen.Multimedia.MediaPlayer/Player/EqualizerBand.cs similarity index 89% rename from src/Tizen.Multimedia/Player/EqualizerBand.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/EqualizerBand.cs index c29c2d6..699f05f 100644 --- a/src/Tizen.Multimedia/Player/EqualizerBand.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/EqualizerBand.cs @@ -15,6 +15,7 @@ */ using System; using System.Diagnostics; +using static Interop; namespace Tizen.Multimedia { @@ -38,10 +39,10 @@ namespace Tizen.Multimedia int frequency = 0; int range = 0; - Interop.Player.AudioEffectGetEqualizerBandFrequency(_owner.Player.Handle, _index, out frequency). + NativePlayer.AudioEffectGetEqualizerBandFrequency(_owner.Player.Handle, _index, out frequency). ThrowIfFailed("Failed to initialize equalizer band"); - Interop.Player.AudioEffectGetEqualizerBandFrequencyRange(_owner.Player.Handle, _index, out range). + NativePlayer.AudioEffectGetEqualizerBandFrequencyRange(_owner.Player.Handle, _index, out range). ThrowIfFailed("Failed to initialize equalizer band"); Frequency = frequency; @@ -72,7 +73,7 @@ namespace Tizen.Multimedia $"but got {value}."); } - Interop.Player.AudioEffectSetEqualizerBandLevel(_owner.Player.Handle, _index, value). + NativePlayer.AudioEffectSetEqualizerBandLevel(_owner.Player.Handle, _index, value). ThrowIfFailed("Failed to set the level of the equalizer band"); } @@ -86,7 +87,7 @@ namespace Tizen.Multimedia _owner.Player.ValidateNotDisposed(); int value = 0; - Interop.Player.AudioEffectGetEqualizerBandLevel(_owner.Player.Handle, _index, out value). + NativePlayer.AudioEffectGetEqualizerBandLevel(_owner.Player.Handle, _index, out value). ThrowIfFailed("Failed to get the level of the equalizer band"); Log.Info(PlayerLog.Tag, "get level : " + value); return value; diff --git a/src/Tizen.Multimedia/Player/MediaBufferSource.cs b/src/Tizen.Multimedia.MediaPlayer/Player/MediaBufferSource.cs similarity index 98% rename from src/Tizen.Multimedia/Player/MediaBufferSource.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/MediaBufferSource.cs index d64761c..8ab2397 100644 --- a/src/Tizen.Multimedia/Player/MediaBufferSource.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/MediaBufferSource.cs @@ -14,6 +14,7 @@ * limitations under the License. */ using System; +using static Interop; namespace Tizen.Multimedia { @@ -130,7 +131,7 @@ namespace Tizen.Multimedia internal override void OnAttached(Player player) { - Interop.Player.SetMemoryBuffer(player.Handle, _buffer, _buffer.Length). + NativePlayer.SetMemoryBuffer(player.Handle, _buffer, _buffer.Length). ThrowIfFailed("Failed to set the memory buffer"); } } diff --git a/src/Tizen.Multimedia/Player/MediaSource.cs b/src/Tizen.Multimedia.MediaPlayer/Player/MediaSource.cs similarity index 100% rename from src/Tizen.Multimedia/Player/MediaSource.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/MediaSource.cs diff --git a/src/Tizen.Multimedia/Player/MediaStreamBufferStatusChangedEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamBufferStatusChangedEventArgs.cs similarity index 100% rename from src/Tizen.Multimedia/Player/MediaStreamBufferStatusChangedEventArgs.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamBufferStatusChangedEventArgs.cs diff --git a/src/Tizen.Multimedia/Player/MediaStreamConfiguration.cs b/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamConfiguration.cs similarity index 93% rename from src/Tizen.Multimedia/Player/MediaStreamConfiguration.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamConfiguration.cs index ad4a443..5c55eba 100644 --- a/src/Tizen.Multimedia/Player/MediaStreamConfiguration.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamConfiguration.cs @@ -15,6 +15,7 @@ */ using System; using System.Diagnostics; +using static Interop; namespace Tizen.Multimedia { @@ -81,7 +82,7 @@ namespace Tizen.Multimedia throw new ArgumentOutOfRangeException(nameof(value), value, "the buffer max size can't be zero."); } - Interop.Player.SetMediaStreamBufferMaxSize(_owner.Player.Handle, _streamType, value). + NativePlayer.SetMediaStreamBufferMaxSize(_owner.Player.Handle, _streamType, value). ThrowIfFailed("Failed to set the buffer max size"); _bufferMaxSize = value; @@ -117,7 +118,7 @@ namespace Tizen.Multimedia $"The threshold can't be greater than 100, but got { value }."); } - Interop.Player.SetMediaStreamBufferMinThreshold(_owner.Player.Handle, _streamType, value). + NativePlayer.SetMediaStreamBufferMinThreshold(_owner.Player.Handle, _streamType, value). ThrowIfFailed("Failed to set the buffer minimum threshold"); _threshold = value; @@ -137,10 +138,10 @@ namespace Tizen.Multimedia player.MediaStreamVideoBufferStatusChanged += MediaStreamBufferStatusChanged; } - Interop.Player.SetMediaStreamBufferMaxSize(player.Handle, _streamType, _bufferMaxSize). + NativePlayer.SetMediaStreamBufferMaxSize(player.Handle, _streamType, _bufferMaxSize). ThrowIfFailed("Failed to initialize the media stream configuration"); - Interop.Player.SetMediaStreamBufferMinThreshold(player.Handle, _streamType, _threshold). + NativePlayer.SetMediaStreamBufferMinThreshold(player.Handle, _streamType, _threshold). ThrowIfFailed("Failed to initialize the media stream configuration"); } diff --git a/src/Tizen.Multimedia/Player/MediaStreamSeekingOccurredEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamSeekingOccurredEventArgs.cs similarity index 100% rename from src/Tizen.Multimedia/Player/MediaStreamSeekingOccurredEventArgs.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamSeekingOccurredEventArgs.cs diff --git a/src/Tizen.Multimedia/Player/MediaStreamSource.cs b/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamSource.cs similarity index 98% rename from src/Tizen.Multimedia/Player/MediaStreamSource.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamSource.cs index 7ef88bd..1c279f0 100644 --- a/src/Tizen.Multimedia/Player/MediaStreamSource.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamSource.cs @@ -17,6 +17,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using static Interop; namespace Tizen.Multimedia { @@ -225,7 +226,7 @@ namespace Tizen.Multimedia _player.ValidatePlayerState(PlayerState.Paused, PlayerState.Playing, PlayerState.Ready); - Interop.Player.PushMediaStream(_player.Handle, packet.GetHandle()). + NativePlayer.PushMediaStream(_player.Handle, packet.GetHandle()). ThrowIfFailed("Failed to push the packet to the player"); } @@ -242,7 +243,7 @@ namespace Tizen.Multimedia try { ptr = mediaFormat.AsNativeHandle(); - Interop.Player.SetMediaStreamInfo(_player.Handle, (int)streamType, ptr). + NativePlayer.SetMediaStreamInfo(_player.Handle, (int)streamType, ptr). ThrowIfFailed("Failed to set the media stream info"); } finally diff --git a/src/Tizen.Multimedia/Player/MediaUriSource.cs b/src/Tizen.Multimedia.MediaPlayer/Player/MediaUriSource.cs similarity index 87% rename from src/Tizen.Multimedia/Player/MediaUriSource.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/MediaUriSource.cs index 0511d03..c9a85e3 100644 --- a/src/Tizen.Multimedia/Player/MediaUriSource.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/MediaUriSource.cs @@ -15,6 +15,7 @@ * limitations under the License. */ using System; +using static Interop; namespace Tizen.Multimedia { @@ -38,12 +39,7 @@ namespace Tizen.Multimedia /// If you provide an invalid uri, you won't receive an error until is called. public MediaUriSource(string uri) { - if (uri == null) - { - Log.Error(PlayerLog.Tag, "uri is null"); - throw new ArgumentNullException(nameof(uri)); - } - Uri = uri; + Uri = uri ?? throw new ArgumentNullException(nameof(uri)); } /// @@ -53,7 +49,7 @@ namespace Tizen.Multimedia internal override void OnAttached(Player player) { - Interop.Player.SetUri(player.Handle, Uri).ThrowIfFailed("Failed to set the source with specified uri"); + NativePlayer.SetUri(player.Handle, Uri).ThrowIfFailed("Failed to set the source with specified uri"); } } } diff --git a/src/Tizen.Multimedia/Player/PlaybackInterruptedEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/PlaybackInterruptedEventArgs.cs similarity index 100% rename from src/Tizen.Multimedia/Player/PlaybackInterruptedEventArgs.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/PlaybackInterruptedEventArgs.cs diff --git a/src/Tizen.Multimedia/Player/Player.cs b/src/Tizen.Multimedia.MediaPlayer/Player/Player.cs old mode 100755 new mode 100644 similarity index 91% rename from src/Tizen.Multimedia/Player/Player.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/Player.cs index c226937..a222a0d --- a/src/Tizen.Multimedia/Player/Player.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/Player.cs @@ -19,7 +19,7 @@ using System.Runtime.InteropServices; using System.Diagnostics; using System.IO; using System.Threading; -using static Tizen.Multimedia.Interop; +using static Interop; namespace Tizen.Multimedia { @@ -46,52 +46,52 @@ namespace Tizen.Multimedia /// Occurs when playback of a media is finished. /// public event EventHandler PlaybackCompleted; - private Interop.Player.PlaybackCompletedCallback _playbackCompletedCallback; + private NativePlayer.PlaybackCompletedCallback _playbackCompletedCallback; /// /// Occurs when playback of a media is interrupted. /// public event EventHandler PlaybackInterrupted; - private Interop.Player.PlaybackInterruptedCallback _playbackInterruptedCallback; + private NativePlayer.PlaybackInterruptedCallback _playbackInterruptedCallback; /// /// Occurs when any error occurs. /// /// The event handler will be executed on an internal thread. public event EventHandler ErrorOccurred; - private Interop.Player.PlaybackErrorCallback _playbackErrorCallback; + private NativePlayer.PlaybackErrorCallback _playbackErrorCallback; /// /// Occurs when the video stream changed. /// /// The event handler will be executed on an internal thread. public event EventHandler VideoStreamChanged; - private Interop.Player.VideoStreamChangedCallback _videoStreamChangedCallback; + private NativePlayer.VideoStreamChangedCallback _videoStreamChangedCallback; /// /// Occurs when the subtitle is updated. /// /// The event handler will be executed on an internal thread. public EventHandler SubtitleUpdated; - private Interop.Player.SubtitleUpdatedCallback _subtitleUpdatedCallback; + private NativePlayer.SubtitleUpdatedCallback _subtitleUpdatedCallback; /// /// Occurs when there is a change in the buffering status of streaming. /// public event EventHandler BufferingProgressChanged; - private Interop.Player.BufferingProgressCallback _bufferingProgressCallback; + private NativePlayer.BufferingProgressCallback _bufferingProgressCallback; internal event EventHandler MediaStreamAudioBufferStatusChanged; - private Interop.Player.MediaStreamBufferStatusCallback _mediaStreamAudioBufferStatusChangedCallback; + private NativePlayer.MediaStreamBufferStatusCallback _mediaStreamAudioBufferStatusChangedCallback; internal event EventHandler MediaStreamVideoBufferStatusChanged; - private Interop.Player.MediaStreamBufferStatusCallback _mediaStreamVideoBufferStatusChangedCallback; + private NativePlayer.MediaStreamBufferStatusCallback _mediaStreamVideoBufferStatusChangedCallback; internal event EventHandler MediaStreamAudioSeekingOccurred; - private Interop.Player.MediaStreamSeekCallback _mediaStreamAudioSeekCallback; + private NativePlayer.MediaStreamSeekCallback _mediaStreamAudioSeekCallback; internal event EventHandler MediaStreamVideoSeekingOccurred; - private Interop.Player.MediaStreamSeekCallback _mediaStreamVideoSeekCallback; + private NativePlayer.MediaStreamSeekCallback _mediaStreamVideoSeekCallback; /// /// Initialize a new instance of the Player class. @@ -100,7 +100,7 @@ namespace Tizen.Multimedia { Log.Debug(PlayerLog.Tag, PlayerLog.Enter); - Interop.Player.Create(out _handle).ThrowIfFailed("Failed to create player"); + NativePlayer.Create(out _handle).ThrowIfFailed("Failed to create player"); Debug.Assert(_handle != null); @@ -120,13 +120,13 @@ namespace Tizen.Multimedia private void RetrieveProperties() { Log.Debug(PlayerLog.Tag, PlayerLog.Enter); - Interop.Player.GetVolume(Handle, out _volume, out _volume). + NativePlayer.GetVolume(Handle, out _volume, out _volume). ThrowIfFailed("Failed to initialize the player"); - Interop.Player.GetAudioLatencyMode(Handle, out _audioLatencyMode). + NativePlayer.GetAudioLatencyMode(Handle, out _audioLatencyMode). ThrowIfFailed("Failed to initialize the player"); - Interop.Player.IsLooping(Handle, out _isLooping).ThrowIfFailed("Failed to initialize the player"); + NativePlayer.IsLooping(Handle, out _isLooping).ThrowIfFailed("Failed to initialize the player"); Log.Debug(PlayerLog.Tag, PlayerLog.Leave); } @@ -209,7 +209,7 @@ namespace Tizen.Multimedia throw new ArgumentNullException(nameof(value), "Cookie can't be null."); } - Interop.Player.SetStreamingCookie(Handle, value, value.Length). + NativePlayer.SetStreamingCookie(Handle, value, value.Length). ThrowIfFailed("Failed to set the cookie to the player"); _cookie = value; @@ -242,7 +242,7 @@ namespace Tizen.Multimedia throw new ArgumentNullException(nameof(value), "UserAgent can't be null."); } - Interop.Player.SetStreamingUserAgent(Handle, value, value.Length). + NativePlayer.SetStreamingUserAgent(Handle, value, value.Length). ThrowIfFailed("Failed to set the user agent to the player"); _userAgent = value; @@ -269,7 +269,7 @@ namespace Tizen.Multimedia } int state = 0; - Interop.Player.GetState(Handle, out state).ThrowIfFailed("Failed to retrieve the state of the player"); + NativePlayer.GetState(Handle, out state).ThrowIfFailed("Failed to retrieve the state of the player"); Debug.Assert(Enum.IsDefined(typeof(PlayerState), state)); @@ -308,7 +308,7 @@ namespace Tizen.Multimedia } ValidationUtil.ValidateEnum(typeof(AudioLatencyMode), value); - Interop.Player.SetAudioLatencyMode(Handle, value). + NativePlayer.SetAudioLatencyMode(Handle, value). ThrowIfFailed("Failed to set the audio latency mode of the player"); _audioLatencyMode = value; @@ -339,7 +339,7 @@ namespace Tizen.Multimedia return; } - Interop.Player.SetLooping(Handle, value).ThrowIfFailed("Failed to set the looping state of the player"); + NativePlayer.SetLooping(Handle, value).ThrowIfFailed("Failed to set the looping state of the player"); _isLooping = value; } @@ -360,7 +360,7 @@ namespace Tizen.Multimedia if (display == null) { Log.Info(PlayerLog.Tag, "set display to none"); - return Interop.Player.SetDisplay(Handle, DisplayType.None, IntPtr.Zero); + return NativePlayer.SetDisplay(Handle, DisplayType.None, IntPtr.Zero); } return display.ApplyTo(this); @@ -423,7 +423,7 @@ namespace Tizen.Multimedia Debug.Assert(Enum.IsDefined(typeof(DisplayType), type)); - return Interop.Player.SetDisplay(Handle, type, evasObject); + return NativePlayer.SetDisplay(Handle, type, evasObject); } #endregion @@ -564,7 +564,7 @@ namespace Tizen.Multimedia ValidateNotDisposed(); bool value = false; - Interop.Player.IsMuted(Handle, out value).ThrowIfFailed("Failed to get the mute state of the player"); + NativePlayer.IsMuted(Handle, out value).ThrowIfFailed("Failed to get the mute state of the player"); Log.Info(PlayerLog.Tag, "get mute : " + value); @@ -581,7 +581,7 @@ namespace Tizen.Multimedia Log.Debug(PlayerLog.Tag, PlayerLog.Enter); ValidateNotDisposed(); - Interop.Player.SetMute(Handle, mute).ThrowIfFailed("Failed to set the mute state of the player"); + NativePlayer.SetMute(Handle, mute).ThrowIfFailed("Failed to set the mute state of the player"); } /// @@ -601,7 +601,7 @@ namespace Tizen.Multimedia int start = 0; int current = 0; - Interop.Player.GetStreamingDownloadProgress(Handle, out start, out current). + NativePlayer.GetStreamingDownloadProgress(Handle, out start, out current). ThrowIfFailed("Failed to get download progress"); Log.Info(PlayerLog.Tag, "get download progress : " + start + ", " + current); @@ -632,7 +632,7 @@ namespace Tizen.Multimedia $"Valid volume range is 0 <= value <= 1.0, but got { value }."); } - Interop.Player.SetVolume(Handle, value, value). + NativePlayer.SetVolume(Handle, value, value). ThrowIfFailed("Failed to set the volume of the player"); } @@ -646,7 +646,7 @@ namespace Tizen.Multimedia ValidateNotDisposed(); float value = 0.0F; - Interop.Player.GetVolume(Handle, out value, out value). + NativePlayer.GetVolume(Handle, out value, out value). ThrowIfFailed("Failed to get the volume of the player"); return value; } @@ -683,7 +683,7 @@ namespace Tizen.Multimedia throw new FileNotFoundException($"The specified file does not exist.", path); } - Interop.Player.SetSubtitlePath(Handle, path). + NativePlayer.SetSubtitlePath(Handle, path). ThrowIfFailed("Failed to set the subtitle path to the player"); Log.Debug(PlayerLog.Tag, PlayerLog.Leave); @@ -700,7 +700,7 @@ namespace Tizen.Multimedia Log.Debug(PlayerLog.Tag, PlayerLog.Enter); ValidatePlayerState(PlayerState.Idle); - Interop.Player.SetSubtitlePath(Handle, null). + NativePlayer.SetSubtitlePath(Handle, null). ThrowIfFailed("Failed to clear the subtitle of the player"); Log.Debug(PlayerLog.Tag, PlayerLog.Leave); } @@ -721,7 +721,7 @@ namespace Tizen.Multimedia Log.Debug(PlayerLog.Tag, PlayerLog.Enter); ValidatePlayerState(PlayerState.Playing, PlayerState.Paused); - var err = Interop.Player.SetSubtitlePositionOffset(Handle, offset); + var err = NativePlayer.SetSubtitlePositionOffset(Handle, offset); if (err == PlayerErrorCode.FeatureNotSupported) { @@ -735,7 +735,7 @@ namespace Tizen.Multimedia private void Prepare() { Log.Debug(PlayerLog.Tag, PlayerLog.Enter); - Interop.Player.Prepare(Handle).ThrowIfFailed("Failed to prepare the player"); + NativePlayer.Prepare(Handle).ThrowIfFailed("Failed to prepare the player"); } /// @@ -812,7 +812,7 @@ namespace Tizen.Multimedia } ValidatePlayerState(PlayerState.Ready, PlayerState.Paused, PlayerState.Playing); - Interop.Player.Unprepare(Handle).ThrowIfFailed("Failed to unprepare the player"); + NativePlayer.Unprepare(Handle).ThrowIfFailed("Failed to unprepare the player"); if (_source != null) { @@ -846,7 +846,7 @@ namespace Tizen.Multimedia } ValidatePlayerState(PlayerState.Ready, PlayerState.Paused); - Interop.Player.Start(Handle).ThrowIfFailed("Failed to start the player"); + NativePlayer.Start(Handle).ThrowIfFailed("Failed to start the player"); Log.Debug(PlayerLog.Tag, PlayerLog.Leave); } @@ -871,7 +871,7 @@ namespace Tizen.Multimedia } ValidatePlayerState(PlayerState.Paused, PlayerState.Playing); - Interop.Player.Stop(Handle).ThrowIfFailed("Failed to stop the player"); + NativePlayer.Stop(Handle).ThrowIfFailed("Failed to stop the player"); Log.Debug(PlayerLog.Tag, PlayerLog.Leave); } @@ -896,7 +896,7 @@ namespace Tizen.Multimedia ValidatePlayerState(PlayerState.Playing); - Interop.Player.Pause(Handle).ThrowIfFailed("Failed to pause the player"); + NativePlayer.Pause(Handle).ThrowIfFailed("Failed to pause the player"); Log.Debug(PlayerLog.Tag, PlayerLog.Leave); } @@ -951,7 +951,7 @@ namespace Tizen.Multimedia TaskCompletionSource t = new TaskCompletionSource(); - Interop.Player.VideoCaptureCallback cb = (data, width, height, size, _) => + NativePlayer.VideoCaptureCallback cb = (data, width, height, size, _) => { Debug.Assert(size <= int.MaxValue); @@ -963,7 +963,7 @@ namespace Tizen.Multimedia using (var cbKeeper = ObjectKeeper.Get(cb)) { - Interop.Player.CaptureVideo(Handle, cb) + NativePlayer.CaptureVideo(Handle, cb) .ThrowIfFailed("Failed to capture the video"); return await t.Task; @@ -984,7 +984,7 @@ namespace Tizen.Multimedia int playPosition = 0; - Interop.Player.GetPlayPosition(Handle, out playPosition). + NativePlayer.GetPlayPosition(Handle, out playPosition). ThrowIfFailed("Failed to get the play position of the player"); Log.Info(PlayerLog.Tag, "get play position : " + playPosition); @@ -993,10 +993,10 @@ namespace Tizen.Multimedia } private void SetPlayPosition(int milliseconds, bool accurate, - Interop.Player.SeekCompletedCallback cb) + NativePlayer.SeekCompletedCallback cb) { Log.Debug(PlayerLog.Tag, PlayerLog.Enter); - var ret = Interop.Player.SetPlayPosition(Handle, milliseconds, accurate, cb, IntPtr.Zero); + var ret = NativePlayer.SetPlayPosition(Handle, milliseconds, accurate, cb, IntPtr.Zero); //Note that we assume invalid param error is returned only when the position value is invalid. if (ret == PlayerErrorCode.InvalidArgument) @@ -1034,7 +1034,7 @@ namespace Tizen.Multimedia bool immediateResult = _source is MediaStreamSource; - Interop.Player.SeekCompletedCallback cb = _ => taskCompletionSource.TrySetResult(true); + NativePlayer.SeekCompletedCallback cb = _ => taskCompletionSource.TrySetResult(true); using (var cbKeeper = ObjectKeeper.Get(cb)) { @@ -1081,7 +1081,7 @@ namespace Tizen.Multimedia ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); - Interop.Player.SetPlaybackRate(Handle, rate).ThrowIfFailed("Failed to set the playback rate."); + NativePlayer.SetPlaybackRate(Handle, rate).ThrowIfFailed("Failed to set the playback rate."); Log.Debug(PlayerLog.Tag, PlayerLog.Leave); } @@ -1112,7 +1112,7 @@ namespace Tizen.Multimedia ValidatePlayerState(PlayerState.Idle); - Interop.Player.SetAudioPolicyInfo(Handle, policy.Handle). + NativePlayer.SetAudioPolicyInfo(Handle, policy.Handle). ThrowIfFailed("Failed to set the audio stream policy to the player"); } #endregion @@ -1126,7 +1126,7 @@ namespace Tizen.Multimedia SubtitleUpdated?.Invoke(this, new SubtitleUpdatedEventArgs(duration, text)); }; - Interop.Player.SetSubtitleUpdatedCb(Handle, _subtitleUpdatedCallback). + NativePlayer.SetSubtitleUpdatedCb(Handle, _subtitleUpdatedCallback). ThrowIfFailed("Failed to initialize the player"); } @@ -1137,7 +1137,7 @@ namespace Tizen.Multimedia Log.Debug(PlayerLog.Tag, "completed callback"); PlaybackCompleted?.Invoke(this, EventArgs.Empty); }; - Interop.Player.SetCompletedCb(Handle, _playbackCompletedCallback). + NativePlayer.SetCompletedCb(Handle, _playbackCompletedCallback). ThrowIfFailed("Failed to set PlaybackCompleted"); } @@ -1153,7 +1153,7 @@ namespace Tizen.Multimedia PlaybackInterrupted?.Invoke(this, new PlaybackInterruptedEventArgs(code)); }; - Interop.Player.SetInterruptedCb(Handle, _playbackInterruptedCallback). + NativePlayer.SetInterruptedCb(Handle, _playbackInterruptedCallback). ThrowIfFailed("Failed to set PlaybackInterrupted"); } @@ -1166,7 +1166,7 @@ namespace Tizen.Multimedia ErrorOccurred?.Invoke(this, new PlayerErrorOccurredEventArgs((PlayerError)code)); }; - Interop.Player.SetErrorCb(Handle, _playbackErrorCallback). + NativePlayer.SetErrorCb(Handle, _playbackErrorCallback). ThrowIfFailed("Failed to set PlaybackError"); } @@ -1174,7 +1174,7 @@ namespace Tizen.Multimedia private EventHandler _videoFrameDecoded; - private Interop.Player.VideoFrameDecodedCallback _videoFrameDecodedCallback; + private NativePlayer.VideoFrameDecodedCallback _videoFrameDecodedCallback; /// /// Occurs when a video frame is decoded @@ -1219,7 +1219,7 @@ namespace Tizen.Multimedia } }; - Interop.Player.SetVideoFrameDecodedCb(Handle, _videoFrameDecodedCallback). + NativePlayer.SetVideoFrameDecodedCb(Handle, _videoFrameDecodedCallback). ThrowIfFailed("Failed to register the VideoFrameDecoded"); } #endregion @@ -1236,7 +1236,7 @@ namespace Tizen.Multimedia VideoStreamChanged?.Invoke(this, new VideoStreamChangedEventArgs(height, width, fps, bitrate)); }; - Interop.Player.SetVideoStreamChangedCb(Handle, _videoStreamChangedCallback). + NativePlayer.SetVideoStreamChangedCb(Handle, _videoStreamChangedCallback). ThrowIfFailed("Failed to set the video stream changed callback"); } @@ -1248,7 +1248,7 @@ namespace Tizen.Multimedia BufferingProgressChanged?.Invoke(this, new BufferingProgressChangedEventArgs(percent)); }; - Interop.Player.SetBufferingCb(Handle, _bufferingProgressCallback). + NativePlayer.SetBufferingCb(Handle, _bufferingProgressCallback). ThrowIfFailed("Failed to set BufferingProgress"); } @@ -1274,9 +1274,9 @@ namespace Tizen.Multimedia } private void RegisterMediaStreamBufferStatusCallback(StreamType streamType, - Interop.Player.MediaStreamBufferStatusCallback cb) + NativePlayer.MediaStreamBufferStatusCallback cb) { - Interop.Player.SetMediaStreamBufferStatusCb(Handle, streamType, cb). + NativePlayer.SetMediaStreamBufferStatusCb(Handle, streamType, cb). ThrowIfFailed("Failed to SetMediaStreamBufferStatus"); } @@ -1297,9 +1297,9 @@ namespace Tizen.Multimedia RegisterMediaStreamSeekCallback(StreamType.Video, _mediaStreamVideoSeekCallback); } - private void RegisterMediaStreamSeekCallback(StreamType streamType, Interop.Player.MediaStreamSeekCallback cb) + private void RegisterMediaStreamSeekCallback(StreamType streamType, NativePlayer.MediaStreamSeekCallback cb) { - Interop.Player.SetMediaStreamSeekCb(Handle, streamType, cb). + NativePlayer.SetMediaStreamSeekCb(Handle, streamType, cb). ThrowIfFailed("Failed to SetMediaStreamSeek"); } #endregion diff --git a/src/Tizen.Multimedia/Player/PlayerDisplaySettings.cs b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerDisplaySettings.cs similarity index 94% rename from src/Tizen.Multimedia/Player/PlayerDisplaySettings.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/PlayerDisplaySettings.cs index d47f92d..b7ac89a 100644 --- a/src/Tizen.Multimedia/Player/PlayerDisplaySettings.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerDisplaySettings.cs @@ -15,6 +15,7 @@ */ using System; using System.Diagnostics; +using static Interop; namespace Tizen.Multimedia { @@ -62,7 +63,7 @@ namespace Tizen.Multimedia ValidationUtil.ValidateEnum(typeof(PlayerDisplayMode), value); - Interop.Player.SetDisplayMode(Player.Handle, value). + NativePlayer.SetDisplayMode(Player.Handle, value). ThrowIfFailed("Failed to set display mode"); _displayMode = value; @@ -94,7 +95,7 @@ namespace Tizen.Multimedia return; } - Interop.Player.SetDisplayVisible(Player.Handle, value). + NativePlayer.SetDisplayVisible(Player.Handle, value). ThrowIfFailed("Failed to set the visible state of the display"); _isVisible = value; @@ -129,7 +130,7 @@ namespace Tizen.Multimedia ValidationUtil.ValidateEnum(typeof(PlayerDisplayRotation), value); - Interop.Player.SetDisplayRotation(Player.Handle, value). + NativePlayer.SetDisplayRotation(Player.Handle, value). ThrowIfFailed("Failed to set the rotation state of the display"); _rotation = value; @@ -169,7 +170,7 @@ namespace Tizen.Multimedia $"The height of the roi can't be less than or equal to zero."); } - Interop.Player.SetDisplayRoi(Player.Handle, roi.X, roi.Y, roi.Width, roi.Height). + NativePlayer.SetDisplayRoi(Player.Handle, roi.X, roi.Y, roi.Width, roi.Height). ThrowIfFailed("Failed to set the roi"); } } diff --git a/src/Tizen.Multimedia/Player/PlayerEnums.cs b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerEnums.cs similarity index 100% rename from src/Tizen.Multimedia/Player/PlayerEnums.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/PlayerEnums.cs diff --git a/src/Tizen.Multimedia/Player/PlayerError.cs b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerError.cs similarity index 100% rename from src/Tizen.Multimedia/Player/PlayerError.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/PlayerError.cs diff --git a/src/Tizen.Multimedia/Player/PlayerErrorOccurredEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerErrorOccurredEventArgs.cs similarity index 100% rename from src/Tizen.Multimedia/Player/PlayerErrorOccurredEventArgs.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/PlayerErrorOccurredEventArgs.cs diff --git a/src/Tizen.Multimedia/Player/PlayerTrackInfo.cs b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerTrackInfo.cs similarity index 94% rename from src/Tizen.Multimedia/Player/PlayerTrackInfo.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/PlayerTrackInfo.cs index 38b1438..6388437 100644 --- a/src/Tizen.Multimedia/Player/PlayerTrackInfo.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerTrackInfo.cs @@ -16,6 +16,7 @@ using System; using System.Diagnostics; using System.Runtime.InteropServices; +using static Interop; namespace Tizen.Multimedia { @@ -50,7 +51,7 @@ namespace Tizen.Multimedia _owner.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); int count = 0; - Interop.Player.GetTrackCount(_owner.Handle, _streamType, out count). + NativePlayer.GetTrackCount(_owner.Handle, _streamType, out count). ThrowIfFailed("Failed to get count of the track"); Log.Info(PlayerLog.Tag, "get count : " + count); return count; @@ -86,7 +87,7 @@ namespace Tizen.Multimedia try { - Interop.Player.GetTrackLanguageCode(_owner.Handle, _streamType, index, out code). + NativePlayer.GetTrackLanguageCode(_owner.Handle, _streamType, index, out code). ThrowIfFailed("Failed to get the selected language of the player"); string result = Marshal.PtrToStringAnsi(code); @@ -101,7 +102,7 @@ namespace Tizen.Multimedia } finally { - Interop.Libc.Free(code); + LibcSupport.Free(code); } } @@ -118,7 +119,7 @@ namespace Tizen.Multimedia int value = 0; - Interop.Player.GetCurrentTrack(_owner.Handle, _streamType, out value). + NativePlayer.GetCurrentTrack(_owner.Handle, _streamType, out value). ThrowIfFailed("Failed to get the selected index of the player"); Log.Debug(PlayerLog.Tag, "get selected index : " + value); return value; @@ -147,7 +148,7 @@ namespace Tizen.Multimedia _owner.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); - Interop.Player.SelectTrack(_owner.Handle, _streamType, index). + NativePlayer.SelectTrack(_owner.Handle, _streamType, index). ThrowIfFailed("Failed to set the selected index of the player"); } diff --git a/src/Tizen.Multimedia/Player/StreamInfo.cs b/src/Tizen.Multimedia.MediaPlayer/Player/StreamInfo.cs similarity index 94% rename from src/Tizen.Multimedia/Player/StreamInfo.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/StreamInfo.cs index 937244b..092df0f 100644 --- a/src/Tizen.Multimedia/Player/StreamInfo.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/StreamInfo.cs @@ -15,6 +15,7 @@ */ using System; using System.Runtime.InteropServices; +using static Interop; namespace Tizen.Multimedia { @@ -150,7 +151,7 @@ namespace Tizen.Multimedia int size; IntPtr art; - Interop.Player.GetAlbumArt(Player.Handle, out art, out size). + NativePlayer.GetAlbumArt(Player.Handle, out art, out size). ThrowIfFailed("Failed to get the album art"); if (art == IntPtr.Zero || size == 0) @@ -172,7 +173,7 @@ namespace Tizen.Multimedia IntPtr videoPtr = IntPtr.Zero; try { - Interop.Player.GetCodecInfo(Player.Handle, out audioPtr, out videoPtr). + NativePlayer.GetCodecInfo(Player.Handle, out audioPtr, out videoPtr). ThrowIfFailed("Failed to get codec info"); if (audioInfo) @@ -188,8 +189,8 @@ namespace Tizen.Multimedia } finally { - Interop.Libc.Free(audioPtr); - Interop.Libc.Free(videoPtr); + LibcSupport.Free(audioPtr); + LibcSupport.Free(videoPtr); } } @@ -221,7 +222,7 @@ namespace Tizen.Multimedia Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); int duration = 0; - Interop.Player.GetDuration(Player.Handle, out duration). + NativePlayer.GetDuration(Player.Handle, out duration). ThrowIfFailed("Failed to get the duration"); Log.Info(PlayerLog.Tag, "get duration : " + duration); @@ -242,7 +243,7 @@ namespace Tizen.Multimedia int channels = 0; int bitRate = 0; - Interop.Player.GetAudioStreamInfo(Player.Handle, out sampleRate, out channels, out bitRate). + NativePlayer.GetAudioStreamInfo(Player.Handle, out sampleRate, out channels, out bitRate). ThrowIfFailed("Failed to get audio stream info"); // TODO should we check value is zero and return null? @@ -263,7 +264,7 @@ namespace Tizen.Multimedia int fps = 0; int bitRate = 0; - Interop.Player.GetVideoStreamInfo(Player.Handle, out fps, out bitRate). + NativePlayer.GetVideoStreamInfo(Player.Handle, out fps, out bitRate). ThrowIfFailed("Failed to get the video stream info"); // TODO should we check value is zero and return null? @@ -278,7 +279,7 @@ namespace Tizen.Multimedia int height = 0; int width = 0; - Interop.Player.GetVideoSize(Player.Handle, out width, out height). + NativePlayer.GetVideoSize(Player.Handle, out width, out height). ThrowIfFailed("Failed to get the video size"); return new Size(width, height); @@ -301,14 +302,14 @@ namespace Tizen.Multimedia try { - Interop.Player.GetContentInfo(Player.Handle, key, out ptr). + NativePlayer.GetContentInfo(Player.Handle, key, out ptr). ThrowIfFailed($"Failed to get the meta data with the key '{ key }'"); return Marshal.PtrToStringAnsi(ptr); } finally { - Interop.Libc.Free(ptr); + LibcSupport.Free(ptr); } } diff --git a/src/Tizen.Multimedia/Player/SubtitleUpdatedEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/SubtitleUpdatedEventArgs.cs similarity index 100% rename from src/Tizen.Multimedia/Player/SubtitleUpdatedEventArgs.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/SubtitleUpdatedEventArgs.cs diff --git a/src/Tizen.Multimedia/Player/VideoFrameDecodedEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/VideoFrameDecodedEventArgs.cs similarity index 100% rename from src/Tizen.Multimedia/Player/VideoFrameDecodedEventArgs.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/VideoFrameDecodedEventArgs.cs diff --git a/src/Tizen.Multimedia/Player/VideoStreamChangedEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/VideoStreamChangedEventArgs.cs similarity index 100% rename from src/Tizen.Multimedia/Player/VideoStreamChangedEventArgs.cs rename to src/Tizen.Multimedia.MediaPlayer/Player/VideoStreamChangedEventArgs.cs diff --git a/src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.csproj b/src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.csproj new file mode 100644 index 0000000..26f09b3 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.csproj @@ -0,0 +1,20 @@ + + + netstandard1.3 + True + True + Tizen.Multimedia.MediaPlayer.snk + true + True + False + + + + + + + + + + + diff --git a/src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.nuspec b/src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.nuspec new file mode 100644 index 0000000..706afb8 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.nuspec @@ -0,0 +1,18 @@ + + + + Tizen.Multimedia.MediaPlayer + $version$ + Samsung Electronics + false + https://www.apache.org/licenses/LICENSE-2.0 + https://www.tizen.org/ + https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png + © Samsung Electronics Co., Ltd All Rights Reserved + Provides the Multimedia Player API for Tizen.Net + + + + + + diff --git a/src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.snk b/src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.snk new file mode 100644 index 0000000..55ba2d7 Binary files /dev/null and b/src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.snk differ diff --git a/src/Tizen.Multimedia.Metadata/Interop/Interop.Libc.cs b/src/Tizen.Multimedia.Metadata/Interop/Interop.Libc.cs new file mode 100644 index 0000000..3ace080 --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/Interop/Interop.Libc.cs @@ -0,0 +1,11 @@ +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free")] + public static extern void Free(IntPtr userData); + } +} diff --git a/src/Tizen.Multimedia.Metadata/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.Metadata/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..df5d155 --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string MetadataEditor = "libcapi-media-metadata-editor.so"; + public const string MetadataExtractor = "libcapi-media-metadata-extractor.so"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Multimedia.Metadata/Interop/Interop.MetadataEditor.cs b/src/Tizen.Multimedia.Metadata/Interop/Interop.MetadataEditor.cs new file mode 100644 index 0000000..c187e7b --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/Interop/Interop.MetadataEditor.cs @@ -0,0 +1,36 @@ +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class MetadataEditor + { + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_create")] + internal static extern MetadataEditorError Create(out IntPtr handle); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_set_path")] + internal static extern MetadataEditorError SetPath(IntPtr handle, string path); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_destroy")] + internal static extern MetadataEditorError Destroy(IntPtr handle); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_get_metadata")] + internal static extern MetadataEditorError GetMetadata(IntPtr handle, MetadataEditorAttr attribute, out IntPtr value); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_set_metadata")] + internal static extern MetadataEditorError SetMetadata(IntPtr handle, MetadataEditorAttr attribute, string value); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_update_metadata")] + internal static extern MetadataEditorError UpdateMetadata(IntPtr handle); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_get_picture")] + internal static extern MetadataEditorError GetPicture(IntPtr handle, int index, out IntPtr picture, out int size, out IntPtr mimeType); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_append_picture")] + internal static extern MetadataEditorError AddPicture(IntPtr handle, string path); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_remove_picture")] + internal static extern MetadataEditorError RemovePicture(IntPtr handle, int index); + } +} diff --git a/src/Tizen.Multimedia.Metadata/Interop/Interop.MetadataExtractor.cs b/src/Tizen.Multimedia.Metadata/Interop/Interop.MetadataExtractor.cs new file mode 100644 index 0000000..54a393f --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/Interop/Interop.MetadataExtractor.cs @@ -0,0 +1,55 @@ +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class MetadataExtractor + { + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_create")] + internal static extern MetadataExtractorError Create(out IntPtr handle); + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_set_path")] + internal static extern MetadataExtractorError SetPath(IntPtr handle, string path); + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_set_buffer")] + internal static extern MetadataExtractorError SetBuffer(IntPtr handle, IntPtr buffer, int size); + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_destroy")] + internal static extern MetadataExtractorError Destroy(IntPtr handle); + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_get_metadata")] + private static extern MetadataExtractorError GetMetadata(IntPtr handle, MetadataExtractorAttr attribute, out IntPtr value); + + internal static string GetMetadata(IntPtr handle, MetadataExtractorAttr attr) + { + IntPtr valuePtr = IntPtr.Zero; + + try + { + var ret = GetMetadata(handle, attr, out valuePtr); + MetadataExtractorRetValidator.ThrowIfError(ret, "Failed to get value for " + attr); + return Marshal.PtrToStringAnsi(valuePtr); + } + finally + { + Libc.Free(valuePtr); + } + } + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_get_artwork")] + internal static extern MetadataExtractorError GetArtwork(IntPtr handle, out IntPtr artwork, + out int size, out IntPtr mimeType); + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_get_frame")] + internal static extern MetadataExtractorError GetFrame(IntPtr handle, out IntPtr frame, out int size); + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_get_synclyrics")] + internal static extern MetadataExtractorError GetSynclyrics(IntPtr handle, int index, + out uint timeStamp, out IntPtr lyrics); + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_get_frame_at_time")] + internal static extern MetadataExtractorError GetFrameAtTime(IntPtr handle, uint timeStamp, + bool isAccurate, out IntPtr frame, out int size); + } +} diff --git a/src/Tizen.Multimedia/MetadataEditor/MetadataEditor.cs b/src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditor.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MetadataEditor/MetadataEditor.cs rename to src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditor.cs diff --git a/src/Tizen.Multimedia/MetadataEditor/MetadataEditorAttr.cs b/src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditorAttr.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MetadataEditor/MetadataEditorAttr.cs rename to src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditorAttr.cs diff --git a/src/Tizen.Multimedia/MetadataEditor/MetadataEditorErrorFactory.cs b/src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditorErrorFactory.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MetadataEditor/MetadataEditorErrorFactory.cs rename to src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditorErrorFactory.cs diff --git a/src/Tizen.Multimedia/MetadataExtractor/Artwork.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/Artwork.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MetadataExtractor/Artwork.cs rename to src/Tizen.Multimedia.Metadata/MetadataExtractor/Artwork.cs diff --git a/src/Tizen.Multimedia/MetadataExtractor/Metadata.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/Metadata.cs similarity index 99% rename from src/Tizen.Multimedia/MetadataExtractor/Metadata.cs rename to src/Tizen.Multimedia.Metadata/MetadataExtractor/Metadata.cs index 818687d..977e84c 100644 --- a/src/Tizen.Multimedia/MetadataExtractor/Metadata.cs +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/Metadata.cs @@ -16,7 +16,7 @@ using System; using System.Diagnostics; -using static Tizen.Multimedia.Interop.MetadataExtractor; +using static Interop.MetadataExtractor; namespace Tizen.Multimedia { diff --git a/src/Tizen.Multimedia/MetadataExtractor/MetadataExtractor.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractor.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MetadataExtractor/MetadataExtractor.cs rename to src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractor.cs diff --git a/src/Tizen.Multimedia/MetadataExtractor/MetadataExtractorAttr.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorAttr.cs similarity index 100% rename from src/Tizen.Multimedia/MetadataExtractor/MetadataExtractorAttr.cs rename to src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorAttr.cs diff --git a/src/Tizen.Multimedia/MetadataExtractor/MetadataExtractorError.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorError.cs similarity index 100% rename from src/Tizen.Multimedia/MetadataExtractor/MetadataExtractorError.cs rename to src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorError.cs diff --git a/src/Tizen.Multimedia/MetadataExtractor/Synclyrics.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/SyncLyrics.cs old mode 100755 new mode 100644 similarity index 99% rename from src/Tizen.Multimedia/MetadataExtractor/Synclyrics.cs rename to src/Tizen.Multimedia.Metadata/MetadataExtractor/SyncLyrics.cs index c9f78b5..d5c971d --- a/src/Tizen.Multimedia/MetadataExtractor/Synclyrics.cs +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/SyncLyrics.cs @@ -20,7 +20,7 @@ namespace Tizen.Multimedia /// Represents synchronized lyrics information of media. /// public class SyncLyrics - { + { /// /// Initialize a new instance of the MetadataExtractor class with the specified lyrics and timestamp. /// diff --git a/src/Tizen.Multimedia/Common/ObjectDescriptionBuilder.cs b/src/Tizen.Multimedia.Metadata/ObjectDescriptionBuilder.cs similarity index 100% rename from src/Tizen.Multimedia/Common/ObjectDescriptionBuilder.cs rename to src/Tizen.Multimedia.Metadata/ObjectDescriptionBuilder.cs diff --git a/src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.csproj b/src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.csproj new file mode 100644 index 0000000..a66db89 --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.csproj @@ -0,0 +1,16 @@ + + + netstandard1.3 + True + True + Tizen.Multimedia.Metadata.snk + true + True + False + + + + + + + diff --git a/src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.nuspec b/src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.nuspec new file mode 100644 index 0000000..566d8af --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.nuspec @@ -0,0 +1,17 @@ + + + + Tizen.Multimedia.Metadata + $version$ + Samsung Electronics + false + https://www.apache.org/licenses/LICENSE-2.0 + https://www.tizen.org/ + https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png + © Samsung Electronics Co., Ltd All Rights Reserved + Provides the Multimedia Metadata API for Tizen.Net + + + + + diff --git a/src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.snk b/src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.snk new file mode 100644 index 0000000..096592b Binary files /dev/null and b/src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.snk differ diff --git a/src/Tizen.Multimedia/Interop/Interop.ErrorCode.cs b/src/Tizen.Multimedia.Radio/Interop/Interop.ErrorCode.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Interop/Interop.ErrorCode.cs rename to src/Tizen.Multimedia.Radio/Interop/Interop.ErrorCode.cs diff --git a/src/Tizen.Multimedia.Radio/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.Radio/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..f237099 --- /dev/null +++ b/src/Tizen.Multimedia.Radio/Interop/Interop.Libraries.cs @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + internal static partial class Interop + { + internal static partial class Libraries + { + public const string Radio = "libcapi-media-radio.so.0"; + } + } +} diff --git a/src/Tizen.Multimedia/Interop/Interop.Radio.cs b/src/Tizen.Multimedia.Radio/Interop/Interop.Radio.cs similarity index 100% rename from src/Tizen.Multimedia/Interop/Interop.Radio.cs rename to src/Tizen.Multimedia.Radio/Interop/Interop.Radio.cs diff --git a/src/Tizen.Multimedia/Interop/Interop.SafeMultimediaHandle.cs b/src/Tizen.Multimedia.Radio/Interop/Interop.SafeMultimediaHandle.cs similarity index 100% rename from src/Tizen.Multimedia/Interop/Interop.SafeMultimediaHandle.cs rename to src/Tizen.Multimedia.Radio/Interop/Interop.SafeMultimediaHandle.cs diff --git a/src/Tizen.Multimedia/Radio/Radio.cs b/src/Tizen.Multimedia.Radio/Radio/Radio.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Radio/Radio.cs rename to src/Tizen.Multimedia.Radio/Radio/Radio.cs diff --git a/src/Tizen.Multimedia/Radio/RadioInterruptedEventArgs.cs b/src/Tizen.Multimedia.Radio/Radio/RadioInterruptedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Radio/RadioInterruptedEventArgs.cs rename to src/Tizen.Multimedia.Radio/Radio/RadioInterruptedEventArgs.cs diff --git a/src/Tizen.Multimedia/Radio/RadioInterruptedReason.cs b/src/Tizen.Multimedia.Radio/Radio/RadioInterruptedReason.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Radio/RadioInterruptedReason.cs rename to src/Tizen.Multimedia.Radio/Radio/RadioInterruptedReason.cs diff --git a/src/Tizen.Multimedia/Radio/RadioState.cs b/src/Tizen.Multimedia.Radio/Radio/RadioState.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Radio/RadioState.cs rename to src/Tizen.Multimedia.Radio/Radio/RadioState.cs diff --git a/src/Tizen.Multimedia/Radio/ScanUpdatedEventArgs.cs b/src/Tizen.Multimedia.Radio/Radio/ScanUpdatedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Radio/ScanUpdatedEventArgs.cs rename to src/Tizen.Multimedia.Radio/Radio/ScanUpdatedEventArgs.cs diff --git a/src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.csproj b/src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.csproj new file mode 100644 index 0000000..61fb22d --- /dev/null +++ b/src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.csproj @@ -0,0 +1,16 @@ + + + netstandard1.3 + True + True + Tizen.Multimedia.Radio.snk + true + True + False + + + + + + + diff --git a/src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.nuspec b/src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.nuspec new file mode 100644 index 0000000..f5162ef --- /dev/null +++ b/src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.nuspec @@ -0,0 +1,17 @@ + + + + Tizen.Multimedia.Radio + $version$ + Samsung Electronics + false + https://www.apache.org/licenses/LICENSE-2.0 + https://www.tizen.org/ + https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png + © Samsung Electronics Co., Ltd All Rights Reserved + Provides the Multimedia Radio API for Tizen.Net + + + + + diff --git a/src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.snk b/src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.snk new file mode 100644 index 0000000..82e7829 Binary files /dev/null and b/src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.snk differ diff --git a/src/Tizen.Multimedia.Recorder/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.Recorder/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..02fd9df --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Recorder = "libcapi-media-recorder.so.0"; + } +} diff --git a/src/Tizen.Multimedia.Recorder/Interop/Interop.Recorder.cs b/src/Tizen.Multimedia.Recorder/Interop/Interop.Recorder.cs new file mode 100644 index 0000000..b2f7ab8 --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Interop/Interop.Recorder.cs @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class Recorder + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecorderErrorCallback(RecorderErrorCode error, RecorderState current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void InterruptedCallback(RecorderPolicy policy, RecorderState previous, RecorderState current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecordingLimitReachedCallback(RecordingLimitType type, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecordingProgressCallback(ulong elapsedTime, ulong fileSize, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void AudioStreamCallback(IntPtr stream, int size, AudioSampleType type, int channel, uint timeStamp, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void StatechangedCallback(RecorderState previous, RecorderState current, bool byPolicy, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MuxedStreamCallback(IntPtr stream, int size, ulong offset, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_create_audiorecorder")] + internal static extern RecorderError Create(out IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_create_videorecorder")] + internal static extern RecorderError CreateVideo(IntPtr cameraHandle, out IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_destroy")] + internal static extern RecorderError Destroy(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_prepare")] + internal static extern RecorderError Prepare(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unprepare")] + internal static extern RecorderError Unprepare(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_start")] + internal static extern RecorderError Start(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_pause")] + internal static extern RecorderError Pause(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_commit")] + internal static extern RecorderError Commit(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_cancel")] + internal static extern RecorderError Cancel(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_state")] + internal static extern RecorderError GetState(IntPtr handle, out RecorderState state); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_sound_stream_info")] + internal static extern RecorderError SetAudioStreamPolicy(IntPtr handle, IntPtr streamInfoHandle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_error_cb")] + internal static extern RecorderError SetErrorCallback(IntPtr handle, RecorderErrorCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_error_cb")] + internal static extern RecorderError UnsetErrorCallback(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_interrupted_cb")] + internal static extern RecorderError SetInterruptedCallback(IntPtr handle, InterruptedCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_interrupted_cb")] + internal static extern RecorderError UnsetInterruptedCallback(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_state_changed_cb")] + internal static extern RecorderError SetStateChangedCallback(IntPtr handle, StatechangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_state_changed_cb")] + internal static extern RecorderError UnsetStateChangedCallback(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_recording_status_cb")] + internal static extern RecorderError SetRecordingProgressCallback(IntPtr handle, RecordingProgressCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_recording_status_cb")] + internal static extern RecorderError UnsetRecordingProgressCallback(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_audio_stream_cb")] + internal static extern RecorderError SetAudioStreamCallback(IntPtr handle, AudioStreamCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_audio_stream_cb")] + internal static extern RecorderError UnsetAudioStreamCallback(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_recording_limit_reached_cb")] + internal static extern RecorderError SetLimitReachedCallback(IntPtr handle, RecordingLimitReachedCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_recording_limit_reached_cb")] + internal static extern RecorderError UnsetLimitReachedCallback(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_muxed_stream_cb")] + internal static extern RecorderError SetMuxedStreamCallback(IntPtr handle, MuxedStreamCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_muxed_stream_cb")] + internal static extern RecorderError UnsetMuxedStreamCallback(IntPtr handle); + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Recorder/Interop/Interop.RecorderFeatures.cs b/src/Tizen.Multimedia.Recorder/Interop/Interop.RecorderFeatures.cs new file mode 100644 index 0000000..77d1ec3 --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Interop/Interop.RecorderFeatures.cs @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class RecorderFeatures + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool VideoResolutionCallback(int width, int height, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool FileFormatCallback(RecorderFileFormat format, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AudioEncoderCallback(RecorderAudioCodec codec, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool VideoEncoderCallback(RecorderVideoCodec codec, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_file_format")] + internal static extern RecorderError FileFormats(IntPtr handle, FileFormatCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_audio_encoder")] + internal static extern RecorderError AudioEncoders(IntPtr handle, AudioEncoderCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_video_encoder")] + internal static extern RecorderError VideoEncoders(IntPtr handle, VideoEncoderCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_video_resolution")] + internal static extern RecorderError VideoResolution(IntPtr handle, VideoResolutionCallback callback, IntPtr userData); + } +} diff --git a/src/Tizen.Multimedia.Recorder/Interop/Interop.RecorderSettings.cs b/src/Tizen.Multimedia.Recorder/Interop/Interop.RecorderSettings.cs new file mode 100644 index 0000000..f0daf01 --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Interop/Interop.RecorderSettings.cs @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class RecorderSettings + { + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_channel")] + internal static extern RecorderError GetAudioChannel(IntPtr handle, out int channelCount); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_channel")] + internal static extern RecorderError SetAudioChannel(IntPtr handle, int channelCount); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_device")] + internal static extern RecorderError GetAudioDevice(IntPtr handle, out RecorderAudioDevice device); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_device")] + internal static extern RecorderError SetAudioDevice(IntPtr handle, RecorderAudioDevice device); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_audio_level")] + internal static extern RecorderError GetAudioLevel(IntPtr handle, out double dB); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_samplerate")] + internal static extern RecorderError GetAudioSampleRate(IntPtr handle, out int sampleRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_samplerate")] + internal static extern RecorderError SetAudioSampleRate(IntPtr handle, int sampleRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_encoder_bitrate")] + internal static extern RecorderError GetAudioEncoderBitrate(IntPtr handle, out int bitRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_encoder_bitrate")] + internal static extern RecorderError SetAudioEncoderBitrate(IntPtr handle, int bitRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_video_encoder_bitrate")] + internal static extern RecorderError GetVideoEncoderBitrate(IntPtr handle, out int bitRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_video_encoder_bitrate")] + internal static extern RecorderError SetVideoEncoderBitrate(IntPtr handle, int bitRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_audio_encoder")] + internal static extern RecorderError GetAudioEncoder(IntPtr handle, out RecorderAudioCodec codec); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_audio_encoder")] + internal static extern RecorderError SetAudioEncoder(IntPtr handle, RecorderAudioCodec codec); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_video_encoder")] + internal static extern RecorderError GetVideoEncoder(IntPtr handle, out RecorderVideoCodec codec); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_video_encoder")] + internal static extern RecorderError SetVideoEncoder(IntPtr handle, RecorderVideoCodec codec); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_file_format")] + internal static extern RecorderError GetFileFormat(IntPtr handle, out RecorderFileFormat format); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_file_format")] + internal static extern RecorderError SetFileFormat(IntPtr handle, RecorderFileFormat format); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_filename")] + internal static extern RecorderError GetFileName(IntPtr handle, out IntPtr path); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_filename")] + internal static extern RecorderError SetFileName(IntPtr handle, string path); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_size_limit")] + internal static extern RecorderError GetSizeLimit(IntPtr handle, out int kbyte); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_size_limit")] + internal static extern RecorderError SetSizeLimit(IntPtr handle, int kbyte); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_time_limit")] + internal static extern RecorderError GetTimeLimit(IntPtr handle, out int second); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_time_limit")] + internal static extern RecorderError SetTimeLimit(IntPtr handle, int second); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_is_muted")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool GetMute(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_mute")] + internal static extern RecorderError SetMute(IntPtr handle, bool enable); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_recording_motion_rate")] + internal static extern RecorderError GetMotionRate(IntPtr handle, out double motionRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_recording_motion_rate")] + internal static extern RecorderError SetMotionRate(IntPtr handle, double motionRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_orientation_tag")] + internal static extern RecorderError GetOrientationTag(IntPtr handle, out RecorderOrientation orientation); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_orientation_tag")] + internal static extern RecorderError SetOrientationTag(IntPtr handle, RecorderOrientation orientation); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_video_resolution")] + internal static extern RecorderError GetVideoResolution(IntPtr handle, out int width, out int height); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_video_resolution")] + internal static extern RecorderError SetVideoResolution(IntPtr handle, int width, int height); + } +} diff --git a/src/Tizen.Multimedia/Recorder/AudioStreamDeliveredEventArgs.cs b/src/Tizen.Multimedia.Recorder/Recorder/AudioStreamDeliveredEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Recorder/AudioStreamDeliveredEventArgs.cs rename to src/Tizen.Multimedia.Recorder/Recorder/AudioStreamDeliveredEventArgs.cs diff --git a/src/Tizen.Multimedia/Recorder/MuxedStreamEventArgs.cs b/src/Tizen.Multimedia.Recorder/Recorder/MuxedStreamEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Recorder/MuxedStreamEventArgs.cs rename to src/Tizen.Multimedia.Recorder/Recorder/MuxedStreamEventArgs.cs diff --git a/src/Tizen.Multimedia/Recorder/Recorder.cs b/src/Tizen.Multimedia.Recorder/Recorder/Recorder.cs old mode 100755 new mode 100644 similarity index 86% rename from src/Tizen.Multimedia/Recorder/Recorder.cs rename to src/Tizen.Multimedia.Recorder/Recorder/Recorder.cs index f47e22e..256f059 --- a/src/Tizen.Multimedia/Recorder/Recorder.cs +++ b/src/Tizen.Multimedia.Recorder/Recorder/Recorder.cs @@ -15,10 +15,9 @@ */ using System; -using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using System.Runtime.InteropServices; +using Native = Interop.Recorder; namespace Tizen.Multimedia { @@ -49,7 +48,7 @@ namespace Tizen.Multimedia /// public Recorder() { - RecorderErrorFactory.ThrowIfError(Interop.Recorder.Create(out _handle), + RecorderErrorFactory.ThrowIfError(Native.Create(out _handle), "Failed to create Audio recorder"); Feature = new RecorderFeatures(this); @@ -71,7 +70,7 @@ namespace Tizen.Multimedia /// public Recorder(Camera camera) { - RecorderErrorFactory.ThrowIfError(Interop.Recorder.CreateVideo(camera.GetHandle(), out _handle), + RecorderErrorFactory.ThrowIfError(Native.CreateVideo(camera.Handle, out _handle), "Failed to create Video recorder."); Feature = new RecorderFeatures(this); @@ -116,7 +115,7 @@ namespace Tizen.Multimedia } if (_handle != IntPtr.Zero) { - Interop.Recorder.Destroy(_handle); + Native.Destroy(_handle); _handle = IntPtr.Zero; } _disposed = true; @@ -158,43 +157,43 @@ namespace Tizen.Multimedia /// Event that occurs when an error occurs during recorder operation. /// public event EventHandler ErrorOccurred; - private Interop.Recorder.RecorderErrorCallback _errorOccuredCallback; + private Native.RecorderErrorCallback _errorOccuredCallback; /// /// Event that occurs when recorder is interrupted. /// public event EventHandler Interrupted; - private Interop.Recorder.InterruptedCallback _interruptedCallback; + private Native.InterruptedCallback _interruptedCallback; /// /// This event occurs when recorder state is changed. /// public event EventHandler StateChanged; - private Interop.Recorder.StatechangedCallback _stateChangedCallback; + private Native.StatechangedCallback _stateChangedCallback; /// /// Event that occurs when recording information changes. /// public event EventHandler RecordingProgress; - private Interop.Recorder.RecordingProgressCallback _recordingProgressCallback; + private Native.RecordingProgressCallback _recordingProgressCallback; /// /// Event that occurs when audio stream data is being delivered. /// public event EventHandler AudioStreamDelivered; - private Interop.Recorder.AudioStreamCallback _audioStreamCallback; + private Native.AudioStreamCallback _audioStreamCallback; /// /// Event that occurs when recording limit is reached. /// public event EventHandler RecordingLimitReached; - private Interop.Recorder.RecordingLimitReachedCallback _recordingLimitReachedCallback; + private Native.RecordingLimitReachedCallback _recordingLimitReachedCallback; /// /// Event that occurs when muxed stream data is being delivered. /// public event EventHandler MuxedStreamDelivered; - private Interop.Recorder.MuxedStreamCallback _muxedStreamCallback; + private Native.MuxedStreamCallback _muxedStreamCallback; #endregion EventHandlers #region Properties @@ -221,7 +220,7 @@ namespace Tizen.Multimedia RecorderState val = 0; - RecorderErrorFactory.ThrowIfError(Interop.Recorder.GetState(_handle, out val), + RecorderErrorFactory.ThrowIfError(Native.GetState(_handle, out val), "Failed to get recorder state."); return val; @@ -249,7 +248,7 @@ namespace Tizen.Multimedia { ValidateState(RecorderState.Created); - RecorderErrorFactory.ThrowIfError(Interop.Recorder.Prepare(_handle), + RecorderErrorFactory.ThrowIfError(Native.Prepare(_handle), "Failed to prepare media recorder for recording"); SetState(RecorderState.Ready); @@ -270,7 +269,7 @@ namespace Tizen.Multimedia { ValidateState(RecorderState.Ready); - RecorderErrorFactory.ThrowIfError(Interop.Recorder.Unprepare(_handle), + RecorderErrorFactory.ThrowIfError(Native.Unprepare(_handle), "Failed to reset the media recorder"); SetState(RecorderState.Created); @@ -297,7 +296,7 @@ namespace Tizen.Multimedia { ValidateState(RecorderState.Ready); - RecorderErrorFactory.ThrowIfError(Interop.Recorder.Start(_handle), + RecorderErrorFactory.ThrowIfError(Native.Start(_handle), "Failed to start the media recorder"); SetState(RecorderState.Recording); @@ -321,7 +320,7 @@ namespace Tizen.Multimedia { ValidateState(RecorderState.Recording); - RecorderErrorFactory.ThrowIfError(Interop.Recorder.Pause(_handle), + RecorderErrorFactory.ThrowIfError(Native.Pause(_handle), "Failed to pause the media recorder"); SetState(RecorderState.Paused); @@ -342,7 +341,7 @@ namespace Tizen.Multimedia { ValidateState(RecorderState.Recording, RecorderState.Paused); - RecorderErrorFactory.ThrowIfError(Interop.Recorder.Commit(_handle), + RecorderErrorFactory.ThrowIfError(Native.Commit(_handle), "Failed to save the recorded content"); SetState(RecorderState.Ready); @@ -364,7 +363,7 @@ namespace Tizen.Multimedia { ValidateState(RecorderState.Recording, RecorderState.Paused); - RecorderErrorFactory.ThrowIfError(Interop.Recorder.Cancel(_handle), + RecorderErrorFactory.ThrowIfError(Native.Cancel(_handle), "Failed to cancel the recording"); SetState(RecorderState.Ready); @@ -379,7 +378,7 @@ namespace Tizen.Multimedia { ValidateNotDisposed(); - RecorderErrorFactory.ThrowIfError(Interop.Recorder.SetAudioStreamPolicy(_handle, policy.Handle), + RecorderErrorFactory.ThrowIfError(Native.SetAudioStreamPolicy(_handle, policy.Handle), "Failed to set audio stream policy"); } #endregion Methods @@ -402,7 +401,7 @@ namespace Tizen.Multimedia { ErrorOccurred?.Invoke(this, new RecordingErrorOccurredEventArgs(error, current)); }; - RecorderErrorFactory.ThrowIfError(Interop.Recorder.SetErrorCallback(_handle, _errorOccuredCallback, IntPtr.Zero), + RecorderErrorFactory.ThrowIfError(Native.SetErrorCallback(_handle, _errorOccuredCallback, IntPtr.Zero), "Setting Error callback failed"); } @@ -412,7 +411,7 @@ namespace Tizen.Multimedia { Interrupted?.Invoke(this, new RecorderInterruptedEventArgs(policy, previous, current)); }; - RecorderErrorFactory.ThrowIfError(Interop.Recorder.SetInterruptedCallback(_handle, _interruptedCallback, IntPtr.Zero), + RecorderErrorFactory.ThrowIfError(Native.SetInterruptedCallback(_handle, _interruptedCallback, IntPtr.Zero), "Setting Interrupted callback failed"); } @@ -424,7 +423,7 @@ namespace Tizen.Multimedia Log.Info(RecorderLog.Tag, "Recorder state changed " + previous.ToString() + " -> " + current.ToString()); StateChanged?.Invoke(this, new RecorderStateChangedEventArgs(previous, current, byPolicy)); }; - RecorderErrorFactory.ThrowIfError(Interop.Recorder.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero), + RecorderErrorFactory.ThrowIfError(Native.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero), "Setting state changed callback failed"); } @@ -434,7 +433,7 @@ namespace Tizen.Multimedia { RecordingProgress?.Invoke(this, new RecordingProgressEventArgs(elapsedTime, fileSize)); }; - RecorderErrorFactory.ThrowIfError(Interop.Recorder.SetRecordingProgressCallback(_handle, _recordingProgressCallback, IntPtr.Zero), + RecorderErrorFactory.ThrowIfError(Native.SetRecordingProgressCallback(_handle, _recordingProgressCallback, IntPtr.Zero), "Setting status changed callback failed"); } @@ -444,7 +443,7 @@ namespace Tizen.Multimedia { AudioStreamDelivered?.Invoke(this, new AudioStreamDeliveredEventArgs(stream, streamSize, type, channel, recordingTime)); }; - RecorderErrorFactory.ThrowIfError(Interop.Recorder.SetAudioStreamCallback(_handle, _audioStreamCallback, IntPtr.Zero), + RecorderErrorFactory.ThrowIfError(Native.SetAudioStreamCallback(_handle, _audioStreamCallback, IntPtr.Zero), "Setting audiostream callback failed"); } @@ -454,7 +453,7 @@ namespace Tizen.Multimedia { RecordingLimitReached?.Invoke(this, new RecordingLimitReachedEventArgs(type)); }; - RecorderErrorFactory.ThrowIfError(Interop.Recorder.SetLimitReachedCallback(_handle, _recordingLimitReachedCallback, IntPtr.Zero), + RecorderErrorFactory.ThrowIfError(Native.SetLimitReachedCallback(_handle, _recordingLimitReachedCallback, IntPtr.Zero), "Setting limit reached callback failed"); } @@ -464,7 +463,7 @@ namespace Tizen.Multimedia { MuxedStreamDelivered?.Invoke(this, new MuxedStreamDeliveredEventArgs(stream, streamSize, offset)); }; - RecorderErrorFactory.ThrowIfError(Interop.Recorder.SetMuxedStreamCallback(_handle, _muxedStreamCallback, IntPtr.Zero), + RecorderErrorFactory.ThrowIfError(Native.SetMuxedStreamCallback(_handle, _muxedStreamCallback, IntPtr.Zero), "Setting muxed stream callback failed"); } #endregion Callback registrations diff --git a/src/Tizen.Multimedia/Recorder/RecorderEnums.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecorderEnums.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Recorder/RecorderEnums.cs rename to src/Tizen.Multimedia.Recorder/Recorder/RecorderEnums.cs diff --git a/src/Tizen.Multimedia/Recorder/RecorderErrorFactory.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecorderErrorFactory.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Recorder/RecorderErrorFactory.cs rename to src/Tizen.Multimedia.Recorder/Recorder/RecorderErrorFactory.cs diff --git a/src/Tizen.Multimedia/Recorder/RecorderFeatures.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecorderFeatures.cs old mode 100755 new mode 100644 similarity index 84% rename from src/Tizen.Multimedia/Recorder/RecorderFeatures.cs rename to src/Tizen.Multimedia.Recorder/Recorder/RecorderFeatures.cs index ed0d010..afe3f46 --- a/src/Tizen.Multimedia/Recorder/RecorderFeatures.cs +++ b/src/Tizen.Multimedia.Recorder/Recorder/RecorderFeatures.cs @@ -17,6 +17,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Native = Interop.RecorderFeatures; namespace Tizen.Multimedia { @@ -55,12 +56,12 @@ namespace Tizen.Multimedia { _fileFormats = new List(); - Interop.RecorderFeatures.FileFormatCallback callback = (RecorderFileFormat format, IntPtr userData) => + Native.FileFormatCallback callback = (RecorderFileFormat format, IntPtr userData) => { _fileFormats.Add(format); return true; }; - RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.FileFormats(_recorder.GetHandle(), callback, IntPtr.Zero), + RecorderErrorFactory.ThrowIfError(Native.FileFormats(_recorder.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported fileformats"); } catch @@ -91,12 +92,12 @@ namespace Tizen.Multimedia { _audioCodec = new List(); - Interop.RecorderFeatures.AudioEncoderCallback callback = (RecorderAudioCodec codec, IntPtr userData) => + Native.AudioEncoderCallback callback = (RecorderAudioCodec codec, IntPtr userData) => { _audioCodec.Add(codec); return true; }; - RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.AudioEncoders(_recorder.GetHandle(), callback, IntPtr.Zero), + RecorderErrorFactory.ThrowIfError(Native.AudioEncoders(_recorder.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported audio encoders"); } catch @@ -128,12 +129,12 @@ namespace Tizen.Multimedia { _videoCodec = new List(); - Interop.RecorderFeatures.VideoEncoderCallback callback = (RecorderVideoCodec codec, IntPtr userData) => + Native.VideoEncoderCallback callback = (RecorderVideoCodec codec, IntPtr userData) => { _videoCodec.Add(codec); return true; }; - RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.VideoEncoders(_recorder.GetHandle(), callback, IntPtr.Zero), + RecorderErrorFactory.ThrowIfError(Native.VideoEncoders(_recorder.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported video encoders"); } catch @@ -165,12 +166,12 @@ namespace Tizen.Multimedia { _videoResolution = new List(); - Interop.RecorderFeatures.VideoResolutionCallback callback = (int width, int height, IntPtr userData) => + Native.VideoResolutionCallback callback = (int width, int height, IntPtr userData) => { _videoResolution.Add(new Size(width, height)); return true; }; - RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.VideoResolution(_recorder.GetHandle(), callback, IntPtr.Zero), + RecorderErrorFactory.ThrowIfError(Native.VideoResolution(_recorder.GetHandle(), callback, IntPtr.Zero), "Failed to get the supported video resolutions."); } catch diff --git a/src/Tizen.Multimedia/Recorder/RecorderInterruptedEventArgs.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecorderInterruptedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Recorder/RecorderInterruptedEventArgs.cs rename to src/Tizen.Multimedia.Recorder/Recorder/RecorderInterruptedEventArgs.cs diff --git a/src/Tizen.Multimedia/Recorder/RecorderSettings.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecorderSettings.cs old mode 100755 new mode 100644 similarity index 74% rename from src/Tizen.Multimedia/Recorder/RecorderSettings.cs rename to src/Tizen.Multimedia.Recorder/Recorder/RecorderSettings.cs index 0f6192c..5f50b94 --- a/src/Tizen.Multimedia/Recorder/RecorderSettings.cs +++ b/src/Tizen.Multimedia.Recorder/Recorder/RecorderSettings.cs @@ -18,6 +18,7 @@ using System; using System.Linq; using System.Runtime.InteropServices; using Tizen.Internals.Errors; +using Native = Interop.RecorderSettings; namespace Tizen.Multimedia { @@ -48,7 +49,7 @@ namespace Tizen.Multimedia { int val = 0; - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.GetAudioChannel(_recorder.GetHandle(), out val), + RecorderErrorFactory.ThrowIfError(Native.GetAudioChannel(_recorder.GetHandle(), out val), "Failed to get audio channel."); return val; @@ -56,7 +57,7 @@ namespace Tizen.Multimedia set { - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetAudioChannel(_recorder.GetHandle(), value), + RecorderErrorFactory.ThrowIfError(Native.SetAudioChannel(_recorder.GetHandle(), value), "Failed to set audio channel"); } } @@ -72,7 +73,7 @@ namespace Tizen.Multimedia { RecorderAudioDevice val = 0; - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.GetAudioDevice(_recorder.GetHandle(), out val), + RecorderErrorFactory.ThrowIfError(Native.GetAudioDevice(_recorder.GetHandle(), out val), "Failed to get audio device."); return val; @@ -80,7 +81,7 @@ namespace Tizen.Multimedia set { - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetAudioDevice(_recorder.GetHandle(), value), + RecorderErrorFactory.ThrowIfError(Native.SetAudioDevice(_recorder.GetHandle(), value), "Failed to set audio device."); } } @@ -98,7 +99,7 @@ namespace Tizen.Multimedia { double level = 0; - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.GetAudioLevel(_recorder.GetHandle(), out level), + RecorderErrorFactory.ThrowIfError(Native.GetAudioLevel(_recorder.GetHandle(), out level), "Failed to get Audio level."); return level; @@ -115,7 +116,7 @@ namespace Tizen.Multimedia { int val = 0; - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.GetAudioSampleRate(_recorder.GetHandle(), out val), + RecorderErrorFactory.ThrowIfError(Native.GetAudioSampleRate(_recorder.GetHandle(), out val), "Failed to get audio sample rate."); return val; @@ -123,7 +124,7 @@ namespace Tizen.Multimedia set { - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetAudioSampleRate(_recorder.GetHandle(), value), + RecorderErrorFactory.ThrowIfError(Native.SetAudioSampleRate(_recorder.GetHandle(), value), "Failed to set audio sample rate."); } } @@ -138,7 +139,7 @@ namespace Tizen.Multimedia { int val = 0; - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.GetAudioEncoderBitrate(_recorder.GetHandle(), out val), + RecorderErrorFactory.ThrowIfError(Native.GetAudioEncoderBitrate(_recorder.GetHandle(), out val), "Failed to get audio bitrate."); return val; @@ -146,7 +147,7 @@ namespace Tizen.Multimedia set { - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetAudioEncoderBitrate(_recorder.GetHandle(), value), + RecorderErrorFactory.ThrowIfError(Native.SetAudioEncoderBitrate(_recorder.GetHandle(), value), "Failed to set audio bitrate"); } } @@ -161,7 +162,7 @@ namespace Tizen.Multimedia { int val = 0; - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.GetVideoEncoderBitrate(_recorder.GetHandle(), out val), + RecorderErrorFactory.ThrowIfError(Native.GetVideoEncoderBitrate(_recorder.GetHandle(), out val), "Failed to get video bitrate."); return val; @@ -169,7 +170,7 @@ namespace Tizen.Multimedia set { - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetVideoEncoderBitrate(_recorder.GetHandle(), value), + RecorderErrorFactory.ThrowIfError(Native.SetVideoEncoderBitrate(_recorder.GetHandle(), value), "Failed to set video bitrate"); } } @@ -185,7 +186,7 @@ namespace Tizen.Multimedia { RecorderAudioCodec val = 0; - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.GetAudioEncoder(_recorder.GetHandle(), out val), + RecorderErrorFactory.ThrowIfError(Native.GetAudioEncoder(_recorder.GetHandle(), out val), "Failed to get audio codec"); return val; @@ -193,7 +194,7 @@ namespace Tizen.Multimedia set { - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetAudioEncoder(_recorder.GetHandle(), value), + RecorderErrorFactory.ThrowIfError(Native.SetAudioEncoder(_recorder.GetHandle(), value), "Failed to set audio codec"); } } @@ -209,7 +210,7 @@ namespace Tizen.Multimedia { RecorderVideoCodec val = 0; - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.GetVideoEncoder(_recorder.GetHandle(), out val), + RecorderErrorFactory.ThrowIfError(Native.GetVideoEncoder(_recorder.GetHandle(), out val), "Failed to get video codec"); return val; @@ -217,7 +218,7 @@ namespace Tizen.Multimedia set { - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetVideoEncoder(_recorder.GetHandle(), value), + RecorderErrorFactory.ThrowIfError(Native.SetVideoEncoder(_recorder.GetHandle(), value), "Failed to set video codec"); } } @@ -233,7 +234,7 @@ namespace Tizen.Multimedia { RecorderFileFormat val = 0; - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.GetFileFormat(_recorder.GetHandle(), out val), + RecorderErrorFactory.ThrowIfError(Native.GetFileFormat(_recorder.GetHandle(), out val), "Failed to get file format."); return val; @@ -241,7 +242,7 @@ namespace Tizen.Multimedia set { - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetFileFormat(_recorder.GetHandle(), value), + RecorderErrorFactory.ThrowIfError(Native.SetFileFormat(_recorder.GetHandle(), value), "Failed to set file format"); } } @@ -259,19 +260,19 @@ namespace Tizen.Multimedia get { IntPtr val; - RecorderError ret = Interop.RecorderSettings.GetFileName(_recorder.GetHandle(), out val); + RecorderError ret = Native.GetFileName(_recorder.GetHandle(), out val); if (ret != RecorderError.None) { Log.Error(RecorderLog.Tag, "Failed to get filepath, " + (RecorderError)ret); } string result = Marshal.PtrToStringAnsi(val); - Interop.Libc.Free(val); + LibcSupport.Free(val); return result; } set { - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetFileName(_recorder.GetHandle(), value), + RecorderErrorFactory.ThrowIfError(Native.SetFileName(_recorder.GetHandle(), value), "Failed to set filepath"); } } @@ -292,7 +293,7 @@ namespace Tizen.Multimedia { int val = 0; - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.GetSizeLimit(_recorder.GetHandle(), out val), + RecorderErrorFactory.ThrowIfError(Native.GetSizeLimit(_recorder.GetHandle(), out val), "Failed to get size limit."); return val; @@ -300,7 +301,7 @@ namespace Tizen.Multimedia set { - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetSizeLimit(_recorder.GetHandle(), value), + RecorderErrorFactory.ThrowIfError(Native.SetSizeLimit(_recorder.GetHandle(), value), "Failed to set size limit"); } } @@ -321,7 +322,7 @@ namespace Tizen.Multimedia { int val = 0; - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.GetTimeLimit(_recorder.GetHandle(), out val), + RecorderErrorFactory.ThrowIfError(Native.GetTimeLimit(_recorder.GetHandle(), out val), "Failed to get time limit."); return val; @@ -329,7 +330,7 @@ namespace Tizen.Multimedia set { - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetTimeLimit(_recorder.GetHandle(), value), + RecorderErrorFactory.ThrowIfError(Native.SetTimeLimit(_recorder.GetHandle(), value), "Failed to set time limit."); } } @@ -342,12 +343,12 @@ namespace Tizen.Multimedia { get { - return Interop.RecorderSettings.GetMute(_recorder.GetHandle()); + return Native.GetMute(_recorder.GetHandle()); } set { - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetMute(_recorder.GetHandle(), value), + RecorderErrorFactory.ThrowIfError(Native.SetMute(_recorder.GetHandle(), value), "Failed to set mute"); } } @@ -367,7 +368,7 @@ namespace Tizen.Multimedia { double val = 0.0; - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.GetMotionRate(_recorder.GetHandle(), out val), + RecorderErrorFactory.ThrowIfError(Native.GetMotionRate(_recorder.GetHandle(), out val), "Failed to get video motion rate."); return val; @@ -375,7 +376,7 @@ namespace Tizen.Multimedia set { - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetMotionRate(_recorder.GetHandle(), value), + RecorderErrorFactory.ThrowIfError(Native.SetMotionRate(_recorder.GetHandle(), value), "Failed to set video motion rate"); } } @@ -391,7 +392,7 @@ namespace Tizen.Multimedia { RecorderOrientation val = 0; - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.GetOrientationTag(_recorder.GetHandle(), out val), + RecorderErrorFactory.ThrowIfError(Native.GetOrientationTag(_recorder.GetHandle(), out val), "Failed to get recorder orientation."); return val; @@ -399,7 +400,7 @@ namespace Tizen.Multimedia set { - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetOrientationTag(_recorder.GetHandle(), value), + RecorderErrorFactory.ThrowIfError(Native.SetOrientationTag(_recorder.GetHandle(), value), "Failed to set recorder orientation"); } } @@ -416,7 +417,7 @@ namespace Tizen.Multimedia int width = 0; int height = 0; - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.GetVideoResolution(_recorder.GetHandle(), out width, out height), + RecorderErrorFactory.ThrowIfError(Native.GetVideoResolution(_recorder.GetHandle(), out width, out height), "Failed to get camera video resolution"); return new Size(width, height); @@ -426,7 +427,7 @@ namespace Tizen.Multimedia { Size res = value; - RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetVideoResolution(_recorder.GetHandle(), res.Width, res.Height), + RecorderErrorFactory.ThrowIfError(Native.SetVideoResolution(_recorder.GetHandle(), res.Width, res.Height), "Failed to set video resolution."); } } diff --git a/src/Tizen.Multimedia/Recorder/RecorderStateChangedEventArgs.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecorderStateChangedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Recorder/RecorderStateChangedEventArgs.cs rename to src/Tizen.Multimedia.Recorder/Recorder/RecorderStateChangedEventArgs.cs diff --git a/src/Tizen.Multimedia/Recorder/RecordingErrorOccurredEventArgs.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecordingErrorOccurredEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Recorder/RecordingErrorOccurredEventArgs.cs rename to src/Tizen.Multimedia.Recorder/Recorder/RecordingErrorOccurredEventArgs.cs diff --git a/src/Tizen.Multimedia/Recorder/RecordingLimitReachedEventArgs.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecordingLimitReachedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/Recorder/RecordingLimitReachedEventArgs.cs rename to src/Tizen.Multimedia.Recorder/Recorder/RecordingLimitReachedEventArgs.cs diff --git a/src/Tizen.Multimedia/Recorder/RecordingProgressEventArgs.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecordingProgressEventArgs.cs old mode 100755 new mode 100644 similarity index 94% rename from src/Tizen.Multimedia/Recorder/RecordingProgressEventArgs.cs rename to src/Tizen.Multimedia.Recorder/Recorder/RecordingProgressEventArgs.cs index 09f193b..619bdcd --- a/src/Tizen.Multimedia/Recorder/RecordingProgressEventArgs.cs +++ b/src/Tizen.Multimedia.Recorder/Recorder/RecordingProgressEventArgs.cs @@ -23,7 +23,7 @@ namespace Tizen.Multimedia /// public class RecordingProgressEventArgs : EventArgs { - internal RecordingProgressEventArgs(ulong elapsedTime, ulong fileSize) + public RecordingProgressEventArgs(ulong elapsedTime, ulong fileSize) { ElapsedTime = elapsedTime; FileSize = fileSize; diff --git a/src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.csproj b/src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.csproj new file mode 100644 index 0000000..a8ab0ac --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.csproj @@ -0,0 +1,22 @@ + + + netstandard1.3 + True + True + Tizen.Multimedia.Recorder.snk + true + True + False + + + + + + + + + + + + + diff --git a/src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.nuspec b/src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.nuspec new file mode 100644 index 0000000..7bbb7cb --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.nuspec @@ -0,0 +1,19 @@ + + + + Tizen.Multimedia.Recorder + $version$ + Samsung Electronics + false + https://www.apache.org/licenses/LICENSE-2.0 + https://www.tizen.org/ + https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png + © Samsung Electronics Co., Ltd All Rights Reserved + Provides the Multimedia Recorder API for Tizen.Net + + + + + + + diff --git a/src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.snk b/src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.snk new file mode 100644 index 0000000..1429633 Binary files /dev/null and b/src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.snk differ diff --git a/src/Tizen.Multimedia.Remoting/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.Remoting/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..d479daa --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string ScreenMirroring = "libcapi-media-screen-mirroring.so.0"; + public const string MediaController = "libcapi-media-controller.so.0"; + } +} + diff --git a/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaController.cs b/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaController.cs new file mode 100644 index 0000000..7efbf0a --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaController.cs @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Applications; +using Tizen.Multimedia; +using Tizen.Multimedia.MediaController; + +internal static partial class Interop +{ + internal static partial class MediaControllerClient + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ServerUpdatedCallback(IntPtr serverName, MediaControllerServerState serverState, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PlaybackUpdatedCallback(IntPtr serverName, IntPtr playback, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MetadataUpdatedCallback(IntPtr serverName, IntPtr metadata, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ShuffleModeUpdatedCallback(IntPtr serverName, MediaControllerShuffleMode shuffleMode, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RepeatModeUpdatedCallback(IntPtr serverName, MediaControllerRepeatMode repeatMode, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void CommandReplyRecievedCallback(IntPtr serverName, int result, IntPtr bundle, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SubscribedServerCallback(IntPtr serverName, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ActivatedServerCallback(IntPtr serverName, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_create")] + internal static extern MediaControllerError Create(out IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy")] + internal static extern MediaControllerError Destroy(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_server_update_cb")] + internal static extern MediaControllerError SetServerUpdatedCb(IntPtr handle, ServerUpdatedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_server_update_cb")] + internal static extern MediaControllerError UnsetServerUpdatedCb(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_playback_update_cb")] + internal static extern MediaControllerError SetPlaybackUpdatedCb(IntPtr handle, PlaybackUpdatedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_playback_update_cb")] + internal static extern MediaControllerError UnsetPlaybackUpdatedCb(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_metadata_update_cb")] + internal static extern MediaControllerError SetMetadataUpdatedCb(IntPtr handle, MetadataUpdatedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_metadata_update_cb")] + internal static extern MediaControllerError UnsetMetadataUpdatedCb(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_shuffle_mode_update_cb")] + internal static extern MediaControllerError SetShuffleModeUpdatedCb(IntPtr handle, ShuffleModeUpdatedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_shuffle_mode_update_cb")] + internal static extern MediaControllerError UnsetShuffleModeUpdatedCb(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_repeat_mode_update_cb")] + internal static extern MediaControllerError SetRepeatModeUpdatedCb(IntPtr handle, RepeatModeUpdatedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_repeat_mode_update_cb")] + internal static extern MediaControllerError UnsetRepeatModeUpdatedCb(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_subscribe")] + internal static extern MediaControllerError Subscribe(IntPtr handle, MediaControllerSubscriptionType subscriptionType, string serverName); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unsubscribe")] + internal static extern MediaControllerError Unsubscribe(IntPtr handle, MediaControllerSubscriptionType subscriptionType, string serverName); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_state")] + internal static extern MediaControllerError GetPlaybackState(IntPtr playback, out MediaControllerPlaybackState state); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_position")] + internal static extern MediaControllerError GetPlaybackPosition(IntPtr playback, out ulong position); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy_playback")] + internal static extern MediaControllerError DestroyPlayback(IntPtr playback); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_metadata")] + private static extern MediaControllerError GetMetadata(IntPtr metadata, MediaControllerAttributes attribute, out IntPtr value); + + internal static string GetMetadata(IntPtr handle, MediaControllerAttributes attr) + { + IntPtr valuePtr = IntPtr.Zero; + + try + { + var ret = GetMetadata(handle, attr, out valuePtr); + MediaControllerValidator.ThrowIfError(ret, "Failed to get value for " + attr); + return Marshal.PtrToStringAnsi(valuePtr); + } + finally + { + LibcSupport.Free(valuePtr); + } + } + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy_metadata")] + internal static extern MediaControllerError DestroyMetadata(IntPtr metadata); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_latest_server_info")] + internal static extern MediaControllerError GetLatestServer(IntPtr handle, out IntPtr serverName, out MediaControllerServerState serverState); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_playback_info")] + internal static extern MediaControllerError GetServerPlayback(IntPtr handle, string serverName, out IntPtr playback); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_metadata")] + internal static extern MediaControllerError GetServerMetadata(IntPtr handle, string serverName, out IntPtr metadata); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_shuffle_mode")] + internal static extern MediaControllerError GetServerShuffleMode(IntPtr handle, string serverName, out MediaControllerShuffleMode mode); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_repeat_mode")] + internal static extern MediaControllerError GetServerRepeatMode(IntPtr handle, string serverName, out MediaControllerRepeatMode mode); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_playback_state_command")] + internal static extern MediaControllerError SendPlaybackStateCommand(IntPtr handle, string serverName, MediaControllerPlaybackState state); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_custom_command")] + internal static extern MediaControllerError SendCustomCommand(IntPtr handle, string serverName, string command, SafeBundleHandle bundle, CommandReplyRecievedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_foreach_server_subscribed")] + internal static extern MediaControllerError ForeachSubscribedServer(IntPtr handle, MediaControllerSubscriptionType subscriptionType, SubscribedServerCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_foreach_server")] + internal static extern MediaControllerError ForeachActivatedServer(IntPtr handle, ActivatedServerCallback callback, IntPtr userData); + } + + internal static partial class MediaControllerServer + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PlaybackStateCommandRecievedCallback(IntPtr clientName, MediaControllerPlaybackState state, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void CustomCommandRecievedCallback(IntPtr clientName, IntPtr command, IntPtr bundle, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_create")] + internal static extern MediaControllerError Create(out IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_destroy")] + internal static extern MediaControllerError Destroy(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_state")] + internal static extern MediaControllerError SetPlaybackState(IntPtr handle, MediaControllerPlaybackState state); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_position")] + internal static extern MediaControllerError SetPlaybackPosition(IntPtr handle, ulong position); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_playback_info")] + internal static extern MediaControllerError UpdatePlayback(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_metadata")] + internal static extern MediaControllerError SetMetadata(IntPtr handle, MediaControllerAttributes attribute, string value); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_metadata")] + internal static extern MediaControllerError UpdateMetadata(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_shuffle_mode")] + internal static extern MediaControllerError UpdateShuffleMode(IntPtr handle, MediaControllerShuffleMode mode); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_repeat_mode")] + internal static extern MediaControllerError UpdateRepeatMode(IntPtr handle, MediaControllerRepeatMode mode); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_state_command_received_cb")] + internal static extern MediaControllerError SetPlaybackStateCmdRecvCb(IntPtr handle, PlaybackStateCommandRecievedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_playback_state_command_received_cb")] + internal static extern MediaControllerError UnsetPlaybackStateCmdRecvCb(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_custom_command_received_cb")] + internal static extern MediaControllerError SetCustomCmdRecvCb(IntPtr handle, CustomCommandRecievedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_custom_command_received_cb")] + internal static extern MediaControllerError UnsetCustomCmdRecvCb(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_command_reply")] + internal static extern MediaControllerError SendCommandReply(IntPtr handle, string clientName, int result, SafeBundleHandle bundle); + } +} diff --git a/src/Tizen.Multimedia.Remoting/Interop/Interop.ScreenMirroring.cs b/src/Tizen.Multimedia.Remoting/Interop/Interop.ScreenMirroring.cs new file mode 100644 index 0000000..707a4c2 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/Interop/Interop.ScreenMirroring.cs @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class ScreenMirroring + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void StateChangedCallback(IntPtr userData, int state, int error); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_create")] + internal static extern int Create(out IntPtr scmirroringSink); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_state_changed_cb")] + internal static extern int SetStateChangedCb(IntPtr scmirroringSink, StateChangedCallback cb, IntPtr userData); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_ip_and_port")] + internal static extern int SetIpAndPort(IntPtr scmirroringSink, string ip, string port); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_display")] + internal static extern int SetDisplay(IntPtr scmirroringSink, int type, IntPtr display); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_resolution")] + internal static extern int SetResolution(IntPtr scmirroringSink, int resolution); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_prepare")] + internal static extern int Prepare(IntPtr scmirroringSink); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_connect")] + internal static extern int ConnectAsync(IntPtr scmirroringSink); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_start")] + internal static extern int StartAsync(IntPtr scmirroringSink); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_pause")] + internal static extern int PauseAsync(IntPtr scmirroringSink); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_resume")] + internal static extern int ResumeAsync(IntPtr scmirroringSink); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_disconnect")] + internal static extern int Disconnect(IntPtr scmirroringSink); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_unprepare")] + internal static extern int Unprepare(IntPtr scmirroringSink); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_unset_state_changed_cb")] + internal static extern int UnsetStateChangedCb(IntPtr scmirroringSink); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_destroy")] + internal static extern int Destroy(IntPtr scmirroringSink); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_video_codec")] + internal static extern int GetNegotiatedVideoCodec(ref IntPtr scmirroringSink, out int codec); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_video_resolution")] + internal static extern int GetNegotiatedVideoResolution(ref IntPtr scmirroringSink, out int width, out int height); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_video_frame_rate")] + internal static extern int GetNegotiatedVideoFrameRate(ref IntPtr scmirroringSink, out int frameRate); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_audio_codec")] + internal static extern int GetNegotiatedAudioCodec(ref IntPtr scmirroringSink, out int codec); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_audio_channel")] + internal static extern int GetNegotiatedAudioChannel(ref IntPtr scmirroringSink, out int channel); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_audio_sample_rate")] + internal static extern int GetNegotiatedAudioSampleRate(ref IntPtr scmirroringSink, out int sampleRate); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_audio_bitwidth")] + internal static extern int GetNegotiatedAudioBitwidth(ref IntPtr scmirroringSink, out int bitwidth); + } +} diff --git a/src/Tizen.Multimedia/MediaController/CustomCommandEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/CustomCommandEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaController/CustomCommandEventArgs.cs rename to src/Tizen.Multimedia.Remoting/MediaController/CustomCommandEventArgs.cs diff --git a/src/Tizen.Multimedia/MediaController/CustomCommandReplyEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/CustomCommandReplyEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaController/CustomCommandReplyEventArgs.cs rename to src/Tizen.Multimedia.Remoting/MediaController/CustomCommandReplyEventArgs.cs diff --git a/src/Tizen.Multimedia/MediaController/MediaControllerClient.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerClient.cs old mode 100755 new mode 100644 similarity index 84% rename from src/Tizen.Multimedia/MediaController/MediaControllerClient.cs rename to src/Tizen.Multimedia.Remoting/MediaController/MediaControllerClient.cs index da1b93d..0af33a2 --- a/src/Tizen.Multimedia/MediaController/MediaControllerClient.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerClient.cs @@ -19,6 +19,7 @@ using System.Collections.Generic; using System.Runtime.InteropServices; using System.Threading.Tasks; using Tizen.Applications; +using Native = Interop.MediaControllerClient; namespace Tizen.Multimedia.MediaController { @@ -38,17 +39,17 @@ namespace Tizen.Multimedia.MediaController private bool _disposed = false; private EventHandler _serverUpdated; - private Interop.MediaControllerClient.ServerUpdatedCallback _serverUpdatedCallback; + private Native.ServerUpdatedCallback _serverUpdatedCallback; private EventHandler _playbackUpdated; - private Interop.MediaControllerClient.PlaybackUpdatedCallback _playbackUpdatedCallback; + private Native.PlaybackUpdatedCallback _playbackUpdatedCallback; private EventHandler _metadataUpdated; - private Interop.MediaControllerClient.MetadataUpdatedCallback _metadataUpdatedCallback; + private Native.MetadataUpdatedCallback _metadataUpdatedCallback; private EventHandler _shufflemodeUpdated; - private Interop.MediaControllerClient.ShuffleModeUpdatedCallback _shufflemodeUpdatedCallback; + private Native.ShuffleModeUpdatedCallback _shufflemodeUpdatedCallback; private EventHandler _repeatmodeUpdated; - private Interop.MediaControllerClient.RepeatModeUpdatedCallback _repeatmodeUpdatedCallback; + private Native.RepeatModeUpdatedCallback _repeatmodeUpdatedCallback; private EventHandler _customcommandReply; - private Interop.MediaControllerClient.CommandReplyRecievedCallback _customcommandReplyCallback; + private Native.CommandReplyRecievedCallback _customcommandReplyCallback; private bool IsValidHandle { @@ -76,7 +77,7 @@ namespace Tizen.Multimedia.MediaController public MediaControllerClient() { MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.Create(out _handle), "Create client failed"); + Native.Create(out _handle), "Create client failed"); } ~MediaControllerClient() @@ -101,7 +102,7 @@ namespace Tizen.Multimedia.MediaController if (IsValidHandle) { - Interop.MediaControllerClient.Destroy(_handle); + Native.Destroy(_handle); _handle = IntPtr.Zero; } @@ -282,12 +283,12 @@ namespace Tizen.Multimedia.MediaController try { MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.GetLatestServer(SafeHandle, out name, out state), "Get Latest server failed"); + Native.GetLatestServer(SafeHandle, out name, out state), "Get Latest server failed"); return new ServerInformation(Marshal.PtrToStringAnsi(name), (MediaControllerServerState)state); } finally { - Interop.Libc.Free(name); + LibcSupport.Free(name); } } @@ -305,7 +306,7 @@ namespace Tizen.Multimedia.MediaController try { MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.GetServerPlayback(SafeHandle, serverName, out playbackHandle), "Get Playback handle failed"); + Native.GetServerPlayback(SafeHandle, serverName, out playbackHandle), "Get Playback handle failed"); playback = new MediaControllerPlayback(playbackHandle); } finally @@ -313,7 +314,7 @@ namespace Tizen.Multimedia.MediaController if (playbackHandle != IntPtr.Zero) { MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.DestroyPlayback(playbackHandle), "Destroy playback failed"); + Native.DestroyPlayback(playbackHandle), "Destroy playback failed"); } } @@ -334,7 +335,7 @@ namespace Tizen.Multimedia.MediaController try { MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.GetServerMetadata(SafeHandle, serverName, out metadataHandle), "Get Metadata handle failed"); + Native.GetServerMetadata(SafeHandle, serverName, out metadataHandle), "Get Metadata handle failed"); metadata = new MediaControllerMetadata(metadataHandle); } finally @@ -342,7 +343,7 @@ namespace Tizen.Multimedia.MediaController if (metadataHandle != IntPtr.Zero) { MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.DestroyMetadata(metadataHandle), "Destroy metadata failed"); + Native.DestroyMetadata(metadataHandle), "Destroy metadata failed"); } } @@ -360,7 +361,7 @@ namespace Tizen.Multimedia.MediaController MediaControllerShuffleMode shuffleMode = MediaControllerShuffleMode.Off; MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.GetServerShuffleMode(SafeHandle, serverName, out shuffleMode), "Get ShuffleMode failed"); + Native.GetServerShuffleMode(SafeHandle, serverName, out shuffleMode), "Get ShuffleMode failed"); return shuffleMode; } @@ -376,7 +377,7 @@ namespace Tizen.Multimedia.MediaController MediaControllerRepeatMode repeatMode = MediaControllerRepeatMode.Off; MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.GetServerRepeatMode(SafeHandle, serverName, out repeatMode), "Get RepeatMode failed"); + Native.GetServerRepeatMode(SafeHandle, serverName, out repeatMode), "Get RepeatMode failed"); return repeatMode; } @@ -390,7 +391,7 @@ namespace Tizen.Multimedia.MediaController public void SendPlaybackStateCommand(string serverName, MediaControllerPlaybackState state) { MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.SendPlaybackStateCommand(SafeHandle, serverName, state), "Send playback state command failed"); + Native.SendPlaybackStateCommand(SafeHandle, serverName, state), "Send playback state command failed"); } /// @@ -403,7 +404,7 @@ namespace Tizen.Multimedia.MediaController public void SendCustomCommand(string serverName, string command, Bundle bundle) { MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.SendCustomCommand(SafeHandle, serverName, command, bundle.SafeBundleHandle, _customcommandReplyCallback, IntPtr.Zero), + Native.SendCustomCommand(SafeHandle, serverName, command, bundle.SafeBundleHandle, _customcommandReplyCallback, IntPtr.Zero), "Send custom command failed"); } @@ -415,7 +416,7 @@ namespace Tizen.Multimedia.MediaController public void Subscribe(MediaControllerSubscriptionType type, string serverName) { MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.Subscribe(SafeHandle, type, serverName), "Subscribe failed"); + Native.Subscribe(SafeHandle, type, serverName), "Subscribe failed"); } /// @@ -426,7 +427,7 @@ namespace Tizen.Multimedia.MediaController public void Unsubscribe(MediaControllerSubscriptionType type, string serverName) { MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.Unsubscribe(SafeHandle, type, serverName), "Unsubscribe failed"); + Native.Unsubscribe(SafeHandle, type, serverName), "Unsubscribe failed"); } /// @@ -465,12 +466,12 @@ namespace Tizen.Multimedia.MediaController ServerUpdatedEventArgs eventArgs = new ServerUpdatedEventArgs(Marshal.PtrToStringAnsi(serverName), serverState); _serverUpdated?.Invoke(this, eventArgs); }; - Interop.MediaControllerClient.SetServerUpdatedCb(SafeHandle, _serverUpdatedCallback, IntPtr.Zero); + Native.SetServerUpdatedCb(SafeHandle, _serverUpdatedCallback, IntPtr.Zero); } private void UnregisterServerUpdatedEvent() { - Interop.MediaControllerClient.UnsetServerUpdatedCb(SafeHandle); + Native.UnsetServerUpdatedCb(SafeHandle); } private void RegisterPlaybackUpdatedEvent() @@ -480,12 +481,12 @@ namespace Tizen.Multimedia.MediaController PlaybackUpdatedEventArgs eventArgs = new PlaybackUpdatedEventArgs(Marshal.PtrToStringAnsi(serverName), playback); _playbackUpdated?.Invoke(this, eventArgs); }; - Interop.MediaControllerClient.SetPlaybackUpdatedCb(SafeHandle, _playbackUpdatedCallback, IntPtr.Zero); + Native.SetPlaybackUpdatedCb(SafeHandle, _playbackUpdatedCallback, IntPtr.Zero); } private void UnregisterPlaybackUpdatedEvent() { - Interop.MediaControllerClient.UnsetPlaybackUpdatedCb(SafeHandle); + Native.UnsetPlaybackUpdatedCb(SafeHandle); } private void RegisterMetadataUpdatedEvent() @@ -495,12 +496,12 @@ namespace Tizen.Multimedia.MediaController MetadataUpdatedEventArgs eventArgs = new MetadataUpdatedEventArgs(Marshal.PtrToStringAnsi(serverName), metadata); _metadataUpdated?.Invoke(this, eventArgs); }; - Interop.MediaControllerClient.SetMetadataUpdatedCb(SafeHandle, _metadataUpdatedCallback, IntPtr.Zero); + Native.SetMetadataUpdatedCb(SafeHandle, _metadataUpdatedCallback, IntPtr.Zero); } private void UnregisterMetadataUpdatedEvent() { - Interop.MediaControllerClient.UnsetMetadataUpdatedCb(SafeHandle); + Native.UnsetMetadataUpdatedCb(SafeHandle); } private void RegisterShuffleModeUpdatedEvent() @@ -512,13 +513,13 @@ namespace Tizen.Multimedia.MediaController }; MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.SetShuffleModeUpdatedCb(SafeHandle, _shufflemodeUpdatedCallback, IntPtr.Zero), + Native.SetShuffleModeUpdatedCb(SafeHandle, _shufflemodeUpdatedCallback, IntPtr.Zero), "Set ShuffleModeUpdated callback failed"); } private void UnregisterShuffleModeUpdatedEvent() { - Interop.MediaControllerClient.UnsetShuffleModeUpdatedCb(SafeHandle); + Native.UnsetShuffleModeUpdatedCb(SafeHandle); } private void RegisterRepeatModeUpdatedEvent() @@ -530,27 +531,27 @@ namespace Tizen.Multimedia.MediaController }; MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.SetRepeatModeUpdatedCb(SafeHandle, _repeatmodeUpdatedCallback, IntPtr.Zero), + Native.SetRepeatModeUpdatedCb(SafeHandle, _repeatmodeUpdatedCallback, IntPtr.Zero), "Set RepeatModeUpdated callback failed"); } private void UnregisterRepeatModeUpdatedEvent() { - Interop.MediaControllerClient.UnsetRepeatModeUpdatedCb(SafeHandle); + Native.UnsetRepeatModeUpdatedCb(SafeHandle); } private static List ForEachSubscribedServer(IntPtr handle, MediaControllerSubscriptionType subscriptionType) { List subscribedServerCollections = new List(); - Interop.MediaControllerClient.SubscribedServerCallback serverCallback = (IntPtr serverName, IntPtr userData) => + Native.SubscribedServerCallback serverCallback = (IntPtr serverName, IntPtr userData) => { subscribedServerCollections.Add(Marshal.PtrToStringAnsi(serverName)); return true; }; MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.ForeachSubscribedServer(handle, subscriptionType, serverCallback, IntPtr.Zero), + Native.ForeachSubscribedServer(handle, subscriptionType, serverCallback, IntPtr.Zero), "Foreach Subscribed server failed"); return subscribedServerCollections; @@ -560,14 +561,14 @@ namespace Tizen.Multimedia.MediaController { List activatedServerCollections = new List(); - Interop.MediaControllerClient.ActivatedServerCallback serverCallback = (IntPtr serverName, IntPtr userData) => + Native.ActivatedServerCallback serverCallback = (IntPtr serverName, IntPtr userData) => { activatedServerCollections.Add(Marshal.PtrToStringAnsi(serverName)); return true; }; MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.ForeachActivatedServer(handle, serverCallback, IntPtr.Zero), + Native.ForeachActivatedServer(handle, serverCallback, IntPtr.Zero), "Foreach Activated server failed"); return activatedServerCollections; diff --git a/src/Tizen.Multimedia/MediaController/MediaControllerEnums.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerEnums.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaController/MediaControllerEnums.cs rename to src/Tizen.Multimedia.Remoting/MediaController/MediaControllerEnums.cs diff --git a/src/Tizen.Multimedia/MediaController/MediaControllerError.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerError.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaController/MediaControllerError.cs rename to src/Tizen.Multimedia.Remoting/MediaController/MediaControllerError.cs diff --git a/src/Tizen.Multimedia/MediaController/MediaControllerLog.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerLog.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaController/MediaControllerLog.cs rename to src/Tizen.Multimedia.Remoting/MediaController/MediaControllerLog.cs diff --git a/src/Tizen.Multimedia/MediaController/MediaControllerMetadata.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerMetadata.cs old mode 100755 new mode 100644 similarity index 69% rename from src/Tizen.Multimedia/MediaController/MediaControllerMetadata.cs rename to src/Tizen.Multimedia.Remoting/MediaController/MediaControllerMetadata.cs index 90eb187..b4a2fc9 --- a/src/Tizen.Multimedia/MediaController/MediaControllerMetadata.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerMetadata.cs @@ -15,7 +15,7 @@ */ using System; -using System.Collections.Generic; +using Native = Interop.MediaControllerClient; namespace Tizen.Multimedia.MediaController { @@ -39,17 +39,17 @@ namespace Tizen.Multimedia.MediaController throw new InvalidOperationException("MediaControllerMetadata is not valid."); } - Title = Interop.MediaControllerClient.GetMetadata(handle, MediaControllerAttributes.Title); - Artist = Interop.MediaControllerClient.GetMetadata(handle, MediaControllerAttributes.Artist); - Album = Interop.MediaControllerClient.GetMetadata(handle, MediaControllerAttributes.Album); - Author = Interop.MediaControllerClient.GetMetadata(handle, MediaControllerAttributes.Author); - Genre = Interop.MediaControllerClient.GetMetadata(handle, MediaControllerAttributes.Genre); - Duration = Interop.MediaControllerClient.GetMetadata(handle, MediaControllerAttributes.Duration); - Date = Interop.MediaControllerClient.GetMetadata(handle, MediaControllerAttributes.Date); - Copyright = Interop.MediaControllerClient.GetMetadata(handle, MediaControllerAttributes.Copyright); - Description = Interop.MediaControllerClient.GetMetadata(handle, MediaControllerAttributes.Description); - TrackNumber = Interop.MediaControllerClient.GetMetadata(handle, MediaControllerAttributes.TrackNumber); - Picture = Interop.MediaControllerClient.GetMetadata(handle, MediaControllerAttributes.Picture); + Title = Native.GetMetadata(handle, MediaControllerAttributes.Title); + Artist = Native.GetMetadata(handle, MediaControllerAttributes.Artist); + Album = Native.GetMetadata(handle, MediaControllerAttributes.Album); + Author = Native.GetMetadata(handle, MediaControllerAttributes.Author); + Genre = Native.GetMetadata(handle, MediaControllerAttributes.Genre); + Duration = Native.GetMetadata(handle, MediaControllerAttributes.Duration); + Date = Native.GetMetadata(handle, MediaControllerAttributes.Date); + Copyright = Native.GetMetadata(handle, MediaControllerAttributes.Copyright); + Description = Native.GetMetadata(handle, MediaControllerAttributes.Description); + TrackNumber = Native.GetMetadata(handle, MediaControllerAttributes.TrackNumber); + Picture = Native.GetMetadata(handle, MediaControllerAttributes.Picture); } /// diff --git a/src/Tizen.Multimedia/MediaController/MediaControllerPlayback.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerPlayback.cs old mode 100755 new mode 100644 similarity index 90% rename from src/Tizen.Multimedia/MediaController/MediaControllerPlayback.cs rename to src/Tizen.Multimedia.Remoting/MediaController/MediaControllerPlayback.cs index b2e3a6c..a451043 --- a/src/Tizen.Multimedia/MediaController/MediaControllerPlayback.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerPlayback.cs @@ -14,8 +14,8 @@ * limitations under the License. */ - using System; +using Native = Interop.MediaControllerClient; namespace Tizen.Multimedia.MediaController { @@ -50,10 +50,10 @@ namespace Tizen.Multimedia.MediaController } MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.GetPlaybackState(handle, out state), "Get Playback state failed"); + Native.GetPlaybackState(handle, out state), "Get Playback state failed"); MediaControllerValidator.ThrowIfError( - Interop.MediaControllerClient.GetPlaybackPosition(handle, out position), "Get Playback position failed"); + Native.GetPlaybackPosition(handle, out position), "Get Playback position failed"); State = state; Position = position; diff --git a/src/Tizen.Multimedia/MediaController/MediaControllerServer.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerServer.cs old mode 100755 new mode 100644 similarity index 73% rename from src/Tizen.Multimedia/MediaController/MediaControllerServer.cs rename to src/Tizen.Multimedia.Remoting/MediaController/MediaControllerServer.cs index 177ae76..7529789 --- a/src/Tizen.Multimedia/MediaController/MediaControllerServer.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerServer.cs @@ -17,6 +17,7 @@ using System; using System.Runtime.InteropServices; using Tizen.Applications; +using Native = Interop.MediaControllerServer; namespace Tizen.Multimedia.MediaController { @@ -36,9 +37,9 @@ namespace Tizen.Multimedia.MediaController private bool _disposed = false; private EventHandler _playbackCommand; - private Interop.MediaControllerServer.PlaybackStateCommandRecievedCallback _playbackCommandCallback; + private Native.PlaybackStateCommandRecievedCallback _playbackCommandCallback; private EventHandler _customCommand; - private Interop.MediaControllerServer.CustomCommandRecievedCallback _customCommandCallback; + private Native.CustomCommandRecievedCallback _customCommandCallback; private bool IsValidHandle { @@ -66,7 +67,7 @@ namespace Tizen.Multimedia.MediaController public MediaControllerServer() { MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.Create(out _handle), "Create server failed"); + Native.Create(out _handle), "Create server failed"); } ~MediaControllerServer() @@ -91,7 +92,7 @@ namespace Tizen.Multimedia.MediaController if (IsValidHandle) { - Interop.MediaControllerServer.Destroy(_handle); + Native.Destroy(_handle); _handle = IntPtr.Zero; } @@ -164,13 +165,13 @@ namespace Tizen.Multimedia.MediaController } MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.SetPlaybackState(SafeHandle, playback.State), "Set Playback state failed"); + Native.SetPlaybackState(SafeHandle, playback.State), "Set Playback state failed"); MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.SetPlaybackPosition(SafeHandle, playback.Position), "Set Playback position failed"); + Native.SetPlaybackPosition(SafeHandle, playback.Position), "Set Playback position failed"); MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.UpdatePlayback(SafeHandle), "Update Playback failed"); + Native.UpdatePlayback(SafeHandle), "Update Playback failed"); } /// @@ -186,40 +187,40 @@ namespace Tizen.Multimedia.MediaController } MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.SetMetadata(SafeHandle, MediaControllerAttributes.Title, metadata.Title), "Set Title failed"); + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Title, metadata.Title), "Set Title failed"); MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.SetMetadata(SafeHandle, MediaControllerAttributes.Artist, metadata.Artist), "Set Artist failed"); + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Artist, metadata.Artist), "Set Artist failed"); MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.SetMetadata(SafeHandle, MediaControllerAttributes.Album, metadata.Album), "Set Album failed"); + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Album, metadata.Album), "Set Album failed"); MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.SetMetadata(SafeHandle, MediaControllerAttributes.Author, metadata.Author), "Set Author failed"); + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Author, metadata.Author), "Set Author failed"); MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.SetMetadata(SafeHandle, MediaControllerAttributes.Genre, metadata.Genre), "Set Genre failed"); + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Genre, metadata.Genre), "Set Genre failed"); MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.SetMetadata(SafeHandle, MediaControllerAttributes.Duration, metadata.Duration), "Set Duration failed"); + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Duration, metadata.Duration), "Set Duration failed"); MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.SetMetadata(SafeHandle, MediaControllerAttributes.Date, metadata.Date), "Set Date failed"); + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Date, metadata.Date), "Set Date failed"); MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.SetMetadata(SafeHandle, MediaControllerAttributes.Copyright, metadata.Copyright), "Set Copyright failed"); + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Copyright, metadata.Copyright), "Set Copyright failed"); MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.SetMetadata(SafeHandle, MediaControllerAttributes.Description, metadata.Description), "Set Description failed"); + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Description, metadata.Description), "Set Description failed"); MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.SetMetadata(SafeHandle, MediaControllerAttributes.TrackNumber, metadata.TrackNumber), "Set TrackNumber failed"); + Native.SetMetadata(SafeHandle, MediaControllerAttributes.TrackNumber, metadata.TrackNumber), "Set TrackNumber failed"); MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.SetMetadata(SafeHandle, MediaControllerAttributes.Picture, metadata.Picture), "Set Picture failed"); + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Picture, metadata.Picture), "Set Picture failed"); MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.UpdateMetadata(SafeHandle), "UpdateMetadata Metadata failed"); + Native.UpdateMetadata(SafeHandle), "UpdateMetadata Metadata failed"); } /// @@ -230,7 +231,7 @@ namespace Tizen.Multimedia.MediaController public void UpdateShuffleMode(MediaControllerShuffleMode mode) { MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.UpdateShuffleMode(SafeHandle, mode), "Update Shuffle Mode failed"); + Native.UpdateShuffleMode(SafeHandle, mode), "Update Shuffle Mode failed"); } /// @@ -241,7 +242,7 @@ namespace Tizen.Multimedia.MediaController public void UpdateRepeatMode(MediaControllerRepeatMode mode) { MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.UpdateRepeatMode(SafeHandle, mode), "Update Repeat Mode failed"); + Native.UpdateRepeatMode(SafeHandle, mode), "Update Repeat Mode failed"); } /// @@ -254,7 +255,7 @@ namespace Tizen.Multimedia.MediaController public void SendCustomCommandReply(string clientName, int result, Bundle bundle) { MediaControllerValidator.ThrowIfError( - Interop.MediaControllerServer.SendCommandReply(SafeHandle, clientName, result, bundle.SafeBundleHandle), "Send reply for command failed"); + Native.SendCommandReply(SafeHandle, clientName, result, bundle.SafeBundleHandle), "Send reply for command failed"); } private void RegisterPlaybackCmdRecvEvent() @@ -264,12 +265,12 @@ namespace Tizen.Multimedia.MediaController PlaybackStateCommandEventArgs eventArgs = new PlaybackStateCommandEventArgs(Marshal.PtrToStringAnsi(clientName), state); _playbackCommand?.Invoke(this, eventArgs); }; - Interop.MediaControllerServer.SetPlaybackStateCmdRecvCb(SafeHandle, _playbackCommandCallback, IntPtr.Zero); + Native.SetPlaybackStateCmdRecvCb(SafeHandle, _playbackCommandCallback, IntPtr.Zero); } private void UnregisterPlaybackCmdRecvEvent() { - Interop.MediaControllerServer.UnsetPlaybackStateCmdRecvCb(SafeHandle); + Native.UnsetPlaybackStateCmdRecvCb(SafeHandle); } private void RegisterCustomCommandEvent() @@ -281,12 +282,12 @@ namespace Tizen.Multimedia.MediaController CustomCommandEventArgs eventArgs = new CustomCommandEventArgs(Marshal.PtrToStringAnsi(clientName), Marshal.PtrToStringAnsi(command), bundleData); _customCommand?.Invoke(this, eventArgs); }; - Interop.MediaControllerServer.SetCustomCmdRecvCb(SafeHandle, _customCommandCallback, IntPtr.Zero); + Native.SetCustomCmdRecvCb(SafeHandle, _customCommandCallback, IntPtr.Zero); } private void UnregisterCustomCommandEvent() { - Interop.MediaControllerServer.UnsetCustomCmdRecvCb(SafeHandle); + Native.UnsetCustomCmdRecvCb(SafeHandle); } } } diff --git a/src/Tizen.Multimedia/MediaController/MetadataUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/MetadataUpdatedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaController/MetadataUpdatedEventArgs.cs rename to src/Tizen.Multimedia.Remoting/MediaController/MetadataUpdatedEventArgs.cs diff --git a/src/Tizen.Multimedia/MediaController/PlaybackStateCommandEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/PlaybackStateCommandEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaController/PlaybackStateCommandEventArgs.cs rename to src/Tizen.Multimedia.Remoting/MediaController/PlaybackStateCommandEventArgs.cs diff --git a/src/Tizen.Multimedia/MediaController/PlaybackUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/PlaybackUpdatedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaController/PlaybackUpdatedEventArgs.cs rename to src/Tizen.Multimedia.Remoting/MediaController/PlaybackUpdatedEventArgs.cs diff --git a/src/Tizen.Multimedia/MediaController/RepeatModeUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/RepeatModeUpdatedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaController/RepeatModeUpdatedEventArgs.cs rename to src/Tizen.Multimedia.Remoting/MediaController/RepeatModeUpdatedEventArgs.cs diff --git a/src/Tizen.Multimedia/MediaController/ServerInformation.cs b/src/Tizen.Multimedia.Remoting/MediaController/ServerInformation.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaController/ServerInformation.cs rename to src/Tizen.Multimedia.Remoting/MediaController/ServerInformation.cs diff --git a/src/Tizen.Multimedia/MediaController/ServerUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/ServerUpdatedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaController/ServerUpdatedEventArgs.cs rename to src/Tizen.Multimedia.Remoting/MediaController/ServerUpdatedEventArgs.cs diff --git a/src/Tizen.Multimedia/MediaController/ShuffleModeUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/ShuffleModeUpdatedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaController/ShuffleModeUpdatedEventArgs.cs rename to src/Tizen.Multimedia.Remoting/MediaController/ShuffleModeUpdatedEventArgs.cs diff --git a/src/Tizen.Multimedia/ScreenMirroring/AudioInformation.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/AudioInformation.cs old mode 100755 new mode 100644 similarity index 90% rename from src/Tizen.Multimedia/ScreenMirroring/AudioInformation.cs rename to src/Tizen.Multimedia.Remoting/ScreenMirroring/AudioInformation.cs index f3dab42..a1d05a8 --- a/src/Tizen.Multimedia/ScreenMirroring/AudioInformation.cs +++ b/src/Tizen.Multimedia.Remoting/ScreenMirroring/AudioInformation.cs @@ -15,7 +15,7 @@ */ using System; -using System.Runtime.InteropServices; +using Native = Interop.ScreenMirroring; namespace Tizen.Multimedia { @@ -48,7 +48,7 @@ namespace Tizen.Multimedia get { int ret; - ret = Interop.ScreenMirroring.GetNegotiatedAudioCodec(ref _handle, out _codec); + ret = Native.GetNegotiatedAudioCodec(ref _handle, out _codec); if (ret != (int)ScreenMirroringError.None) { Log.Error(ScreenMirroringLog.LogTag, "Failed to get audio codec" + (ScreenMirroringError)ret); @@ -69,7 +69,7 @@ namespace Tizen.Multimedia get { int ret; - ret = Interop.ScreenMirroring.GetNegotiatedAudioChannel(ref _handle, out _channel); + ret = Native.GetNegotiatedAudioChannel(ref _handle, out _channel); if (ret != (int)ScreenMirroringError.None) { Log.Error(ScreenMirroringLog.LogTag, "Failed to get audio channel" + (ScreenMirroringError)ret); @@ -90,7 +90,7 @@ namespace Tizen.Multimedia get { int ret; - ret = Interop.ScreenMirroring.GetNegotiatedAudioSampleRate(ref _handle, out _sampleRate); + ret = Native.GetNegotiatedAudioSampleRate(ref _handle, out _sampleRate); if (ret != (int)ScreenMirroringError.None) { Log.Error(ScreenMirroringLog.LogTag, "Failed to get audio sample rate" + (ScreenMirroringError)ret); @@ -111,7 +111,7 @@ namespace Tizen.Multimedia get { int ret; - ret = Interop.ScreenMirroring.GetNegotiatedAudioBitwidth(ref _handle, out _bitWidth); + ret = Native.GetNegotiatedAudioBitwidth(ref _handle, out _bitWidth); if (ret != (int)ScreenMirroringError.None) { Log.Error(ScreenMirroringLog.LogTag, "Failed to get audio bitwidth" + (ScreenMirroringError)ret); diff --git a/src/Tizen.Multimedia/ScreenMirroring/ScreenMirroring.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs old mode 100755 new mode 100644 similarity index 93% rename from src/Tizen.Multimedia/ScreenMirroring/ScreenMirroring.cs rename to src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs index 3d2669e..1c54ef0 --- a/src/Tizen.Multimedia/ScreenMirroring/ScreenMirroring.cs +++ b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs @@ -16,6 +16,7 @@ using System; using System.Diagnostics; using System.Threading.Tasks; +using Native = Interop.ScreenMirroring; namespace Tizen.Multimedia { @@ -40,7 +41,7 @@ namespace Tizen.Multimedia private bool _disposed = false; private EventHandler _stateChanged; - private Interop.ScreenMirroring.StateChangedCallback _stateChangedCallback; + private Native.StateChangedCallback _stateChangedCallback; /// /// Initializes a new instance of the ScreenMirroring class with parameters Ip, Port, Surface type and Display handle. @@ -54,7 +55,7 @@ namespace Tizen.Multimedia /// Thrown when method fail due to an invalid parameter public ScreenMirroring(Display display, string ip, string port) { - int ret = Interop.ScreenMirroring.Create(out _handle); + int ret = Native.Create(out _handle); if (ret != (int)ScreenMirroringError.None) { ScreenMirroringErrorFactory.ThrowException(ret, "Failed to create Screen Mirroring Sink"); @@ -65,7 +66,7 @@ namespace Tizen.Multimedia _port = port; // Set ip and port - int ret1 = Interop.ScreenMirroring.SetIpAndPort(_handle, _ip, _port); + int ret1 = Native.SetIpAndPort(_handle, _ip, _port); if (ret1 != (int)ScreenMirroringError.None) { Log.Error(ScreenMirroringLog.LogTag, "Set ip and port failed" + (ScreenMirroringError)ret1); @@ -130,7 +131,7 @@ namespace Tizen.Multimedia /// Thrown when method fail due to an invalid parameter public void SetIpAndPort(string ip, string port) { - int ret = Interop.ScreenMirroring.SetIpAndPort(_handle, ip, port); + int ret = Native.SetIpAndPort(_handle, ip, port); if (ret != (int)ScreenMirroringError.None) { Log.Error(ScreenMirroringLog.LogTag, "Set ip and port failed" + (ScreenMirroringError)ret); @@ -146,7 +147,7 @@ namespace Tizen.Multimedia /// Thrown when method fail due to an invalid parameter public void SetResolution(ResolutionType resolution) { - int ret = Interop.ScreenMirroring.SetResolution(_handle, (int)resolution); + int ret = Native.SetResolution(_handle, (int)resolution); if (ret != (int)ScreenMirroringError.None) { Log.Error(ScreenMirroringLog.LogTag, "Set resolution failed" + (ScreenMirroringError)ret); @@ -210,7 +211,7 @@ namespace Tizen.Multimedia Debug.Assert(Enum.IsDefined(typeof(DisplayType), type)); - return Interop.ScreenMirroring.SetDisplay(_handle, (int)type, evasObject); + return Native.SetDisplay(_handle, (int)type, evasObject); } /// @@ -220,7 +221,7 @@ namespace Tizen.Multimedia /// Thrown when method fail due to an internal error public void Prepare() { - int ret = Interop.ScreenMirroring.Prepare(_handle); + int ret = Native.Prepare(_handle); if (ret != (int)ScreenMirroringError.None) { ScreenMirroringErrorFactory.ThrowException(ret, "Failed to prepare sink for screen mirroring"); @@ -237,7 +238,7 @@ namespace Tizen.Multimedia /// Thrown when method fail due to an internal error public Task ConnectAsync() { - int ret = Interop.ScreenMirroring.ConnectAsync(_handle); + int ret = Native.ConnectAsync(_handle); var task = new TaskCompletionSource(); Task.Factory.StartNew(() => @@ -300,7 +301,7 @@ namespace Tizen.Multimedia /// Thrown when method fail due to an internal error public Task StartAsync() { - int ret = Interop.ScreenMirroring.StartAsync(_handle); + int ret = Native.StartAsync(_handle); var task = new TaskCompletionSource(); Task.Factory.StartNew(() => @@ -331,7 +332,7 @@ namespace Tizen.Multimedia /// Thrown when method fail due to an internal error public Task PauseAsync() { - int ret = Interop.ScreenMirroring.PauseAsync(_handle); + int ret = Native.PauseAsync(_handle); var task = new TaskCompletionSource(); Task.Factory.StartNew(() => @@ -362,7 +363,7 @@ namespace Tizen.Multimedia /// Thrown when method fail due to an internal error public Task ResumeAsync() { - int ret = Interop.ScreenMirroring.ResumeAsync(_handle); + int ret = Native.ResumeAsync(_handle); var task = new TaskCompletionSource(); Task.Factory.StartNew(() => @@ -391,7 +392,7 @@ namespace Tizen.Multimedia /// Thrown when method fail due to no connection between devices public void Disconnect() { - int ret = Interop.ScreenMirroring.Disconnect(_handle); + int ret = Native.Disconnect(_handle); if (ret != (int)ScreenMirroringError.None) { ScreenMirroringErrorFactory.ThrowException(ret, "Failed to disconnect sink for screen mirroring"); @@ -405,7 +406,7 @@ namespace Tizen.Multimedia /// Thrown when method fail due to an internal error public void Unprepare() { - int ret = Interop.ScreenMirroring.Unprepare(_handle); + int ret = Native.Unprepare(_handle); if (ret != (int)ScreenMirroringError.None) { ScreenMirroringErrorFactory.ThrowException(ret, "Failed to reset the screen mirroring sink"); @@ -441,7 +442,7 @@ namespace Tizen.Multimedia if (_handle != IntPtr.Zero) { - Interop.ScreenMirroring.Destroy(_handle); + Native.Destroy(_handle); _handle = IntPtr.Zero; } @@ -472,7 +473,7 @@ namespace Tizen.Multimedia StateError(state, error); }; - int ret = Interop.ScreenMirroring.SetStateChangedCb(_handle, _stateChangedCallback, IntPtr.Zero); + int ret = Native.SetStateChangedCb(_handle, _stateChangedCallback, IntPtr.Zero); if (ret != (int)ScreenMirroringError.None) { Log.Error(ScreenMirroringLog.LogTag, "Setting StateChanged callback failed" + (ScreenMirroringError)ret); @@ -486,7 +487,7 @@ namespace Tizen.Multimedia /// Thrown when method fail due to an internal error private void UnregisterStateChangedEvent() { - int ret = Interop.ScreenMirroring.UnsetStateChangedCb(_handle); + int ret = Native.UnsetStateChangedCb(_handle); if (ret != (int)ScreenMirroringError.None) { Log.Error(ScreenMirroringLog.LogTag, "Unsetting StateChnaged callback failed" + (ScreenMirroringError)ret); diff --git a/src/Tizen.Multimedia/ScreenMirroring/ScreenMirroringEnumerations.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringEnumerations.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/ScreenMirroring/ScreenMirroringEnumerations.cs rename to src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringEnumerations.cs diff --git a/src/Tizen.Multimedia/ScreenMirroring/ScreenMirroringErrorFactory.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringErrorFactory.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/ScreenMirroring/ScreenMirroringErrorFactory.cs rename to src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringErrorFactory.cs diff --git a/src/Tizen.Multimedia/ScreenMirroring/StateChangedEventArgs.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/StateChangedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/ScreenMirroring/StateChangedEventArgs.cs rename to src/Tizen.Multimedia.Remoting/ScreenMirroring/StateChangedEventArgs.cs diff --git a/src/Tizen.Multimedia/ScreenMirroring/VideoInformation.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/VideoInformation.cs old mode 100755 new mode 100644 similarity index 90% rename from src/Tizen.Multimedia/ScreenMirroring/VideoInformation.cs rename to src/Tizen.Multimedia.Remoting/ScreenMirroring/VideoInformation.cs index d8ccabf..59f9a9c --- a/src/Tizen.Multimedia/ScreenMirroring/VideoInformation.cs +++ b/src/Tizen.Multimedia.Remoting/ScreenMirroring/VideoInformation.cs @@ -16,7 +16,7 @@ */ using System; -using System.Runtime.InteropServices; +using Native = Interop.ScreenMirroring; namespace Tizen.Multimedia { @@ -49,7 +49,7 @@ namespace Tizen.Multimedia get { int ret; - ret = Interop.ScreenMirroring.GetNegotiatedVideoCodec(ref _handle, out _codec); + ret = Native.GetNegotiatedVideoCodec(ref _handle, out _codec); if (ret != (int)ScreenMirroringError.None) { Log.Error(ScreenMirroringLog.LogTag, "Failed to get video codec" + (ScreenMirroringError)ret); @@ -70,7 +70,7 @@ namespace Tizen.Multimedia get { int ret; - ret = Interop.ScreenMirroring.GetNegotiatedVideoResolution(ref _handle, out _width, out _height); + ret = Native.GetNegotiatedVideoResolution(ref _handle, out _width, out _height); if (ret != (int)ScreenMirroringError.None) { Log.Error(ScreenMirroringLog.LogTag, "Failed to get height" + (ScreenMirroringError)ret); @@ -91,7 +91,7 @@ namespace Tizen.Multimedia get { int ret; - ret = Interop.ScreenMirroring.GetNegotiatedVideoResolution(ref _handle, out _width, out _height); + ret = Native.GetNegotiatedVideoResolution(ref _handle, out _width, out _height); if (ret != (int)ScreenMirroringError.None) { Log.Error(ScreenMirroringLog.LogTag, "Failed to get width" + (ScreenMirroringError)ret); @@ -112,7 +112,7 @@ namespace Tizen.Multimedia get { int ret; - ret = Interop.ScreenMirroring.GetNegotiatedVideoFrameRate(ref _handle, out _frameRate); + ret = Native.GetNegotiatedVideoFrameRate(ref _handle, out _frameRate); if (ret != (int)ScreenMirroringError.None) { Log.Error(ScreenMirroringLog.LogTag, "Failed to get frame rate" + (ScreenMirroringError)ret); diff --git a/src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.csproj b/src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.csproj new file mode 100644 index 0000000..4cfc174 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.csproj @@ -0,0 +1,20 @@ + + + netstandard1.3 + True + True + Tizen.Multimedia.Remoting.snk + true + True + False + + + + + + + + + + + diff --git a/src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.nuspec b/src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.nuspec new file mode 100644 index 0000000..49bea79 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.nuspec @@ -0,0 +1,18 @@ + + + + Tizen.Multimedia.Remoting + $version$ + Samsung Electronics + false + https://www.apache.org/licenses/LICENSE-2.0 + https://www.tizen.org/ + https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png + © Samsung Electronics Co., Ltd All Rights Reserved + Provides the Multimedia Remoting API(MediaController, ScreenMirroring) for Tizen.Net + + + + + + diff --git a/src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.snk b/src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.snk new file mode 100644 index 0000000..623ff70 Binary files /dev/null and b/src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.snk differ diff --git a/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..43f15f2 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string StreamRecorder = "libcapi-media-streamrecorder.so.0"; + } +} diff --git a/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.cs b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.cs new file mode 100644 index 0000000..dd79eab --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.cs @@ -0,0 +1,186 @@ +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class StreamRecorder + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecordingLimitReachedCallback(StreamRecordingLimitType type, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecordingStatusCallback(ulong elapsedTime, ulong fileSize, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void NotifiedCallback(StreamRecorderState previous, StreamRecorderState current, StreamRecorderNotify notfication, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecorderErrorCallback(StreamRecorderErrorCode error, StreamRecorderState current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void BufferConsumedCallback(IntPtr buffer, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool VideoResolutionCallback(int width, int height, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool FileFormatCallback(StreamRecorderFileFormat format, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AudioEncoderCallback(StreamRecorderAudioCodec codec, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool VideoEncoderCallback(StreamRecorderVideoCodec codec, IntPtr userData); + + /* begin of method */ + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_create")] + internal static extern int Create(out IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_prepare")] + internal static extern int Prepare(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unprepare")] + internal static extern int Unprepare(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_start")] + internal static extern int Start(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_pause")] + internal static extern int Pause(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_commit")] + internal static extern int Commit(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_cancel")] + internal static extern int Cancel(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_push_stream_buffer")] + internal static extern int PushStreamBuffer(IntPtr handle, IntPtr/* media_packet_h */ inbuf); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_enable_source_buffer")] + internal static extern int EnableSourceBuffer(IntPtr handle, int type); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_state")] + internal static extern int GetState(IntPtr handle, out int state); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_filename")] + internal static extern int SetFileName(IntPtr handle, string path); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_filename")] + internal static extern int GetFileName(IntPtr handle, out IntPtr path); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_file_format")] + internal static extern int SetFileFormat(IntPtr handle, int format); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_file_format")] + internal static extern int GetFileFormat(IntPtr handle, out int format); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_encoder")] + internal static extern int SetAudioEncoder(IntPtr handle, int codec); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_encoder")] + internal static extern int GetAudioEncoder(IntPtr handle, out int codec); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_encoder")] + internal static extern int SetVideoEncoder(IntPtr handle, int codec); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_encoder")] + internal static extern int GetVideoEncoder(IntPtr handle, out int codec); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_resolution")] + internal static extern int SetVideoResolution(IntPtr handle, int width, int height); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_resolution")] + internal static extern int GetVideoResolution(IntPtr handle, out int width, out int height); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_framerate")] + internal static extern int SetVideoFramerate(IntPtr handle, int framerate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_framerate")] + internal static extern int GetVideoFramerate(IntPtr handle, out int framerate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_source_format")] + internal static extern int SetVideoSourceFormat(IntPtr handle, int format); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_source_format")] + internal static extern int GetVideoSourceFormat(IntPtr handle, out int format); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_limit")] + internal static extern int SetRecordingLimit(IntPtr handle, int type, int limit); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_recording_limit")] + internal static extern int GetRecordingLimit(IntPtr handle, int type, out int format); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_samplerate")] + internal static extern int SetAudioSampleRate(IntPtr handle, int samplerate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_samplerate")] + internal static extern int GetAudioSampleRate(IntPtr handle, out int samplerate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_encoder_bitrate")] + internal static extern int SetAudioEncoderBitrate(IntPtr handle, int bitrate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_encoder_bitrate")] + internal static extern int GetAudioEncoderBitrate(IntPtr handle, out int bitrate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_encoder_bitrate")] + internal static extern int SetVideoEncoderBitrate(IntPtr handle, int bitrate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_encoder_bitrate")] + internal static extern int GetVideoEncoderBitrate(IntPtr handle, out int bitrate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_channel")] + internal static extern int SetAudioChannel(IntPtr handle, int channel); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_channel")] + internal static extern int GetAudioChannel(IntPtr handle, out int channel); + /* End of method */ + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_file_format")] + internal static extern int FileFormats(IntPtr handle, FileFormatCallback callback, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_audio_encoder")] + internal static extern int AudioEncoders(IntPtr handle, AudioEncoderCallback callback, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_video_encoder")] + internal static extern int VideoEncoders(IntPtr handle, VideoEncoderCallback callback, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_video_resolution")] + internal static extern int VideoResolution(IntPtr handle, VideoResolutionCallback callback, IntPtr userData); + /* End of foreach method */ + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_notify_cb")] + internal static extern int SetNotifiedCallback(IntPtr handle, NotifiedCallback callback, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_notify_cb")] + internal static extern int UnsetNotifiedCallback(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_status_cb")] + internal static extern int SetStatusChangedCallback(IntPtr handle, RecordingStatusCallback callback, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_recording_status_cb")] + internal static extern int UnsetStatusChangedCallback(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_limit_reached_cb")] + internal static extern int SetLimitReachedCallback(IntPtr handle, RecordingLimitReachedCallback callback, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_recording_limit_reached_cb")] + internal static extern int UnsetLimitReachedCallback(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_error_cb")] + internal static extern int SetErrorCallback(IntPtr handle, RecorderErrorCallback callback, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_error_cb")] + internal static extern int UnsetErrorCallback(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_buffer_consume_completed_cb")] + internal static extern int SetBufferConsumedCallback(IntPtr handle, BufferConsumedCallback callback, IntPtr userDat); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_buffer_consume_completed_cb")] + internal static extern int UnsetBufferConsumedCallback(IntPtr handle); + } +} diff --git a/src/Tizen.Multimedia/StreamRecorder/StreamRecorder.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.cs old mode 100755 new mode 100644 similarity index 74% rename from src/Tizen.Multimedia/StreamRecorder/StreamRecorder.cs rename to src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.cs index 9d24d62..c534d6c --- a/src/Tizen.Multimedia/StreamRecorder/StreamRecorder.cs +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.cs @@ -18,6 +18,7 @@ using System; using System.Collections.Generic; using System.Runtime.InteropServices; using Tizen.Internals.Errors; +using Native = Interop.StreamRecorder; namespace Tizen.Multimedia { @@ -41,27 +42,27 @@ namespace Tizen.Multimedia /// Occurred when recording is progressing for recording status. /// private EventHandler _recordingStatusChanged; - private Interop.StreamRecorder.RecordingStatusCallback _recordingStatusCallback; + private Native.RecordingStatusCallback _recordingStatusCallback; /// /// Occurred when recording time or size reach limit. /// private EventHandler _recordingLimitReached; - private Interop.StreamRecorder.RecordingLimitReachedCallback _recordingLimitReachedCallback; + private Native.RecordingLimitReachedCallback _recordingLimitReachedCallback; /// /// Occurred when streamrecorder complete to use pushed buffer. /// private EventHandler _bufferConsumed; - private Interop.StreamRecorder.BufferConsumedCallback _bufferConsumedCallback; + private Native.BufferConsumedCallback _bufferConsumedCallback; /// /// Occurred when streamrecorder state is changed. /// private EventHandler _recorderNotified; - private Interop.StreamRecorder.NotifiedCallback _notifiedCallback; + private Native.NotifiedCallback _notifiedCallback; /// /// Occurred when error is occured. /// private EventHandler _recordingErrorOccurred; - private Interop.StreamRecorder.RecorderErrorCallback _recorderErrorCallback; + private Native.RecorderErrorCallback _recorderErrorCallback; private List _formats; private List _audioCodec; @@ -74,16 +75,16 @@ namespace Tizen.Multimedia /// public StreamRecorder() { - int ret = Interop.StreamRecorder.Create (out _handle); + int ret = Native.Create(out _handle); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Failed to create stream recorder"); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to create stream recorder"); } _formats = new List(); _audioCodec = new List(); - _videoCodec = new List (); - _resolutions = new List (); - _videoResolution = new StreamRecorderVideoResolution (_handle); + _videoCodec = new List(); + _resolutions = new List(); + _videoResolution = new StreamRecorderVideoResolution(_handle); } /// @@ -91,7 +92,7 @@ namespace Tizen.Multimedia /// ~StreamRecorder() { - Dispose (false); + Dispose(false); } /// @@ -112,7 +113,7 @@ namespace Tizen.Multimedia _recorderNotified -= value; if (_recorderNotified == null) { - UnregisterStreamRecorderNotifiedEvent (); + UnregisterStreamRecorderNotifiedEvent(); } } } @@ -135,7 +136,7 @@ namespace Tizen.Multimedia _bufferConsumed -= value; if (_bufferConsumed == null) { - UnregisterBufferComsumedEvent (); + UnregisterBufferComsumedEvent(); } } } @@ -158,7 +159,7 @@ namespace Tizen.Multimedia _recordingStatusChanged -= value; if (_recordingStatusChanged == null) { - UnregisterRecordingStatusChangedEvent (); + UnregisterRecordingStatusChangedEvent(); } } } @@ -181,7 +182,7 @@ namespace Tizen.Multimedia _recordingLimitReached -= value; if (_recordingLimitReached == null) { - UnregisterRecordingLimitReachedEvent (); + UnregisterRecordingLimitReachedEvent(); } } } @@ -204,7 +205,7 @@ namespace Tizen.Multimedia _recordingErrorOccurred -= value; if (_recordingErrorOccurred == null) { - UnregisterRecordingErrorOccurredEvent (); + UnregisterRecordingErrorOccurredEvent(); } } } @@ -221,22 +222,22 @@ namespace Tizen.Multimedia get { IntPtr val; - int ret = Interop.StreamRecorder.GetFileName (_handle, out val); + int ret = Native.GetFileName(_handle, out val); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to get filepath, " + (StreamRecorderError)ret); + Log.Error(StreamRecorderLog.Tag, "Failed to get filepath, " + (StreamRecorderError)ret); } - string result = Marshal.PtrToStringAnsi (val); - Interop.Libc.Free (val); + string result = Marshal.PtrToStringAnsi(val); + LibcSupport.Free(val); return result; } set { - int ret = Interop.StreamRecorder.SetFileName (_handle, value); + int ret = Native.SetFileName(_handle, value); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to set filepath, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException (ret, "Failed to set filepath"); + Log.Error(StreamRecorderLog.Tag, "Failed to set filepath, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to set filepath"); } } } @@ -251,10 +252,10 @@ namespace Tizen.Multimedia { int val = 0; - int ret = Interop.StreamRecorder.GetState (_handle, out val); + int ret = Native.GetState(_handle, out val); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to get stream recorder state, " + (StreamRecorderError)ret); + Log.Error(StreamRecorderLog.Tag, "Failed to get stream recorder state, " + (StreamRecorderError)ret); } return (StreamRecorderState)val; } @@ -275,20 +276,20 @@ namespace Tizen.Multimedia { int val = 0; - int ret = Interop.StreamRecorder.GetFileFormat (_handle, out val); + int ret = Native.GetFileFormat(_handle, out val); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to get file format, " + (StreamRecorderError)ret); + Log.Error(StreamRecorderLog.Tag, "Failed to get file format, " + (StreamRecorderError)ret); } return (StreamRecorderFileFormat)val; } set { - int ret = Interop.StreamRecorder.SetFileFormat (_handle, (int)value); + int ret = Native.SetFileFormat(_handle, (int)value); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to set file format, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException (ret); + Log.Error(StreamRecorderLog.Tag, "Failed to set file format, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret); } } } @@ -308,20 +309,20 @@ namespace Tizen.Multimedia { int val = 0; - int ret = Interop.StreamRecorder.GetAudioEncoder (_handle, out val); + int ret = Native.GetAudioEncoder(_handle, out val); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to get audio codec, " + (StreamRecorderError)ret); + Log.Error(StreamRecorderLog.Tag, "Failed to get audio codec, " + (StreamRecorderError)ret); } return (StreamRecorderAudioCodec)val; } set { - int ret = Interop.StreamRecorder.SetAudioEncoder (_handle, (int)value); + int ret = Native.SetAudioEncoder(_handle, (int)value); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to set audio codec, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException (ret); + Log.Error(StreamRecorderLog.Tag, "Failed to set audio codec, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret); } } } @@ -341,20 +342,20 @@ namespace Tizen.Multimedia { int val = 0; - int ret = Interop.StreamRecorder.GetVideoEncoder (_handle, out val); + int ret = Native.GetVideoEncoder(_handle, out val); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to get video codec, " + (StreamRecorderError)ret); + Log.Error(StreamRecorderLog.Tag, "Failed to get video codec, " + (StreamRecorderError)ret); } return (StreamRecorderVideoCodec)val; } set { - int ret = Interop.StreamRecorder.SetVideoEncoder (_handle, (int)value); + int ret = Native.SetVideoEncoder(_handle, (int)value); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to set video codec, " + (StreamRecorderError)ret); + Log.Error(StreamRecorderLog.Tag, "Failed to set video codec, " + (StreamRecorderError)ret); StreamRecorderErrorFactory.ThrowException(ret); } } @@ -377,20 +378,20 @@ namespace Tizen.Multimedia { int val = 0; - int ret = Interop.StreamRecorder.GetRecordingLimit (_handle, 1, out val); + int ret = Native.GetRecordingLimit(_handle, 1, out val); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to get size limit, " + (StreamRecorderError)ret); + Log.Error(StreamRecorderLog.Tag, "Failed to get size limit, " + (StreamRecorderError)ret); } return val; } set { - int ret = Interop.StreamRecorder.SetRecordingLimit (_handle, 1, value); + int ret = Native.SetRecordingLimit(_handle, 1, value); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to set sizelimit, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException (ret, "Failed to set size limit"); + Log.Error(StreamRecorderLog.Tag, "Failed to set sizelimit, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to set size limit"); } } } @@ -412,20 +413,20 @@ namespace Tizen.Multimedia { int val = 0; - int ret = Interop.StreamRecorder.GetRecordingLimit (_handle, 0, out val); + int ret = Native.GetRecordingLimit(_handle, 0, out val); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to get time limit, " + (StreamRecorderError)ret); + Log.Error(StreamRecorderLog.Tag, "Failed to get time limit, " + (StreamRecorderError)ret); } return val; } set { - int ret = Interop.StreamRecorder.SetRecordingLimit (_handle, 0, value); + int ret = Native.SetRecordingLimit(_handle, 0, value); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to set timelimit, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException (ret, "Failed to set time limit"); + Log.Error(StreamRecorderLog.Tag, "Failed to set timelimit, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to set time limit"); } } } @@ -445,20 +446,20 @@ namespace Tizen.Multimedia { int val = 0; - int ret = Interop.StreamRecorder.GetAudioSampleRate (_handle, out val); + int ret = Native.GetAudioSampleRate(_handle, out val); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to get audio samplerate, " + (StreamRecorderError)ret); + Log.Error(StreamRecorderLog.Tag, "Failed to get audio samplerate, " + (StreamRecorderError)ret); } return val; } set { - int ret = Interop.StreamRecorder.SetAudioSampleRate (_handle, value); + int ret = Native.SetAudioSampleRate(_handle, value); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to set audio samplerate, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException (ret, "Failed to set audio samplerate"); + Log.Error(StreamRecorderLog.Tag, "Failed to set audio samplerate, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to set audio samplerate"); } } } @@ -478,20 +479,20 @@ namespace Tizen.Multimedia { int val = 0; - int ret = Interop.StreamRecorder.GetAudioEncoderBitrate (_handle, out val); + int ret = Native.GetAudioEncoderBitrate(_handle, out val); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to get audio bitrate, " + (StreamRecorderError)ret); + Log.Error(StreamRecorderLog.Tag, "Failed to get audio bitrate, " + (StreamRecorderError)ret); } return val; } set { - int ret = Interop.StreamRecorder.SetAudioEncoderBitrate (_handle, value); + int ret = Native.SetAudioEncoderBitrate(_handle, value); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to set audio bitrate, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException (ret, "Failed to set audio bitrate"); + Log.Error(StreamRecorderLog.Tag, "Failed to set audio bitrate, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to set audio bitrate"); } } } @@ -511,20 +512,20 @@ namespace Tizen.Multimedia { int val = 0; - int ret = Interop.StreamRecorder.GetVideoEncoderBitrate (_handle, out val); + int ret = Native.GetVideoEncoderBitrate(_handle, out val); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to get video bitrate, " + (StreamRecorderError)ret); + Log.Error(StreamRecorderLog.Tag, "Failed to get video bitrate, " + (StreamRecorderError)ret); } return val; } set { - int ret = Interop.StreamRecorder.SetVideoEncoderBitrate (_handle, value); + int ret = Native.SetVideoEncoderBitrate(_handle, value); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to set video bitrate, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException (ret, "Failed to set video bitrate"); + Log.Error(StreamRecorderLog.Tag, "Failed to set video bitrate, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to set video bitrate"); } } } @@ -544,7 +545,7 @@ namespace Tizen.Multimedia { int val = 0; - int ret = Interop.StreamRecorder.GetVideoFramerate(_handle, out val); + int ret = Native.GetVideoFramerate(_handle, out val); if ((StreamRecorderError)ret != StreamRecorderError.None) { Log.Error(StreamRecorderLog.Tag, "Failed to get video framerate, " + (StreamRecorderError)ret); @@ -553,7 +554,7 @@ namespace Tizen.Multimedia } set { - int ret = Interop.StreamRecorder.SetVideoFramerate(_handle, value); + int ret = Native.SetVideoFramerate(_handle, value); if ((StreamRecorderError)ret != StreamRecorderError.None) { Log.Error(StreamRecorderLog.Tag, "Failed to set video framerate, " + (StreamRecorderError)ret); @@ -573,7 +574,7 @@ namespace Tizen.Multimedia { int val = 0; - int ret = Interop.StreamRecorder.GetVideoSourceFormat(_handle, out val); + int ret = Native.GetVideoSourceFormat(_handle, out val); if ((StreamRecorderError)ret != StreamRecorderError.None) { Log.Error(StreamRecorderLog.Tag, "Failed to get video framerate, " + (StreamRecorderError)ret); @@ -582,7 +583,7 @@ namespace Tizen.Multimedia } set { - int ret = Interop.StreamRecorder.SetVideoSourceFormat(_handle, (int)value); + int ret = Native.SetVideoSourceFormat(_handle, (int)value); if ((StreamRecorderError)ret != StreamRecorderError.None) { Log.Error(StreamRecorderLog.Tag, "Failed to set video framerate, " + (StreamRecorderError)ret); @@ -607,20 +608,20 @@ namespace Tizen.Multimedia { int val = 0; - int ret = Interop.StreamRecorder.GetAudioChannel (_handle, out val); + int ret = Native.GetAudioChannel(_handle, out val); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to get audio channel, " + (StreamRecorderError)ret); + Log.Error(StreamRecorderLog.Tag, "Failed to get audio channel, " + (StreamRecorderError)ret); } return val; } set { - int ret = Interop.StreamRecorder.SetAudioChannel (_handle, value); + int ret = Native.SetAudioChannel(_handle, value); if ((StreamRecorderError)ret != StreamRecorderError.None) { - Log.Error (StreamRecorderLog.Tag, "Failed to set audio channel, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException (ret, "Failed to set audio channel"); + Log.Error(StreamRecorderLog.Tag, "Failed to set audio channel, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to set audio channel"); } } } @@ -657,15 +658,15 @@ namespace Tizen.Multimedia { if (_formats.Count == 0) { - Interop.StreamRecorder.FileFormatCallback callback = (StreamRecorderFileFormat format, IntPtr userData) => + Native.FileFormatCallback callback = (StreamRecorderFileFormat format, IntPtr userData) => { - _formats.Add (format); + _formats.Add(format); return true; }; - int ret = Interop.StreamRecorder.FileFormats (_handle, callback, IntPtr.Zero); + int ret = Native.FileFormats(_handle, callback, IntPtr.Zero); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Failed to get the supported fileformats"); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to get the supported fileformats"); } } return _formats; @@ -686,15 +687,15 @@ namespace Tizen.Multimedia { if (_audioCodec.Count == 0) { - Interop.StreamRecorder.AudioEncoderCallback callback = (StreamRecorderAudioCodec codec, IntPtr userData) => + Native.AudioEncoderCallback callback = (StreamRecorderAudioCodec codec, IntPtr userData) => { _audioCodec.Add(codec); return true; }; - int ret = Interop.StreamRecorder.AudioEncoders (_handle, callback, IntPtr.Zero); + int ret = Native.AudioEncoders(_handle, callback, IntPtr.Zero); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Failed to get the supported audio encoders"); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to get the supported audio encoders"); } } return _audioCodec; @@ -715,15 +716,15 @@ namespace Tizen.Multimedia { if (_videoCodec.Count == 0) { - Interop.StreamRecorder.VideoEncoderCallback callback = (StreamRecorderVideoCodec codec, IntPtr userData) => + Native.VideoEncoderCallback callback = (StreamRecorderVideoCodec codec, IntPtr userData) => { _videoCodec.Add(codec); return true; }; - int ret = Interop.StreamRecorder.VideoEncoders (_handle, callback, IntPtr.Zero); + int ret = Native.VideoEncoders(_handle, callback, IntPtr.Zero); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Failed to get the supported video encoders"); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to get the supported video encoders"); } } return _videoCodec; @@ -744,16 +745,16 @@ namespace Tizen.Multimedia { if (_resolutions.Count == 0) { - Interop.StreamRecorder.VideoResolutionCallback callback = (int width, int height, IntPtr userData) => + Native.VideoResolutionCallback callback = (int width, int height, IntPtr userData) => { StreamRecorderVideoResolution temp = new StreamRecorderVideoResolution(width, height); _resolutions.Add(temp); return true; }; - int ret = Interop.StreamRecorder.VideoResolution (_handle, callback, IntPtr.Zero); + int ret = Native.VideoResolution(_handle, callback, IntPtr.Zero); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Failed to get the supported video resolutions"); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to get the supported video resolutions"); } } return _resolutions; @@ -771,10 +772,10 @@ namespace Tizen.Multimedia /// public void Prepare() { - int ret = Interop.StreamRecorder.Prepare (_handle); + int ret = Native.Prepare(_handle); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Failed to prepare stream recorder"); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to prepare stream recorder"); } } @@ -789,10 +790,10 @@ namespace Tizen.Multimedia /// public void Unprepare() { - int ret = Interop.StreamRecorder.Unprepare (_handle); + int ret = Native.Unprepare(_handle); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Failed to reset the stream recorder"); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to reset the stream recorder"); } } @@ -815,10 +816,10 @@ namespace Tizen.Multimedia /// public void Start() { - int ret = Interop.StreamRecorder.Start (_handle); + int ret = Native.Start(_handle); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Failed to start the stream recorder"); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to start the stream recorder"); } } @@ -834,10 +835,10 @@ namespace Tizen.Multimedia /// public void Pause() { - int ret = Interop.StreamRecorder.Pause (_handle); + int ret = Native.Pause(_handle); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Failed to pause the stream recorder"); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to pause the stream recorder"); } } @@ -859,10 +860,10 @@ namespace Tizen.Multimedia /// public void Commit() { - int ret = Interop.StreamRecorder.Commit (_handle); + int ret = Native.Commit(_handle); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Failed to save the recorded content"); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to save the recorded content"); } } @@ -874,10 +875,10 @@ namespace Tizen.Multimedia /// public void Cancel() { - int ret = Interop.StreamRecorder.Cancel (_handle); + int ret = Native.Cancel(_handle); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Failed to cancel the recording"); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to cancel the recording"); } } @@ -889,7 +890,7 @@ namespace Tizen.Multimedia IntPtr _packet_h = packet.GetHandle(); Log.Info("Tizen.Multimedia.StreamRecorder", "PUSH stream buffer"); - int ret = Interop.StreamRecorder.PushStreamBuffer(_handle, _packet_h); + int ret = Native.PushStreamBuffer(_handle, _packet_h); if (ret != (int)StreamRecorderError.None) { StreamRecorderErrorFactory.ThrowException(ret, "Failed to push buffer"); @@ -902,7 +903,7 @@ namespace Tizen.Multimedia /// public void EnableSourceBuffer(StreamRecorderSourceType type) { - int ret = Interop.StreamRecorder.EnableSourceBuffer(_handle, (int) type); + int ret = Native.EnableSourceBuffer(_handle, (int)type); if (ret != (int)StreamRecorderError.None) { StreamRecorderErrorFactory.ThrowException(ret, "Failed to set EnableSourceBuffer"); @@ -928,7 +929,7 @@ namespace Tizen.Multimedia } if (_handle != IntPtr.Zero) { - Interop.StreamRecorder.Destroy (_handle); + Native.Destroy(_handle); _handle = IntPtr.Zero; } _disposed = true; @@ -942,19 +943,19 @@ namespace Tizen.Multimedia StreamRecorderNotifiedEventArgs eventArgs = new StreamRecorderNotifiedEventArgs(previous, current, notify); _recorderNotified?.Invoke(this, eventArgs); }; - int ret = Interop.StreamRecorder.SetNotifiedCallback (_handle, _notifiedCallback, IntPtr.Zero); + int ret = Native.SetNotifiedCallback(_handle, _notifiedCallback, IntPtr.Zero); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Setting notify callback failed"); + StreamRecorderErrorFactory.ThrowException(ret, "Setting notify callback failed"); } } private void UnregisterStreamRecorderNotifiedEvent() { - int ret = Interop.StreamRecorder.UnsetNotifiedCallback (_handle); + int ret = Native.UnsetNotifiedCallback(_handle); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Unsetting notify callback failed"); + StreamRecorderErrorFactory.ThrowException(ret, "Unsetting notify callback failed"); } } @@ -965,19 +966,19 @@ namespace Tizen.Multimedia StreamRecordingBufferConsumedEventArgs eventArgs = new StreamRecordingBufferConsumedEventArgs(buffer); _bufferConsumed?.Invoke(this, eventArgs); }; - int ret = Interop.StreamRecorder.SetBufferConsumedCallback (_handle, _bufferConsumedCallback, IntPtr.Zero); + int ret = Native.SetBufferConsumedCallback(_handle, _bufferConsumedCallback, IntPtr.Zero); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Setting buffer consumed callback failed"); + StreamRecorderErrorFactory.ThrowException(ret, "Setting buffer consumed callback failed"); } } private void UnregisterBufferComsumedEvent() { - int ret = Interop.StreamRecorder.UnsetBufferConsumedCallback (_handle); + int ret = Native.UnsetBufferConsumedCallback(_handle); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Unsetting buffer consumed callback failed"); + StreamRecorderErrorFactory.ThrowException(ret, "Unsetting buffer consumed callback failed"); } } @@ -988,19 +989,19 @@ namespace Tizen.Multimedia RecordingProgressEventArgs eventArgs = new RecordingProgressEventArgs(elapsedTime, fileSize); _recordingStatusChanged?.Invoke(this, eventArgs); }; - int ret = Interop.StreamRecorder.SetStatusChangedCallback(_handle, _recordingStatusCallback, IntPtr.Zero); + int ret = Native.SetStatusChangedCallback(_handle, _recordingStatusCallback, IntPtr.Zero); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Setting status changed callback failed"); + StreamRecorderErrorFactory.ThrowException(ret, "Setting status changed callback failed"); } } private void UnregisterRecordingStatusChangedEvent() { - int ret = Interop.StreamRecorder.UnsetStatusChangedCallback(_handle); + int ret = Native.UnsetStatusChangedCallback(_handle); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Unsetting status changed callback failed"); + StreamRecorderErrorFactory.ThrowException(ret, "Unsetting status changed callback failed"); } } @@ -1011,16 +1012,16 @@ namespace Tizen.Multimedia StreamRecordingLimitReachedEventArgs eventArgs = new StreamRecordingLimitReachedEventArgs(type); _recordingLimitReached?.Invoke(this, eventArgs); }; - int ret = Interop.StreamRecorder.SetLimitReachedCallback (_handle, _recordingLimitReachedCallback, IntPtr.Zero); + int ret = Native.SetLimitReachedCallback(_handle, _recordingLimitReachedCallback, IntPtr.Zero); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Setting limit reached callback failed"); + StreamRecorderErrorFactory.ThrowException(ret, "Setting limit reached callback failed"); } } private void UnregisterRecordingLimitReachedEvent() { - int ret = Interop.StreamRecorder.UnsetLimitReachedCallback (_handle); + int ret = Native.UnsetLimitReachedCallback(_handle); if (ret != (int)StreamRecorderError.None) { StreamRecorderErrorFactory.ThrowException(ret, "Unsetting limit reached callback failed"); @@ -1034,19 +1035,19 @@ namespace Tizen.Multimedia StreamRecordingErrorOccurredEventArgs eventArgs = new StreamRecordingErrorOccurredEventArgs(error, current); _recordingErrorOccurred?.Invoke(this, eventArgs); }; - int ret = Interop.StreamRecorder.SetErrorCallback (_handle, _recorderErrorCallback, IntPtr.Zero); + int ret = Native.SetErrorCallback(_handle, _recorderErrorCallback, IntPtr.Zero); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Setting Error callback failed"); + StreamRecorderErrorFactory.ThrowException(ret, "Setting Error callback failed"); } } private void UnregisterRecordingErrorOccurredEvent() { - int ret = Interop.StreamRecorder.UnsetErrorCallback (_handle); + int ret = Native.UnsetErrorCallback(_handle); if (ret != (int)StreamRecorderError.None) { - StreamRecorderErrorFactory.ThrowException (ret, "Unsetting Error callback failed"); + StreamRecorderErrorFactory.ThrowException(ret, "Unsetting Error callback failed"); } } } diff --git a/src/Tizen.Multimedia/StreamRecorder/StreamRecorderEnums.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderEnums.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/StreamRecorder/StreamRecorderEnums.cs rename to src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderEnums.cs diff --git a/src/Tizen.Multimedia/StreamRecorder/StreamRecorderErrorFactory.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderErrorFactory.cs old mode 100755 new mode 100644 similarity index 99% rename from src/Tizen.Multimedia/StreamRecorder/StreamRecorderErrorFactory.cs rename to src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderErrorFactory.cs index ce2a7dd..d16b7c2 --- a/src/Tizen.Multimedia/StreamRecorder/StreamRecorderErrorFactory.cs +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderErrorFactory.cs @@ -42,13 +42,13 @@ namespace Tizen.Multimedia } switch((StreamRecorderError)errorCode) { case StreamRecorderError.InvalidParameter: - throw new ArgumentException(errorMessage, paramName); - case StreamRecorderError.OutOfMemory: - throw new OutOfMemoryException(errorMessage); - case StreamRecorderError.PermissionDenied: - throw new UnauthorizedAccessException(errorMessage); + throw new ArgumentException(errorMessage, paramName); + case StreamRecorderError.OutOfMemory: + throw new OutOfMemoryException(errorMessage); + case StreamRecorderError.PermissionDenied: + throw new UnauthorizedAccessException(errorMessage); case StreamRecorderError.NotSupported: - throw new NotSupportedException(errorMessage); + throw new NotSupportedException(errorMessage); case StreamRecorderError.InvalidState: case StreamRecorderError.InvalidOperation: case StreamRecorderError.OutOfStorage: diff --git a/src/Tizen.Multimedia/StreamRecorder/StreamRecorderNotifiedEventArgs.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderNotifiedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/StreamRecorder/StreamRecorderNotifiedEventArgs.cs rename to src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderNotifiedEventArgs.cs diff --git a/src/Tizen.Multimedia/StreamRecorder/StreamRecorderVideoResolution.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderVideoResolution.cs old mode 100755 new mode 100644 similarity index 84% rename from src/Tizen.Multimedia/StreamRecorder/StreamRecorderVideoResolution.cs rename to src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderVideoResolution.cs index 87c4431..8523098 --- a/src/Tizen.Multimedia/StreamRecorder/StreamRecorderVideoResolution.cs +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderVideoResolution.cs @@ -15,6 +15,7 @@ */ using System; +using Native = Interop.StreamRecorder; namespace Tizen.Multimedia { @@ -31,7 +32,7 @@ namespace Tizen.Multimedia { _Handle = handle; _interopFlag = true; - int ret = Interop.StreamRecorder.GetVideoResolution(_Handle, out _width, out _height); + int ret = Native.GetVideoResolution(_Handle, out _width, out _height); StreamRecorderError err = (StreamRecorderError)ret; Log.Info(StreamRecorderLog.Tag, "width " + _width + " height " + _height + "return " + err.ToString()); } @@ -50,13 +51,13 @@ namespace Tizen.Multimedia public int Width { get { if(_interopFlag == true) - Interop.StreamRecorder.GetVideoResolution(_Handle, out _width, out _height); + Native.GetVideoResolution(_Handle, out _width, out _height); return _width; } set { _width = value; if(_interopFlag == true) { - int ret = Interop.StreamRecorder.SetVideoResolution(_Handle, _width, _height); + int ret = Native.SetVideoResolution(_Handle, _width, _height); StreamRecorderError err = (StreamRecorderError)ret; Log.Info(StreamRecorderLog.Tag, " set width " + _width + " height " + _height + "set return " + err.ToString()); } @@ -70,13 +71,13 @@ namespace Tizen.Multimedia public int Height { get { if(_interopFlag == true) - Interop.StreamRecorder.GetVideoResolution(_Handle, out _width, out _height); + Native.GetVideoResolution(_Handle, out _width, out _height); return _height; } set { _height = value; if(_interopFlag == true) { - int ret = Interop.StreamRecorder.SetVideoResolution(_Handle, _width, _height); + int ret = Native.SetVideoResolution(_Handle, _width, _height); StreamRecorderError err = (StreamRecorderError)ret; Log.Info(StreamRecorderLog.Tag, " set width " + _width + " height " + _height + "set return " + err.ToString()); } diff --git a/src/Tizen.Multimedia/StreamRecorder/StreamRecordingBufferConsumedEventArgs.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingBufferConsumedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/StreamRecorder/StreamRecordingBufferConsumedEventArgs.cs rename to src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingBufferConsumedEventArgs.cs diff --git a/src/Tizen.Multimedia/StreamRecorder/StreamRecordingErrorOccurredEventArgs.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingErrorOccurredEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/StreamRecorder/StreamRecordingErrorOccurredEventArgs.cs rename to src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingErrorOccurredEventArgs.cs diff --git a/src/Tizen.Multimedia/StreamRecorder/StreamRecordingLimitReachedEventArgs.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingLimitReachedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/StreamRecorder/StreamRecordingLimitReachedEventArgs.cs rename to src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingLimitReachedEventArgs.cs diff --git a/src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.csproj b/src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.csproj new file mode 100644 index 0000000..a21f590 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.csproj @@ -0,0 +1,20 @@ + + + netstandard1.3 + True + True + Tizen.Multimedia.StreamRecorder.snk + true + True + False + + + + + + + + + + + diff --git a/src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.nuspec b/src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.nuspec new file mode 100644 index 0000000..0cd5804 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.nuspec @@ -0,0 +1,18 @@ + + + + Tizen.Multimedia.StreamRecorder + $version$ + Samsung Electronics + false + https://www.apache.org/licenses/LICENSE-2.0 + https://www.tizen.org/ + https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png + © Samsung Electronics Co., Ltd All Rights Reserved + Provides the Multimedia StreamRecorder API for Tizen.Net + + + + + + diff --git a/src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.snk b/src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.snk new file mode 100644 index 0000000..7801c11 Binary files /dev/null and b/src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.snk differ diff --git a/src/Tizen.Multimedia.Util/Interop/Interop.ErrorCode.cs b/src/Tizen.Multimedia.Util/Interop/Interop.ErrorCode.cs new file mode 100644 index 0000000..169c630 --- /dev/null +++ b/src/Tizen.Multimedia.Util/Interop/Interop.ErrorCode.cs @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using System.Runtime.CompilerServices; +using Tizen; + +internal static partial class Interop +{ + internal enum ErrorCode + { + None = Tizen.Internals.Errors.ErrorCode.None, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + InvalidOperation = Tizen.Internals.Errors.ErrorCode.InvalidOperation, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, + ResourceBusy = Tizen.Internals.Errors.ErrorCode.ResourceBusy, + NoSuchFile = Tizen.Internals.Errors.ErrorCode.NoSuchFile, + + // Radio + InvalidState = -0x019A0000 | 0x01, // RADIO_ERROR_INVALID_STATE + SoundPolicy = -0x019A0000 | 0x02, // RADIO_ERROR_SOUND_POLICY + NoAntenna = -0x019A0000 | 0x03, // RADIO_ERROR_NO_ANTENNA + + // Image/ Video Utility + NotSupportedFormat = -0x01980000 | 0x01, // VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT + } +} + +internal static class ErrorCodeExtensions +{ + private const string LogTag = "Tizen.Multimedia"; + + internal static bool IsSuccess(this Interop.ErrorCode err) + { + return err == Interop.ErrorCode.None; + } + + internal static bool IsFailed(this Interop.ErrorCode err) + { + return !err.IsSuccess(); + } + + /// + /// Utility method to check for error, returns false if failed and print warning messages + /// + /// true in case of no error, false otherwise + internal static bool WarnIfFailed(this Interop.ErrorCode err, string msg, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + if (err.IsFailed()) + { + Log.Debug(LogTag, $"{msg}, err: {err.ToString()}", file, func, line); + return false; + } + return true; + } + + /// + /// Utility method to check for error, returns false if failed and throw exception + /// + /// true in case of no error + internal static bool ThrowIfFailed(this Interop.ErrorCode err, string msg, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + if (err.IsFailed()) + { + Log.Error(LogTag, $"{msg}, err: {err.ToString()}", file, func, line); + throw err.GetException(msg); + } + return true; + } + + internal static Exception GetException(this Interop.ErrorCode err, string message) + { + string errMessage = $"{message}, err: {err.ToString()}"; + switch (err) + { + //case ErrorCode.None: + case Interop.ErrorCode.PermissionDenied: return new UnauthorizedAccessException(errMessage); + case Interop.ErrorCode.InvalidParameter: return new ArgumentException(errMessage); + case Interop.ErrorCode.NoSuchFile: return new FileNotFoundException(errMessage); + case Interop.ErrorCode.OutOfMemory: return new OutOfMemoryException(errMessage); + case Interop.ErrorCode.NoAntenna: + case Interop.ErrorCode.NotSupported: return new NotSupportedException(errMessage); + case Interop.ErrorCode.InvalidOperation: + case Interop.ErrorCode.InvalidState: + case Interop.ErrorCode.SoundPolicy: + case Interop.ErrorCode.ResourceBusy: + default: return new InvalidOperationException(errMessage); + } + } +} diff --git a/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Decode.cs b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Decode.cs new file mode 100644 index 0000000..c295303 --- /dev/null +++ b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Decode.cs @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + // Image Decoder + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_set_input_path")] + internal static extern ErrorCode SetInputPath(this ImageDecoderHandle /* image_util_decode_h */ handle, string path); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_set_input_buffer")] + internal static extern ErrorCode SetInputBuffer(this ImageDecoderHandle /* image_util_decode_h */ handle, byte[] srcBuffer, ulong srcSize); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_set_output_buffer")] + internal static extern ErrorCode SetOutputBuffer(this ImageDecoderHandle /* image_util_decode_h */ handle, out IntPtr dstBuffer); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_set_colorspace")] + internal static extern ErrorCode SetColorspace(this ImageDecoderHandle /* image_util_encode_h */ handle, ImageColorSpace /* image_util_colorspace_e */ colorspace); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_set_jpeg_downscale")] + internal static extern ErrorCode SetJpegDownscale(this ImageDecoderHandle /* image_util_encode_h */ handle, JpegDownscale /* image_util_scale_e */ downscale); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_run")] + internal static extern ErrorCode DecodeRun(this ImageDecoderHandle /* image_util_decode_h */ handle, out int width, out int height, out ulong size); + + internal class ImageDecoderHandle : SafeMultimediaHandle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DecodeCompletedCallback(ErrorCode errorCode, IntPtr /* void */ userData, int width, int height, ulong size); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_run_async")] + internal static extern ErrorCode DecodeRunAsync(ImageDecoderHandle /* image_util_decode_h */ handle, DecodeCompletedCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_create")] + internal static extern ErrorCode Create(out IntPtr /* image_util_decode_h */ handle); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* image_util_decode_h */ handle); + + internal ImageColorSpace Colorspace + { + set { NativeSet(this.SetColorspace, value); } + } + + internal JpegDownscale JpegDownscale + { + set { NativeSet(this.SetJpegDownscale, value); } + } + + internal ImageDecoderHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease) + { + } + + internal ImageDecoderHandle() : this(CreateNativeHandle(), true) + { + } + + internal static IntPtr CreateNativeHandle() + { + IntPtr handle; + Create(out handle).ThrowIfFailed("Failed to create native handle"); + return handle; + } + + internal override ErrorCode DisposeNativeHandle() + { + return Destroy(handle); + } + } +} diff --git a/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Encode.cs b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Encode.cs new file mode 100644 index 0000000..18b98a3 --- /dev/null +++ b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Encode.cs @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + // Image Encoder + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_resolution")] + internal static extern ErrorCode SetResolution(this ImageEncoderHandle /* image_util_encode_h */ handle, uint width, uint height); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_colorspace")] + internal static extern ErrorCode SetColorspace(this ImageEncoderHandle /* image_util_encode_h */ handle, ImageColorSpace /* image_util_colorspace_e */ colorspace); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_quality")] + internal static extern ErrorCode SetQuality(this ImageEncoderHandle /* image_util_encode_h */ handle, int quality); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_png_compression")] + internal static extern ErrorCode SetPngCompression(this ImageEncoderHandle /* image_util_encode_h */ handle, PngCompression /* image_util_png_compression_e */ compression); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_gif_frame_delay_time")] + internal static extern ErrorCode SetGifFrameDelayTime(this ImageEncoderHandle /* image_util_encode_h */ handle, ulong delayTime); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_output_path")] + internal static extern ErrorCode SetOutputPath(this ImageEncoderHandle /* image_util_encode_h */ handle, string path); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_input_buffer")] + internal static extern ErrorCode SetInputBuffer(this ImageEncoderHandle /* image_util_encode_h */ handle, byte[] srcBuffer); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_output_buffer")] + internal static extern ErrorCode SetOutputBuffer(this ImageEncoderHandle /* image_util_encode_h */ handle, out IntPtr dstBuffer); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_run")] + internal static extern ErrorCode EncodeRun(this ImageEncoderHandle /* image_util_encode_h */ handle, out ulong size); + + internal class ImageEncoderHandle : SafeMultimediaHandle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void EncodeCompletedCallback(ErrorCode errorCode, IntPtr /* void */ userData, ulong size); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_run_async")] + internal static extern ErrorCode EncodeRunAsync(ImageEncoderHandle /* image_util_encode_h */ handle, EncodeCompletedCallback callback, IntPtr /* void */ userData); + + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_create")] + internal static extern ErrorCode Create(ImageType /* image_util_type_e */ type, out IntPtr /* image_util_encode_h */ handle); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* image_util_encode_h */ handle); + + internal ImageEncoderHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease) + { + } + + internal ImageEncoderHandle(ImageType type) : this(CreateNativeHandle(type), true) + { + } + + internal ImageColorSpace Colorspace + { + set { NativeSet(this.SetColorspace, value); } + } + + internal int Quality + { + set { NativeSet(this.SetQuality, value); } + } + + internal PngCompression PngCompression + { + set { NativeSet(this.SetPngCompression, value); } + } + + internal ulong GifFrameDelay + { + set { NativeSet(this.SetGifFrameDelayTime, value); } + } + + internal string OutputPath + { + set { NativeSet(this.SetOutputPath, value); } + } + + internal byte[] InputBuffer + { + set { NativeSet(this.SetInputBuffer, value); } + } + + internal static IntPtr CreateNativeHandle(ImageType type) + { + IntPtr handle; + Create(type, out handle).ThrowIfFailed("Failed to create native handle"); + return handle; + } + + internal override ErrorCode DisposeNativeHandle() + { + return Destroy(handle); + } + } +} diff --git a/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Transform.cs b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Transform.cs new file mode 100644 index 0000000..9bad56c --- /dev/null +++ b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Transform.cs @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_set_hardware_acceleration")] + internal static extern ErrorCode SetHardwareAcceleration(this ImageTransformHandle /* transformation_h */ handle, bool mode); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_get_colorspace")] + internal static extern ErrorCode GetColorspace(this ImageTransformHandle /* transformation_h */ handle, out ImageColorSpace /* image_util_colorspace_e */ colorspace); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_set_colorspace")] + internal static extern ErrorCode SetColorspace(this ImageTransformHandle /* transformation_h */ handle, ImageColorSpace /* image_util_colorspace_e */ colorspace); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_get_rotation")] + internal static extern ErrorCode GetRotation(this ImageTransformHandle /* transformation_h */ handle, out ImageRotation /* image_util_rotation_e */ rotation); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_set_rotation")] + internal static extern ErrorCode SetRotation(this ImageTransformHandle /* transformation_h */ handle, ImageRotation /* image_util_rotation_e */ rotation); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_get_resolution")] + internal static extern ErrorCode GetResolution(this ImageTransformHandle /* transformation_h */ handle, out uint width, out uint height); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_set_resolution")] + internal static extern ErrorCode SetResolution(this ImageTransformHandle /* transformation_h */ handle, uint width, uint height); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_get_crop_area")] + internal static extern ErrorCode GetCropArea(this ImageTransformHandle /* transformation_h */ handle, out uint startX, out uint startY, out uint endX, out uint endY); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_set_crop_area")] + internal static extern ErrorCode SetCropArea(this ImageTransformHandle /* transformation_h */ handle, int startX, int startY, int endX, int endY); + + internal class ImageTransformHandle : SafeMultimediaHandle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TransformCompletedCallback(IntPtr /* media_packet_h */ dst, ErrorCode errorCode, IntPtr /* void */ userData); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_run")] + internal static extern ErrorCode Transform(ImageTransformHandle /* transformation_h */ handle, IntPtr /* media_packet_h */ src, TransformCompletedCallback callback, IntPtr /* void */ userData); + + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_create")] + internal static extern ErrorCode Create(out IntPtr /* transformation_h */ handle); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* transformation_h */ handle); + + internal ImageTransformHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease) + { + } + + internal ImageTransformHandle() : this(CreateNativeHandle(), true) + { + } + + internal bool HardwareAccelerationEnabled + { + set { NativeSet(this.SetHardwareAcceleration, value); } + } + + internal ImageColorSpace Colorspace + { + get { return NativeGet(this.GetColorspace); } + set { NativeSet(this.SetColorspace, value); } + } + + internal ImageRotation Rotation + { + get { return NativeGet(this.GetRotation); } + set { NativeSet(this.SetRotation, value); } + } + + internal static IntPtr CreateNativeHandle() + { + IntPtr handle; + Create(out handle).ThrowIfFailed("Failed to create native handle"); + return handle; + } + + internal override ErrorCode DisposeNativeHandle() + { + return Destroy(handle); + } + } +} diff --git a/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.cs b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.cs new file mode 100644 index 0000000..d3f74b6 --- /dev/null +++ b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.cs @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal enum ImageColorSpace + { + Yv12, // IMAGE_UTIL_COLORSPACE_YV12 + Yuv422, // IMAGE_UTIL_COLORSPACE_YUV422 + I420, // IMAGE_UTIL_COLORSPACE_I420 + Nv12, // IMAGE_UTIL_COLORSPACE_NV12 + Uyvy, // IMAGE_UTIL_COLORSPACE_UYVY + Yuyv, // IMAGE_UTIL_COLORSPACE_YUYV + Rgb565, // IMAGE_UTIL_COLORSPACE_RGB565 + Rgb888, // IMAGE_UTIL_COLORSPACE_RGB888 + Argb8888, // IMAGE_UTIL_COLORSPACE_ARGB8888 + Bgra8888, // IMAGE_UTIL_COLORSPACE_BGRA8888 + Rgba8888, // IMAGE_UTIL_COLORSPACE_RGBA8888 + Bgrx8888, // IMAGE_UTIL_COLORSPACE_BGRX8888 + Nv21, // IMAGE_UTIL_COLORSPACE_NV21 + Nv16, // IMAGE_UTIL_COLORSPACE_NV16 + Nv61, // IMAGE_UTIL_COLORSPACE_NV61 + } + + internal enum ImageRotation + { + None, // IMAGE_UTIL_ROTATION_NONE + Rotate90, // IMAGE_UTIL_ROTATION_90 + Rotate180, // IMAGE_UTIL_ROTATION_180 + Rotate270, // IMAGE_UTIL_ROTATION_270 + FlipHorizontal, // IMAGE_UTIL_ROTATION_FLIP_HORZ + FlipVertical, // IMAGE_UTIL_ROTATION_FLIP_VERT + } + + internal enum ImageType + { + Jpeg, // IMAGE_UTIL_JPEG + Png, // IMAGE_UTIL_PNG + Gif, // IMAGE_UTIL_GIF + Bmp, // IMAGE_UTIL_BMP + } + + internal enum JpegDownscale + { + NoDownscale, // IMAGE_UTIL_DOWNSCALE_1_1 + OneHalf, // IMAGE_UTIL_DOWNSCALE_1_2 + OneFourth, // IMAGE_UTIL_DOWNSCALE_1_4 + OneEighth, // IMAGE_UTIL_DOWNSCALE_1_8 + } + + internal enum PngCompression + { + NoCompression, // IMAGE_UTIL_PNG_COMPRESSION_0 + Level1, // IMAGE_UTIL_PNG_COMPRESSION_1 + Level2, // IMAGE_UTIL_PNG_COMPRESSION_2 + Level3, // IMAGE_UTIL_PNG_COMPRESSION_3 + Level4, // IMAGE_UTIL_PNG_COMPRESSION_4 + Level5, // IMAGE_UTIL_PNG_COMPRESSION_5 + Level6, // IMAGE_UTIL_PNG_COMPRESSION_6 + Level7, // IMAGE_UTIL_PNG_COMPRESSION_7 + Level8, // IMAGE_UTIL_PNG_COMPRESSION_8 + Level9, // IMAGE_UTIL_PNG_COMPRESSION_9 + } + + internal class ImageUtil + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SupportedColorspaceCallback(ImageColorSpace /* image_util_colorspace_e */ colorspace, IntPtr /* void */ userData); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_foreach_supported_colorspace")] + internal static extern ErrorCode ForeachSupportedColorspace(ImageType /* image_util_type_e */ type, SupportedColorspaceCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_calculate_buffer_size")] + internal static extern ErrorCode CalculateBufferSize(int width, int height, ImageColorSpace /* image_util_colorspace_e */ colorspace, out uint size); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_extract_color_from_memory")] + internal static extern ErrorCode ExtractColorFromMemory(byte[] buffer, int width, int height, out byte rgbR, out byte rgbG, out byte rgbB); + + internal static void ForeachSupportedColorspace(ImageType type, Action action) + { + SupportedColorspaceCallback callback = (codec, userData) => + { + action(codec); + return true; + }; + + ForeachSupportedColorspace(type, callback, IntPtr.Zero).WarnIfFailed("Failed to get supported color-space list from native handle"); + } + + internal static uint CalculateBufferSize(int width, int height, ImageColorSpace colorSpace) + { + uint size; + CalculateBufferSize(width, height, colorSpace, out size).ThrowIfFailed("Failed to calculate buffer size"); + return size; + } + + internal static ElmSharp.Color ExtractColorFromMemory(byte[] buffer, int width, int height) + { + byte r, g, b; + ExtractColorFromMemory(buffer, width, height, out r, out g, out b); + return new ElmSharp.Color(r, g, b); + } + + internal static byte[] NativeToByteArray(IntPtr nativeBuffer, int size) + { + Debug.Assert(nativeBuffer != IntPtr.Zero); + + byte[] managedArray = new byte[size]; + Marshal.Copy(nativeBuffer, managedArray, 0, size); + + LibcSupport.Free(nativeBuffer); + return managedArray; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Util/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.Util/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..3b5ae55 --- /dev/null +++ b/src/Tizen.Multimedia.Util/Interop/Interop.Libraries.cs @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string ImageUtil = "libcapi-media-image-util.so.0"; + public const string ThumbnailExtractor = "libcapi-media-thumbnail-util.so"; + } +} diff --git a/src/Tizen.Multimedia.Util/Interop/Interop.SafeMultimediaHandle.cs b/src/Tizen.Multimedia.Util/Interop/Interop.SafeMultimediaHandle.cs new file mode 100644 index 0000000..ced1e62 --- /dev/null +++ b/src/Tizen.Multimedia.Util/Interop/Interop.SafeMultimediaHandle.cs @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +internal static partial class Interop +{ + internal static Task PinnedTask(TaskCompletionSource tcs) + { + var gch = GCHandle.Alloc(tcs); + return tcs.Task.ContinueWith( + t => { gch.Free(); return t; }, + TaskContinuationOptions.ExecuteSynchronously).Unwrap(); + } + + internal abstract class SafeMultimediaHandle : SafeHandle + { + internal delegate ErrorCode GetterMethod(out TProp value); + internal delegate ErrorCode SetterMethod(TProp value); + + protected SafeMultimediaHandle(IntPtr handle, bool needToRelease) : base(handle, true) + { + Debug.Assert(handle != IntPtr.Zero); + HasOwnership = needToRelease; + } + + internal bool HasOwnership { get; set; } + public override bool IsInvalid { get { return handle == IntPtr.Zero; } } + + internal abstract ErrorCode DisposeNativeHandle(); + + internal TProp NativeGet(GetterMethod getter, [CallerMemberName] string propertyName = "") + { + TProp value; getter(out value).ThrowIfFailed($"Failed to get {propertyName}"); + return value; + } + + internal string NativeGet(GetterMethod getter, [CallerMemberName] string propertyName = "") + { + string value; getter(out value).ThrowIfFailed($"Failed to get {propertyName}"); + return value; + } + + internal void NativeSet(SetterMethod setter, TProp value, [CallerMemberName] string propertyName = "") + { + setter(value).ThrowIfFailed($"Failed to set {propertyName}"); + } + + protected override bool ReleaseHandle() + { + var err = ErrorCode.None; + if (HasOwnership) + { + err = DisposeNativeHandle(); + err.WarnIfFailed($"Failed to delete native {GetType()} handle"); + } + + SetHandle(IntPtr.Zero); + return err.IsSuccess(); + } + } +} diff --git a/src/Tizen.Multimedia.Util/Interop/Interop.ThumbnailExtractor.cs b/src/Tizen.Multimedia.Util/Interop/Interop.ThumbnailExtractor.cs new file mode 100644 index 0000000..b7ae4b0 --- /dev/null +++ b/src/Tizen.Multimedia.Util/Interop/Interop.ThumbnailExtractor.cs @@ -0,0 +1,27 @@ +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class ThumbnailExtractor + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void ThumbnailExtractCallback(ThumbnailExtractorError error, string requestId, int thumbWidth, int thumbHeight, IntPtr thumbData, int thumbSize, IntPtr userData); + + [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_create")] + internal static extern ThumbnailExtractorError Create(out IntPtr handle); + + [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_extract")] + internal static extern ThumbnailExtractorError Extract(IntPtr handle, ThumbnailExtractCallback callback, IntPtr userData, out IntPtr requestId); + + [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_set_path")] + internal static extern ThumbnailExtractorError SetPath(IntPtr handle, string path); + + [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_set_size")] + internal static extern ThumbnailExtractorError SetSize(IntPtr handle, int width, int height); + + [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_destroy")] + internal static extern ThumbnailExtractorError Destroy(IntPtr handle); + } +} diff --git a/src/Tizen.Multimedia/ThumbnailExtractor/ThumbnailData.cs b/src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailData.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/ThumbnailExtractor/ThumbnailData.cs rename to src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailData.cs diff --git a/src/Tizen.Multimedia/ThumbnailExtractor/ThumbnailExtractor.cs b/src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractor.cs old mode 100755 new mode 100644 similarity index 89% rename from src/Tizen.Multimedia/ThumbnailExtractor/ThumbnailExtractor.cs rename to src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractor.cs index 2ccaf7e..eea6290 --- a/src/Tizen.Multimedia/ThumbnailExtractor/ThumbnailExtractor.cs +++ b/src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractor.cs @@ -14,10 +14,10 @@ * limitations under the License. */ - using System; using System.Threading.Tasks; using System.Runtime.InteropServices; +using Native = Interop.ThumbnailExtractor; namespace Tizen.Multimedia { @@ -49,17 +49,17 @@ namespace Tizen.Multimedia throw new ArgumentNullException(nameof(path)); } - ThumbnailExtractorError ret = Interop.ThumbnailExtractor.Create(out _handle); + ThumbnailExtractorError ret = Native.Create(out _handle); ThumbnailExtractorErrorFactory.ThrowIfError(ret, "Failed to create constructor"); try { ThumbnailExtractorErrorFactory.ThrowIfError( - Interop.ThumbnailExtractor.SetPath(_handle, path), "Failed to set the path"); + Native.SetPath(_handle, path), "Failed to set the path"); } catch (Exception) { - Interop.ThumbnailExtractor.Destroy(_handle); + Native.Destroy(_handle); _handle = IntPtr.Zero; throw; } @@ -82,20 +82,20 @@ namespace Tizen.Multimedia throw new ArgumentOutOfRangeException(nameof(height), "The height must be greater than zero:[" + height + "]"); } - ThumbnailExtractorError ret = Interop.ThumbnailExtractor.Create(out _handle); + ThumbnailExtractorError ret = Native.Create(out _handle); ThumbnailExtractorErrorFactory.ThrowIfError(ret, "Failed to create constructor"); try { ThumbnailExtractorErrorFactory.ThrowIfError( - Interop.ThumbnailExtractor.SetPath(_handle, path), "Failed to set the path"); + Native.SetPath(_handle, path), "Failed to set the path"); ThumbnailExtractorErrorFactory.ThrowIfError( - Interop.ThumbnailExtractor.SetSize(_handle, width, height), "Failed to set the size"); + Native.SetSize(_handle, width, height), "Failed to set the size"); } catch (Exception) { - Interop.ThumbnailExtractor.Destroy(_handle); + Native.Destroy(_handle); _handle = IntPtr.Zero; throw; } @@ -159,7 +159,7 @@ namespace Tizen.Multimedia var task = new TaskCompletionSource(); - Interop.ThumbnailExtractor.ThumbnailExtractCallback extractCallback = (ThumbnailExtractorError error, + Native.ThumbnailExtractCallback extractCallback = (ThumbnailExtractorError error, string requestId, int thumbWidth, int thumbHeight, @@ -182,7 +182,7 @@ namespace Tizen.Multimedia } finally { - Interop.Libc.Free(thumbData); + LibcSupport.Free(thumbData); } } else @@ -192,10 +192,10 @@ namespace Tizen.Multimedia }; IntPtr id = IntPtr.Zero; - ThumbnailExtractorError res = Interop.ThumbnailExtractor.Extract(_handle, extractCallback, IntPtr.Zero, out id); + ThumbnailExtractorError res = Native.Extract(_handle, extractCallback, IntPtr.Zero, out id); if (id != IntPtr.Zero) { - Interop.Libc.Free(id); + LibcSupport.Free(id); id = IntPtr.Zero; } @@ -223,7 +223,7 @@ namespace Tizen.Multimedia if (_handle != IntPtr.Zero) { - Interop.ThumbnailExtractor.Destroy(_handle); + Native.Destroy(_handle); _handle = IntPtr.Zero; } diff --git a/src/Tizen.Multimedia/ThumbnailExtractor/ThumbnailExtractorErrorFactory.cs b/src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractorErrorFactory.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/ThumbnailExtractor/ThumbnailExtractorErrorFactory.cs rename to src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractorErrorFactory.cs diff --git a/src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.csproj b/src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.csproj new file mode 100644 index 0000000..e40c951 --- /dev/null +++ b/src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.csproj @@ -0,0 +1,20 @@ + + + netstandard1.3 + True + True + Tizen.Multimedia.Util.snk + true + True + False + + + + + + + + + + + diff --git a/src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.nuspec b/src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.nuspec new file mode 100644 index 0000000..aa34478 --- /dev/null +++ b/src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.nuspec @@ -0,0 +1,18 @@ + + + + Tizen.Multimedia.Util + $version$ + Samsung Electronics + false + https://www.apache.org/licenses/LICENSE-2.0 + https://www.tizen.org/ + https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png + © Samsung Electronics Co., Ltd All Rights Reserved + Provides the Multimedia Util API for Tizen.Net + + + + + + diff --git a/src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.snk b/src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.snk new file mode 100644 index 0000000..4ce3793 Binary files /dev/null and b/src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.snk differ diff --git a/src/Tizen.Multimedia/Utility/ImageColorSpace.cs b/src/Tizen.Multimedia.Util/Utility/ImageColorSpace.cs old mode 100755 new mode 100644 similarity index 69% rename from src/Tizen.Multimedia/Utility/ImageColorSpace.cs rename to src/Tizen.Multimedia.Util/Utility/ImageColorSpace.cs index a39c191..8db3d6f --- a/src/Tizen.Multimedia/Utility/ImageColorSpace.cs +++ b/src/Tizen.Multimedia.Util/Utility/ImageColorSpace.cs @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + namespace Tizen.Multimedia.Utility { /// @@ -24,62 +24,62 @@ namespace Tizen.Multimedia.Utility /// /// YV12 - YCrCb planar format /// - Yv12 = Interop.ImageColorSpace.Yv12, + Yv12 = global::Interop.ImageColorSpace.Yv12, /// /// UYVY - packed /// - Uyvy = Interop.ImageColorSpace.Uyvy, + Uyvy = global::Interop.ImageColorSpace.Uyvy, /// /// YUYV - packed /// - Yuyv = Interop.ImageColorSpace.Yuyv, + Yuyv = global::Interop.ImageColorSpace.Yuyv, /// /// YUV422 - planar /// - Yuv422 = Interop.ImageColorSpace.Yuv422, + Yuv422 = global::Interop.ImageColorSpace.Yuv422, /// /// YUV420 - planar /// - I420 = Interop.ImageColorSpace.I420, + I420 = global::Interop.ImageColorSpace.I420, /// /// RGB565, high-byte is Blue /// - Rgb565 = Interop.ImageColorSpace.Rgb565, + Rgb565 = global::Interop.ImageColorSpace.Rgb565, /// /// RGB888, high-byte is Blue /// - Rgb888 = Interop.ImageColorSpace.Rgb888, + Rgb888 = global::Interop.ImageColorSpace.Rgb888, /// /// ARGB8888, high-byte is Blue /// - Argb8888 = Interop.ImageColorSpace.Argb8888, + Argb8888 = global::Interop.ImageColorSpace.Argb8888, /// /// BGRA8888, high-byte is Alpha /// - Bgra8888 = Interop.ImageColorSpace.Bgra8888, + Bgra8888 = global::Interop.ImageColorSpace.Bgra8888, /// /// RGBA8888, high-byte is Alpha /// - Rgba8888 = Interop.ImageColorSpace.Rgba8888, + Rgba8888 = global::Interop.ImageColorSpace.Rgba8888, /// /// BGRX8888, high-byte is X /// - Bgrx8888 = Interop.ImageColorSpace.Bgrx8888, + Bgrx8888 = global::Interop.ImageColorSpace.Bgrx8888, /// /// NV12- planar /// - Nv12 = Interop.ImageColorSpace.Nv12, + Nv12 = global::Interop.ImageColorSpace.Nv12, /// /// NV16- planar /// - Nv16 = Interop.ImageColorSpace.Nv16, + Nv16 = global::Interop.ImageColorSpace.Nv16, /// /// NV21- planar /// - Nv21 = Interop.ImageColorSpace.Nv21, + Nv21 = global::Interop.ImageColorSpace.Nv21, /// /// NV61- planar /// - Nv61 = Interop.ImageColorSpace.Nv61, + Nv61 = global::Interop.ImageColorSpace.Nv61, } } \ No newline at end of file diff --git a/src/Tizen.Multimedia/Utility/ImageData.cs b/src/Tizen.Multimedia.Util/Utility/ImageData.cs old mode 100755 new mode 100644 similarity index 92% rename from src/Tizen.Multimedia/Utility/ImageData.cs rename to src/Tizen.Multimedia.Util/Utility/ImageData.cs index 5d21090..819ebbd --- a/src/Tizen.Multimedia/Utility/ImageData.cs +++ b/src/Tizen.Multimedia.Util/Utility/ImageData.cs @@ -15,8 +15,8 @@ */ using System; -using System.Diagnostics; using Tizen.Common; +using static Interop.ImageUtil; namespace Tizen.Multimedia.Utility { @@ -48,7 +48,7 @@ namespace Tizen.Multimedia.Utility internal ImageData(IntPtr nativeBuffer, int width, int height, int size) { - Buffer = Interop.ImageUtil.NativeToByteArray(nativeBuffer, size); + Buffer = NativeToByteArray(nativeBuffer, size); Width = width; Height = height; } @@ -82,7 +82,7 @@ namespace Tizen.Multimedia.Utility private Color GetColor() { byte r, g, b, a = 0; - Interop.ImageUtil.ExtractColorFromMemory(Buffer, Width, Height, out r, out g, out b) + ExtractColorFromMemory(Buffer, Width, Height, out r, out g, out b) .ThrowIfFailed("Failed to extract color from buffer"); return new Color(r, g, b, a); } diff --git a/src/Tizen.Multimedia/Utility/ImageDecoder.cs b/src/Tizen.Multimedia.Util/Utility/ImageDecoder.cs old mode 100755 new mode 100644 similarity index 86% rename from src/Tizen.Multimedia/Utility/ImageDecoder.cs rename to src/Tizen.Multimedia.Util/Utility/ImageDecoder.cs index 9a19b75..38de9fe --- a/src/Tizen.Multimedia/Utility/ImageDecoder.cs +++ b/src/Tizen.Multimedia.Util/Utility/ImageDecoder.cs @@ -16,6 +16,7 @@ using System; using System.Threading.Tasks; +using Native = Interop; namespace Tizen.Multimedia.Utility { @@ -27,13 +28,13 @@ namespace Tizen.Multimedia.Utility public const ImageColorSpace DefaultColorspace = ImageColorSpace.Rgba8888; public const JpegDownscale DefaultJpegDownscale = JpegDownscale.NoDownscale; - internal Interop.ImageDecoderHandle _handle; + internal Native.ImageDecoderHandle _handle; private ImageColorSpace _colorspace = DefaultColorspace; private JpegDownscale _jpegDownscale = DefaultJpegDownscale; internal ImageDecoder() { - _handle = new Interop.ImageDecoderHandle(); + _handle = new Native.ImageDecoderHandle(); } /// @@ -45,7 +46,7 @@ namespace Tizen.Multimedia.Utility set { ValidateObjectNotDisposed(); - _handle.Colorspace = (Interop.ImageColorSpace)value; + _handle.Colorspace = (Native.ImageColorSpace)value; _colorspace = value; } } @@ -91,12 +92,12 @@ namespace Tizen.Multimedia.Utility { if (_colorspace != DefaultColorspace) { - _handle.Colorspace = (Interop.ImageColorSpace)_colorspace; + _handle.Colorspace = (Native.ImageColorSpace)_colorspace; } if (_jpegDownscale != DefaultJpegDownscale) { - _handle.SetJpegDownscale((Interop.JpegDownscale)_jpegDownscale).ThrowIfFailed("Failed to set JPEG Downscale for decoding"); + _handle.SetJpegDownscale((Native.JpegDownscale)_jpegDownscale).ThrowIfFailed("Failed to set JPEG Downscale for decoding"); } } @@ -108,7 +109,7 @@ namespace Tizen.Multimedia.Utility Initialize(); TaskCompletionSource tcs = new TaskCompletionSource(); - Interop.ImageDecoderHandle.DecodeCompletedCallback callback = (errorCode, userData, width, height, size) => + Native.ImageDecoderHandle.DecodeCompletedCallback callback = (errorCode, userData, width, height, size) => { if (errorCode.IsSuccess()) { @@ -121,8 +122,8 @@ namespace Tizen.Multimedia.Utility } }; - Interop.ImageDecoderHandle.DecodeRunAsync(_handle, callback, IntPtr.Zero).ThrowIfFailed("Failed to decode given image"); - return Interop.PinnedTask(tcs); + Native.ImageDecoderHandle.DecodeRunAsync(_handle, callback, IntPtr.Zero).ThrowIfFailed("Failed to decode given image"); + return Native.PinnedTask(tcs); } private void ValidateObjectNotDisposed() diff --git a/src/Tizen.Multimedia/Utility/ImageEncoder.cs b/src/Tizen.Multimedia.Util/Utility/ImageEncoder.cs old mode 100755 new mode 100644 similarity index 84% rename from src/Tizen.Multimedia/Utility/ImageEncoder.cs rename to src/Tizen.Multimedia.Util/Utility/ImageEncoder.cs index e730a5f..5cda946 --- a/src/Tizen.Multimedia/Utility/ImageEncoder.cs +++ b/src/Tizen.Multimedia.Util/Utility/ImageEncoder.cs @@ -16,6 +16,7 @@ using System; using System.Threading.Tasks; +using Native = Interop; namespace Tizen.Multimedia.Utility { @@ -60,7 +61,7 @@ namespace Tizen.Multimedia.Utility /// Encoded image buffer public Task EncodeAsync(byte[] inputBuffer) { - using (var handle = new Interop.ImageEncoderHandle((Interop.ImageType)_type)) + using (var handle = new Native.ImageEncoderHandle((Native.ImageType)_type)) { handle.SetInputBuffer(inputBuffer).ThrowIfFailed("Failed to set input buffer for encoding"); @@ -70,11 +71,11 @@ namespace Tizen.Multimedia.Utility Initialize(handle); TaskCompletionSource tcs = new TaskCompletionSource(); - Interop.ImageEncoderHandle.EncodeCompletedCallback callback = (errorCode, userData, size) => + Native.ImageEncoderHandle.EncodeCompletedCallback callback = (errorCode, userData, size) => { if (errorCode.IsSuccess()) { - tcs.TrySetResult(Interop.ImageUtil.NativeToByteArray(nativeBuffer, (int)size)); + tcs.TrySetResult(Native.ImageUtil.NativeToByteArray(nativeBuffer, (int)size)); } else { @@ -82,8 +83,8 @@ namespace Tizen.Multimedia.Utility } }; - Interop.ImageEncoderHandle.EncodeRunAsync(handle, callback, IntPtr.Zero).ThrowIfFailed("Failed to encode given image"); - return Interop.PinnedTask(tcs); + Native.ImageEncoderHandle.EncodeRunAsync(handle, callback, IntPtr.Zero).ThrowIfFailed("Failed to encode given image"); + return Native.PinnedTask(tcs); } } @@ -95,7 +96,7 @@ namespace Tizen.Multimedia.Utility /// true if encoding is successful public Task EncodeAsync(byte[] inputBuffer, string outputFilePath) { - using (var handle = new Interop.ImageEncoderHandle((Interop.ImageType)_type)) + using (var handle = new Native.ImageEncoderHandle((Native.ImageType)_type)) { handle.SetInputBuffer(inputBuffer).ThrowIfFailed("Failed to set input buffer for encoding"); handle.SetOutputPath(outputFilePath).ThrowIfFailed("Failed to set output file path for encoding"); @@ -103,7 +104,7 @@ namespace Tizen.Multimedia.Utility Initialize(handle); TaskCompletionSource tcs = new TaskCompletionSource(); - Interop.ImageEncoderHandle.EncodeCompletedCallback callback = (errorCode, userData, size) => + Native.ImageEncoderHandle.EncodeCompletedCallback callback = (errorCode, userData, size) => { if (errorCode.IsSuccess()) { @@ -115,16 +116,16 @@ namespace Tizen.Multimedia.Utility } }; - Interop.ImageEncoderHandle.EncodeRunAsync(handle, callback, IntPtr.Zero).ThrowIfFailed("Failed to encode given image"); - return Interop.PinnedTask(tcs); + Native.ImageEncoderHandle.EncodeRunAsync(handle, callback, IntPtr.Zero).ThrowIfFailed("Failed to encode given image"); + return Native.PinnedTask(tcs); } } - internal virtual void Initialize(Interop.ImageEncoderHandle handle) + internal virtual void Initialize(Native.ImageEncoderHandle handle) { if (_colorspace != DefaultColorspace) { - handle.Colorspace = (Interop.ImageColorSpace)_colorspace; + handle.Colorspace = (Native.ImageColorSpace)_colorspace; } if (_resolution.Width != 0 && _resolution.Height != 0) @@ -191,7 +192,7 @@ namespace Tizen.Multimedia.Utility } } - internal override void Initialize(Interop.ImageEncoderHandle handle) + internal override void Initialize(Native.ImageEncoderHandle handle) { if (_quality != DefaultQuality) { @@ -225,12 +226,12 @@ namespace Tizen.Multimedia.Utility set {_pngCompressionLevel = value; } } - internal override void Initialize(Interop.ImageEncoderHandle handle) + internal override void Initialize(Native.ImageEncoderHandle handle) { if (_pngCompressionLevel != DefaultPngCompressionLevel) { base.Initialize(handle); - handle.PngCompression = (Interop.PngCompression)_pngCompressionLevel; + handle.PngCompression = (Native.PngCompression)_pngCompressionLevel; } } } @@ -259,7 +260,7 @@ namespace Tizen.Multimedia.Utility set { _gifFrameDelay = value; } } - internal override void Initialize(Interop.ImageEncoderHandle handle) + internal override void Initialize(Native.ImageEncoderHandle handle) { if (_gifFrameDelay != DefaultGifFrameDelay) { diff --git a/src/Tizen.Multimedia/Utility/ImageFormat.cs b/src/Tizen.Multimedia.Util/Utility/ImageFormat.cs old mode 100755 new mode 100644 similarity index 84% rename from src/Tizen.Multimedia/Utility/ImageFormat.cs rename to src/Tizen.Multimedia.Util/Utility/ImageFormat.cs index e76e1cf..c75ea44 --- a/src/Tizen.Multimedia/Utility/ImageFormat.cs +++ b/src/Tizen.Multimedia.Util/Utility/ImageFormat.cs @@ -24,18 +24,18 @@ namespace Tizen.Multimedia.Utility /// /// JPEG image /// - Jpeg = Interop.ImageType.Jpeg, + Jpeg = global::Interop.ImageType.Jpeg, /// /// PNG image /// - Png = Interop.ImageType.Png, + Png = global::Interop.ImageType.Png, /// /// GIF image /// - Gif = Interop.ImageType.Gif, + Gif = global::Interop.ImageType.Gif, /// /// BMP image /// - Bmp = Interop.ImageType.Bmp, + Bmp = global::Interop.ImageType.Bmp, } } \ No newline at end of file diff --git a/src/Tizen.Multimedia/Utility/ImageRotation.cs b/src/Tizen.Multimedia.Util/Utility/ImageRotation.cs old mode 100755 new mode 100644 similarity index 76% rename from src/Tizen.Multimedia/Utility/ImageRotation.cs rename to src/Tizen.Multimedia.Util/Utility/ImageRotation.cs index e4a4b72..e755315 --- a/src/Tizen.Multimedia/Utility/ImageRotation.cs +++ b/src/Tizen.Multimedia.Util/Utility/ImageRotation.cs @@ -24,26 +24,26 @@ namespace Tizen.Multimedia.Utility /// /// No rotation /// - None = Interop.ImageRotation.None, + None = global::Interop.ImageRotation.None, /// /// Rotate 90 degree /// - Rotate90 = Interop.ImageRotation.Rotate90, + Rotate90 = global::Interop.ImageRotation.Rotate90, /// /// Rotate 180 degree /// - Rotate180 = Interop.ImageRotation.Rotate180, + Rotate180 = global::Interop.ImageRotation.Rotate180, /// /// Rotate 270 degree /// - Rotate270 = Interop.ImageRotation.Rotate270, + Rotate270 = global::Interop.ImageRotation.Rotate270, /// /// Flip horizontal /// - FlipHorizontal = Interop.ImageRotation.FlipHorizontal, + FlipHorizontal = global::Interop.ImageRotation.FlipHorizontal, /// /// Flip vertical /// - FlipVertical = Interop.ImageRotation.FlipVertical, + FlipVertical = global::Interop.ImageRotation.FlipVertical, } } \ No newline at end of file diff --git a/src/Tizen.Multimedia/Utility/ImageTransformer.cs b/src/Tizen.Multimedia.Util/Utility/ImageTransformer.cs old mode 100755 new mode 100644 similarity index 81% rename from src/Tizen.Multimedia/Utility/ImageTransformer.cs rename to src/Tizen.Multimedia.Util/Utility/ImageTransformer.cs index e4c5bce..29cbf9b --- a/src/Tizen.Multimedia/Utility/ImageTransformer.cs +++ b/src/Tizen.Multimedia.Util/Utility/ImageTransformer.cs @@ -16,6 +16,7 @@ using System; using System.Threading.Tasks; +using static Interop; namespace Tizen.Multimedia.Utility { @@ -23,9 +24,9 @@ namespace Tizen.Multimedia.Utility { public static Task ConvertColorspaceAsync(this MediaPacket packet, ImageColorSpace colorspace, bool useHardwareAcceleration) { - using (var handle = new Interop.ImageTransformHandle()) + using (var handle = new ImageTransformHandle()) { - handle.Colorspace = (Interop.ImageColorSpace)colorspace; + handle.Colorspace = (global::Interop.ImageColorSpace)colorspace; return TransformAsync(handle, packet, useHardwareAcceleration); } } @@ -37,7 +38,7 @@ namespace Tizen.Multimedia.Utility public static Task ResizeAsync(this MediaPacket packet, Size resolution, bool useHardwareAcceleration) { - using (var handle = new Interop.ImageTransformHandle()) + using (var handle = new ImageTransformHandle()) { handle.SetResolution((uint)resolution.Width, (uint)resolution.Height) .ThrowIfFailed("Failed to set image resolution for transformation"); @@ -52,9 +53,9 @@ namespace Tizen.Multimedia.Utility public static Task RotateAsync(this MediaPacket packet, ImageRotation rotation, bool useHardwareAcceleration) { - using (var handle = new Interop.ImageTransformHandle()) + using (var handle = new ImageTransformHandle()) { - handle.Rotation = (Interop.ImageRotation)rotation; + handle.Rotation = (global::Interop.ImageRotation)rotation; return TransformAsync(handle, packet, useHardwareAcceleration); } } @@ -66,7 +67,7 @@ namespace Tizen.Multimedia.Utility public static Task CropAsync(this MediaPacket packet, Rectangle cropArea, bool useHardwareAcceleration) { - using (var handle = new Interop.ImageTransformHandle()) + using (var handle = new ImageTransformHandle()) { handle.SetCropArea(cropArea.X, cropArea.Y, cropArea.X + cropArea.Width, cropArea.Y + cropArea.Height) .ThrowIfFailed("Failed to set crop area for transformation"); @@ -79,7 +80,7 @@ namespace Tizen.Multimedia.Utility return CropAsync(packet, cropArea, false); } - private static Task TransformAsync(Interop.ImageTransformHandle handle, MediaPacket packet, bool useHardwareAcceleration) + private static Task TransformAsync(ImageTransformHandle handle, MediaPacket packet, bool useHardwareAcceleration) { if (useHardwareAcceleration) { @@ -87,7 +88,7 @@ namespace Tizen.Multimedia.Utility } TaskCompletionSource tcs = new TaskCompletionSource(); - Interop.ImageTransformHandle.TransformCompletedCallback callback = (nativehandle, errorCode, userData) => + ImageTransformHandle.TransformCompletedCallback callback = (nativehandle, errorCode, userData) => { if (errorCode.IsSuccess()) { @@ -99,9 +100,9 @@ namespace Tizen.Multimedia.Utility } }; - Interop.ImageTransformHandle.Transform(handle, packet.GetHandle(), callback, IntPtr.Zero) + ImageTransformHandle.Transform(handle, packet.GetHandle(), callback, IntPtr.Zero) .ThrowIfFailed("Failed to transform given packet"); - return Interop.PinnedTask(tcs); + return PinnedTask(tcs); } } } \ No newline at end of file diff --git a/src/Tizen.Multimedia/Utility/ImageUtility.cs b/src/Tizen.Multimedia.Util/Utility/ImageUtility.cs old mode 100755 new mode 100644 similarity index 87% rename from src/Tizen.Multimedia/Utility/ImageUtility.cs rename to src/Tizen.Multimedia.Util/Utility/ImageUtility.cs index 24d555c..7993b4d --- a/src/Tizen.Multimedia/Utility/ImageUtility.cs +++ b/src/Tizen.Multimedia.Util/Utility/ImageUtility.cs @@ -15,6 +15,7 @@ */ using System.Collections.Generic; +using static Interop; namespace Tizen.Multimedia.Utility { @@ -31,7 +32,7 @@ namespace Tizen.Multimedia.Utility public static IEnumerable GetSupportedColorspace(ImageFormat type) { var colorspaces = new List(); - Interop.ImageUtil.ForeachSupportedColorspace((Interop.ImageType)type, (colorspace) => colorspaces.Add((ImageColorSpace)colorspace)); + ImageUtil.ForeachSupportedColorspace((ImageType)type, (colorspace) => colorspaces.Add((ImageColorSpace)colorspace)); return colorspaces; } @@ -45,7 +46,7 @@ namespace Tizen.Multimedia.Utility public static uint CalculateBufferSize(int width, int height, ImageColorSpace colorspace) { uint bufferSize; - Interop.ImageUtil.CalculateBufferSize(width, height, (Interop.ImageColorSpace)colorspace, out bufferSize) + ImageUtil.CalculateBufferSize(width, height, (global::Interop.ImageColorSpace)colorspace, out bufferSize) .ThrowIfFailed("Failed to calculate buffer size for given parameter"); return bufferSize; } diff --git a/src/Tizen.Multimedia/Utility/JpegDownscale.cs b/src/Tizen.Multimedia.Util/Utility/JpegDownscale.cs old mode 100755 new mode 100644 similarity index 81% rename from src/Tizen.Multimedia/Utility/JpegDownscale.cs rename to src/Tizen.Multimedia.Util/Utility/JpegDownscale.cs index 7673789..4cde770 --- a/src/Tizen.Multimedia/Utility/JpegDownscale.cs +++ b/src/Tizen.Multimedia.Util/Utility/JpegDownscale.cs @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + namespace Tizen.Multimedia.Utility { /// @@ -24,18 +24,18 @@ namespace Tizen.Multimedia.Utility /// /// No downscale /// - NoDownscale = Interop.JpegDownscale.NoDownscale, + NoDownscale = global::Interop.JpegDownscale.NoDownscale, /// /// 1/2 downscale /// - OneHalf = Interop.JpegDownscale.OneHalf, + OneHalf = global::Interop.JpegDownscale.OneHalf, /// /// 1/4 downscale /// - OneFourth = Interop.JpegDownscale.OneFourth, + OneFourth = global::Interop.JpegDownscale.OneFourth, /// /// 1/8 downscale /// - OneEighth = Interop.JpegDownscale.OneEighth, + OneEighth = global::Interop.JpegDownscale.OneEighth, } } \ No newline at end of file diff --git a/src/Tizen.Multimedia/Utility/PngCompressionLevel.cs b/src/Tizen.Multimedia.Util/Utility/PngCompressionLevel.cs old mode 100755 new mode 100644 similarity index 73% rename from src/Tizen.Multimedia/Utility/PngCompressionLevel.cs rename to src/Tizen.Multimedia.Util/Utility/PngCompressionLevel.cs index 0410682..87b4b46 --- a/src/Tizen.Multimedia/Utility/PngCompressionLevel.cs +++ b/src/Tizen.Multimedia.Util/Utility/PngCompressionLevel.cs @@ -24,42 +24,42 @@ namespace Tizen.Multimedia.Utility /// /// No Compression /// - NoCompression = Interop.PngCompression.NoCompression, + NoCompression = global::Interop.PngCompression.NoCompression, /// /// Compression Level 1. Best speed /// - Level1 = Interop.PngCompression.Level1, + Level1 = global::Interop.PngCompression.Level1, /// /// Compression Level 2 /// - Level2 = Interop.PngCompression.Level2, + Level2 = global::Interop.PngCompression.Level2, /// /// Compression Level 3 /// - Level3 = Interop.PngCompression.Level3, + Level3 = global::Interop.PngCompression.Level3, /// /// Compression Level 4 /// - Level4 = Interop.PngCompression.Level4, + Level4 = global::Interop.PngCompression.Level4, /// /// Compression Level 5 /// - Level5 = Interop.PngCompression.Level5, + Level5 = global::Interop.PngCompression.Level5, /// /// Compression Level 6 /// - Level6 = Interop.PngCompression.Level6, + Level6 = global::Interop.PngCompression.Level6, /// /// Compression Level 7 /// - Level7 = Interop.PngCompression.Level7, + Level7 = global::Interop.PngCompression.Level7, /// /// Compression Level 8 /// - Level8 = Interop.PngCompression.Level8, + Level8 = global::Interop.PngCompression.Level8, /// /// Compression Level 9 /// - Level9 = Interop.PngCompression.Level9, + Level9 = global::Interop.PngCompression.Level9, } } diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..c48de1c --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string MediaVision = "libcapi-media-vision.so.0"; + } +} diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.BarCode.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.BarCode.cs new file mode 100644 index 0000000..03a0013 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.BarCode.cs @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +/// +/// Interop APIs +/// +internal static partial class Interop +{ + /// + /// Interop for media vision APIs + /// + internal static partial class MediaVision + { + /// + /// Interop for barcode detector APIs + /// + internal static partial class BarcodeDetector + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_barcode_detect")] + internal static extern MediaVisionError Detect(IntPtr source, IntPtr engineCfg, Rectangle roi, + DetectedCallback detectCb, IntPtr userData = default(IntPtr)); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DetectedCallback( + IntPtr source, + IntPtr engineCfg, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + Quadrangle[] locations, + [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr, SizeParamIndex = 5)] + string[] messages, + BarcodeType[] types, + int numberOfBarcodes, + IntPtr userData); + } + + /// + /// Interop for barcode generator APIs + /// + internal static partial class BarcodeGenerator + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_barcode_generate_source")] + internal static extern MediaVisionError GenerateSource(IntPtr engineCfg, string message, + BarcodeType type, int qrEncMode, int qrEcc, int qrVersion, IntPtr source); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_barcode_generate_image")] + internal static extern MediaVisionError GenerateImage(IntPtr engineCfg, + string message, int imageWidth, int imageHeight, BarcodeType type, + int qrEncMode, int qrEcc, int qrVersion, string imagePath, BarcodeImageFormat imageFormat); + } + } +} diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Common.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Common.cs new file mode 100644 index 0000000..771749f --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Common.cs @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +/// +/// Interop APIs +/// +internal static partial class Interop +{ + internal static Tizen.Multimedia.Point ToApiStruct(this MediaVision.Point pt) + { + return new Tizen.Multimedia.Point(pt.x, pt.y); + } + + internal static MediaVision.Point ToMarshalable(this Tizen.Multimedia.Point pt) + { + return new MediaVision.Point() { x = pt.X, y = pt.Y }; + } + + internal static MediaVision.Point[] ToMarshalable(Tizen.Multimedia.Point[] pts) + { + var result = new MediaVision.Point[pts.Length]; + for (int i = 0; i < pts.Length; ++i) + { + result[i] = pts[i].ToMarshalable(); + } + return result; + } + + + internal static Tizen.Multimedia.Quadrangle ToApiStruct(this MediaVision.Quadrangle quadrangle) + { + Tizen.Multimedia.Point[] points = new Tizen.Multimedia.Point[4]; + for (int i = 0; i < 4; ++i) + { + points[i] = quadrangle.points[i].ToApiStruct(); + } + return new Tizen.Multimedia.Quadrangle(points); + } + + internal static MediaVision.Quadrangle ToMarshalable(this Tizen.Multimedia.Quadrangle quadrangle) + { + MediaVision.Point[] points = new MediaVision.Point[4]; + for (int i = 0; i < 4; ++i) + { + points[i] = quadrangle.Points[i].ToMarshalable(); + } + return new MediaVision.Quadrangle() { points = points }; + } + + internal static Tizen.Multimedia.Rectangle ToApiStruct(this MediaVision.Rectangle rectangle) + { + return new Tizen.Multimedia.Rectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height); + } + + internal static MediaVision.Rectangle ToMarshalable(this Tizen.Multimedia.Rectangle rectangle) + { + return new MediaVision.Rectangle() + { + x = rectangle.X, + y = rectangle.Y, + width = rectangle.Width, + height = rectangle.Height + }; + } + + internal static Tizen.Multimedia.Rectangle[] ToApiStruct(MediaVision.Rectangle[] rects) + { + var result = new Tizen.Multimedia.Rectangle[rects.Length]; + + for (int i = 0; i < rects.Length; i++) + { + result[i] = rects[i].ToApiStruct(); + } + return result; + } + + /// + /// Interop for media vision APIs + /// + internal static partial class MediaVision + { + [StructLayout(LayoutKind.Sequential)] + internal struct Point + { + internal int x; + internal int y; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct Rectangle + { + internal int x; + internal int y; + internal int width; + internal int height; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct Quadrangle + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + internal Point[] points; + } + + /// + /// Interop for media vision source APIs + /// + internal static partial class MediaSource + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_create_source")] + internal static extern MediaVisionError Create(out IntPtr source); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_destroy_source")] + internal static extern int Destroy(IntPtr /* mv_source_h */ source); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_fill_by_media_packet")] + internal static extern MediaVisionError FillMediaPacket(IntPtr source, IntPtr mediaPacket); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_fill_by_buffer")] + internal static extern MediaVisionError FillBuffer(IntPtr source, byte[] buffer, + int bufferSize, uint imageWidth, uint imageHeight, Colorspace colorspace); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_clear")] + internal static extern int Clear(IntPtr /* mv_source_h */ source); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_get_buffer")] + internal static extern MediaVisionError GetBuffer(IntPtr source, out IntPtr buffer, out int bufferSize); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_get_height")] + internal static extern int GetHeight(IntPtr source, out uint imageHeight); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_get_width")] + internal static extern int GetWidth(IntPtr source, out uint imageWidth); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_get_colorspace")] + internal static extern int GetColorspace(IntPtr /* mv_source_h */ source, out Tizen.Multimedia.Colorspace colorspace); + } + + /// + /// Interop for engine configuration APIs + /// + internal static partial class EngineConfig + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_create_engine_config")] + internal static extern MediaVisionError Create(out IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_destroy_engine_config")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_double_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError SetDouble(IntPtr handle, string name, double value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_int_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError SetInt(IntPtr handle, string name, int value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_bool_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError SetBool(IntPtr handle, string name, bool value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_string_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError SetString(IntPtr handle, string name, string value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_double_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError GetDouble(IntPtr handle, string name, out double value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_int_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError GetInt(IntPtr handle, string name, out int value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_bool_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError GetBool(IntPtr handle, string name, out bool value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_string_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError GetString(IntPtr handle, string name, out IntPtr value); + } + } +} diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Face.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Face.cs new file mode 100644 index 0000000..224caa8 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Face.cs @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +/// +/// Interop APIs +/// +internal static partial class Interop +{ + /// + /// Interop for media vision APIs + /// + internal static partial class MediaVision + { + /// + /// Interop for Face APIs + /// + internal static partial class Face + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_detect")] + internal static extern MediaVisionError Detect(IntPtr source, IntPtr engineCfg, + DetectedCallback detectedCb, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognize")] + internal static extern MediaVisionError Recognize(IntPtr source, IntPtr recognitionModel, IntPtr engineCfg, + IntPtr faceLocation, RecognizedCallback recognizedCb, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognize")] + internal static extern MediaVisionError Recognize(IntPtr source, IntPtr recognitionModel, IntPtr engineCfg, + ref Rectangle faceLocation, RecognizedCallback recognizedCb, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_track")] + internal static extern MediaVisionError Track(IntPtr source, IntPtr trackingModel, IntPtr engineCfg, + TrackedCallback trackedCb, bool doLearn, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_eye_condition_recognize")] + internal static extern MediaVisionError RecognizeEyeCondition(IntPtr source, IntPtr engineCfg, + Rectangle faceLocation, EyeConditionRecognizedCallback eyeConditionRecognizedCb, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_facial_expression_recognize")] + internal static extern MediaVisionError RecognizeFacialExpression(IntPtr source, IntPtr engineCfg, + Rectangle faceLocation, MvFaceFacialExpressionRecognizedCallback expressionRecognizedCb, + IntPtr userData = default(IntPtr)); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DetectedCallback(IntPtr source, IntPtr engineCfg, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] Rectangle[] facesLocations, + int numberOfFaces, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecognizedCallback(IntPtr source, IntPtr recognitionModel, + IntPtr engineCfg, IntPtr faceLocation, IntPtr faceLabel, double confidence, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TrackedCallback(IntPtr source, IntPtr trackingModel, IntPtr engineCfg, + IntPtr location, double confidence, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void EyeConditionRecognizedCallback(IntPtr source, IntPtr engineCfg, + Rectangle faceLocation, EyeCondition eyeCondition, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MvFaceFacialExpressionRecognizedCallback(IntPtr source, + IntPtr engineCfg, Rectangle faceLocation, FacialExpression facialExpression, IntPtr userData); + } + + /// + /// Interop for FaceRecognitionModel APIs + /// + internal static partial class FaceRecognitionModel + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_create")] + internal static extern MediaVisionError Create(out IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_clone")] + internal static extern int Clone(IntPtr src, out IntPtr dst); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_save")] + internal static extern MediaVisionError Save(string fileName, IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_load")] + internal static extern MediaVisionError Load(string fileName, out IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_add")] + internal static extern MediaVisionError Add(IntPtr source, IntPtr recognitionModel, + ref Rectangle exampleLocation, int faceLabel); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_add")] + internal static extern MediaVisionError Add(IntPtr source, IntPtr recognitionModel, + IntPtr exampleLocation, int faceLabel); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_reset")] + internal static extern MediaVisionError Reset(IntPtr recognitionModel, IntPtr faceLabel = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_reset")] + internal static extern MediaVisionError Remove(IntPtr recognitionModel, ref int faceLabel); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_learn")] + internal static extern MediaVisionError Learn(IntPtr engineCfg, IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_query_labels")] + internal static extern MediaVisionError QueryLabels(IntPtr handle, out IntPtr labels, out uint numberOfLabels); + } + + /// + /// Interop for FaceTrackingModel APIs + /// + internal static partial class FaceTrackingModel + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_create")] + internal static extern MediaVisionError Create(out IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_prepare")] + internal static extern MediaVisionError Prepare(IntPtr trackingModel, IntPtr engineCfg, + IntPtr source, ref Quadrangle location); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_prepare")] + internal static extern MediaVisionError Prepare(IntPtr trackingModel, IntPtr engineCfg, + IntPtr source, IntPtr location); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_clone")] + internal static extern int Clone(IntPtr src, out IntPtr dst); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_save")] + internal static extern MediaVisionError Save(string fileName, IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_load")] + internal static extern MediaVisionError Load(string fileName, out IntPtr handle); + } + } +} diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Image.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Image.cs new file mode 100644 index 0000000..215331b --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Image.cs @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +/// +/// Interop APIs +/// +internal static partial class Interop +{ + /// + /// Interop for Media vision APIs + /// + internal static partial class MediaVision + { + /// + /// Interop for Image APIs + /// + internal static partial class Image + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_recognize")] + internal static extern MediaVisionError Recognize(IntPtr source, IntPtr[] imageObjects, + int numberOfObjects, IntPtr engineCfg, RecognizedCallback recognizedCb, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_track")] + internal static extern MediaVisionError Track(IntPtr source, IntPtr imageTrackingModel, + IntPtr engineCfg, TrackedCallback trackedCb, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_create")] + internal static extern MediaVisionError Create(out IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_fill")] + internal static extern MediaVisionError Fill(IntPtr handle, IntPtr engineCfg, IntPtr source, ref Rectangle location); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_fill")] + internal static extern MediaVisionError Fill(IntPtr handle, IntPtr engineCfg, IntPtr source, IntPtr location); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_get_recognition_rate")] + internal static extern MediaVisionError GetRecognitionRate(IntPtr handle, out double recognitionRate); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_set_label")] + internal static extern MediaVisionError SetLabel(IntPtr handle, int label); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_get_label")] + internal static extern MediaVisionError GetLabel(IntPtr handle, out int label); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_clone")] + internal static extern int Clone(IntPtr src, out IntPtr dst); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_save")] + internal static extern MediaVisionError Save(string fileName, IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_load")] + internal static extern MediaVisionError Load(string fileName, out IntPtr handle); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecognizedCallback(IntPtr source, IntPtr engineCfg, IntPtr imageObjects, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + IntPtr[] locations, uint numberOfObjects, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TrackedCallback(IntPtr source, IntPtr imageTrackingModel, + IntPtr engineCfg, IntPtr location, IntPtr userData); + } + + /// + /// Interop for ImageTrackingModel APIs + /// + internal static partial class ImageTrackingModel + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_create")] + internal static extern MediaVisionError Create(out IntPtr imageTrackingModel); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_set_target")] + internal static extern MediaVisionError SetTarget(IntPtr handle, IntPtr imageTrackingModel); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_destroy")] + internal static extern int Destroy(IntPtr imageTrackingModel); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_refresh")] + internal static extern MediaVisionError Refresh(IntPtr imageTrackingModel, IntPtr engineCfg); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_clone")] + internal static extern int Clone(IntPtr src, out IntPtr dest); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_save")] + internal static extern MediaVisionError Save(string fileName, IntPtr imageTrackingModel); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_load")] + internal static extern MediaVisionError Load(string fileName, out IntPtr imageTrackingModel); + } + } +} diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Surveillance.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Surveillance.cs new file mode 100644 index 0000000..5119730 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Surveillance.cs @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +/// +/// Interop APIs +/// +internal static partial class Interop +{ + /// + /// Interop for media vision APIs + /// + internal static partial class MediaVision + { + /// + /// Interop for surveillance APIs + /// + internal static partial class Surveillance + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_event_trigger_create")] + internal static extern MediaVisionError EventTriggerCreate(string eventType, out IntPtr trigger); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_event_trigger_destroy")] + internal static extern int EventTriggerDestroy(IntPtr trigger); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_event_trigger_type")] + internal static extern int GetEventTriggerType(IntPtr trigger, out string eventType); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_set_event_trigger_roi")] + internal static extern MediaVisionError SetEventTriggerRoi(IntPtr trigger, int numberOfPoints, Point[] roi); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_event_trigger_roi")] + internal static extern MediaVisionError GetEventTriggerRoi(IntPtr trigger, out int numberOfPoints, out IntPtr roi); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_subscribe_event_trigger")] + internal static extern MediaVisionError SubscribeEventTrigger(IntPtr trigger, int videoStreamId, + IntPtr engineCfg, EventOccurredCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_unsubscribe_event_trigger")] + internal static extern MediaVisionError UnsubscribeEventTrigger(IntPtr trigger, int videoStreamId); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_push_source")] + internal static extern MediaVisionError PushSource(IntPtr source, int videoStreamId); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_foreach_supported_event_type")] + internal static extern int ForeachSupportedEventType(EventTypeCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_foreach_event_result_name")] + internal static extern int ForeachEventResultName(string eventType, EventResultNameCallback callback, + IntPtr userData); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_result_value")] + internal static extern MediaVisionError GetResultValue(IntPtr result, string name, out int value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_result_value")] + internal static extern MediaVisionError GetResultValue(IntPtr result, string name, [Out] int[] value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_result_value")] + internal static extern MediaVisionError GetResultValue(IntPtr result, string name, [Out] double[] value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_result_value")] + internal static extern MediaVisionError GetResultValue(IntPtr result, string name, [Out] Rectangle[] value); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void EventOccurredCallback(IntPtr trigger, IntPtr source, + int videoStreamId, IntPtr eventResult, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool EventTypeCallback(string eventType, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool EventResultNameCallback(string name, IntPtr userData); + } + } +} diff --git a/src/Tizen.Multimedia/MediaVision/Barcode.cs b/src/Tizen.Multimedia.Vision/MediaVision/Barcode.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/Barcode.cs rename to src/Tizen.Multimedia.Vision/MediaVision/Barcode.cs diff --git a/src/Tizen.Multimedia/MediaVision/BarcodeDetectionConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetectionConfiguration.cs similarity index 100% rename from src/Tizen.Multimedia/MediaVision/BarcodeDetectionConfiguration.cs rename to src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetectionConfiguration.cs diff --git a/src/Tizen.Multimedia/MediaVision/BarcodeDetectionTarget.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetectionTarget.cs similarity index 100% rename from src/Tizen.Multimedia/MediaVision/BarcodeDetectionTarget.cs rename to src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetectionTarget.cs diff --git a/src/Tizen.Multimedia/MediaVision/BarcodeDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetector.cs similarity index 97% rename from src/Tizen.Multimedia/MediaVision/BarcodeDetector.cs rename to src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetector.cs index c92e641..8430537 100644 --- a/src/Tizen.Multimedia/MediaVision/BarcodeDetector.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetector.cs @@ -17,8 +17,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using InteropBarcode = Tizen.Multimedia.Interop.MediaVision.BarcodeDetector; -using Unmanaged = Tizen.Multimedia.Interop.MediaVision; +using InteropBarcode = Interop.MediaVision.BarcodeDetector; +using Unmanaged = Interop.MediaVision; namespace Tizen.Multimedia { diff --git a/src/Tizen.Multimedia/MediaVision/BarcodeGenerationConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeGenerationConfiguration.cs similarity index 100% rename from src/Tizen.Multimedia/MediaVision/BarcodeGenerationConfiguration.cs rename to src/Tizen.Multimedia.Vision/MediaVision/BarcodeGenerationConfiguration.cs diff --git a/src/Tizen.Multimedia/MediaVision/BarcodeGenerator.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeGenerator.cs similarity index 99% rename from src/Tizen.Multimedia/MediaVision/BarcodeGenerator.cs rename to src/Tizen.Multimedia.Vision/MediaVision/BarcodeGenerator.cs index 9cb9aac..cec752b 100644 --- a/src/Tizen.Multimedia/MediaVision/BarcodeGenerator.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeGenerator.cs @@ -15,7 +15,7 @@ */ using System; -using InteropBarcode = Tizen.Multimedia.Interop.MediaVision.BarcodeGenerator; +using InteropBarcode = Interop.MediaVision.BarcodeGenerator; namespace Tizen.Multimedia { diff --git a/src/Tizen.Multimedia/MediaVision/BarcodeImageConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeImageConfiguration.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/BarcodeImageConfiguration.cs rename to src/Tizen.Multimedia.Vision/MediaVision/BarcodeImageConfiguration.cs diff --git a/src/Tizen.Multimedia/MediaVision/BarcodeImageFormat.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeImageFormat.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/BarcodeImageFormat.cs rename to src/Tizen.Multimedia.Vision/MediaVision/BarcodeImageFormat.cs diff --git a/src/Tizen.Multimedia/MediaVision/BarcodeType.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeType.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/BarcodeType.cs rename to src/Tizen.Multimedia.Vision/MediaVision/BarcodeType.cs diff --git a/src/Tizen.Multimedia/MediaVision/Colorspace.cs b/src/Tizen.Multimedia.Vision/MediaVision/Colorspace.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/Colorspace.cs rename to src/Tizen.Multimedia.Vision/MediaVision/Colorspace.cs diff --git a/src/Tizen.Multimedia/MediaVision/EngineConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/EngineConfiguration.cs similarity index 98% rename from src/Tizen.Multimedia/MediaVision/EngineConfiguration.cs rename to src/Tizen.Multimedia.Vision/MediaVision/EngineConfiguration.cs index ef126b1..61f5199 100644 --- a/src/Tizen.Multimedia/MediaVision/EngineConfiguration.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/EngineConfiguration.cs @@ -17,7 +17,7 @@ using System; using Tizen.System; using System.Runtime.InteropServices; -using static Tizen.Multimedia.Interop.MediaVision; +using static Interop.MediaVision; namespace Tizen.Multimedia { @@ -141,7 +141,7 @@ namespace Tizen.Multimedia } finally { - Interop.Libc.Free(ptr); + LibcSupport.Free(ptr); } } diff --git a/src/Tizen.Multimedia/MediaVision/ErrorCorrectionLevel.cs b/src/Tizen.Multimedia.Vision/MediaVision/ErrorCorrectionLevel.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/ErrorCorrectionLevel.cs rename to src/Tizen.Multimedia.Vision/MediaVision/ErrorCorrectionLevel.cs diff --git a/src/Tizen.Multimedia/MediaVision/EyeCondition.cs b/src/Tizen.Multimedia.Vision/MediaVision/EyeCondition.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/EyeCondition.cs rename to src/Tizen.Multimedia.Vision/MediaVision/EyeCondition.cs diff --git a/src/Tizen.Multimedia/MediaVision/FaceDetectionConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceDetectionConfiguration.cs similarity index 100% rename from src/Tizen.Multimedia/MediaVision/FaceDetectionConfiguration.cs rename to src/Tizen.Multimedia.Vision/MediaVision/FaceDetectionConfiguration.cs diff --git a/src/Tizen.Multimedia/MediaVision/FaceDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceDetector.cs similarity index 96% rename from src/Tizen.Multimedia/MediaVision/FaceDetector.cs rename to src/Tizen.Multimedia.Vision/MediaVision/FaceDetector.cs index bf90073..c04167e 100644 --- a/src/Tizen.Multimedia/MediaVision/FaceDetector.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/FaceDetector.cs @@ -16,7 +16,7 @@ using System; using System.Threading.Tasks; -using InteropFace = Tizen.Multimedia.Interop.MediaVision.Face; +using InteropFace = Interop.MediaVision.Face; namespace Tizen.Multimedia { @@ -73,7 +73,7 @@ namespace Tizen.Multimedia private static InteropFace.DetectedCallback GetCallback(TaskCompletionSource tcs) { - return (IntPtr sourceHandle, IntPtr engineConfig, Interop.MediaVision.Rectangle[] facesLocations, + return (IntPtr sourceHandle, IntPtr engineConfig, global::Interop.MediaVision.Rectangle[] facesLocations, int numberOfFaces, IntPtr _) => { try diff --git a/src/Tizen.Multimedia/MediaVision/FaceRecognitionConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionConfiguration.cs similarity index 100% rename from src/Tizen.Multimedia/MediaVision/FaceRecognitionConfiguration.cs rename to src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionConfiguration.cs diff --git a/src/Tizen.Multimedia/MediaVision/FaceRecognitionModel.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionModel.cs similarity index 98% rename from src/Tizen.Multimedia/MediaVision/FaceRecognitionModel.cs rename to src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionModel.cs index 7b8b9e9..c9a9889 100644 --- a/src/Tizen.Multimedia/MediaVision/FaceRecognitionModel.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionModel.cs @@ -17,7 +17,7 @@ using System; using System.IO; using System.Runtime.InteropServices; -using InteropModel = Tizen.Multimedia.Interop.MediaVision.FaceRecognitionModel; +using InteropModel = Interop.MediaVision.FaceRecognitionModel; namespace Tizen.Multimedia { @@ -94,7 +94,7 @@ namespace Tizen.Multimedia { if (unmangedArray != IntPtr.Zero) { - Interop.Libc.Free(unmangedArray); + LibcSupport.Free(unmangedArray); } } } diff --git a/src/Tizen.Multimedia/MediaVision/FaceRecognitionModelType.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionModelType.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/FaceRecognitionModelType.cs rename to src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionModelType.cs diff --git a/src/Tizen.Multimedia/MediaVision/FaceRecognitionResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionResult.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/FaceRecognitionResult.cs rename to src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionResult.cs diff --git a/src/Tizen.Multimedia/MediaVision/FaceRecognizer.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognizer.cs similarity index 97% rename from src/Tizen.Multimedia/MediaVision/FaceRecognizer.cs rename to src/Tizen.Multimedia.Vision/MediaVision/FaceRecognizer.cs index 7c06dc3..346b072 100644 --- a/src/Tizen.Multimedia/MediaVision/FaceRecognizer.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognizer.cs @@ -17,7 +17,7 @@ using System; using System.Runtime.InteropServices; using System.Threading.Tasks; -using InteropFace = Tizen.Multimedia.Interop.MediaVision.Face; +using InteropFace = Interop.MediaVision.Face; namespace Tizen.Multimedia { @@ -169,7 +169,7 @@ namespace Tizen.Multimedia Rectangle? faceLocation = null; if (faceLocationPtr != IntPtr.Zero) { - var area = Marshal.PtrToStructure(faceLocationPtr); + var area = Marshal.PtrToStructure(faceLocationPtr); faceLocation = area.ToApiStruct(); } @@ -238,7 +238,7 @@ namespace Tizen.Multimedia TaskCompletionSource tcs = new TaskCompletionSource(); InteropFace.EyeConditionRecognizedCallback cb = (IntPtr sourceHandle, IntPtr engineCfgHandle, - Interop.MediaVision.Rectangle faceLocation, EyeCondition eyeCondition, IntPtr _) => + global::Interop.MediaVision.Rectangle faceLocation, EyeCondition eyeCondition, IntPtr _) => { Log.Info(MediaVisionLog.Tag, $"Eye condition recognized, eye condition : {eyeCondition}"); if (!tcs.TrySetResult(eyeCondition)) @@ -297,7 +297,7 @@ namespace Tizen.Multimedia TaskCompletionSource tcsResult = new TaskCompletionSource(); InteropFace.MvFaceFacialExpressionRecognizedCallback cb = (IntPtr sourceHandle, IntPtr engineCfgHandle, - Interop.MediaVision.Rectangle faceLocation, FacialExpression facialExpression, IntPtr _) => + global::Interop.MediaVision.Rectangle faceLocation, FacialExpression facialExpression, IntPtr _) => { Log.Info(MediaVisionLog.Tag, $"Facial expression recognized, expression : {facialExpression}"); if (!tcsResult.TrySetResult(facialExpression)) diff --git a/src/Tizen.Multimedia/MediaVision/FaceTracker.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceTracker.cs similarity index 96% rename from src/Tizen.Multimedia/MediaVision/FaceTracker.cs rename to src/Tizen.Multimedia.Vision/MediaVision/FaceTracker.cs index f472c19..e83a932 100644 --- a/src/Tizen.Multimedia/MediaVision/FaceTracker.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/FaceTracker.cs @@ -17,7 +17,7 @@ using System; using System.Runtime.InteropServices; using System.Threading.Tasks; -using InteropFace = Tizen.Multimedia.Interop.MediaVision.Face; +using InteropFace = Interop.MediaVision.Face; namespace Tizen.Multimedia { @@ -81,7 +81,7 @@ namespace Tizen.Multimedia Quadrangle area = null; if (locationPtr != IntPtr.Zero) { - area = Marshal.PtrToStructure(locationPtr).ToApiStruct(); + area = Marshal.PtrToStructure(locationPtr).ToApiStruct(); } Log.Info(MediaVisionLog.Tag, $"Tracked area : {area}, confidence : {confidence}"); diff --git a/src/Tizen.Multimedia/MediaVision/FaceTrackingModel.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceTrackingModel.cs similarity index 98% rename from src/Tizen.Multimedia/MediaVision/FaceTrackingModel.cs rename to src/Tizen.Multimedia.Vision/MediaVision/FaceTrackingModel.cs index 2d26630..07816cc 100644 --- a/src/Tizen.Multimedia/MediaVision/FaceTrackingModel.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/FaceTrackingModel.cs @@ -16,7 +16,7 @@ using System; using System.IO; -using InteropModel = Tizen.Multimedia.Interop.MediaVision.FaceTrackingModel; +using InteropModel = Interop.MediaVision.FaceTrackingModel; namespace Tizen.Multimedia { diff --git a/src/Tizen.Multimedia/MediaVision/FaceTrackingResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceTrackingResult.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/FaceTrackingResult.cs rename to src/Tizen.Multimedia.Vision/MediaVision/FaceTrackingResult.cs diff --git a/src/Tizen.Multimedia/MediaVision/FacialExpression.cs b/src/Tizen.Multimedia.Vision/MediaVision/FacialExpression.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/FacialExpression.cs rename to src/Tizen.Multimedia.Vision/MediaVision/FacialExpression.cs diff --git a/src/Tizen.Multimedia/MediaVision/ImageFillConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageFillConfiguration.cs similarity index 100% rename from src/Tizen.Multimedia/MediaVision/ImageFillConfiguration.cs rename to src/Tizen.Multimedia.Vision/MediaVision/ImageFillConfiguration.cs diff --git a/src/Tizen.Multimedia/MediaVision/ImageObject.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageObject.cs similarity index 99% rename from src/Tizen.Multimedia/MediaVision/ImageObject.cs rename to src/Tizen.Multimedia.Vision/MediaVision/ImageObject.cs index d186639..2102003 100644 --- a/src/Tizen.Multimedia/MediaVision/ImageObject.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/ImageObject.cs @@ -16,7 +16,7 @@ using System; using System.IO; -using InteropImage = Tizen.Multimedia.Interop.MediaVision.Image; +using InteropImage = Interop.MediaVision.Image; namespace Tizen.Multimedia { diff --git a/src/Tizen.Multimedia/MediaVision/ImageRecognitionConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageRecognitionConfiguration.cs similarity index 100% rename from src/Tizen.Multimedia/MediaVision/ImageRecognitionConfiguration.cs rename to src/Tizen.Multimedia.Vision/MediaVision/ImageRecognitionConfiguration.cs diff --git a/src/Tizen.Multimedia/MediaVision/ImageRecognitionResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageRecognitionResult.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/ImageRecognitionResult.cs rename to src/Tizen.Multimedia.Vision/MediaVision/ImageRecognitionResult.cs diff --git a/src/Tizen.Multimedia/MediaVision/ImageRecognizer.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageRecognizer.cs similarity index 97% rename from src/Tizen.Multimedia/MediaVision/ImageRecognizer.cs rename to src/Tizen.Multimedia.Vision/MediaVision/ImageRecognizer.cs index 48e4ff8..85f5a24 100644 --- a/src/Tizen.Multimedia/MediaVision/ImageRecognizer.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/ImageRecognizer.cs @@ -17,7 +17,7 @@ using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Threading.Tasks; -using InteropImage = Tizen.Multimedia.Interop.MediaVision.Image; +using InteropImage = Interop.MediaVision.Image; namespace Tizen.Multimedia { @@ -106,7 +106,7 @@ namespace Tizen.Multimedia for (int i = 0; i < numOfObjects; i++) { Quadrangle quadrangle = locations[i] != IntPtr.Zero ? - Marshal.PtrToStructure(locations[i]).ToApiStruct() : null; + Marshal.PtrToStructure(locations[i]).ToApiStruct() : null; results[i] = new ImageRecognitionResult(locations[i] != IntPtr.Zero, quadrangle); } diff --git a/src/Tizen.Multimedia/MediaVision/ImageTracker.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageTracker.cs similarity index 96% rename from src/Tizen.Multimedia/MediaVision/ImageTracker.cs rename to src/Tizen.Multimedia.Vision/MediaVision/ImageTracker.cs index 7ec69e3..01c22c3 100644 --- a/src/Tizen.Multimedia/MediaVision/ImageTracker.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/ImageTracker.cs @@ -17,7 +17,7 @@ using System; using System.Runtime.InteropServices; using System.Threading.Tasks; -using InteropImage = Tizen.Multimedia.Interop.MediaVision.Image; +using InteropImage = Interop.MediaVision.Image; namespace Tizen.Multimedia { @@ -105,7 +105,7 @@ namespace Tizen.Multimedia Quadrangle region = null; if (locationPtr != IntPtr.Zero) { - region = Marshal.PtrToStructure(locationPtr).ToApiStruct(); + region = Marshal.PtrToStructure(locationPtr).ToApiStruct(); } Log.Info(MediaVisionLog.Tag, $"Image tracked, region : {region}"); diff --git a/src/Tizen.Multimedia/MediaVision/ImageTrackingConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageTrackingConfiguration.cs similarity index 100% rename from src/Tizen.Multimedia/MediaVision/ImageTrackingConfiguration.cs rename to src/Tizen.Multimedia.Vision/MediaVision/ImageTrackingConfiguration.cs diff --git a/src/Tizen.Multimedia/MediaVision/ImageTrackingModel.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageTrackingModel.cs similarity index 98% rename from src/Tizen.Multimedia/MediaVision/ImageTrackingModel.cs rename to src/Tizen.Multimedia.Vision/MediaVision/ImageTrackingModel.cs index 7d4f14e..6b9c1e9 100644 --- a/src/Tizen.Multimedia/MediaVision/ImageTrackingModel.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/ImageTrackingModel.cs @@ -16,7 +16,7 @@ using System; using System.IO; -using InteropModel = Tizen.Multimedia.Interop.MediaVision.ImageTrackingModel; +using InteropModel = Interop.MediaVision.ImageTrackingModel; namespace Tizen.Multimedia { diff --git a/src/Tizen.Multimedia/MediaVision/MediaVisionError.cs b/src/Tizen.Multimedia.Vision/MediaVision/MediaVisionError.cs similarity index 100% rename from src/Tizen.Multimedia/MediaVision/MediaVisionError.cs rename to src/Tizen.Multimedia.Vision/MediaVision/MediaVisionError.cs diff --git a/src/Tizen.Multimedia/MediaVision/MediaVisionSource.cs b/src/Tizen.Multimedia.Vision/MediaVision/MediaVisionSource.cs similarity index 99% rename from src/Tizen.Multimedia/MediaVision/MediaVisionSource.cs rename to src/Tizen.Multimedia.Vision/MediaVision/MediaVisionSource.cs index 3932b2a..a0581c0 100644 --- a/src/Tizen.Multimedia/MediaVision/MediaVisionSource.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/MediaVisionSource.cs @@ -16,7 +16,7 @@ using System; using System.Diagnostics; -using InteropSource = Tizen.Multimedia.Interop.MediaVision.MediaSource; +using InteropSource = Interop.MediaVision.MediaSource; namespace Tizen.Multimedia { diff --git a/src/Tizen.Multimedia/MediaVision/MovementDetectedEventArgs.cs b/src/Tizen.Multimedia.Vision/MediaVision/MovementDetectedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/MovementDetectedEventArgs.cs rename to src/Tizen.Multimedia.Vision/MediaVision/MovementDetectedEventArgs.cs diff --git a/src/Tizen.Multimedia/MediaVision/MovementDetectionConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/MovementDetectionConfiguration.cs similarity index 100% rename from src/Tizen.Multimedia/MediaVision/MovementDetectionConfiguration.cs rename to src/Tizen.Multimedia.Vision/MediaVision/MovementDetectionConfiguration.cs diff --git a/src/Tizen.Multimedia/MediaVision/MovementDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/MovementDetector.cs similarity index 96% rename from src/Tizen.Multimedia/MediaVision/MovementDetector.cs rename to src/Tizen.Multimedia.Vision/MediaVision/MovementDetector.cs index fde8c32..d03072c 100644 --- a/src/Tizen.Multimedia/MediaVision/MovementDetector.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/MovementDetector.cs @@ -15,7 +15,7 @@ */ using System; -using static Tizen.Multimedia.Interop.MediaVision.Surveillance; +using static Interop.MediaVision.Surveillance; namespace Tizen.Multimedia { @@ -67,11 +67,11 @@ namespace Tizen.Multimedia return new Rectangle[0]; } - var rects = new Interop.MediaVision.Rectangle[count]; + var rects = new global::Interop.MediaVision.Rectangle[count]; GetResultValue(result, KeyRegions, rects).Validate("Failed to get regions"); - return Interop.ToApiStruct(rects); + return global::Interop.ToApiStruct(rects); } private static MovementDetectedEventArgs CreateMovementDetectedEventArgs(IntPtr result) diff --git a/src/Tizen.Multimedia/MediaVision/PersonAppearanceDetectedEventArgs.cs b/src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetectedEventArgs.cs similarity index 100% rename from src/Tizen.Multimedia/MediaVision/PersonAppearanceDetectedEventArgs.cs rename to src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetectedEventArgs.cs diff --git a/src/Tizen.Multimedia/MediaVision/PersonAppearanceDetectionConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetectionConfiguration.cs similarity index 100% rename from src/Tizen.Multimedia/MediaVision/PersonAppearanceDetectionConfiguration.cs rename to src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetectionConfiguration.cs diff --git a/src/Tizen.Multimedia/MediaVision/PersonAppearanceDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetector.cs similarity index 96% rename from src/Tizen.Multimedia/MediaVision/PersonAppearanceDetector.cs rename to src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetector.cs index fcd4c0f..51fbd22 100644 --- a/src/Tizen.Multimedia/MediaVision/PersonAppearanceDetector.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetector.cs @@ -15,7 +15,7 @@ */ using System; -using static Tizen.Multimedia.Interop.MediaVision.Surveillance; +using static Interop.MediaVision.Surveillance; namespace Tizen.Multimedia { @@ -76,13 +76,13 @@ namespace Tizen.Multimedia int count = 0; GetResultValue(result, countKey, out count).Validate("Failed to get result"); - var rects = new Interop.MediaVision.Rectangle[count]; + var rects = new global::Interop.MediaVision.Rectangle[count]; if (count > 0) { GetResultValue(result, regionsKey, rects).Validate("Failed to get result"); } - return Interop.ToApiStruct(rects); + return global::Interop.ToApiStruct(rects); } /// diff --git a/src/Tizen.Multimedia/MediaVision/PersonRecognitionConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognitionConfiguration.cs similarity index 100% rename from src/Tizen.Multimedia/MediaVision/PersonRecognitionConfiguration.cs rename to src/Tizen.Multimedia.Vision/MediaVision/PersonRecognitionConfiguration.cs diff --git a/src/Tizen.Multimedia/MediaVision/PersonRecognitionInfo.cs b/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognitionInfo.cs similarity index 100% rename from src/Tizen.Multimedia/MediaVision/PersonRecognitionInfo.cs rename to src/Tizen.Multimedia.Vision/MediaVision/PersonRecognitionInfo.cs diff --git a/src/Tizen.Multimedia/MediaVision/PersonRecognizedEventArgs.cs b/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognizedEventArgs.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/PersonRecognizedEventArgs.cs rename to src/Tizen.Multimedia.Vision/MediaVision/PersonRecognizedEventArgs.cs diff --git a/src/Tizen.Multimedia/MediaVision/PersonRecognizer.cs b/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognizer.cs similarity index 97% rename from src/Tizen.Multimedia/MediaVision/PersonRecognizer.cs rename to src/Tizen.Multimedia.Vision/MediaVision/PersonRecognizer.cs index ca2bdee..f6cd077 100644 --- a/src/Tizen.Multimedia/MediaVision/PersonRecognizer.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognizer.cs @@ -15,7 +15,7 @@ */ using System; -using static Tizen.Multimedia.Interop.MediaVision.Surveillance; +using static Interop.MediaVision.Surveillance; namespace Tizen.Multimedia { @@ -70,7 +70,7 @@ namespace Tizen.Multimedia if (count > 0) { - var rects = new Interop.MediaVision.Rectangle[count]; + var rects = new global::Interop.MediaVision.Rectangle[count]; GetResultValue(result, KeyLocations, rects).Validate("Failed to get location"); var labels = new int[count]; diff --git a/src/Tizen.Multimedia/MediaVision/QrConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/QrConfiguration.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/QrConfiguration.cs rename to src/Tizen.Multimedia.Vision/MediaVision/QrConfiguration.cs diff --git a/src/Tizen.Multimedia/MediaVision/QrMode.cs b/src/Tizen.Multimedia.Vision/MediaVision/QrMode.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/QrMode.cs rename to src/Tizen.Multimedia.Vision/MediaVision/QrMode.cs diff --git a/src/Tizen.Multimedia/MediaVision/Quadrangle.cs b/src/Tizen.Multimedia.Vision/MediaVision/Quadrangle.cs old mode 100755 new mode 100644 similarity index 100% rename from src/Tizen.Multimedia/MediaVision/Quadrangle.cs rename to src/Tizen.Multimedia.Vision/MediaVision/Quadrangle.cs diff --git a/src/Tizen.Multimedia/MediaVision/SurveillanceConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/SurveillanceConfiguration.cs similarity index 100% rename from src/Tizen.Multimedia/MediaVision/SurveillanceConfiguration.cs rename to src/Tizen.Multimedia.Vision/MediaVision/SurveillanceConfiguration.cs diff --git a/src/Tizen.Multimedia/MediaVision/SurveillanceEngine.cs b/src/Tizen.Multimedia.Vision/MediaVision/SurveillanceEngine.cs similarity index 93% rename from src/Tizen.Multimedia/MediaVision/SurveillanceEngine.cs rename to src/Tizen.Multimedia.Vision/MediaVision/SurveillanceEngine.cs index 19518be..47b189f 100644 --- a/src/Tizen.Multimedia/MediaVision/SurveillanceEngine.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/SurveillanceEngine.cs @@ -16,7 +16,7 @@ using System; using System.Runtime.InteropServices; -using static Tizen.Multimedia.Interop.MediaVision.Surveillance; +using static Interop.MediaVision.Surveillance; namespace Tizen.Multimedia { @@ -77,22 +77,22 @@ namespace Tizen.Multimedia for (int i = 0; i < count; i++) { - points[i] = Marshal.PtrToStructure(iterPtr).ToApiStruct(); - iterPtr = IntPtr.Add(iterPtr, Marshal.SizeOf()); + points[i] = Marshal.PtrToStructure(iterPtr).ToApiStruct(); + iterPtr = IntPtr.Add(iterPtr, Marshal.SizeOf()); } return points; } finally { - Interop.Libc.Free(roiPtr); + LibcSupport.Free(roiPtr); } } set { int length = value == null ? 0 : value.Length; - var points = value == null ? null : Interop.ToMarshalable(value); + var points = value == null ? null : global::Interop.ToMarshalable(value); SetEventTriggerRoi(Handle, length, points).Validate("Failed to set roi"); } diff --git a/src/Tizen.Multimedia/MediaVision/SurveillanceSource.cs b/src/Tizen.Multimedia.Vision/MediaVision/SurveillanceSource.cs similarity index 97% rename from src/Tizen.Multimedia/MediaVision/SurveillanceSource.cs rename to src/Tizen.Multimedia.Vision/MediaVision/SurveillanceSource.cs index 608a8b3..bd9c314 100644 --- a/src/Tizen.Multimedia/MediaVision/SurveillanceSource.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/SurveillanceSource.cs @@ -15,7 +15,7 @@ */ using System; -using static Tizen.Multimedia.Interop.MediaVision.Surveillance; +using static Interop.MediaVision.Surveillance; namespace Tizen.Multimedia { diff --git a/src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.csproj b/src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.csproj new file mode 100644 index 0000000..7f5d94c --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.csproj @@ -0,0 +1,20 @@ + + + netstandard1.3 + True + True + Tizen.Multimedia.Vision.snk + true + True + False + + + + + + + + + + + diff --git a/src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.nuspec b/src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.nuspec new file mode 100644 index 0000000..3f381d9 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.nuspec @@ -0,0 +1,18 @@ + + + + Tizen.Multimedia.Vision + $version$ + Samsung Electronics + false + https://www.apache.org/licenses/LICENSE-2.0 + https://www.tizen.org/ + https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png + © Samsung Electronics Co., Ltd All Rights Reserved + Provides the Multimedia Vision API for Tizen.Net + + + + + + diff --git a/src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.snk b/src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.snk new file mode 100644 index 0000000..5be4954 Binary files /dev/null and b/src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.snk differ diff --git a/src/Tizen.Multimedia/AssemblyAttrs.cs b/src/Tizen.Multimedia/AssemblyAttrs.cs new file mode 100644 index 0000000..c61b0cb --- /dev/null +++ b/src/Tizen.Multimedia/AssemblyAttrs.cs @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + // This file specifies any assembly atrributes. + // Note that InternalsVisibleToAttribute can be removed or added and needs to be only Multimedia packages only. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Tizen.Multimedia.Camera, " + + "PublicKey=00240000048000009400000006020000002400005253413100040000010001007300c77617f1d0" + + "a26dfc511908863899485c5edbd72f9b609b43f404d77dfa79b119da616ef67bd3626315cff717" + + "10763e94889730481ba1e3360d96027fa46ff17ff3e2230315452a79d0ede364bef0f8981e4051" + + "56c658c0376161303fa92c670ffab56fd1af0fd6081c40c82443caf0d476ec2b3a49a70669c555e68e58ac")] + +[assembly: InternalsVisibleTo("Tizen.Multimedia.MediaCodec, " + + "PublicKey=002400000480000094000000060200000024000052534131000400000100010085f7b7a5984e7e995" + + "d5f86234bfd1d4b2609b9334d5cb6cd3076c5faab98f8c4922d88fec96bea747fec274bceedc2bd1adb28c38a33" + + "c66182245adec7fbcee69cc556c337758646936500b770e19a562ebd10a527787f176eba8fdcf58c8e220042580" + + "75fe2903b3b5090953ac1d41c587993377cde63269a7cdd6cbf98efda")] + +[assembly: InternalsVisibleTo("Tizen.Multimedia.MediaPlayer, " + + "PublicKey=0024000004800000940000000602000000240000525341310004000001000100e79de2ab67570e" + + "a4fd4113c0a2d764733f83dcd865323bf19532a366c2e399ff9184cf55f737b7eee208a163e6cd" + + "6b46b979f1e75d1af33dc83f8fa96ad9f679803e90338dee955d469ce8728fb6e9b1058ab8c97b" + + "531312a776c6039e53c62c1fb2fac5d5a67f453f839e437cbc999fa91599b471e0f4aa0842b9bc7e8e6aa3")] + +[assembly: InternalsVisibleTo("Tizen.Multimedia.Recorder, " + + "PublicKey=00240000048000009400000006020000002400005253413100040000010001007de0e8b3c2ebf9" + + "60d0fadad3350560f1bf36f2b069483de5c9c088714408ffa6c2d3b2ea9179a7e2a75b39bb1e7d" + + "c4dcb24d48f8cd027fcb58d82615e90b03edc3279845b63d27a24c5bc94ab7ffb939bd142d038a" + + "960a95c7b2ad8cdef32c6e9a8e0266335b6c4e533aafa12e7673df16ad7e884addfa269a87c9776611d0c4")] + +[assembly: InternalsVisibleTo("Tizen.Multimedia.StreamRecorder, " + + "PublicKey=0024000004800000940000000602000000240000525341310004000001000100cbdafbbfe5d1d8" + + "53d448ad35a17f0d07e8859ce3f3799956d5ba33e4c94d19c317ccb680db7378cb585c73c0f261" + + "a897c14458f5ced06bd8d1bb6462ef1508ffeeba2f428166370cff5346199470b386fce8abf805" + + "fb56ab907a3a022f27f924352c3e7325db4e137a5b05403ffc9b158aee5c706fe9501d7dfdd9e9953e83c5")] + +[assembly: InternalsVisibleTo("Tizen.Multimedia.Remoting, " + + "PublicKey=002400000480000094000000060200000024000052534131000400000100010097f0121866a1bd" + + "270798f7991f068618c6677bf4b595edb04bebbc50daa3472af4003ab4b56d633e5af6604e796f" + + "f4937e41e6535accd6c954f24e3e3cb393c18963b4b95128f1e78e178090187dde345913b9eb42" + + "fe33ca1c44300de4be25cbe7200a2db8ec36f889ac6189ab34f4de9ccd6b6b93419efc0f223a4e6bbd8ba5")] + +[assembly: InternalsVisibleTo("Tizen.Multimedia.Util, " + + "PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed486cf1e1dd7d" + + "7ccaef24afadd1f32fd619808cd375246d2213fcedf27113b4c6cc6de5e47b765df0b43116f912" + + "ac0766d5445531e508180f0414f622442c6c1518dcd57fb5dae56fc4b054521758962e476494cf" + + "3baf76a3aad08e069840cc18e07bf359b73bd783036722a01313f1b2b1bde22333d3349570e082df8148a6")] + +[assembly: InternalsVisibleTo("Tizen.Multimedia.Vision, " + + "PublicKey=0024000004800000940000000602000000240000525341310004000001000100df5262fe92f79e" + + "f0c8a64ad607a441d1f637b39a2a981e883406efc14fffca58a8aa8fe2565dce89fbb8124c28f3" + + "6eddb9c7760477c18c8b162c3cd7bb2e1ca13cfa82af570e5e26774905618fa39161977a51a430" + + "390a620b0809023e1b2a2056eb573710bf005c0a95e15eff46df590a965ed4da705292b1072f33621950d6")] \ No newline at end of file diff --git a/src/Tizen.Multimedia/AudioManager/AudioStreamPolicy.cs b/src/Tizen.Multimedia/AudioManager/AudioStreamPolicy.cs index 04baddf..1a2c1ac 100755 --- a/src/Tizen.Multimedia/AudioManager/AudioStreamPolicy.cs +++ b/src/Tizen.Multimedia/AudioManager/AudioStreamPolicy.cs @@ -200,7 +200,7 @@ namespace Tizen.Multimedia } } - internal IntPtr Handle { + public IntPtr Handle { get { return _streamInfo; } diff --git a/src/Tizen.Multimedia/Common/Features.cs b/src/Tizen.Multimedia/Common.Internal/Features.cs similarity index 100% rename from src/Tizen.Multimedia/Common/Features.cs rename to src/Tizen.Multimedia/Common.Internal/Features.cs diff --git a/src/Tizen.Multimedia/Common/IBufferOwner.cs b/src/Tizen.Multimedia/Common.Internal/IBufferOwner.cs similarity index 100% rename from src/Tizen.Multimedia/Common/IBufferOwner.cs rename to src/Tizen.Multimedia/Common.Internal/IBufferOwner.cs diff --git a/src/Tizen.Multimedia/Common.Internal/LibcSupport.cs b/src/Tizen.Multimedia/Common.Internal/LibcSupport.cs new file mode 100644 index 0000000..0f11db1 --- /dev/null +++ b/src/Tizen.Multimedia/Common.Internal/LibcSupport.cs @@ -0,0 +1,13 @@ + +using System; + +namespace Tizen.Multimedia +{ + internal static class LibcSupport + { + internal static void Free(IntPtr ptr) + { + Interop.Libc.Free(ptr); + } + } +} diff --git a/src/Tizen.Multimedia/Common.Internal/MultimediaDebug.cs b/src/Tizen.Multimedia/Common.Internal/MultimediaDebug.cs new file mode 100644 index 0000000..3e00569 --- /dev/null +++ b/src/Tizen.Multimedia/Common.Internal/MultimediaDebug.cs @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Diagnostics; + +namespace Tizen.Multimedia +{ + internal class MultimediaDebug + { + [Conditional("DEBUG")] + internal static void AssertNoError(int errorCode) + { + Debug.Assert(errorCode == (int)Internals.Errors.ErrorCode.None, + $"The API is supposed not to return an error! But it returns error({ errorCode }).", + "Implementation of core may have been changed, modify the call to throw if the return code is not ok."); + } + } +} diff --git a/src/Tizen.Multimedia/Common/MultimediaLog.cs b/src/Tizen.Multimedia/Common.Internal/MultimediaLog.cs similarity index 100% rename from src/Tizen.Multimedia/Common/MultimediaLog.cs rename to src/Tizen.Multimedia/Common.Internal/MultimediaLog.cs diff --git a/src/Tizen.Multimedia/Common/ObjectKeeper.cs b/src/Tizen.Multimedia/Common.Internal/ObjectKeeper.cs similarity index 100% rename from src/Tizen.Multimedia/Common/ObjectKeeper.cs rename to src/Tizen.Multimedia/Common.Internal/ObjectKeeper.cs diff --git a/src/Tizen.Multimedia/Common/ValdiationUtil.cs b/src/Tizen.Multimedia/Common.Internal/ValdiationUtil.cs similarity index 98% rename from src/Tizen.Multimedia/Common/ValdiationUtil.cs rename to src/Tizen.Multimedia/Common.Internal/ValdiationUtil.cs index d4d6383..3e71d0b 100644 --- a/src/Tizen.Multimedia/Common/ValdiationUtil.cs +++ b/src/Tizen.Multimedia/Common.Internal/ValdiationUtil.cs @@ -15,7 +15,6 @@ */ using System; -using Tizen.System; namespace Tizen.Multimedia { diff --git a/src/Tizen.Multimedia/Common/AssemblyAttrs.cs b/src/Tizen.Multimedia/Common/AssemblyAttrs.cs deleted file mode 100644 index 88b0f3b..0000000 --- a/src/Tizen.Multimedia/Common/AssemblyAttrs.cs +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("Tizen.Multimedia.MediaCodec, " + - "PublicKey=002400000480000094000000060200000024000052534131000400000100010085f7b7a5984e7e995" + - "d5f86234bfd1d4b2609b9334d5cb6cd3076c5faab98f8c4922d88fec96bea747fec274bceedc2bd1adb28c38a33" + - "c66182245adec7fbcee69cc556c337758646936500b770e19a562ebd10a527787f176eba8fdcf58c8e220042580" + - "75fe2903b3b5090953ac1d41c587993377cde63269a7cdd6cbf98efda")] diff --git a/src/Tizen.Multimedia/Interop/Interop.AudioIO.cs b/src/Tizen.Multimedia/Interop/Interop.AudioIO.cs deleted file mode 100644 index f13a675..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.AudioIO.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class AudioIO - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void AudioStreamCallback(IntPtr handle, uint nbytes, IntPtr userdata); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void AudioStateChangedCallback(IntPtr handle, int previous, int current, bool byPolicy, IntPtr userData); - - internal static partial class AudioInput - { - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_set_state_changed_cb")] - internal static extern int SetStateChangedCallback(IntPtr handle, AudioStateChangedCallback callback, IntPtr user_data); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_set_stream_cb")] - internal static extern int SetStreamCallback(IntPtr handle, AudioStreamCallback callback, IntPtr user_data); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_create")] - internal static extern int Create(int sampleRate, int channel, int type, out IntPtr handle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_destroy")] - internal static extern int Destroy(IntPtr handle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_set_sound_stream_info")] - internal static extern int SetStreamInfo(IntPtr handle, IntPtr streamInfoHandle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_prepare")] - internal static extern int Prepare(IntPtr handle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_unprepare")] - internal static extern int Unprepare(IntPtr handle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_pause")] - internal static extern int Pause(IntPtr handle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_resume")] - internal static extern int Resume(IntPtr handle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_flush")] - internal static extern int Flush(IntPtr handle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_read")] - internal static extern int Read(IntPtr handle, byte[] buffer, int length); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_buffer_size")] - internal static extern int GetBufferSize(IntPtr handle, out int size); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_sample_rate")] - internal static extern int GetSampleRate(IntPtr handle, out int sampleRate); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_channel")] - internal static extern int GetChannel(IntPtr handle, out int channel); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_sample_type")] - internal static extern int GetSampleType(IntPtr handle, out int sampleType); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_peek")] - internal static extern int Peek(IntPtr handle, out IntPtr buffer, ref uint length); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_drop")] - internal static extern int Drop(IntPtr handle); - } - internal static partial class AudioOutput - { - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_set_state_changed_cb")] - internal static extern int SetStateChangedCallback(IntPtr handle, AudioStateChangedCallback callback, IntPtr user_data); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_set_stream_cb")] - internal static extern int SetStreamChangedCallback(IntPtr handle, AudioStreamCallback callback, IntPtr user_data); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_create_new")] - internal static extern int Create(int sampleRate, int channel, int type, out IntPtr handle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_destroy")] - internal static extern int Destroy(IntPtr handle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_drain")] - internal static extern int Drain(IntPtr handle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_flush")] - internal static extern int Flush(IntPtr handle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_buffer_size")] - internal static extern int GetBufferSize(IntPtr handle, out int size); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_channel")] - internal static extern int GetChannel(IntPtr handle, out int channel); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_sample_rate")] - internal static extern int GetSampleRate(IntPtr handle, out int sampleRate); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_sample_type")] - internal static extern int GetSampleType(IntPtr handle, out int sampleType); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_sound_type")] - internal static extern int GetSoundType(IntPtr handle, out int soundType); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_pause")] - internal static extern int Pause(IntPtr handle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_prepare")] - internal static extern int Prepare(IntPtr handle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_resume")] - internal static extern int Resume(IntPtr handle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_set_sound_stream_info")] - internal static extern int SetStreamInfo(IntPtr handle, IntPtr streamInfoHandle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_unprepare")] - internal static extern int Unprepare(IntPtr handle); - - [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_write")] - internal static extern int Write(IntPtr handle, byte[] buffer, uint length); - } - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.Camera.cs b/src/Tizen.Multimedia/Interop/Interop.Camera.cs deleted file mode 100755 index 45ee869..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.Camera.cs +++ /dev/null @@ -1,259 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class Camera - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void FaceDetectedCallback(IntPtr faces, int count, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void StateChangedCallback(CameraState previous, CameraState current, bool byPolicy, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void InterruptedCallback(CameraPolicy policy, CameraState previous, CameraState current, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void FocusStateChangedCallback(CameraFocusState state, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void ErrorCallback(CameraErrorCode error, CameraState current, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void CapturingCallback(IntPtr image, IntPtr postview, IntPtr thumbnail, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void CaptureCompletedCallback(IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void PreviewCallback(IntPtr frame, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void MediaPacketPreviewCallback(IntPtr mediaPacketHandle, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void HdrCaptureProgressCallback(int percent, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void DeviceStateChangedCallback(CameraDevice device, CameraDeviceState state, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_create")] - internal static extern CameraError Create(int device, out IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_change_device")] - internal static extern CameraError ChangeDevice(IntPtr handle, int device); - - [DllImport(Libraries.Camera, EntryPoint = "camera_destroy")] - internal static extern CameraError Destroy(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_get_device_count")] - internal static extern CameraError GetDeviceCount(IntPtr handle, out int count); - - [DllImport(Libraries.Camera, EntryPoint = "camera_start_preview")] - internal static extern CameraError StartPreview(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_stop_preview")] - internal static extern CameraError StopPreview(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_get_device_state")] - internal static extern CameraError GetDeviceState(CameraDevice device, out int state); - - [DllImport(Libraries.Camera, EntryPoint = "camera_start_capture")] - internal static extern CameraError StartCapture(IntPtr handle, CapturingCallback captureCallback, - CaptureCompletedCallback completedCallback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_start_continuous_capture")] - internal static extern CameraError StartContinuousCapture(IntPtr handle, int count, int interval, - CapturingCallback captureCallback, CaptureCompletedCallback completedCallback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_stop_continuous_capture")] - internal static extern CameraError StopContinuousCapture(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_get_state")] - internal static extern CameraError GetState(IntPtr handle, out CameraState state); - - [DllImport(Libraries.Camera, EntryPoint = "camera_start_focusing")] - internal static extern CameraError StartFocusing(IntPtr handle, bool continuous); - - [DllImport(Libraries.Camera, EntryPoint = "camera_cancel_focusing")] - internal static extern CameraError CancelFocusing(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_preview_resolution")] - internal static extern CameraError SetPreviewResolution(IntPtr handle, int width, int height); - - [DllImport(Libraries.Camera, EntryPoint = "camera_get_preview_resolution")] - internal static extern CameraError GetPreviewResolution(IntPtr handle, out int width, out int height); - - [DllImport(Libraries.Camera, EntryPoint = "camera_get_recommended_preview_resolution")] - internal static extern CameraError GetRecommendedPreviewResolution(IntPtr handle, out int width, out int height); - - [DllImport(Libraries.Camera, EntryPoint = "camera_start_face_detection")] - internal static extern CameraError StartFaceDetection(IntPtr handle, FaceDetectedCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_stop_face_detection")] - internal static extern CameraError StopFaceDetection(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_display_reuse_hint")] - internal static extern CameraError SetDisplayReuseHint(IntPtr handle, bool hint); - - [DllImport(Libraries.Camera, EntryPoint = "camera_get_display_reuse_hint")] - internal static extern CameraError GetDisplayReuseHint(IntPtr handle, out bool hint); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_capture_resolution")] - internal static extern CameraError SetCaptureResolution(IntPtr handle, int width, int height); - - [DllImport(Libraries.Camera, EntryPoint = "camera_get_capture_resolution")] - internal static extern CameraError GetCaptureResolution(IntPtr handle, out int width, out int height); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_capture_format")] - internal static extern CameraError SetCaptureFormat(IntPtr handle, CameraPixelFormat format); - - [DllImport(Libraries.Camera, EntryPoint = "camera_get_capture_format")] - internal static extern CameraError GetCaptureFormat(IntPtr handle, out CameraPixelFormat format); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_preview_format")] - internal static extern CameraError SetPreviewPixelFormat(IntPtr handle, CameraPixelFormat format); - - [DllImport(Libraries.Camera, EntryPoint = "camera_get_preview_format")] - internal static extern CameraError GetPreviewPixelFormat(IntPtr handle, out CameraPixelFormat format); - - [DllImport(Libraries.Camera, EntryPoint = "camera_get_facing_direction")] - internal static extern CameraError GetFacingDirection(IntPtr handle, out CameraFacingDirection direction); - - [DllImport(Libraries.Camera, EntryPoint = "camera_get_flash_state")] - internal static extern CameraError GetFlashState(CameraDevice device, out CameraFlashState state); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_preview_cb")] - internal static extern CameraError SetPreviewCallback(IntPtr handle, PreviewCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_unset_preview_cb")] - internal static extern CameraError UnsetPreviewCallback(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_media_packet_preview_cb")] - internal static extern CameraError SetMediaPacketPreviewCallback(IntPtr handle, MediaPacketPreviewCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_unset_media_packet_preview_cb")] - internal static extern CameraError UnsetMediaPacketPreviewCallback(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_state_changed_cb")] - internal static extern CameraError SetStateChangedCallback(IntPtr handle, StateChangedCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_add_device_state_changed_cb")] - internal static extern CameraError SetDeviceStateChangedCallback(DeviceStateChangedCallback callback, IntPtr userData, out int callbackId); - - [DllImport(Libraries.Camera, EntryPoint = "camera_unset_state_changed_cb")] - internal static extern CameraError UnsetStateChangedCallback(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_remove_device_state_changed_cb")] - internal static extern CameraError UnsetDeviceStateChangedCallback(int cbId); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_interrupted_cb")] - internal static extern CameraError SetInterruptedCallback(IntPtr handle, InterruptedCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_unset_interrupted_cb")] - internal static extern CameraError UnsetInterruptedCallback(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_focus_changed_cb")] - internal static extern CameraError SetFocusStateChangedCallback(IntPtr handle, FocusStateChangedCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_unset_focus_changed_cb")] - internal static extern CameraError UnsetFocusChangedCallback(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_error_cb")] - internal static extern CameraError SetErrorCallback(IntPtr handle, ErrorCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_unset_error_cb")] - internal static extern CameraError UnsetErrorCallback(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_hdr_capture_progress_cb")] - internal static extern CameraError SetHdrCaptureProgressCallback(IntPtr handle, HdrCaptureProgressCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_unset_hdr_capture_progress_cb")] - internal static extern CameraError UnsetHdrCaptureProgressCallback(IntPtr handle); - - [StructLayout(LayoutKind.Sequential)] - internal struct ImageDataStruct - { - internal IntPtr Data; - internal uint DataLength; - internal int Width; - internal int Height; - internal CameraPixelFormat Format; - internal IntPtr Exif; - internal uint ExifLength; - } - - [StructLayout(LayoutKind.Sequential)] - internal struct DetectedFaceStruct - { - internal int Id; - internal int Score; - internal int X; - internal int Y; - internal int Width; - internal int Height; - } - - [StructLayout(LayoutKind.Sequential)] - internal struct SinglePlaneStruct - { - internal IntPtr Data; - internal uint DataLength; - } - - [StructLayout(LayoutKind.Sequential)] - internal struct DoublePlaneStruct - { - internal IntPtr Y; - internal IntPtr UV; - internal uint YLength; - internal uint UVLength; - } - - [StructLayout(LayoutKind.Sequential)] - internal struct TriplePlaneStruct - { - internal IntPtr Y; - internal IntPtr U; - internal IntPtr V; - internal uint YLength; - internal uint ULength; - internal uint VLength; - } - - [StructLayout(LayoutKind.Sequential)] - internal struct EncodedPlaneStruct - { - internal IntPtr Data; - internal uint DataLength; - } - - [StructLayout(LayoutKind.Explicit)] - internal struct PreviewPlaneStruct - { - [FieldOffsetAttribute(0)] - internal SinglePlaneStruct SinglePlane; - [FieldOffsetAttribute(0)] - internal DoublePlaneStruct DoublePlane; - [FieldOffsetAttribute(0)] - internal TriplePlaneStruct TriplePlane; - [FieldOffsetAttribute(0)] - internal EncodedPlaneStruct EncodedPlane; - } - - [StructLayout(LayoutKind.Sequential)] - internal struct CameraPreviewDataStruct - { - internal CameraPixelFormat Format; - internal int Width; - internal int Height; - internal int NumOfPlanes; - internal uint TimeStamp; - internal PreviewPlaneStruct Plane; - } - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.CameraDisplay.cs b/src/Tizen.Multimedia/Interop/Interop.CameraDisplay.cs deleted file mode 100755 index edf6a90..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.CameraDisplay.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class CameraDisplay - { - [DllImport(Libraries.Camera, EntryPoint = "camera_get_display_mode")] - internal static extern CameraError GetMode(IntPtr handle, out CameraDisplayMode mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_display_mode")] - internal static extern CameraError SetMode(IntPtr handle, CameraDisplayMode mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_is_display_visible")] - internal static extern CameraError GetVisible(IntPtr handle, out bool visible); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_display_visible")] - internal static extern CameraError SetVisible(IntPtr handle, bool visible); - - [DllImport(Libraries.Camera, EntryPoint = "camera_get_display_rotation")] - internal static extern CameraError GetRotation(IntPtr handle, out CameraRotation rotation); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_display_rotation")] - internal static extern CameraError SetRotation(IntPtr handle, CameraRotation rotation); - - [DllImport(Libraries.Camera, EntryPoint = "camera_get_display_flip")] - internal static extern CameraError GetFlip(IntPtr handle, out CameraFlip flip); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_display_flip")] - internal static extern CameraError SetFlip(IntPtr handle, CameraFlip flip); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_display_roi_area")] - internal static extern CameraError GetRoiArea(IntPtr handle, out int x, out int y, out int width, out int height); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_display_roi_area")] - internal static extern CameraError SetRoiArea(IntPtr handle, int x, int y, int width, int height); - - [DllImport(Libraries.Camera, EntryPoint = "camera_set_display")] - internal static extern CameraError SetTarget(IntPtr handle, DisplayType displayType, IntPtr displayHandle); - } - } -} diff --git a/src/Tizen.Multimedia/Interop/Interop.CameraFeatures.cs b/src/Tizen.Multimedia/Interop/Interop.CameraFeatures.cs deleted file mode 100755 index e7077de..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.CameraFeatures.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using Tizen.Multimedia; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class CameraFeatures - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool PreviewResolutionCallback(int Width, int Height, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool CaptureResolutionCallback(int Width, int Height, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool CaptureFormatCallback(CameraPixelFormat format, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool PreviewFormatCallback(CameraPixelFormat format, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool FpsCallback(CameraFps fps, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool FpsByResolutionCallback(CameraFps fps, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool AfModeCallback(CameraAutoFocusMode mode, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool ExposureModeCallback(CameraExposureMode mode, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool IsoCallback(CameraIsoLevel iso, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool TheaterModeCallback(CameraTheaterMode mode, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool WhitebalanceCallback(CameraWhiteBalance whitebalance, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool EffectCallback(CameraEffectMode effect, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool SceneModeCallback(CameraSceneMode mode, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool FlashModeCallback(CameraFlashMode mode, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool StreamRotationCallback(CameraRotation rotation, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool StreamFlipCallback(CameraFlip flip, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool PtzTypeCallback(CameraPtzType type, IntPtr userData); - - - [DllImport(Libraries.Camera, EntryPoint = "camera_is_supported_continuous_capture")] - [return: MarshalAs(UnmanagedType.I1)] - internal static extern bool IsContinuousCaptureSupported(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_is_supported_face_detection")] - [return: MarshalAs(UnmanagedType.I1)] - internal static extern bool IsFaceDetectionSupported(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_is_supported_zero_shutter_lag")] - [return: MarshalAs(UnmanagedType.I1)] - internal static extern bool IsZeroShutterLagSupported(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_is_supported_media_packet_preview_cb")] - [return: MarshalAs(UnmanagedType.I1)] - internal static extern bool IsMediaPacketPreviewCallbackSupported(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_supported_hdr_capture")] - [return: MarshalAs(UnmanagedType.I1)] - internal static extern bool IsHdrCaptureSupported(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_supported_anti_shake")] - [return: MarshalAs(UnmanagedType.I1)] - internal static extern bool IsAntiShakeSupported(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_supported_video_stabilization")] - [return: MarshalAs(UnmanagedType.I1)] - internal static extern bool IsVideoStabilizationSupported(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_supported_auto_contrast")] - [return: MarshalAs(UnmanagedType.I1)] - internal static extern bool IsAutoContrastSupported(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_preview_resolution")] - internal static extern CameraError SupportedPreviewResolutions(IntPtr handle, PreviewResolutionCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_capture_resolution")] - internal static extern CameraError SupportedCaptureResolutions(IntPtr handle, CaptureResolutionCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_capture_format")] - internal static extern CameraError SupportedCapturePixelFormats(IntPtr handle, CaptureFormatCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_preview_format")] - internal static extern CameraError SupportedPreviewPixelFormats(IntPtr handle, PreviewFormatCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_fps")] - internal static extern CameraError SupportedPreviewFps(IntPtr handle, FpsCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_fps_by_resolution")] - internal static extern CameraError SupportedPreviewFpsByResolution(IntPtr handle, int width, int height, FpsByResolutionCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_af_mode")] - internal static extern CameraError SupportedAfModes(IntPtr handle, AfModeCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_exposure_mode")] - internal static extern CameraError SupportedExposureModes(IntPtr handle, ExposureModeCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_iso")] - internal static extern CameraError SupportedIso(IntPtr handle, IsoCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_theater_mode")] - internal static extern CameraError SupportedTheaterModes(IntPtr handle, TheaterModeCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_whitebalance")] - internal static extern CameraError SupportedWhitebalance(IntPtr handle, WhitebalanceCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_effect")] - internal static extern CameraError SupportedEffects(IntPtr handle, EffectCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_scene_mode")] - internal static extern CameraError SupportedSceneModes(IntPtr handle, SceneModeCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_flash_mode")] - internal static extern CameraError SupportedFlashModes(IntPtr handle, FlashModeCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_stream_rotation")] - internal static extern CameraError SupportedStreamRotations(IntPtr handle, StreamRotationCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_stream_flip")] - internal static extern CameraError SupportedStreamFlips(IntPtr handle, StreamFlipCallback callback, IntPtr userData); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_ptz_type")] - internal static extern CameraError SupportedPtzTypes(IntPtr handle, PtzTypeCallback callback, IntPtr userData); - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.CameraSettings.cs b/src/Tizen.Multimedia/Interop/Interop.CameraSettings.cs deleted file mode 100755 index f0c63c3..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.CameraSettings.cs +++ /dev/null @@ -1,221 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class CameraSettings - { - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_preview_fps")] - internal static extern CameraError SetPreviewFps(IntPtr handle, CameraFps fps); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_preview_fps")] - internal static extern CameraError GetPreviewFps(IntPtr handle, out CameraFps fps); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_image_quality")] - internal static extern CameraError SetImageQuality(IntPtr handle, int quality); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_image_quality")] - internal static extern CameraError GetImageQuality(IntPtr handle, out int quality); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_encoded_preview_bitrate")] - internal static extern CameraError SetBitrate(IntPtr handle, int bitrate); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_encoded_preview_bitrate")] - internal static extern CameraError GetBitrate(IntPtr handle, out int bitrate); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_encoded_preview_gop_interval")] - internal static extern CameraError SetGopInterval(IntPtr handle, int interval); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_encoded_preview_gop_interval")] - internal static extern CameraError GetGopInterval(IntPtr handle, out int interval); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_zoom")] - internal static extern CameraError SetZoom(IntPtr handle, int zoom); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_zoom")] - internal static extern CameraError GetZoom(IntPtr handle, out int zoom); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_zoom_range")] - internal static extern CameraError GetZoomRange(IntPtr handle, out int min, out int max); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_af_mode")] - internal static extern CameraError SetAutoFocusMode(IntPtr handle, CameraAutoFocusMode mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_af_mode")] - internal static extern CameraError GetAutoFocusMode(IntPtr handle, out CameraAutoFocusMode mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_af_area")] - internal static extern CameraError SetAutoFocusArea(IntPtr handle, int x, int y); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_clear_af_area")] - internal static extern CameraError ClearAutoFocusArea(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_exposure_mode")] - internal static extern CameraError SetExposureMode(IntPtr handle, CameraExposureMode mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_exposure_mode")] - internal static extern CameraError GetExposureMode(IntPtr handle, out CameraExposureMode mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_exposure")] - internal static extern CameraError SetExposure(IntPtr handle, int value); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_exposure")] - internal static extern CameraError GetExposure(IntPtr handle, out int value); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_exposure_range")] - internal static extern CameraError GetExposureRange(IntPtr handle, out int min, out int max); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_iso")] - internal static extern CameraError SetIso(IntPtr handle, CameraIsoLevel iso); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_iso")] - internal static extern CameraError GetIso(IntPtr handle, out CameraIsoLevel iso); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_theater_mode")] - internal static extern CameraError SetTheaterMode(IntPtr handle, CameraTheaterMode mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_theater_mode")] - internal static extern CameraError GetTheaterMode(IntPtr handle, out CameraTheaterMode mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_brightness")] - internal static extern CameraError SetBrightness(IntPtr handle, int level); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_brightness")] - internal static extern CameraError GetBrightness(IntPtr handle, out int level); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_brightness_range")] - internal static extern CameraError GetBrightnessRange(IntPtr handle, out int min, out int max); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_contrast")] - internal static extern CameraError SetContrast(IntPtr handle, int level); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_contrast")] - internal static extern CameraError GetContrast(IntPtr handle, out int level); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_contrast_range")] - internal static extern CameraError GetContrastRange(IntPtr handle, out int min, out int max); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_whitebalance")] - internal static extern CameraError SetWhitebalance(IntPtr handle, CameraWhiteBalance level); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_whitebalance")] - internal static extern CameraError GetWhiteBalance(IntPtr handle, out CameraWhiteBalance level); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_effect")] - internal static extern CameraError SetEffect(IntPtr handle, CameraEffectMode mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_effect")] - internal static extern CameraError GetEffect(IntPtr handle, out CameraEffectMode mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_scene_mode")] - internal static extern CameraError SetSceneMode(IntPtr handle, CameraSceneMode mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_scene_mode")] - internal static extern CameraError GetSceneMode(IntPtr handle, out CameraSceneMode mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_tag")] - internal static extern CameraError EnableTag(IntPtr handle, bool enable); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_enabled_tag")] - internal static extern CameraError IsEnabledTag(IntPtr handle, out bool enabled); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tag_image_description")] - internal static extern CameraError SetImageDescription(IntPtr handle, string description); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tag_image_description")] - internal static extern CameraError GetImageDescription(IntPtr handle, out IntPtr description); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tag_software")] - internal static extern CameraError SetTagSoftware(IntPtr handle, string software); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tag_software")] - internal static extern CameraError GetTagSoftware(IntPtr handle, out IntPtr software); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tag_orientation")] - internal static extern CameraError SetTagOrientation(IntPtr handle, CameraTagOrientation orientation); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tag_orientation")] - internal static extern CameraError GetTagOrientation(IntPtr handle, out CameraTagOrientation orientation); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_geotag")] - internal static extern CameraError SetGeotag(IntPtr handle, double latitude, double longtitude, double altitude); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_geotag")] - internal static extern CameraError GetGeotag(IntPtr handle, out double latitude, out double longtitude, out double altitude); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_remove_geotag")] - internal static extern CameraError RemoveGeotag(IntPtr handle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_flash_mode")] - internal static extern CameraError SetFlashMode(IntPtr handle, CameraFlashMode mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_flash_mode")] - internal static extern CameraError GetFlashMode(IntPtr handle, out CameraFlashMode mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_lens_orientation")] - internal static extern CameraError GetLensOrientation(IntPtr handle, out int angle); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_stream_rotation")] - internal static extern CameraError SetStreamRotation(IntPtr handle, CameraRotation mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_stream_rotation")] - internal static extern CameraError GetStreamRotation(IntPtr handle, out CameraRotation mode); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_stream_flip")] - internal static extern CameraError SetFlip(IntPtr handle, CameraFlip flip); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_stream_flip")] - internal static extern CameraError GetFlip(IntPtr handle, out CameraFlip flip); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_hdr_mode")] - internal static extern CameraError SetHdrMode(IntPtr handle, CameraHdrMode hdr); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_hdr_mode")] - internal static extern CameraError GetHdrMode(IntPtr handle, out CameraHdrMode hdr); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_anti_shake")] - internal static extern CameraError EnableAntiShake(IntPtr handle, bool enable); - - [DllImport(Libraries.Camera, EntryPoint = " camera_attr_is_enabled_anti_shake")] - internal static extern CameraError IsEnabledAntiShake(IntPtr handle, out bool enabled); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_video_stabilization")] - internal static extern CameraError EnableVideoStabilization(IntPtr handle, bool enable); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_enabled_video_stabilization")] - internal static extern CameraError IsEnabledVideoStabilization(IntPtr handle, out bool enabled); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_auto_contrast")] - internal static extern CameraError EnableAutoContrast(IntPtr handle, bool enable); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_enabled_auto_contrast")] - internal static extern CameraError IsEnabledAutoContrast(IntPtr handle, out bool enabled); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_disable_shutter_sound")] - internal static extern CameraError DisableShutterSound(IntPtr handle, bool disable); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_pan")] - internal static extern CameraError SetPan(IntPtr handle, CameraPtzMoveType type, int step); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_pan")] - internal static extern CameraError GetPan(IntPtr handle, out int step); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_pan_range")] - internal static extern CameraError GetPanRange(IntPtr handle, out int min, out int max); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tilt")] - internal static extern CameraError SetTilt(IntPtr handle, CameraPtzMoveType type, int step); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tilt")] - internal static extern CameraError GetTilt(IntPtr handle, out int step); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tilt_range")] - internal static extern CameraError GetTiltRange(IntPtr handle, out int min, out int max); - - [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_ptz_type")] - internal static extern CameraError SetPtzType(IntPtr handle, int type); - } - } -} diff --git a/src/Tizen.Multimedia/Interop/Interop.ImageUtil.Decode.cs b/src/Tizen.Multimedia/Interop/Interop.ImageUtil.Decode.cs deleted file mode 100644 index 6635183..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.ImageUtil.Decode.cs +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - // Image Decoder - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_set_input_path")] - internal static extern ErrorCode SetInputPath(this ImageDecoderHandle /* image_util_decode_h */ handle, string path); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_set_input_buffer")] - internal static extern ErrorCode SetInputBuffer(this ImageDecoderHandle /* image_util_decode_h */ handle, byte[] srcBuffer, ulong srcSize); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_set_output_buffer")] - internal static extern ErrorCode SetOutputBuffer(this ImageDecoderHandle /* image_util_decode_h */ handle, out IntPtr dstBuffer); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_set_colorspace")] - internal static extern ErrorCode SetColorspace(this ImageDecoderHandle /* image_util_encode_h */ handle, ImageColorSpace /* image_util_colorspace_e */ colorspace); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_set_jpeg_downscale")] - internal static extern ErrorCode SetJpegDownscale(this ImageDecoderHandle /* image_util_encode_h */ handle, JpegDownscale /* image_util_scale_e */ downscale); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_run")] - internal static extern ErrorCode DecodeRun(this ImageDecoderHandle /* image_util_decode_h */ handle, out int width, out int height, out ulong size); - - internal class ImageDecoderHandle : SafeMultimediaHandle - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void DecodeCompletedCallback(ErrorCode errorCode, IntPtr /* void */ userData, int width, int height, ulong size); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_run_async")] - internal static extern ErrorCode DecodeRunAsync(ImageDecoderHandle /* image_util_decode_h */ handle, DecodeCompletedCallback callback, IntPtr /* void */ userData); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_create")] - internal static extern ErrorCode Create(out IntPtr /* image_util_decode_h */ handle); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_destroy")] - internal static extern ErrorCode Destroy(IntPtr /* image_util_decode_h */ handle); - - internal ImageColorSpace Colorspace - { - set { NativeSet(this.SetColorspace, value); } - } - - internal JpegDownscale JpegDownscale - { - set { NativeSet(this.SetJpegDownscale, value); } - } - - internal ImageDecoderHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease) - { - } - - internal ImageDecoderHandle() : this(CreateNativeHandle(), true) - { - } - - internal static IntPtr CreateNativeHandle() - { - IntPtr handle; - Create(out handle).ThrowIfFailed("Failed to create native handle"); - return handle; - } - - internal override ErrorCode DisposeNativeHandle() - { - return Destroy(handle); - } - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.ImageUtil.Encode.cs b/src/Tizen.Multimedia/Interop/Interop.ImageUtil.Encode.cs deleted file mode 100644 index 6ac714d..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.ImageUtil.Encode.cs +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - // Image Encoder - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_resolution")] - internal static extern ErrorCode SetResolution(this ImageEncoderHandle /* image_util_encode_h */ handle, uint width, uint height); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_colorspace")] - internal static extern ErrorCode SetColorspace(this ImageEncoderHandle /* image_util_encode_h */ handle, ImageColorSpace /* image_util_colorspace_e */ colorspace); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_quality")] - internal static extern ErrorCode SetQuality(this ImageEncoderHandle /* image_util_encode_h */ handle, int quality); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_png_compression")] - internal static extern ErrorCode SetPngCompression(this ImageEncoderHandle /* image_util_encode_h */ handle, PngCompression /* image_util_png_compression_e */ compression); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_gif_frame_delay_time")] - internal static extern ErrorCode SetGifFrameDelayTime(this ImageEncoderHandle /* image_util_encode_h */ handle, ulong delayTime); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_output_path")] - internal static extern ErrorCode SetOutputPath(this ImageEncoderHandle /* image_util_encode_h */ handle, string path); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_input_buffer")] - internal static extern ErrorCode SetInputBuffer(this ImageEncoderHandle /* image_util_encode_h */ handle, byte[] srcBuffer); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_output_buffer")] - internal static extern ErrorCode SetOutputBuffer(this ImageEncoderHandle /* image_util_encode_h */ handle, out IntPtr dstBuffer); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_run")] - internal static extern ErrorCode EncodeRun(this ImageEncoderHandle /* image_util_encode_h */ handle, out ulong size); - - internal class ImageEncoderHandle : SafeMultimediaHandle - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void EncodeCompletedCallback(ErrorCode errorCode, IntPtr /* void */ userData, ulong size); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_run_async")] - internal static extern ErrorCode EncodeRunAsync(ImageEncoderHandle /* image_util_encode_h */ handle, EncodeCompletedCallback callback, IntPtr /* void */ userData); - - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_create")] - internal static extern ErrorCode Create(ImageType /* image_util_type_e */ type, out IntPtr /* image_util_encode_h */ handle); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_destroy")] - internal static extern ErrorCode Destroy(IntPtr /* image_util_encode_h */ handle); - - internal ImageEncoderHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease) - { - } - - internal ImageEncoderHandle(ImageType type) : this(CreateNativeHandle(type), true) - { - } - - internal ImageColorSpace Colorspace - { - set { NativeSet(this.SetColorspace, value); } - } - - internal int Quality - { - set { NativeSet(this.SetQuality, value); } - } - - internal PngCompression PngCompression - { - set { NativeSet(this.SetPngCompression, value); } - } - - internal ulong GifFrameDelay - { - set { NativeSet(this.SetGifFrameDelayTime, value); } - } - - internal string OutputPath - { - set { NativeSet(this.SetOutputPath, value); } - } - - internal byte[] InputBuffer - { - set { NativeSet(this.SetInputBuffer, value); } - } - - internal static IntPtr CreateNativeHandle(ImageType type) - { - IntPtr handle; - Create(type, out handle).ThrowIfFailed("Failed to create native handle"); - return handle; - } - - internal override ErrorCode DisposeNativeHandle() - { - return Destroy(handle); - } - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.ImageUtil.Transform.cs b/src/Tizen.Multimedia/Interop/Interop.ImageUtil.Transform.cs deleted file mode 100644 index 30d07b6..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.ImageUtil.Transform.cs +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_set_hardware_acceleration")] - internal static extern ErrorCode SetHardwareAcceleration(this ImageTransformHandle /* transformation_h */ handle, bool mode); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_get_colorspace")] - internal static extern ErrorCode GetColorspace(this ImageTransformHandle /* transformation_h */ handle, out ImageColorSpace /* image_util_colorspace_e */ colorspace); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_set_colorspace")] - internal static extern ErrorCode SetColorspace(this ImageTransformHandle /* transformation_h */ handle, ImageColorSpace /* image_util_colorspace_e */ colorspace); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_get_rotation")] - internal static extern ErrorCode GetRotation(this ImageTransformHandle /* transformation_h */ handle, out ImageRotation /* image_util_rotation_e */ rotation); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_set_rotation")] - internal static extern ErrorCode SetRotation(this ImageTransformHandle /* transformation_h */ handle, ImageRotation /* image_util_rotation_e */ rotation); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_get_resolution")] - internal static extern ErrorCode GetResolution(this ImageTransformHandle /* transformation_h */ handle, out uint width, out uint height); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_set_resolution")] - internal static extern ErrorCode SetResolution(this ImageTransformHandle /* transformation_h */ handle, uint width, uint height); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_get_crop_area")] - internal static extern ErrorCode GetCropArea(this ImageTransformHandle /* transformation_h */ handle, out uint startX, out uint startY, out uint endX, out uint endY); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_set_crop_area")] - internal static extern ErrorCode SetCropArea(this ImageTransformHandle /* transformation_h */ handle, int startX, int startY, int endX, int endY); - - internal class ImageTransformHandle : SafeMultimediaHandle - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void TransformCompletedCallback(IntPtr /* media_packet_h */ dst, ErrorCode errorCode, IntPtr /* void */ userData); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_run")] - internal static extern ErrorCode Transform(ImageTransformHandle /* transformation_h */ handle, IntPtr /* media_packet_h */ src, TransformCompletedCallback callback, IntPtr /* void */ userData); - - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_create")] - internal static extern ErrorCode Create(out IntPtr /* transformation_h */ handle); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_destroy")] - internal static extern ErrorCode Destroy(IntPtr /* transformation_h */ handle); - - internal ImageTransformHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease) - { - } - - internal ImageTransformHandle() : this(CreateNativeHandle(), true) - { - } - - internal bool HardwareAccelerationEnabled - { - set { NativeSet(this.SetHardwareAcceleration, value); } - } - - internal ImageColorSpace Colorspace - { - get { return NativeGet(this.GetColorspace); } - set { NativeSet(this.SetColorspace, value); } - } - - internal ImageRotation Rotation - { - get { return NativeGet(this.GetRotation); } - set { NativeSet(this.SetRotation, value); } - } - - internal static IntPtr CreateNativeHandle() - { - IntPtr handle; - Create(out handle).ThrowIfFailed("Failed to create native handle"); - return handle; - } - - internal override ErrorCode DisposeNativeHandle() - { - return Destroy(handle); - } - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.ImageUtil.cs b/src/Tizen.Multimedia/Interop/Interop.ImageUtil.cs deleted file mode 100644 index 7db50a5..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.ImageUtil.cs +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal enum ImageColorSpace - { - Yv12, // IMAGE_UTIL_COLORSPACE_YV12 - Yuv422, // IMAGE_UTIL_COLORSPACE_YUV422 - I420, // IMAGE_UTIL_COLORSPACE_I420 - Nv12, // IMAGE_UTIL_COLORSPACE_NV12 - Uyvy, // IMAGE_UTIL_COLORSPACE_UYVY - Yuyv, // IMAGE_UTIL_COLORSPACE_YUYV - Rgb565, // IMAGE_UTIL_COLORSPACE_RGB565 - Rgb888, // IMAGE_UTIL_COLORSPACE_RGB888 - Argb8888, // IMAGE_UTIL_COLORSPACE_ARGB8888 - Bgra8888, // IMAGE_UTIL_COLORSPACE_BGRA8888 - Rgba8888, // IMAGE_UTIL_COLORSPACE_RGBA8888 - Bgrx8888, // IMAGE_UTIL_COLORSPACE_BGRX8888 - Nv21, // IMAGE_UTIL_COLORSPACE_NV21 - Nv16, // IMAGE_UTIL_COLORSPACE_NV16 - Nv61, // IMAGE_UTIL_COLORSPACE_NV61 - } - - internal enum ImageRotation - { - None, // IMAGE_UTIL_ROTATION_NONE - Rotate90, // IMAGE_UTIL_ROTATION_90 - Rotate180, // IMAGE_UTIL_ROTATION_180 - Rotate270, // IMAGE_UTIL_ROTATION_270 - FlipHorizontal, // IMAGE_UTIL_ROTATION_FLIP_HORZ - FlipVertical, // IMAGE_UTIL_ROTATION_FLIP_VERT - } - - internal enum ImageType - { - Jpeg, // IMAGE_UTIL_JPEG - Png, // IMAGE_UTIL_PNG - Gif, // IMAGE_UTIL_GIF - Bmp, // IMAGE_UTIL_BMP - } - - internal enum JpegDownscale - { - NoDownscale, // IMAGE_UTIL_DOWNSCALE_1_1 - OneHalf, // IMAGE_UTIL_DOWNSCALE_1_2 - OneFourth, // IMAGE_UTIL_DOWNSCALE_1_4 - OneEighth, // IMAGE_UTIL_DOWNSCALE_1_8 - } - - internal enum PngCompression - { - NoCompression, // IMAGE_UTIL_PNG_COMPRESSION_0 - Level1, // IMAGE_UTIL_PNG_COMPRESSION_1 - Level2, // IMAGE_UTIL_PNG_COMPRESSION_2 - Level3, // IMAGE_UTIL_PNG_COMPRESSION_3 - Level4, // IMAGE_UTIL_PNG_COMPRESSION_4 - Level5, // IMAGE_UTIL_PNG_COMPRESSION_5 - Level6, // IMAGE_UTIL_PNG_COMPRESSION_6 - Level7, // IMAGE_UTIL_PNG_COMPRESSION_7 - Level8, // IMAGE_UTIL_PNG_COMPRESSION_8 - Level9, // IMAGE_UTIL_PNG_COMPRESSION_9 - } - - internal class ImageUtil - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool SupportedColorspaceCallback(ImageColorSpace /* image_util_colorspace_e */ colorspace, IntPtr /* void */ userData); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_foreach_supported_colorspace")] - internal static extern ErrorCode ForeachSupportedColorspace(ImageType /* image_util_type_e */ type, SupportedColorspaceCallback callback, IntPtr /* void */ userData); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_calculate_buffer_size")] - internal static extern ErrorCode CalculateBufferSize(int width, int height, ImageColorSpace /* image_util_colorspace_e */ colorspace, out uint size); - - [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_extract_color_from_memory")] - internal static extern ErrorCode ExtractColorFromMemory(byte[] buffer, int width, int height, out byte rgbR, out byte rgbG, out byte rgbB); - - internal static void ForeachSupportedColorspace(ImageType type, Action action) - { - SupportedColorspaceCallback callback = (codec, userData) => - { - action(codec); - return true; - }; - - ForeachSupportedColorspace(type, callback, IntPtr.Zero).WarnIfFailed("Failed to get supported color-space list from native handle"); - } - - internal static uint CalculateBufferSize(int width, int height, ImageColorSpace colorSpace) - { - uint size; - CalculateBufferSize(width, height, colorSpace, out size).ThrowIfFailed("Failed to calculate buffer size"); - return size; - } - - internal static ElmSharp.Color ExtractColorFromMemory(byte[] buffer, int width, int height) - { - byte r, g, b; - ExtractColorFromMemory(buffer, width, height, out r, out g, out b); - return new ElmSharp.Color(r, g, b); - } - - internal static byte[] NativeToByteArray(IntPtr nativeBuffer, int size) - { - Debug.Assert(nativeBuffer != IntPtr.Zero); - - byte[] managedArray = new byte[size]; - Marshal.Copy(nativeBuffer, managedArray, 0, size); - - Libc.Free(nativeBuffer); - return managedArray; - } - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.Libc.cs b/src/Tizen.Multimedia/Interop/Interop.Libc.cs new file mode 100644 index 0000000..9903e0b --- /dev/null +++ b/src/Tizen.Multimedia/Interop/Interop.Libc.cs @@ -0,0 +1,14 @@ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + internal static partial class Interop + { + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free")] + public static extern void Free(IntPtr ptr); + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia/Interop/Interop.Libraries.cs index 95afffe..f0ce791 100644 --- a/src/Tizen.Multimedia/Interop/Interop.Libraries.cs +++ b/src/Tizen.Multimedia/Interop/Interop.Libraries.cs @@ -20,25 +20,9 @@ namespace Tizen.Multimedia { internal static partial class Libraries { - public const string Player = "libcapi-media-player.so.0"; - public const string Recorder = "libcapi-media-recorder.so.0"; public const string SoundManager = "libcapi-media-sound-manager.so.0"; - public const string AudioIO = "libcapi-media-audio-io.so.0"; - public const string ScreenMirroring = "libcapi-media-screen-mirroring.so.0"; - public const string MetadataEditor = "libcapi-media-metadata-editor.so"; - public const string MetadataExtractor = "libcapi-media-metadata-extractor.so"; - public const string MediaController = "libcapi-media-controller.so.0"; public const string MediaTool = "libcapi-media-tool.so.0"; - public const string MediaVision = "libcapi-media-vision.so.0"; public const string Libc = "libc.so.6"; - public const string Camera = "libcapi-media-camera.so.0"; - public const string StreamRecorder = "libcapi-media-streamrecorder.so.0"; - public const string Radio = "libcapi-media-radio.so.0"; - public const string VideoUtil = "libcapi-media-video-util.so.0"; - public const string ImageUtil = "libcapi-media-image-util.so.0"; - public const string ThumbnailExtractor = "libcapi-media-thumbnail-util.so"; - public const string WavPlayer = "libcapi-media-wav-player.so.0"; - public const string TonePlayer = "libcapi-media-tone-player.so.0"; } } } diff --git a/src/Tizen.Multimedia/Interop/Interop.MediaController.cs b/src/Tizen.Multimedia/Interop/Interop.MediaController.cs deleted file mode 100644 index e9d7619..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.MediaController.cs +++ /dev/null @@ -1,188 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using Tizen.Applications; -using Tizen.Multimedia.MediaController; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class MediaControllerClient - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void ServerUpdatedCallback(IntPtr serverName, MediaControllerServerState serverState, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void PlaybackUpdatedCallback(IntPtr serverName, IntPtr playback, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void MetadataUpdatedCallback(IntPtr serverName, IntPtr metadata, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void ShuffleModeUpdatedCallback(IntPtr serverName, MediaControllerShuffleMode shuffleMode, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void RepeatModeUpdatedCallback(IntPtr serverName, MediaControllerRepeatMode repeatMode, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void CommandReplyRecievedCallback(IntPtr serverName, int result, IntPtr bundle, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool SubscribedServerCallback(IntPtr serverName, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool ActivatedServerCallback(IntPtr serverName, IntPtr userData); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_create")] - internal static extern MediaControllerError Create(out IntPtr handle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy")] - internal static extern MediaControllerError Destroy(IntPtr handle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_server_update_cb")] - internal static extern MediaControllerError SetServerUpdatedCb(IntPtr handle, ServerUpdatedCallback callback, IntPtr userData); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_server_update_cb")] - internal static extern MediaControllerError UnsetServerUpdatedCb(IntPtr handle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_playback_update_cb")] - internal static extern MediaControllerError SetPlaybackUpdatedCb(IntPtr handle, PlaybackUpdatedCallback callback, IntPtr userData); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_playback_update_cb")] - internal static extern MediaControllerError UnsetPlaybackUpdatedCb(IntPtr handle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_metadata_update_cb")] - internal static extern MediaControllerError SetMetadataUpdatedCb(IntPtr handle, MetadataUpdatedCallback callback, IntPtr userData); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_metadata_update_cb")] - internal static extern MediaControllerError UnsetMetadataUpdatedCb(IntPtr handle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_shuffle_mode_update_cb")] - internal static extern MediaControllerError SetShuffleModeUpdatedCb(IntPtr handle, ShuffleModeUpdatedCallback callback, IntPtr userData); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_shuffle_mode_update_cb")] - internal static extern MediaControllerError UnsetShuffleModeUpdatedCb(IntPtr handle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_repeat_mode_update_cb")] - internal static extern MediaControllerError SetRepeatModeUpdatedCb(IntPtr handle, RepeatModeUpdatedCallback callback, IntPtr userData); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_repeat_mode_update_cb")] - internal static extern MediaControllerError UnsetRepeatModeUpdatedCb(IntPtr handle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_subscribe")] - internal static extern MediaControllerError Subscribe(IntPtr handle, MediaControllerSubscriptionType subscriptionType, string serverName); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unsubscribe")] - internal static extern MediaControllerError Unsubscribe(IntPtr handle, MediaControllerSubscriptionType subscriptionType, string serverName); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_state")] - internal static extern MediaControllerError GetPlaybackState(IntPtr playback, out MediaControllerPlaybackState state); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_position")] - internal static extern MediaControllerError GetPlaybackPosition(IntPtr playback, out ulong position); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy_playback")] - internal static extern MediaControllerError DestroyPlayback(IntPtr playback); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_metadata")] - private static extern MediaControllerError GetMetadata(IntPtr metadata, MediaControllerAttributes attribute, out IntPtr value); - - internal static string GetMetadata(IntPtr handle, MediaControllerAttributes attr) - { - IntPtr valuePtr = IntPtr.Zero; - - try - { - var ret = GetMetadata(handle, attr, out valuePtr); - MediaControllerValidator.ThrowIfError(ret, "Failed to get value for " + attr); - return Marshal.PtrToStringAnsi(valuePtr); - } - finally - { - Libc.Free(valuePtr); - } - } - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy_metadata")] - internal static extern MediaControllerError DestroyMetadata(IntPtr metadata); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_latest_server_info")] - internal static extern MediaControllerError GetLatestServer(IntPtr handle, out IntPtr serverName, out MediaControllerServerState serverState); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_playback_info")] - internal static extern MediaControllerError GetServerPlayback(IntPtr handle, string serverName, out IntPtr playback); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_metadata")] - internal static extern MediaControllerError GetServerMetadata(IntPtr handle, string serverName, out IntPtr metadata); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_shuffle_mode")] - internal static extern MediaControllerError GetServerShuffleMode(IntPtr handle, string serverName, out MediaControllerShuffleMode mode); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_repeat_mode")] - internal static extern MediaControllerError GetServerRepeatMode(IntPtr handle, string serverName, out MediaControllerRepeatMode mode); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_playback_state_command")] - internal static extern MediaControllerError SendPlaybackStateCommand(IntPtr handle, string serverName, MediaControllerPlaybackState state); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_custom_command")] - internal static extern MediaControllerError SendCustomCommand(IntPtr handle, string serverName, string command, SafeBundleHandle bundle, CommandReplyRecievedCallback callback, IntPtr userData); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_foreach_server_subscribed")] - internal static extern MediaControllerError ForeachSubscribedServer(IntPtr handle, MediaControllerSubscriptionType subscriptionType, SubscribedServerCallback callback, IntPtr userData); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_foreach_server")] - internal static extern MediaControllerError ForeachActivatedServer(IntPtr handle, ActivatedServerCallback callback, IntPtr userData); - } - - internal static partial class MediaControllerServer - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void PlaybackStateCommandRecievedCallback(IntPtr clientName, MediaControllerPlaybackState state, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void CustomCommandRecievedCallback(IntPtr clientName, IntPtr command, IntPtr bundle, IntPtr userData); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_create")] - internal static extern MediaControllerError Create(out IntPtr handle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_destroy")] - internal static extern MediaControllerError Destroy(IntPtr handle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_state")] - internal static extern MediaControllerError SetPlaybackState(IntPtr handle, MediaControllerPlaybackState state); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_position")] - internal static extern MediaControllerError SetPlaybackPosition(IntPtr handle, ulong position); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_playback_info")] - internal static extern MediaControllerError UpdatePlayback(IntPtr handle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_metadata")] - internal static extern MediaControllerError SetMetadata(IntPtr handle, MediaControllerAttributes attribute, string value); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_metadata")] - internal static extern MediaControllerError UpdateMetadata(IntPtr handle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_shuffle_mode")] - internal static extern MediaControllerError UpdateShuffleMode(IntPtr handle, MediaControllerShuffleMode mode); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_repeat_mode")] - internal static extern MediaControllerError UpdateRepeatMode(IntPtr handle, MediaControllerRepeatMode mode); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_state_command_received_cb")] - internal static extern MediaControllerError SetPlaybackStateCmdRecvCb(IntPtr handle, PlaybackStateCommandRecievedCallback callback, IntPtr userData); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_playback_state_command_received_cb")] - internal static extern MediaControllerError UnsetPlaybackStateCmdRecvCb(IntPtr handle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_custom_command_received_cb")] - internal static extern MediaControllerError SetCustomCmdRecvCb(IntPtr handle, CustomCommandRecievedCallback callback, IntPtr userData); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_custom_command_received_cb")] - internal static extern MediaControllerError UnsetCustomCmdRecvCb(IntPtr handle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_command_reply")] - internal static extern MediaControllerError SendCommandReply(IntPtr handle, string clientName, int result, SafeBundleHandle bundle); - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.MediaVision.BarCode.cs b/src/Tizen.Multimedia/Interop/Interop.MediaVision.BarCode.cs deleted file mode 100644 index c1bc048..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.MediaVision.BarCode.cs +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - /// - /// Interop APIs - /// - internal static partial class Interop - { - /// - /// Interop for media vision APIs - /// - internal static partial class MediaVision - { - /// - /// Interop for barcode detector APIs - /// - internal static partial class BarcodeDetector - { - [DllImport(Libraries.MediaVision, EntryPoint = "mv_barcode_detect")] - internal static extern MediaVisionError Detect(IntPtr source, IntPtr engineCfg, Rectangle roi, - DetectedCallback detectCb, IntPtr userData = default(IntPtr)); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void DetectedCallback( - IntPtr source, - IntPtr engineCfg, - [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] - Quadrangle[] locations, - [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr, SizeParamIndex = 5)] - string[] messages, - BarcodeType[] types, - int numberOfBarcodes, - IntPtr userData); - } - - /// - /// Interop for barcode generator APIs - /// - internal static partial class BarcodeGenerator - { - [DllImport(Libraries.MediaVision, EntryPoint = "mv_barcode_generate_source")] - internal static extern MediaVisionError GenerateSource(IntPtr engineCfg, string message, - BarcodeType type, int qrEncMode, int qrEcc, int qrVersion, IntPtr source); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_barcode_generate_image")] - internal static extern MediaVisionError GenerateImage(IntPtr engineCfg, - string message, int imageWidth, int imageHeight, BarcodeType type, - int qrEncMode, int qrEcc, int qrVersion, string imagePath, BarcodeImageFormat imageFormat); - } - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.MediaVision.Common.cs b/src/Tizen.Multimedia/Interop/Interop.MediaVision.Common.cs deleted file mode 100644 index b373db4..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.MediaVision.Common.cs +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - /// - /// Interop APIs - /// - internal static partial class Interop - { - internal static Tizen.Multimedia.Point ToApiStruct(this MediaVision.Point pt) - { - return new Tizen.Multimedia.Point(pt.x, pt.y); - } - - internal static MediaVision.Point ToMarshalable(this Tizen.Multimedia.Point pt) - { - return new MediaVision.Point() { x = pt.X, y = pt.Y }; - } - - internal static MediaVision.Point[] ToMarshalable(Tizen.Multimedia.Point[] pts) - { - var result = new MediaVision.Point[pts.Length]; - for (int i = 0; i < pts.Length; ++i) - { - result[i] = pts[i].ToMarshalable(); - } - return result; - } - - - internal static Tizen.Multimedia.Quadrangle ToApiStruct(this MediaVision.Quadrangle quadrangle) - { - Tizen.Multimedia.Point[] points = new Tizen.Multimedia.Point[4]; - for (int i = 0; i < 4; ++i) - { - points[i] = quadrangle.points[i].ToApiStruct(); - } - return new Tizen.Multimedia.Quadrangle(points); - } - - internal static MediaVision.Quadrangle ToMarshalable(this Tizen.Multimedia.Quadrangle quadrangle) - { - MediaVision.Point[] points = new MediaVision.Point[4]; - for (int i = 0; i < 4; ++i) - { - points[i] = quadrangle.Points[i].ToMarshalable(); - } - return new MediaVision.Quadrangle() { points = points }; - } - - internal static Tizen.Multimedia.Rectangle ToApiStruct(this MediaVision.Rectangle rectangle) - { - return new Tizen.Multimedia.Rectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height); - } - - internal static MediaVision.Rectangle ToMarshalable(this Tizen.Multimedia.Rectangle rectangle) - { - return new MediaVision.Rectangle() - { - x = rectangle.X, - y = rectangle.Y, - width = rectangle.Width, - height = rectangle.Height - }; - } - - internal static Tizen.Multimedia.Rectangle[] ToApiStruct(MediaVision.Rectangle[] rects) - { - var result = new Tizen.Multimedia.Rectangle[rects.Length]; - - for (int i = 0; i < rects.Length; i++) - { - result[i] = rects[i].ToApiStruct(); - } - return result; - } - - /// - /// Interop for media vision APIs - /// - internal static partial class MediaVision - { - [StructLayout(LayoutKind.Sequential)] - internal struct Point - { - internal int x; - internal int y; - } - - [StructLayout(LayoutKind.Sequential)] - internal struct Rectangle - { - internal int x; - internal int y; - internal int width; - internal int height; - } - - [StructLayout(LayoutKind.Sequential)] - internal struct Quadrangle - { - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - internal Point[] points; - } - - /// - /// Interop for media vision source APIs - /// - internal static partial class MediaSource - { - [DllImport(Libraries.MediaVision, EntryPoint = "mv_create_source")] - internal static extern MediaVisionError Create(out IntPtr source); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_destroy_source")] - internal static extern int Destroy(IntPtr /* mv_source_h */ source); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_fill_by_media_packet")] - internal static extern MediaVisionError FillMediaPacket(IntPtr source, IntPtr mediaPacket); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_fill_by_buffer")] - internal static extern MediaVisionError FillBuffer(IntPtr source, byte[] buffer, - int bufferSize, uint imageWidth, uint imageHeight, Colorspace colorspace); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_clear")] - internal static extern int Clear(IntPtr /* mv_source_h */ source); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_get_buffer")] - internal static extern MediaVisionError GetBuffer(IntPtr source, out IntPtr buffer, out int bufferSize); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_get_height")] - internal static extern int GetHeight(IntPtr source, out uint imageHeight); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_get_width")] - internal static extern int GetWidth(IntPtr source, out uint imageWidth); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_get_colorspace")] - internal static extern int GetColorspace(IntPtr /* mv_source_h */ source, out Tizen.Multimedia.Colorspace colorspace); - } - - /// - /// Interop for engine configuration APIs - /// - internal static partial class EngineConfig - { - [DllImport(Libraries.MediaVision, EntryPoint = "mv_create_engine_config")] - internal static extern MediaVisionError Create(out IntPtr handle); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_destroy_engine_config")] - internal static extern int Destroy(IntPtr handle); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_double_attribute")] - internal static extern Tizen.Multimedia.MediaVisionError SetDouble(IntPtr handle, string name, double value); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_int_attribute")] - internal static extern Tizen.Multimedia.MediaVisionError SetInt(IntPtr handle, string name, int value); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_bool_attribute")] - internal static extern Tizen.Multimedia.MediaVisionError SetBool(IntPtr handle, string name, bool value); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_string_attribute")] - internal static extern Tizen.Multimedia.MediaVisionError SetString(IntPtr handle, string name, string value); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_double_attribute")] - internal static extern Tizen.Multimedia.MediaVisionError GetDouble(IntPtr handle, string name, out double value); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_int_attribute")] - internal static extern Tizen.Multimedia.MediaVisionError GetInt(IntPtr handle, string name, out int value); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_bool_attribute")] - internal static extern Tizen.Multimedia.MediaVisionError GetBool(IntPtr handle, string name, out bool value); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_string_attribute")] - internal static extern Tizen.Multimedia.MediaVisionError GetString(IntPtr handle, string name, out IntPtr value); - } - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.MediaVision.Face.cs b/src/Tizen.Multimedia/Interop/Interop.MediaVision.Face.cs deleted file mode 100644 index 3ee606b..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.MediaVision.Face.cs +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - /// - /// Interop APIs - /// - internal static partial class Interop - { - /// - /// Interop for media vision APIs - /// - internal static partial class MediaVision - { - /// - /// Interop for Face APIs - /// - internal static partial class Face - { - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_detect")] - internal static extern MediaVisionError Detect(IntPtr source, IntPtr engineCfg, - DetectedCallback detectedCb, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognize")] - internal static extern MediaVisionError Recognize(IntPtr source, IntPtr recognitionModel, IntPtr engineCfg, - IntPtr faceLocation, RecognizedCallback recognizedCb, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognize")] - internal static extern MediaVisionError Recognize(IntPtr source, IntPtr recognitionModel, IntPtr engineCfg, - ref Rectangle faceLocation, RecognizedCallback recognizedCb, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_track")] - internal static extern MediaVisionError Track(IntPtr source, IntPtr trackingModel, IntPtr engineCfg, - TrackedCallback trackedCb, bool doLearn, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_eye_condition_recognize")] - internal static extern MediaVisionError RecognizeEyeCondition(IntPtr source, IntPtr engineCfg, - Rectangle faceLocation, EyeConditionRecognizedCallback eyeConditionRecognizedCb, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_facial_expression_recognize")] - internal static extern MediaVisionError RecognizeFacialExpression(IntPtr source, IntPtr engineCfg, - Rectangle faceLocation, MvFaceFacialExpressionRecognizedCallback expressionRecognizedCb, - IntPtr userData = default(IntPtr)); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void DetectedCallback(IntPtr source, IntPtr engineCfg, - [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] Rectangle[] facesLocations, - int numberOfFaces, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void RecognizedCallback(IntPtr source, IntPtr recognitionModel, - IntPtr engineCfg, IntPtr faceLocation, IntPtr faceLabel, double confidence, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void TrackedCallback(IntPtr source, IntPtr trackingModel, IntPtr engineCfg, - IntPtr location, double confidence, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void EyeConditionRecognizedCallback(IntPtr source, IntPtr engineCfg, - Rectangle faceLocation, EyeCondition eyeCondition, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void MvFaceFacialExpressionRecognizedCallback(IntPtr source, - IntPtr engineCfg, Rectangle faceLocation, FacialExpression facialExpression, IntPtr userData); - } - - /// - /// Interop for FaceRecognitionModel APIs - /// - internal static partial class FaceRecognitionModel - { - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_create")] - internal static extern MediaVisionError Create(out IntPtr handle); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_destroy")] - internal static extern int Destroy(IntPtr handle); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_clone")] - internal static extern int Clone(IntPtr src, out IntPtr dst); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_save")] - internal static extern MediaVisionError Save(string fileName, IntPtr handle); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_load")] - internal static extern MediaVisionError Load(string fileName, out IntPtr handle); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_add")] - internal static extern MediaVisionError Add(IntPtr source, IntPtr recognitionModel, - ref Rectangle exampleLocation, int faceLabel); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_add")] - internal static extern MediaVisionError Add(IntPtr source, IntPtr recognitionModel, - IntPtr exampleLocation, int faceLabel); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_reset")] - internal static extern MediaVisionError Reset(IntPtr recognitionModel, IntPtr faceLabel = default(IntPtr)); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_reset")] - internal static extern MediaVisionError Remove(IntPtr recognitionModel, ref int faceLabel); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_learn")] - internal static extern MediaVisionError Learn(IntPtr engineCfg, IntPtr handle); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_query_labels")] - internal static extern MediaVisionError QueryLabels(IntPtr handle, out IntPtr labels, out uint numberOfLabels); - } - - /// - /// Interop for FaceTrackingModel APIs - /// - internal static partial class FaceTrackingModel - { - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_create")] - internal static extern MediaVisionError Create(out IntPtr handle); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_destroy")] - internal static extern int Destroy(IntPtr handle); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_prepare")] - internal static extern MediaVisionError Prepare(IntPtr trackingModel, IntPtr engineCfg, - IntPtr source, ref Quadrangle location); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_prepare")] - internal static extern MediaVisionError Prepare(IntPtr trackingModel, IntPtr engineCfg, - IntPtr source, IntPtr location); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_clone")] - internal static extern int Clone(IntPtr src, out IntPtr dst); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_save")] - internal static extern MediaVisionError Save(string fileName, IntPtr handle); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_load")] - internal static extern MediaVisionError Load(string fileName, out IntPtr handle); - } - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.MediaVision.Image.cs b/src/Tizen.Multimedia/Interop/Interop.MediaVision.Image.cs deleted file mode 100644 index 03d36d0..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.MediaVision.Image.cs +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - /// - /// Interop APIs - /// - internal static partial class Interop - { - /// - /// Interop for Media vision APIs - /// - internal static partial class MediaVision - { - /// - /// Interop for Image APIs - /// - internal static partial class Image - { - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_recognize")] - internal static extern MediaVisionError Recognize(IntPtr source, IntPtr[] imageObjects, - int numberOfObjects, IntPtr engineCfg, RecognizedCallback recognizedCb, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_track")] - internal static extern MediaVisionError Track(IntPtr source, IntPtr imageTrackingModel, - IntPtr engineCfg, TrackedCallback trackedCb, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_create")] - internal static extern MediaVisionError Create(out IntPtr handle); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_destroy")] - internal static extern int Destroy(IntPtr handle); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_fill")] - internal static extern MediaVisionError Fill(IntPtr handle, IntPtr engineCfg, IntPtr source, ref Rectangle location); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_fill")] - internal static extern MediaVisionError Fill(IntPtr handle, IntPtr engineCfg, IntPtr source, IntPtr location); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_get_recognition_rate")] - internal static extern MediaVisionError GetRecognitionRate(IntPtr handle, out double recognitionRate); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_set_label")] - internal static extern MediaVisionError SetLabel(IntPtr handle, int label); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_get_label")] - internal static extern MediaVisionError GetLabel(IntPtr handle, out int label); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_clone")] - internal static extern int Clone(IntPtr src, out IntPtr dst); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_save")] - internal static extern MediaVisionError Save(string fileName, IntPtr handle); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_load")] - internal static extern MediaVisionError Load(string fileName, out IntPtr handle); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void RecognizedCallback(IntPtr source, IntPtr engineCfg, IntPtr imageObjects, - [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] - IntPtr[] locations, uint numberOfObjects, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void TrackedCallback(IntPtr source, IntPtr imageTrackingModel, - IntPtr engineCfg, IntPtr location, IntPtr userData); - } - - /// - /// Interop for ImageTrackingModel APIs - /// - internal static partial class ImageTrackingModel - { - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_create")] - internal static extern MediaVisionError Create(out IntPtr imageTrackingModel); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_set_target")] - internal static extern MediaVisionError SetTarget(IntPtr handle, IntPtr imageTrackingModel); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_destroy")] - internal static extern int Destroy(IntPtr imageTrackingModel); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_refresh")] - internal static extern MediaVisionError Refresh(IntPtr imageTrackingModel, IntPtr engineCfg); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_clone")] - internal static extern int Clone(IntPtr src, out IntPtr dest); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_save")] - internal static extern MediaVisionError Save(string fileName, IntPtr imageTrackingModel); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_load")] - internal static extern MediaVisionError Load(string fileName, out IntPtr imageTrackingModel); - } - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.MediaVision.Surveillance.cs b/src/Tizen.Multimedia/Interop/Interop.MediaVision.Surveillance.cs deleted file mode 100644 index 64aaf2c..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.MediaVision.Surveillance.cs +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - /// - /// Interop APIs - /// - internal static partial class Interop - { - /// - /// Interop for media vision APIs - /// - internal static partial class MediaVision - { - /// - /// Interop for surveillance APIs - /// - internal static partial class Surveillance - { - [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_event_trigger_create")] - internal static extern MediaVisionError EventTriggerCreate(string eventType, out IntPtr trigger); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_event_trigger_destroy")] - internal static extern int EventTriggerDestroy(IntPtr trigger); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_event_trigger_type")] - internal static extern int GetEventTriggerType(IntPtr trigger, out string eventType); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_set_event_trigger_roi")] - internal static extern MediaVisionError SetEventTriggerRoi(IntPtr trigger, int numberOfPoints, Point[] roi); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_event_trigger_roi")] - internal static extern MediaVisionError GetEventTriggerRoi(IntPtr trigger, out int numberOfPoints, out IntPtr roi); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_subscribe_event_trigger")] - internal static extern MediaVisionError SubscribeEventTrigger(IntPtr trigger, int videoStreamId, - IntPtr engineCfg, EventOccurredCallback callback, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_unsubscribe_event_trigger")] - internal static extern MediaVisionError UnsubscribeEventTrigger(IntPtr trigger, int videoStreamId); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_push_source")] - internal static extern MediaVisionError PushSource(IntPtr source, int videoStreamId); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_foreach_supported_event_type")] - internal static extern int ForeachSupportedEventType(EventTypeCallback callback, IntPtr userData); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_foreach_event_result_name")] - internal static extern int ForeachEventResultName(string eventType, EventResultNameCallback callback, - IntPtr userData); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_result_value")] - internal static extern MediaVisionError GetResultValue(IntPtr result, string name, out int value); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_result_value")] - internal static extern MediaVisionError GetResultValue(IntPtr result, string name, [Out] int[] value); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_result_value")] - internal static extern MediaVisionError GetResultValue(IntPtr result, string name, [Out] double[] value); - - [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_result_value")] - internal static extern MediaVisionError GetResultValue(IntPtr result, string name, [Out] Rectangle[] value); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void EventOccurredCallback(IntPtr trigger, IntPtr source, - int videoStreamId, IntPtr eventResult, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool EventTypeCallback(string eventType, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool EventResultNameCallback(string name, IntPtr userData); - } - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.MetadataEditor.cs b/src/Tizen.Multimedia/Interop/Interop.MetadataEditor.cs deleted file mode 100644 index 9f988c4..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.MetadataEditor.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class MetadataEditor - { - [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_create")] - internal static extern MetadataEditorError Create(out IntPtr handle); - - [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_set_path")] - internal static extern MetadataEditorError SetPath(IntPtr handle, string path); - - [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_destroy")] - internal static extern MetadataEditorError Destroy(IntPtr handle); - - [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_get_metadata")] - internal static extern MetadataEditorError GetMetadata(IntPtr handle, MetadataEditorAttr attribute, out IntPtr value); - - [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_set_metadata")] - internal static extern MetadataEditorError SetMetadata(IntPtr handle, MetadataEditorAttr attribute, string value); - - [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_update_metadata")] - internal static extern MetadataEditorError UpdateMetadata(IntPtr handle); - - [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_get_picture")] - internal static extern MetadataEditorError GetPicture(IntPtr handle, int index, out IntPtr picture, out int size, out IntPtr mimeType); - - [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_append_picture")] - internal static extern MetadataEditorError AddPicture(IntPtr handle, string path); - - [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_remove_picture")] - internal static extern MetadataEditorError RemovePicture(IntPtr handle, int index); - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.MetadataExtractor.cs b/src/Tizen.Multimedia/Interop/Interop.MetadataExtractor.cs deleted file mode 100644 index 14f9b4a..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.MetadataExtractor.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class MetadataExtractor - { - [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_create")] - internal static extern MetadataExtractorError Create(out IntPtr handle); - - [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_set_path")] - internal static extern MetadataExtractorError SetPath(IntPtr handle, string path); - - [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_set_buffer")] - internal static extern MetadataExtractorError SetBuffer(IntPtr handle, IntPtr buffer, int size); - - [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_destroy")] - internal static extern MetadataExtractorError Destroy(IntPtr handle); - - [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_get_metadata")] - private static extern MetadataExtractorError GetMetadata(IntPtr handle, MetadataExtractorAttr attribute, out IntPtr value); - - internal static string GetMetadata(IntPtr handle, MetadataExtractorAttr attr) - { - IntPtr valuePtr = IntPtr.Zero; - - try - { - var ret = GetMetadata(handle, attr, out valuePtr); - MetadataExtractorRetValidator.ThrowIfError(ret, "Failed to get value for " + attr); - return Marshal.PtrToStringAnsi(valuePtr); - } - finally - { - Libc.Free(valuePtr); - } - } - - [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_get_artwork")] - internal static extern MetadataExtractorError GetArtwork(IntPtr handle, out IntPtr artwork, - out int size, out IntPtr mimeType); - - [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_get_frame")] - internal static extern MetadataExtractorError GetFrame(IntPtr handle, out IntPtr frame, out int size); - - [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_get_synclyrics")] - internal static extern MetadataExtractorError GetSynclyrics(IntPtr handle, int index, - out uint timeStamp, out IntPtr lyrics); - - [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_get_frame_at_time")] - internal static extern MetadataExtractorError GetFrameAtTime(IntPtr handle, uint timeStamp, - bool isAccurate, out IntPtr frame, out int size); - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.Player.cs b/src/Tizen.Multimedia/Interop/Interop.Player.cs deleted file mode 100644 index 0037124..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.Player.cs +++ /dev/null @@ -1,321 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class Player - { - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void PlaybackCompletedCallback(IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void PlaybackInterruptedCallback(PlaybackInterruptionReason code, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void PlaybackErrorCallback(int code, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void VideoFrameDecodedCallback(IntPtr packetHandle, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void SubtitleUpdatedCallback(uint duration, string text, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void BufferingProgressCallback(int percent, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void VideoStreamChangedCallback(int width, int height, int fps, int bitrate, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void MediaStreamBufferStatusCallback(MediaStreamBufferStatus status, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void MediaStreamSeekCallback(ulong offset, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void VideoCaptureCallback(IntPtr data, int width, int height, uint size, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void PrepareCallback(IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void SeekCompletedCallback(IntPtr userData); - - - [DllImport(Libraries.Player, EntryPoint = "player_create")] - internal static extern PlayerErrorCode Create(out PlayerHandle player); - - [DllImport(Libraries.Player, EntryPoint = "player_destroy")] - internal static extern PlayerErrorCode Destroy(IntPtr player); - - [DllImport(Libraries.Player, EntryPoint = "player_prepare")] - internal static extern PlayerErrorCode Prepare(IntPtr player); - - [DllImport(Libraries.Player, EntryPoint = "player_unprepare")] - internal static extern PlayerErrorCode Unprepare(IntPtr player); - - [DllImport(Libraries.Player, EntryPoint = "player_set_uri")] - internal static extern PlayerErrorCode SetUri(IntPtr player, string uri); - - [DllImport(Libraries.Player, EntryPoint = "player_set_display")] - internal static extern PlayerErrorCode SetDisplay(IntPtr player, DisplayType type, IntPtr display); - - [DllImport(Libraries.Player, EntryPoint = "player_start")] - internal static extern PlayerErrorCode Start(IntPtr player); - - [DllImport(Libraries.Player, EntryPoint = "player_stop")] - internal static extern PlayerErrorCode Stop(IntPtr player); - - [DllImport(Libraries.Player, EntryPoint = "player_pause")] - internal static extern PlayerErrorCode Pause(IntPtr player); - - [DllImport(Libraries.Player, EntryPoint = "player_set_memory_buffer")] - internal static extern PlayerErrorCode SetMemoryBuffer(IntPtr player, byte[] data, int size); - - [DllImport(Libraries.Player, EntryPoint = "player_get_state")] - internal static extern PlayerErrorCode GetState(IntPtr player, out int state); - - [DllImport(Libraries.Player, EntryPoint = "player_set_volume")] - internal static extern PlayerErrorCode SetVolume(IntPtr player, float left, float right); - - [DllImport(Libraries.Player, EntryPoint = "player_get_volume")] - internal static extern PlayerErrorCode GetVolume(IntPtr player, out float left, out float right); - - [DllImport(Libraries.Player, EntryPoint = "player_set_sound_stream_info")] - internal static extern PlayerErrorCode SetAudioPolicyInfo(IntPtr player, IntPtr streamInfo); - - [DllImport(Libraries.Player, EntryPoint = "player_set_audio_latency_mode")] - internal static extern PlayerErrorCode SetAudioLatencyMode(IntPtr player, AudioLatencyMode latencyMode); - - [DllImport(Libraries.Player, EntryPoint = "player_get_audio_latency_mode")] - internal static extern PlayerErrorCode GetAudioLatencyMode(IntPtr player, out AudioLatencyMode latencyMode); - - [DllImport(Libraries.Player, EntryPoint = "player_get_play_position")] - internal static extern PlayerErrorCode GetPlayPosition(IntPtr player, out int millisecond); - - [DllImport(Libraries.Player, EntryPoint = "player_set_play_position")] - internal static extern PlayerErrorCode SetPlayPosition(IntPtr player, int millisecond, - bool accurate, SeekCompletedCallback cb, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.Player, EntryPoint = "player_set_mute")] - internal static extern PlayerErrorCode SetMute(IntPtr player, bool muted); - - [DllImport(Libraries.Player, EntryPoint = "player_is_muted")] - internal static extern PlayerErrorCode IsMuted(IntPtr player, out bool muted); - - [DllImport(Libraries.Player, EntryPoint = "player_set_looping")] - internal static extern PlayerErrorCode SetLooping(IntPtr player, bool looping); - - [DllImport(Libraries.Player, EntryPoint = "player_is_looping")] - internal static extern PlayerErrorCode IsLooping(IntPtr player, out bool looping); - - [DllImport(Libraries.Player, EntryPoint = "player_set_completed_cb")] - internal static extern PlayerErrorCode SetCompletedCb(IntPtr player, - PlaybackCompletedCallback callback, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.Player, EntryPoint = "player_unset_completed_cb")] - internal static extern PlayerErrorCode UnsetCompletedCb(IntPtr player); - - [DllImport(Libraries.Player, EntryPoint = "player_set_interrupted_cb")] - internal static extern PlayerErrorCode SetInterruptedCb(IntPtr player, - PlaybackInterruptedCallback callback, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.Player, EntryPoint = "player_unset_interrupted_cb")] - internal static extern PlayerErrorCode UnsetInterruptedCb(IntPtr player); - - [DllImport(Libraries.Player, EntryPoint = "player_set_error_cb")] - internal static extern PlayerErrorCode SetErrorCb(IntPtr player, PlaybackErrorCallback callback, - IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.Player, EntryPoint = "player_unset_error_cb")] - internal static extern PlayerErrorCode UnsetErrorCb(IntPtr player); - - [DllImport(Libraries.Player, EntryPoint = "player_capture_video")] - internal static extern PlayerErrorCode CaptureVideo(IntPtr player, VideoCaptureCallback callback, - IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.Player, EntryPoint = "player_set_media_packet_video_frame_decoded_cb")] - internal static extern PlayerErrorCode SetVideoFrameDecodedCb(IntPtr player, VideoFrameDecodedCallback callback, - IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.Player, EntryPoint = "player_unset_media_packet_video_frame_decoded_cb")] - internal static extern PlayerErrorCode UnsetVideoFrameDecodedCb(IntPtr player); - - [DllImport(Libraries.Player, EntryPoint = "player_set_streaming_cookie")] - internal static extern PlayerErrorCode SetStreamingCookie(IntPtr player, string cookie, int size); - - [DllImport(Libraries.Player, EntryPoint = "player_set_streaming_user_agent")] - internal static extern PlayerErrorCode SetStreamingUserAgent(IntPtr player, string userAgent, int size); - - [DllImport(Libraries.Player, EntryPoint = "player_get_streaming_download_progress")] - internal static extern PlayerErrorCode GetStreamingDownloadProgress(IntPtr player, out int start, out int current); - - [DllImport(Libraries.Player, EntryPoint = "player_set_buffering_cb")] - internal static extern PlayerErrorCode SetBufferingCb(IntPtr player, - BufferingProgressCallback callback, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.Player, EntryPoint = "player_unset_buffering_cb")] - internal static extern PlayerErrorCode UnsetBufferingCb(IntPtr player); - - [DllImport(Libraries.Player, EntryPoint = "player_set_playback_rate")] - internal static extern PlayerErrorCode SetPlaybackRate(IntPtr player, float rate); - - [DllImport(Libraries.Player, EntryPoint = "player_push_media_stream")] - internal static extern PlayerErrorCode PushMediaStream(IntPtr player, IntPtr packet); - - [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_info")] - internal static extern PlayerErrorCode SetMediaStreamInfo(IntPtr player, int type, IntPtr format); - - [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_buffer_status_cb")] - internal static extern PlayerErrorCode SetMediaStreamBufferStatusCb(IntPtr player, StreamType type, - MediaStreamBufferStatusCallback callback, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.Player, EntryPoint = "player_unset_media_stream_buffer_status_cb")] - internal static extern PlayerErrorCode UnsetMediaStreamBufferStatusCb(IntPtr player, int type); - - [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_seek_cb")] - internal static extern PlayerErrorCode SetMediaStreamSeekCb(IntPtr player, StreamType type, - MediaStreamSeekCallback callback, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.Player, EntryPoint = "player_unset_media_stream_seek_cb")] - internal static extern PlayerErrorCode UnsetMediaStreamSeekCb(IntPtr player, int type); - - [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_buffer_max_size")] - internal static extern PlayerErrorCode SetMediaStreamBufferMaxSize(IntPtr player, StreamType type, ulong maxSize); - - [DllImport(Libraries.Player, EntryPoint = "player_get_media_stream_buffer_max_size")] - internal static extern PlayerErrorCode GetMediaStreamBufferMaxSize(IntPtr player, StreamType type, out ulong maxSize); - - [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_buffer_min_threshold")] - internal static extern PlayerErrorCode SetMediaStreamBufferMinThreshold(IntPtr player, StreamType type, uint percent); - - [DllImport(Libraries.Player, EntryPoint = "player_get_media_stream_buffer_min_threshold")] - internal static extern PlayerErrorCode GetMediaStreamBufferMinThreshold(IntPtr player, int type, out uint percent); - - [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_bands_count")] - internal static extern PlayerErrorCode AudioEffectGetEqualizerBandsCount(IntPtr player, out int count); - - [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_set_equalizer_band_level")] - internal static extern PlayerErrorCode AudioEffectSetEqualizerBandLevel(IntPtr player, int index, int level); - - [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_band_level")] - internal static extern PlayerErrorCode AudioEffectGetEqualizerBandLevel(IntPtr player, int index, out int level); - - [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_set_equalizer_all_bands")] - internal static extern PlayerErrorCode AudioEffectSetEqualizerAllBands(IntPtr player, out int band_levels, int length); - - [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_level_range")] - internal static extern PlayerErrorCode AudioEffectGetEqualizerLevelRange(IntPtr player, out int min, out int max); - - [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_band_frequency")] - internal static extern PlayerErrorCode AudioEffectGetEqualizerBandFrequency(IntPtr player, int index, out int frequency); - - [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_band_frequency_range")] - internal static extern PlayerErrorCode AudioEffectGetEqualizerBandFrequencyRange(IntPtr player, int index, out int range); - - [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_equalizer_clear")] - internal static extern PlayerErrorCode AudioEffectEqualizerClear(IntPtr player); - - [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_equalizer_is_available")] - internal static extern PlayerErrorCode AudioEffectEqualizerIsAvailable(IntPtr player, out bool available); - - [DllImport(Libraries.Player, EntryPoint = "player_set_display_mode")] - internal static extern PlayerErrorCode SetDisplayMode(IntPtr player, PlayerDisplayMode mode); - - [DllImport(Libraries.Player, EntryPoint = "player_get_display_mode")] - internal static extern PlayerErrorCode GetDisplayMode(IntPtr player, out int mode); - - [DllImport(Libraries.Player, EntryPoint = "player_set_display_visible")] - internal static extern PlayerErrorCode SetDisplayVisible(IntPtr player, bool visible); - - [DllImport(Libraries.Player, EntryPoint = "player_is_display_visible")] - internal static extern PlayerErrorCode IsDisplayVisible(IntPtr player, out bool visible); - - [DllImport(Libraries.Player, EntryPoint = "player_set_display_rotation")] - internal static extern PlayerErrorCode SetDisplayRotation(IntPtr player, PlayerDisplayRotation rotation); - - [DllImport(Libraries.Player, EntryPoint = "player_get_display_rotation")] - internal static extern PlayerErrorCode GetDisplayRotation(IntPtr player, out int rotation); - - [DllImport(Libraries.Player, EntryPoint = "player_set_display_roi_area")] - internal static extern PlayerErrorCode SetDisplayRoi(IntPtr player, int x, int y, int width, int height); - - [DllImport(Libraries.Player, EntryPoint = "player_get_content_info")] - internal static extern PlayerErrorCode GetContentInfo(IntPtr player, StreamMetadataKey key, out IntPtr value); - - [DllImport(Libraries.Player, EntryPoint = "player_get_codec_info")] - internal static extern PlayerErrorCode GetCodecInfo(IntPtr player, out IntPtr audioCodec, out IntPtr videoCodec); - - [DllImport(Libraries.Player, EntryPoint = "player_get_audio_stream_info")] - internal static extern PlayerErrorCode GetAudioStreamInfo(IntPtr player, out int sampleRate, out int channel, out int bitRate); - - [DllImport(Libraries.Player, EntryPoint = "player_get_video_stream_info")] - internal static extern PlayerErrorCode GetVideoStreamInfo(IntPtr player, out int fps, out int bitRate); - - [DllImport(Libraries.Player, EntryPoint = "player_get_album_art")] - internal static extern PlayerErrorCode GetAlbumArt(IntPtr player, out IntPtr albumArt, out int size); - - [DllImport(Libraries.Player, EntryPoint = "player_get_video_size")] - internal static extern PlayerErrorCode GetVideoSize(IntPtr player, out int width, out int height); - - [DllImport(Libraries.Player, EntryPoint = "player_get_duration")] - internal static extern PlayerErrorCode GetDuration(IntPtr player, out int duration); - - [DllImport(Libraries.Player, EntryPoint = "player_set_subtitle_path")] - internal static extern PlayerErrorCode SetSubtitlePath(IntPtr player, string path); - - [DllImport(Libraries.Player, EntryPoint = "player_set_subtitle_updated_cb")] - internal static extern PlayerErrorCode SetSubtitleUpdatedCb(IntPtr player, - SubtitleUpdatedCallback callback, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.Player, EntryPoint = "player_unset_subtitle_updated_cb")] - internal static extern PlayerErrorCode UnsetSubtitleUpdatedCb(IntPtr player); - - [DllImport(Libraries.Player, EntryPoint = "player_set_subtitle_position_offset")] - internal static extern PlayerErrorCode SetSubtitlePositionOffset(IntPtr player, int millisecond); - - [DllImport(Libraries.Player, EntryPoint = "player_set_video_stream_changed_cb")] - internal static extern PlayerErrorCode SetVideoStreamChangedCb(IntPtr player, - VideoStreamChangedCallback callback, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.Player, EntryPoint = "player_unset_video_stream_changed_cb")] - internal static extern PlayerErrorCode UnsetVideoStreamChangedCb(IntPtr player); - - [DllImport(Libraries.Player, EntryPoint = "player_get_track_count")] - internal static extern PlayerErrorCode GetTrackCount(IntPtr player, int type, out int count); - - [DllImport(Libraries.Player, EntryPoint = "player_select_track")] - internal static extern PlayerErrorCode SelectTrack(IntPtr player, int type, int index); - - [DllImport(Libraries.Player, EntryPoint = "player_get_current_track")] - internal static extern PlayerErrorCode GetCurrentTrack(IntPtr player, int type, out int index); - - [DllImport(Libraries.Player, EntryPoint = "player_get_track_language_code")] - internal static extern PlayerErrorCode GetTrackLanguageCode(IntPtr player, int type, int index, out IntPtr code); - } - - internal class PlayerHandle : SafeHandle - { - protected PlayerHandle() : base(IntPtr.Zero, true) - { - } - - public override bool IsInvalid => handle == IntPtr.Zero; - - protected override bool ReleaseHandle() - { - var ret = Player.Destroy(handle); - if (ret != PlayerErrorCode.None) - { - Log.Debug(GetType().FullName, $"Failed to release native {GetType().Name}"); - return false; - } - - return true; - } - } - } -} diff --git a/src/Tizen.Multimedia/Interop/Interop.Recorder.cs b/src/Tizen.Multimedia/Interop/Interop.Recorder.cs deleted file mode 100755 index aecb874..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.Recorder.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class Libc - { - [DllImport(Libraries.Libc, EntryPoint = "free")] - public static extern void Free(IntPtr userData); - } - - internal static partial class Recorder - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void RecorderErrorCallback(RecorderErrorCode error, RecorderState current, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void InterruptedCallback(RecorderPolicy policy, RecorderState previous, RecorderState current, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void RecordingLimitReachedCallback(RecordingLimitType type, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void RecordingProgressCallback(ulong elapsedTime, ulong fileSize, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void AudioStreamCallback(IntPtr stream, int size, AudioSampleType type, int channel, uint timeStamp, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void StatechangedCallback(RecorderState previous, RecorderState current, bool byPolicy, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void MuxedStreamCallback(IntPtr stream, int size, ulong offset, IntPtr userData); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_create_audiorecorder")] - internal static extern RecorderError Create(out IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_create_videorecorder")] - internal static extern RecorderError CreateVideo(IntPtr cameraHandle, out IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_destroy")] - internal static extern RecorderError Destroy(IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_prepare")] - internal static extern RecorderError Prepare(IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_unprepare")] - internal static extern RecorderError Unprepare(IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_start")] - internal static extern RecorderError Start(IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_pause")] - internal static extern RecorderError Pause(IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_commit")] - internal static extern RecorderError Commit(IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_cancel")] - internal static extern RecorderError Cancel(IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_state")] - internal static extern RecorderError GetState(IntPtr handle, out RecorderState state); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_sound_stream_info")] - internal static extern RecorderError SetAudioStreamPolicy(IntPtr handle, IntPtr streamInfoHandle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_error_cb")] - internal static extern RecorderError SetErrorCallback(IntPtr handle, RecorderErrorCallback callback, IntPtr userData); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_error_cb")] - internal static extern RecorderError UnsetErrorCallback(IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_interrupted_cb")] - internal static extern RecorderError SetInterruptedCallback(IntPtr handle, InterruptedCallback callback, IntPtr userData); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_interrupted_cb")] - internal static extern RecorderError UnsetInterruptedCallback(IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_state_changed_cb")] - internal static extern RecorderError SetStateChangedCallback(IntPtr handle, StatechangedCallback callback, IntPtr userData); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_state_changed_cb")] - internal static extern RecorderError UnsetStateChangedCallback(IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_recording_status_cb")] - internal static extern RecorderError SetRecordingProgressCallback(IntPtr handle, RecordingProgressCallback callback, IntPtr userData); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_recording_status_cb")] - internal static extern RecorderError UnsetRecordingProgressCallback(IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_audio_stream_cb")] - internal static extern RecorderError SetAudioStreamCallback(IntPtr handle, AudioStreamCallback callback, IntPtr userData); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_audio_stream_cb")] - internal static extern RecorderError UnsetAudioStreamCallback(IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_recording_limit_reached_cb")] - internal static extern RecorderError SetLimitReachedCallback(IntPtr handle, RecordingLimitReachedCallback callback, IntPtr userData); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_recording_limit_reached_cb")] - internal static extern RecorderError UnsetLimitReachedCallback(IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_muxed_stream_cb")] - internal static extern RecorderError SetMuxedStreamCallback(IntPtr handle, MuxedStreamCallback callback, IntPtr userData); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_muxed_stream_cb")] - internal static extern RecorderError UnsetMuxedStreamCallback(IntPtr handle); - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.RecorderFeatures.cs b/src/Tizen.Multimedia/Interop/Interop.RecorderFeatures.cs deleted file mode 100755 index 58cc03f..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.RecorderFeatures.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class RecorderFeatures - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool VideoResolutionCallback(int width, int height, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool FileFormatCallback(RecorderFileFormat format, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool AudioEncoderCallback(RecorderAudioCodec codec, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool VideoEncoderCallback(RecorderVideoCodec codec, IntPtr userData); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_file_format")] - internal static extern RecorderError FileFormats(IntPtr handle, FileFormatCallback callback, IntPtr userData); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_audio_encoder")] - internal static extern RecorderError AudioEncoders(IntPtr handle, AudioEncoderCallback callback, IntPtr userData); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_video_encoder")] - internal static extern RecorderError VideoEncoders(IntPtr handle, VideoEncoderCallback callback, IntPtr userData); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_video_resolution")] - internal static extern RecorderError VideoResolution(IntPtr handle, VideoResolutionCallback callback, IntPtr userData); - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.RecorderSettings.cs b/src/Tizen.Multimedia/Interop/Interop.RecorderSettings.cs deleted file mode 100755 index ce62a18..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.RecorderSettings.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class RecorderSettings - { - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_channel")] - internal static extern RecorderError GetAudioChannel(IntPtr handle, out int channelCount); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_channel")] - internal static extern RecorderError SetAudioChannel(IntPtr handle, int channelCount); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_device")] - internal static extern RecorderError GetAudioDevice(IntPtr handle, out RecorderAudioDevice device); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_device")] - internal static extern RecorderError SetAudioDevice(IntPtr handle, RecorderAudioDevice device); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_audio_level")] - internal static extern RecorderError GetAudioLevel(IntPtr handle, out double dB); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_samplerate")] - internal static extern RecorderError GetAudioSampleRate(IntPtr handle, out int sampleRate); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_samplerate")] - internal static extern RecorderError SetAudioSampleRate(IntPtr handle, int sampleRate); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_encoder_bitrate")] - internal static extern RecorderError GetAudioEncoderBitrate(IntPtr handle, out int bitRate); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_encoder_bitrate")] - internal static extern RecorderError SetAudioEncoderBitrate(IntPtr handle, int bitRate); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_video_encoder_bitrate")] - internal static extern RecorderError GetVideoEncoderBitrate(IntPtr handle, out int bitRate); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_video_encoder_bitrate")] - internal static extern RecorderError SetVideoEncoderBitrate(IntPtr handle, int bitRate); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_audio_encoder")] - internal static extern RecorderError GetAudioEncoder(IntPtr handle, out RecorderAudioCodec codec); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_audio_encoder")] - internal static extern RecorderError SetAudioEncoder(IntPtr handle, RecorderAudioCodec codec); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_video_encoder")] - internal static extern RecorderError GetVideoEncoder(IntPtr handle, out RecorderVideoCodec codec); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_video_encoder")] - internal static extern RecorderError SetVideoEncoder(IntPtr handle, RecorderVideoCodec codec); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_file_format")] - internal static extern RecorderError GetFileFormat(IntPtr handle, out RecorderFileFormat format); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_file_format")] - internal static extern RecorderError SetFileFormat(IntPtr handle, RecorderFileFormat format); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_filename")] - internal static extern RecorderError GetFileName(IntPtr handle, out IntPtr path); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_filename")] - internal static extern RecorderError SetFileName(IntPtr handle, string path); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_size_limit")] - internal static extern RecorderError GetSizeLimit(IntPtr handle, out int kbyte); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_size_limit")] - internal static extern RecorderError SetSizeLimit(IntPtr handle, int kbyte); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_time_limit")] - internal static extern RecorderError GetTimeLimit(IntPtr handle, out int second); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_time_limit")] - internal static extern RecorderError SetTimeLimit(IntPtr handle, int second); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_is_muted")] - [return: MarshalAs(UnmanagedType.I1)] - internal static extern bool GetMute(IntPtr handle); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_mute")] - internal static extern RecorderError SetMute(IntPtr handle, bool enable); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_recording_motion_rate")] - internal static extern RecorderError GetMotionRate(IntPtr handle, out double motionRate); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_recording_motion_rate")] - internal static extern RecorderError SetMotionRate(IntPtr handle, double motionRate); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_orientation_tag")] - internal static extern RecorderError GetOrientationTag(IntPtr handle, out RecorderOrientation orientation); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_orientation_tag")] - internal static extern RecorderError SetOrientationTag(IntPtr handle, RecorderOrientation orientation); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_video_resolution")] - internal static extern RecorderError GetVideoResolution(IntPtr handle, out int width, out int height); - - [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_video_resolution")] - internal static extern RecorderError SetVideoResolution(IntPtr handle, int width, int height); - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.ScreenMirroring.cs b/src/Tizen.Multimedia/Interop/Interop.ScreenMirroring.cs deleted file mode 100644 index 6f78597..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.ScreenMirroring.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class ScreenMirroring - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void StateChangedCallback(IntPtr userData, int state, int error); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_create")] - internal static extern int Create(out IntPtr scmirroringSink); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_state_changed_cb")] - internal static extern int SetStateChangedCb(IntPtr scmirroringSink, StateChangedCallback cb, IntPtr userData); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_ip_and_port")] - internal static extern int SetIpAndPort(IntPtr scmirroringSink, string ip, string port); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_display")] - internal static extern int SetDisplay(IntPtr scmirroringSink, int type, IntPtr display); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_resolution")] - internal static extern int SetResolution(IntPtr scmirroringSink, int resolution); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_prepare")] - internal static extern int Prepare(IntPtr scmirroringSink); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_connect")] - internal static extern int ConnectAsync(IntPtr scmirroringSink); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_start")] - internal static extern int StartAsync(IntPtr scmirroringSink); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_pause")] - internal static extern int PauseAsync(IntPtr scmirroringSink); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_resume")] - internal static extern int ResumeAsync(IntPtr scmirroringSink); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_disconnect")] - internal static extern int Disconnect(IntPtr scmirroringSink); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_unprepare")] - internal static extern int Unprepare(IntPtr scmirroringSink); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_unset_state_changed_cb")] - internal static extern int UnsetStateChangedCb(IntPtr scmirroringSink); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_destroy")] - internal static extern int Destroy(IntPtr scmirroringSink); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_video_codec")] - internal static extern int GetNegotiatedVideoCodec(ref IntPtr scmirroringSink, out int codec); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_video_resolution")] - internal static extern int GetNegotiatedVideoResolution(ref IntPtr scmirroringSink, out int width, out int height); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_video_frame_rate")] - internal static extern int GetNegotiatedVideoFrameRate(ref IntPtr scmirroringSink, out int frameRate); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_audio_codec")] - internal static extern int GetNegotiatedAudioCodec(ref IntPtr scmirroringSink, out int codec); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_audio_channel")] - internal static extern int GetNegotiatedAudioChannel(ref IntPtr scmirroringSink, out int channel); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_audio_sample_rate")] - internal static extern int GetNegotiatedAudioSampleRate(ref IntPtr scmirroringSink, out int sampleRate); - - [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_audio_bitwidth")] - internal static extern int GetNegotiatedAudioBitwidth(ref IntPtr scmirroringSink, out int bitwidth); - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.StreamRecorder.cs b/src/Tizen.Multimedia/Interop/Interop.StreamRecorder.cs deleted file mode 100644 index c638037..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.StreamRecorder.cs +++ /dev/null @@ -1,188 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class StreamRecorder - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void RecordingLimitReachedCallback(StreamRecordingLimitType type, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void RecordingStatusCallback(ulong elapsedTime, ulong fileSize, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void NotifiedCallback(StreamRecorderState previous, StreamRecorderState current, StreamRecorderNotify notfication, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void RecorderErrorCallback(StreamRecorderErrorCode error, StreamRecorderState current, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void BufferConsumedCallback(IntPtr buffer, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool VideoResolutionCallback(int width, int height, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool FileFormatCallback(StreamRecorderFileFormat format, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool AudioEncoderCallback(StreamRecorderAudioCodec codec, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool VideoEncoderCallback(StreamRecorderVideoCodec codec, IntPtr userData); - - /* begin of method */ - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_create")] - internal static extern int Create(out IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_destroy")] - internal static extern int Destroy(IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_prepare")] - internal static extern int Prepare(IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unprepare")] - internal static extern int Unprepare(IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_start")] - internal static extern int Start(IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_pause")] - internal static extern int Pause(IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_commit")] - internal static extern int Commit(IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_cancel")] - internal static extern int Cancel(IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_push_stream_buffer")] - internal static extern int PushStreamBuffer(IntPtr handle, IntPtr/* media_packet_h */ inbuf); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_enable_source_buffer")] - internal static extern int EnableSourceBuffer(IntPtr handle, int type); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_state")] - internal static extern int GetState(IntPtr handle, out int state); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_filename")] - internal static extern int SetFileName(IntPtr handle, string path); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_filename")] - internal static extern int GetFileName(IntPtr handle, out IntPtr path); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_file_format")] - internal static extern int SetFileFormat(IntPtr handle, int format); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_file_format")] - internal static extern int GetFileFormat(IntPtr handle, out int format); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_encoder")] - internal static extern int SetAudioEncoder(IntPtr handle, int codec); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_encoder")] - internal static extern int GetAudioEncoder(IntPtr handle, out int codec); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_encoder")] - internal static extern int SetVideoEncoder(IntPtr handle, int codec); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_encoder")] - internal static extern int GetVideoEncoder(IntPtr handle, out int codec); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_resolution")] - internal static extern int SetVideoResolution(IntPtr handle, int width, int height); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_resolution")] - internal static extern int GetVideoResolution(IntPtr handle, out int width, out int height); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_framerate")] - internal static extern int SetVideoFramerate(IntPtr handle, int framerate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_framerate")] - internal static extern int GetVideoFramerate(IntPtr handle, out int framerate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_source_format")] - internal static extern int SetVideoSourceFormat(IntPtr handle, int format); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_source_format")] - internal static extern int GetVideoSourceFormat(IntPtr handle, out int format); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_limit")] - internal static extern int SetRecordingLimit(IntPtr handle, int type, int limit); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_recording_limit")] - internal static extern int GetRecordingLimit(IntPtr handle, int type, out int format); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_samplerate")] - internal static extern int SetAudioSampleRate(IntPtr handle, int samplerate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_samplerate")] - internal static extern int GetAudioSampleRate(IntPtr handle, out int samplerate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_encoder_bitrate")] - internal static extern int SetAudioEncoderBitrate(IntPtr handle, int bitrate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_encoder_bitrate")] - internal static extern int GetAudioEncoderBitrate(IntPtr handle, out int bitrate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_encoder_bitrate")] - internal static extern int SetVideoEncoderBitrate(IntPtr handle, int bitrate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_encoder_bitrate")] - internal static extern int GetVideoEncoderBitrate(IntPtr handle, out int bitrate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_channel")] - internal static extern int SetAudioChannel(IntPtr handle, int channel); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_channel")] - internal static extern int GetAudioChannel(IntPtr handle, out int channel); - /* End of method */ - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_file_format")] - internal static extern int FileFormats(IntPtr handle, FileFormatCallback callback, IntPtr userData); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_audio_encoder")] - internal static extern int AudioEncoders(IntPtr handle, AudioEncoderCallback callback, IntPtr userData); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_video_encoder")] - internal static extern int VideoEncoders(IntPtr handle, VideoEncoderCallback callback, IntPtr userData); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_video_resolution")] - internal static extern int VideoResolution(IntPtr handle, VideoResolutionCallback callback, IntPtr userData); - /* End of foreach method */ - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_notify_cb")] - internal static extern int SetNotifiedCallback(IntPtr handle, NotifiedCallback callback, IntPtr userData); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_notify_cb")] - internal static extern int UnsetNotifiedCallback(IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_status_cb")] - internal static extern int SetStatusChangedCallback(IntPtr handle, RecordingStatusCallback callback, IntPtr userData); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_recording_status_cb")] - internal static extern int UnsetStatusChangedCallback(IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_limit_reached_cb")] - internal static extern int SetLimitReachedCallback(IntPtr handle, RecordingLimitReachedCallback callback, IntPtr userData); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_recording_limit_reached_cb")] - internal static extern int UnsetLimitReachedCallback(IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_error_cb")] - internal static extern int SetErrorCallback(IntPtr handle, RecorderErrorCallback callback, IntPtr userData); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_error_cb")] - internal static extern int UnsetErrorCallback(IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_buffer_consume_completed_cb")] - internal static extern int SetBufferConsumedCallback(IntPtr handle, BufferConsumedCallback callback, IntPtr userDat); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_buffer_consume_completed_cb")] - internal static extern int UnsetBufferConsumedCallback(IntPtr handle); - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.ThumbnailExtractor.cs b/src/Tizen.Multimedia/Interop/Interop.ThumbnailExtractor.cs deleted file mode 100644 index efc95e8..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.ThumbnailExtractor.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class ThumbnailExtractor - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void ThumbnailExtractCallback(ThumbnailExtractorError error, string requestId, int thumbWidth, int thumbHeight, IntPtr thumbData, int thumbSize, IntPtr userData); - - [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_create")] - internal static extern ThumbnailExtractorError Create(out IntPtr handle); - - [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_extract")] - internal static extern ThumbnailExtractorError Extract(IntPtr handle, ThumbnailExtractCallback callback, IntPtr userData, out IntPtr requestId); - - [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_set_path")] - internal static extern ThumbnailExtractorError SetPath(IntPtr handle, string path); - - [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_set_size")] - internal static extern ThumbnailExtractorError SetSize(IntPtr handle, int width, int height); - - [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_destroy")] - internal static extern ThumbnailExtractorError Destroy(IntPtr handle); - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.TonePlayer.cs b/src/Tizen.Multimedia/Interop/Interop.TonePlayer.cs deleted file mode 100644 index dbae73b..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.TonePlayer.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class TonePlayer - { - [DllImport(Libraries.TonePlayer, EntryPoint = "tone_player_start_new")] - internal static extern int Start(ToneType tone, IntPtr streamInfoHandle, int durationMs, out int playerId); - - [DllImport(Libraries.TonePlayer, EntryPoint = "tone_player_stop")] - internal static extern int Stop(int PlayerId); - } - } -} diff --git a/src/Tizen.Multimedia/Interop/Interop.VideoUtil.cs b/src/Tizen.Multimedia/Interop/Interop.VideoUtil.cs deleted file mode 100644 index d55f8fc..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.VideoUtil.cs +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal enum VideoCodec - { - Mpeg4, // VIDEO_UTIL_VIDEO_CODEC_MPEG4 - H263, // VIDEO_UTIL_VIDEO_CODEC_H263 - H264, // VIDEO_UTIL_VIDEO_CODEC_H264 - None, // VIDEO_UTIL_VIDEO_CODEC_NONE - } - - internal enum AudioCodec - { - Aac, // VIDEO_UTIL_AUDIO_CODEC_AAC - Amrnb, // VIDEO_UTIL_AUDIO_CODEC_AMRNB - None, // VIDEO_UTIL_AUDIO_CODEC_NONE - } - - internal enum VideoFileFormat - { - Format3Gp, // VIDEO_UTIL_FILE_FORMAT_3GP - FormatMp4, // VIDEO_UTIL_FILE_FORMAT_MP4 - FormatMax, // VIDEO_UTIL_FILE_FORMAT_MAX - } - - - [DllImport(Libraries.VideoUtil, EntryPoint = "video_util_foreach_supported_file_format")] - internal static extern ErrorCode ForeachSupportedFileFormat(this VideoTranscoderHandle /* video_util_h */ handle, VideoTranscoderHandle.SupportedFileFormatCallback callback, IntPtr /* void */ userData); - - [DllImport(Libraries.VideoUtil, EntryPoint = "video_util_foreach_supported_video_codec")] - internal static extern ErrorCode ForeachSupportedVideoCodec(this VideoTranscoderHandle /* video_util_h */ handle, VideoTranscoderHandle.SupportedVideoEncoderCallback callback, IntPtr /* void */ userData); - - [DllImport(Libraries.VideoUtil, EntryPoint = "video_util_foreach_supported_audio_codec")] - internal static extern ErrorCode ForeachSupportedAudioCodec(this VideoTranscoderHandle /* video_util_h */ handle, VideoTranscoderHandle.SupportedAudioEncoderCallback callback, IntPtr /* void */ userData); - - [DllImport(Libraries.VideoUtil, EntryPoint = "video_util_start_transcoding")] - internal static extern ErrorCode StartTranscoding(this VideoTranscoderHandle /* video_util_h */ handle, ulong start, ulong duration, - string outPath, VideoTranscoderHandle.TranscodingProgressCallback progressCb, VideoTranscoderHandle.TranscodingCompletedCallback completedCb, IntPtr /* void */ userData); - - [DllImport(Libraries.VideoUtil, EntryPoint = "video_util_cancel_transcoding")] - internal static extern ErrorCode CancelTranscoding(this VideoTranscoderHandle /* video_util_h */ handle); - - [DllImport(Libraries.VideoUtil, EntryPoint = "video_util_get_progress_transcoding")] - internal static extern ErrorCode GetProgressTranscoding(this VideoTranscoderHandle /* video_util_h */ handle, out ulong currentPosition, out ulong duration); - - [DllImport(Libraries.VideoUtil, EntryPoint = "video_util_set_resolution")] - internal static extern ErrorCode SetResolution(this VideoTranscoderHandle /* video_util_h */ handle, int width, int height); - - - [DllImport(Libraries.VideoUtil, EntryPoint = "video_util_set_file_path")] - internal static extern ErrorCode SetFilePath(this VideoTranscoderHandle /* video_util_h */ handle, string path); - - [DllImport(Libraries.VideoUtil, EntryPoint = "video_util_set_accurate_mode")] - internal static extern ErrorCode SetAccurateMode(this VideoTranscoderHandle /* video_util_h */ handle, bool mode); - - [DllImport(Libraries.VideoUtil, EntryPoint = "video_util_set_video_codec")] - internal static extern ErrorCode SetVideoCodec(this VideoTranscoderHandle /* video_util_h */ handle, VideoCodec /* video_util_video_codec_e */ codec); - - [DllImport(Libraries.VideoUtil, EntryPoint = "video_util_set_audio_codec")] - internal static extern ErrorCode SetAudioCodec(this VideoTranscoderHandle /* video_util_h */ handle, AudioCodec /* video_util_audio_codec_e */ codec); - - [DllImport(Libraries.VideoUtil, EntryPoint = "video_util_set_file_format")] - internal static extern ErrorCode SetFileFormat(this VideoTranscoderHandle /* video_util_h */ handle, VideoFileFormat /* video_util_file_format_e */ format); - - [DllImport(Libraries.VideoUtil, EntryPoint = "video_util_set_fps")] - internal static extern ErrorCode SetFps(this VideoTranscoderHandle /* video_util_h */ handle, int fps); - - internal class VideoTranscoderHandle : SafeMultimediaHandle - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void TranscodingProgressCallback(ulong currentPosition, ulong duration, IntPtr /* void */ userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void TranscodingCompletedCallback(ErrorCode /* video_util_error_e */ errorCode, IntPtr /* void */ userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool SupportedFileFormatCallback(VideoFileFormat /* video_util_file_format_e */ format, IntPtr /* void */ userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool SupportedVideoEncoderCallback(VideoCodec /* video_util_video_codec_e */ codec, IntPtr /* void */ userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool SupportedAudioEncoderCallback(AudioCodec /* video_util_audio_codec_e */ codec, IntPtr /* void */ userData); - - [DllImport(Libraries.VideoUtil, EntryPoint = "video_util_create")] - internal static extern ErrorCode Create(out IntPtr /* video_util_h */ handle); - - [DllImport(Libraries.VideoUtil, EntryPoint = "video_util_destroy")] - internal static extern ErrorCode Destroy(IntPtr /* video_util_h */ handle); - - internal string InputFile - { - set { NativeSet(this.SetFilePath, value); } - } - - internal bool AccurateModeEnabled - { - set { NativeSet(this.SetAccurateMode, value); } - } - - internal VideoCodec VideoCodec - { - set { NativeSet(this.SetVideoCodec, value); } - } - - internal AudioCodec AudioCodec - { - set { NativeSet(this.SetAudioCodec, value); } - } - - internal VideoFileFormat FileFormat - { - set { NativeSet(this.SetFileFormat, value); } - } - - internal int Fps - { - set { NativeSet(this.SetFps, value); } - } - - internal VideoTranscoderHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease) - { - } - - internal VideoTranscoderHandle() : this(CreateNativeHandle(), true) - { - } - - internal static IntPtr CreateNativeHandle() - { - IntPtr handle; - Create(out handle).ThrowIfFailed("Failed to create native handle"); - return handle; - } - - internal override ErrorCode DisposeNativeHandle() - { - return Destroy(handle); - } - - internal void ForeachSupportedFileFormat(Action action) - { - SupportedFileFormatCallback callback = (codec, userData) => - { - action(codec); - return true; - }; - - this.ForeachSupportedFileFormat(callback, IntPtr.Zero).ThrowIfFailed("Failed to get supported file format list from native handle"); - } - - internal void ForeachSupportedVideoCodec(Action action) - { - SupportedVideoEncoderCallback callback = (codec, userData) => - { - action(codec); - return true; - }; - - this.ForeachSupportedVideoCodec(callback, IntPtr.Zero).ThrowIfFailed("Failed to get supported video codec list from native handle"); - } - - internal void ForeachSupportedAudioCodec(Action action) - { - SupportedAudioEncoderCallback callback = (codec, userData) => - { - action(codec); - return true; - }; - - this.ForeachSupportedAudioCodec(callback, IntPtr.Zero).ThrowIfFailed("Failed to get supported audio codec list from native handle"); - } - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.WavPlayer.cs b/src/Tizen.Multimedia/Interop/Interop.WavPlayer.cs deleted file mode 100644 index 1e1a6a2..0000000 --- a/src/Tizen.Multimedia/Interop/Interop.WavPlayer.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Tizen.Multimedia -{ - internal static partial class Interop - { - internal static partial class WavPlayer - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void WavPlayerCompletedCallback(int playerId, IntPtr userData); - - [DllImport(Libraries.WavPlayer, EntryPoint = "wav_player_start_new")] - internal static extern int WavPlayerStart(string filePath, IntPtr streamInfoHandle, WavPlayerCompletedCallback completedCallback, - IntPtr userData, out int playerId); - - [DllImport(Libraries.WavPlayer, EntryPoint = "wav_player_stop")] - internal static extern int WavPlayerStop(int PlayerId); - } - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Tizen.Multimedia.nuspec b/src/Tizen.Multimedia/Tizen.Multimedia.nuspec index e0950c8..a9c8f26 100755 --- a/src/Tizen.Multimedia/Tizen.Multimedia.nuspec +++ b/src/Tizen.Multimedia/Tizen.Multimedia.nuspec @@ -9,7 +9,7 @@ https://www.tizen.org/ https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png © Samsung Electronics Co., Ltd All Rights Reserved - Provides the Multimedia API for Tizen.Net + Common classes and interfaces for the Tizen.Net Multimedia diff --git a/src/Tizen.Multimedia/Utility/AudioCodec.cs b/src/Tizen.Multimedia/Utility/AudioCodec.cs deleted file mode 100755 index 47cb060..0000000 --- a/src/Tizen.Multimedia/Utility/AudioCodec.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Tizen.Multimedia.Utility -{ - /// - /// Audio codec - /// - public enum AudioCodec - { - /// - /// No trans-coding for audio - /// - None = Interop.AudioCodec.None, - /// - /// AAC - /// - Aac = Interop.AudioCodec.Aac, - /// - /// AMRNB - /// - Amrnb = Interop.AudioCodec.Amrnb, - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Utility/VideoCodec.cs b/src/Tizen.Multimedia/Utility/VideoCodec.cs deleted file mode 100755 index 718507d..0000000 --- a/src/Tizen.Multimedia/Utility/VideoCodec.cs +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Tizen.Multimedia.Utility -{ - /// - /// Video codec for trans-coding - /// - public enum VideoCodec - { - /// - /// No trans-coding for video - /// - None = Interop.VideoCodec.None, - /// - /// MPEG4 - /// - Mpeg4 = Interop.VideoCodec.Mpeg4, - /// - /// H263 - /// - H263 = Interop.VideoCodec.H263, - /// - /// H264 - /// - H264 = Interop.VideoCodec.H264, - } -} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Utility/VideoTranscoder.cs b/src/Tizen.Multimedia/Utility/VideoTranscoder.cs deleted file mode 100755 index 719bd8a..0000000 --- a/src/Tizen.Multimedia/Utility/VideoTranscoder.cs +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace Tizen.Multimedia.Utility -{ - /// - /// Video trans-coding utility - /// - public class VideoTranscoder : IDisposable - { - public const AudioCodec DetaultAudioCodec = AudioCodec.Aac; - public const VideoCodec DetaultVideoCodec = VideoCodec.Mpeg4; - public const VideoFileFormat DetaultFileFormat = VideoFileFormat.ThreeGp; - public const bool DefaultAccurateModeEnabled = false; - public static Size DefaultResolution = new Size(0, 0); - public const int DefaultFps = 0; - - internal Interop.VideoTranscoderHandle _handle; - private Size _resolution = DefaultResolution; - private int _fps = DefaultFps; - - /// - /// Creates Video trans-coder - /// - /// Thrown if framework failed to allocate memory - /// Thrown if video trans-coding is not supported in device - public VideoTranscoder() - { - _handle = new Interop.VideoTranscoderHandle(); - } - - /// - /// Indicate if trans-coder is busy trans-coding - /// - public bool IsBusy { get; private set; } - - /// - /// Indicates if accurate mode is enabled - /// - /// Default is false, if set to true, next trans-coding will start from accurate frame for given the duration, otherwise from nearest i-frame - public bool IsAccurateModeEnabled { get; set; } = DefaultAccurateModeEnabled; - - /// - /// Audio codec for encoding stream for next trans-coding - /// - /// Default is AudioCodec.Aac - public AudioCodec AudioCodec { get; set; } = DetaultAudioCodec; - - /// - /// Video codec for encoding stream for next trans-coding - /// - /// Default is VideoCodec.Mpeg4 - public VideoCodec VideoCodec { get; set; } = DetaultVideoCodec; - - /// - /// File format for trans-coding media stream for next trans-coding - /// - /// Default is VideoFileFormat.ThreeGp - public VideoFileFormat Format { get; set; } = DetaultFileFormat; - - /// - /// Media resolution for next trans-coding - /// - /// - /// Default value is Size(0, 0) - /// If the width is 0, it set original size.(minimum value is 128) - /// If the height is 0, it set original size.(minimum value is 96) - /// - /// Thrown if value is not in valid range - public Size Resolution - { - get { return _resolution; } - set - { - ValidateInputRange(value.Width, () => value.Width >= 128 || value.Width == 0, "Width", "Valid value is 0 and value >= 128"); - ValidateInputRange(value.Height, () => value.Width >= 96 || value.Width == 0, "Height", "Valid value is 0 and value >= 96"); - _resolution = value; - } - } - - /// - /// Frame rate, in range [5-30] for next trans-coding - /// - /// - /// Default value is 0 - /// If fps is set 0, the default is original fps from source. - /// - /// Thrown if value is not in valid range - public int Fps - { - get { return _fps; } - set - { - ValidateInputRange(value, 5, 30, "Fps"); - _fps = value; - } - } - - /// - /// Supported audio codecs - /// - public IEnumerable SupportedAudioCodecs - { - get - { - var audioCodecs = new List(); - _handle.ForeachSupportedAudioCodec((codec) => audioCodecs.Add((AudioCodec)codec)); - return audioCodecs; - } - } - - /// - /// Supported video codecs - /// - public IEnumerable SupportedVideoCodecs - { - get - { - var videoCodecs = new List(); - _handle.ForeachSupportedVideoCodec((codec) => videoCodecs.Add((VideoCodec)codec)); - return videoCodecs; - } - } - - /// - /// Supported video file formats - /// - public IEnumerable SupportedVideoFileFormats - { - get - { - var videoFileFormats = new List(); - _handle.ForeachSupportedFileFormat((codec) => videoFileFormats.Add((VideoFileFormat)codec)); - return videoFileFormats; - } - } - - /// - /// Trans-code video - /// - /// Source video file to trans-code - /// Position to start trans-code in seconds - /// Total duration to trans-code, in seconds, if set to 0, trans-coding happens until end of the video - /// Output file path - /// progress update provider - /// Cancellation token, to be used to cancel trans-coding - /// http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage - /// http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage - /// Thrown if application does not have required privilege - /// Thrown if sourceFilePath or outputFile is null - /// Thrown if sourceFilePath does not exist - /// Thrown if video file format is not supported - /// Thrown if Trans-coder is busy trans-coding previous file - /// Thrown if trans-coding is canceled - /// Trans-coding task - public Task TranscodeAsync(string sourceFilePath, ulong startPosition, ulong totalDuration, string outputFile, IProgress progress, CancellationToken cancelToken) - { - ValidateObjectNotDisposed(); - - if (sourceFilePath == null) throw new ArgumentNullException(nameof(sourceFilePath)); - if (outputFile == null) throw new ArgumentNullException(nameof(outputFile)); - - // CAPI does not allow setting properties or start another trans-coding if trans-coder is busy - if (IsBusy) throw new InvalidOperationException("Previous trans-coding is still going on"); - - ConfigureNativeHandle(sourceFilePath); - - var transcodingTask = new TaskCompletionSource(); - if (cancelToken != CancellationToken.None) - { - if (cancelToken.IsCancellationRequested) - { - IsBusy = false; - transcodingTask.TrySetCanceled(); - } - - cancelToken.Register(() => - { - _handle.CancelTranscoding().ThrowIfFailed("Failed to cancel trans-coding"); - IsBusy = false; - transcodingTask.SetResult(false); - }); - } - - Interop.VideoTranscoderHandle.TranscodingProgressCallback progressCb = (currentPosition, duration, userData) => - { - progress?.Report((int)((currentPosition - startPosition) / duration)); - }; - - Interop.VideoTranscoderHandle.TranscodingCompletedCallback completedCb = (errorCode, userData) => - { - if (IsBusy) - { - IsBusy = false; - if (errorCode.IsSuccess()) - { - transcodingTask.TrySetResult(true); - } - else - { - transcodingTask.TrySetException(errorCode.GetException("Failed to trans-code")); - } - } - }; - - var err = _handle.StartTranscoding(startPosition, totalDuration, outputFile, progressCb, completedCb, IntPtr.Zero); - err.ThrowIfFailed("Failed to start trans-coding"); - - IsBusy = !transcodingTask.Task.IsCanceled; - return Interop.PinnedTask(transcodingTask); - } - - /// - /// Trans-code video from start position in input file till end of file. - /// - /// Source video file to trans-code - /// Position to start trans-code in seconds - /// Output file path - /// progress update provider - /// Cancellation token, to be used to cancel trans-coding - /// http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage - /// http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage - /// Thrown if application does not have required privilege - /// Thrown if sourceFilePath or outputFile is null - /// Thrown if sourceFilePath does not exist - /// Thrown if video file format is not supported - /// Thrown if Trans-coder is busy trans-coding previous file - /// Thrown if trans-coding is canceled - /// Trans-coding task - public Task TranscodeAsync(string sourceFilePath, ulong startPosition, string outputFile, IProgress progress, CancellationToken cancelToken) - { - return TranscodeAsync(sourceFilePath, startPosition, 0, outputFile, progress, cancelToken); - } - - /// - /// Trans-code video - /// - /// Source video file to trans-code - /// Position to start trans-code in seconds - /// Total duration to trans-code, in seconds, if set to 0, trans-coding happens until end of the video - /// Output file path - /// progress update provider - /// http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage - /// http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage - /// Thrown if application does not have required privilege - /// Thrown if sourceFilePath or outputFile is null - /// Thrown if sourceFilePath does not exist - /// Thrown if video file format is not supported - /// Thrown if Trans-coder is busy trans-coding previous file - /// Trans-coding task - public Task TranscodeAsync(string sourceFilePath, ulong startPosition, ulong duration, string outputFile, IProgress progress) - { - return TranscodeAsync(sourceFilePath, startPosition, duration, outputFile, progress, CancellationToken.None); - } - - /// - /// Trans-code video - /// - /// Source video file to trans-code - /// Position to start trans-code in seconds - /// Output file path - /// progress update provider - /// http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage - /// http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage - /// Thrown if application does not have required privilege - /// Thrown if sourceFilePath or outputFile is null - /// Thrown if sourceFilePath does not exist - /// Thrown if video file format is not supported - /// Thrown if Trans-coder is busy trans-coding previous file - /// Trans-coding task - public Task TranscodeAsync(string sourceFilePath, ulong startPosition, string outputFile, IProgress progress) - { - return TranscodeAsync(sourceFilePath, startPosition, 0, outputFile, progress, CancellationToken.None); - } - - private void ConfigureNativeHandle(string sourceFilePath) - { - _handle.InputFile = sourceFilePath; - - if (AudioCodec != DetaultAudioCodec) _handle.AudioCodec = (Interop.AudioCodec)AudioCodec; - if (VideoCodec != DetaultVideoCodec) _handle.VideoCodec = (Interop.VideoCodec)VideoCodec; - if (Format != DetaultFileFormat) _handle.FileFormat = (Interop.VideoFileFormat)Format; - if (IsAccurateModeEnabled != DefaultAccurateModeEnabled) _handle.AccurateModeEnabled = IsAccurateModeEnabled; - if (Fps != DefaultFps) _handle.Fps = Fps; - if (Resolution.Width != DefaultResolution.Width || Resolution.Height != DefaultResolution.Height) - { - _handle.SetResolution(Resolution.Width, Resolution.Height).ThrowIfFailed($"Failed to set resolution to {Resolution}"); - } - } - - private void ValidateObjectNotDisposed() - { - if (_disposedValue) - { - throw new ObjectDisposedException(GetType().Name); - } - } - - internal static void ValidateInputRange(T actualValue, T min, T max, string paramName) where T : IComparable - { - if (min.CompareTo(actualValue) == 1 || max.CompareTo(actualValue) == -1) - { - throw new ArgumentOutOfRangeException(paramName, actualValue, $"Valid Range [{min} - {max}]"); - } - } - - internal static void ValidateInputRange(T actualValue, Func verifier, string paramName, string message) - { - if (verifier() == false) - { - throw new ArgumentOutOfRangeException(paramName, actualValue, message); - } - } - - #region IDisposable Support - private bool _disposedValue = false; - - protected virtual void Dispose(bool disposing) - { - if (!_disposedValue) - { - if (IsBusy) - { - _handle.CancelTranscoding(); - } - _handle.Dispose(); - _disposedValue = true; - } - } - - public void Dispose() - { - Dispose(true); - } - #endregion - } -} \ No newline at end of file