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
{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
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
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}
$"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;
/// The stream is paused.
/// </summary>
Paused = 2
- }\r
-\r
+ }
+
/// <summary>
/// Enumeration for audio sample type.
/// </summary>
$"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;
--- /dev/null
+/*
+ * 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);
+ }
+ }
+}
* limitations under the License.
*/
-namespace Tizen.Multimedia.Utility
+internal static partial class Interop
{
- /// <summary>
- /// Video file format
- /// </summary>
- public enum VideoFileFormat
+ internal static partial class Libraries
{
- /// <summary>
- /// 3GP file
- /// </summary>
- ThreeGp = Interop.VideoFileFormat.Format3Gp,
- /// <summary>
- /// MP4 file
- /// </summary>
- 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
+}
--- /dev/null
+/*
+ * 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);
+ }
+}
+
--- /dev/null
+/*
+ * 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);
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>netstandard1.3</TargetFramework>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <SignAssembly>True</SignAssembly>
+ <AssemblyOriginatorKeyFile>Tizen.Multimedia.AudioIO.snk</AssemblyOriginatorKeyFile>
+ <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
+ <GenerateReferenceAssembly>True</GenerateReferenceAssembly>
+ <DelaySign>False</DelaySign>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Tizen" Version="1.0.3" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Tizen.Multimedia\Tizen.Multimedia.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+<?xml version="1.0"?>
+<package>
+ <metadata>
+ <id>Tizen.Multimedia.AudioIO</id>
+ <version>$version$</version>
+ <authors>Samsung Electronics</authors>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+ <projectUrl>https://www.tizen.org/</projectUrl>
+ <iconUrl>https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png</iconUrl>
+ <copyright>© Samsung Electronics Co., Ltd All Rights Reserved</copyright>
+ <description>Provides the Multimedia AudioIO API for Tizen.Net</description>
+ <dependencies>
+ <dependency id="Tizen" version="1.0.2" />
+ <dependency id="Tizen.Multimedia" version="1.2.0" />
+ </dependencies>
+ </metadata>
+</package>
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
-\r
+
namespace Tizen.Multimedia
{
static internal class TonePlayerLog
--- /dev/null
+/*
+ * 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);
+ }
+ }
+ }
+}
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
+using static Interop;
+using Native = Interop.Camera;
namespace Tizen.Multimedia
{
/// </privilege>
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);
Dispose(false);
}
+ public IntPtr Handle => GetHandle();
+
internal IntPtr GetHandle()
{
ValidateNotDisposed();
if (_handle != IntPtr.Zero)
{
- Interop.Camera.Destroy(_handle);
+ Native.Destroy(_handle);
_handle = IntPtr.Zero;
}
/// Event that occurs when an camera is interrupted by policy.
/// </summary>
public event EventHandler<CameraInterruptedEventArgs> Interrupted;
- private Interop.Camera.InterruptedCallback _interruptedCallback;
+ private Native.InterruptedCallback _interruptedCallback;
/// <summary>
/// Event that occurs when there is an asynchronous error.
/// </summary>
public event EventHandler<CameraErrorOccurredEventArgs> ErrorOccurred;
- private Interop.Camera.ErrorCallback _errorCallback;
+ private Native.ErrorCallback _errorCallback;
/// <summary>
/// Event that occurs when the auto focus state is changed.
/// </summary>
public event EventHandler<CameraFocusStateChangedEventArgs> FocusStateChanged;
- private Interop.Camera.FocusStateChangedCallback _focusStateChangedCallback;
+ private Native.FocusStateChangedCallback _focusStateChangedCallback;
/// <summary>
/// Event that occurs when a face is detected in preview frame.
/// </summary>
public event EventHandler<FaceDetectedEventArgs> FaceDetected;
- private Interop.Camera.FaceDetectedCallback _faceDetectedCallback;
+ private Native.FaceDetectedCallback _faceDetectedCallback;
/// <summary>
/// Event that occurs during capture of image.
/// </summary>
public event EventHandler<CameraCapturingEventArgs> Capturing;
- private Interop.Camera.CapturingCallback _capturingCallback;
+ private Native.CapturingCallback _capturingCallback;
/// <summary>
/// Event that occurs after the capture of the image.
/// </summary>
public event EventHandler<EventArgs> CaptureCompleted;
- private Interop.Camera.CaptureCompletedCallback _captureCompletedCallback;
+ private Native.CaptureCompletedCallback _captureCompletedCallback;
/// <summary>
/// Event that occurs when there is change in HDR capture progress.
/// Check whether HdrCapture feature is supported or not before add this EventHandler.
/// </summary>
public event EventHandler<HdrCaptureProgressEventArgs> HdrCaptureProgress;
- private Interop.Camera.HdrCaptureProgressCallback _hdrCaptureProgressCallback;
+ private Native.HdrCaptureProgressCallback _hdrCaptureProgressCallback;
/// <summary>
/// Event that occurs when camera state is changed.
/// </summary>
public event EventHandler<CameraStateChangedEventArgs> 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<CameraDeviceStateChangedEventArgs> _deviceStateChanged;
public static object _deviceStateChangedEventLock = new object();
/// 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.
/// </summary>
- /// <param name="callback">Callback of type <see cref="Interop.Camera.DeviceStateChangedCallback"/>.</param>
+ /// <param name="callback">Callback of type <see cref="Native.DeviceStateChangedCallback"/>.</param>
/// <param name="callbackId">The Id of registered callback.</param>
/// <exception cref="InvalidOperationException">In case of any invalid operations</exception>
/// <exception cref="NotSupportedException">In case of this feature is not supported</exception>
{
_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.
_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);
#endregion DeviceStateChanged callback
#region Preview EventHandler
- private Interop.Camera.PreviewCallback _previewCallback;
+ private Native.PreviewCallback _previewCallback;
private event EventHandler<PreviewEventArgs> _preview;
private object _previewEventLock = new object();
/// <summary>
if (_preview == null)
{
- CameraErrorFactory.ThrowIfError(Interop.Camera.UnsetPreviewCallback(_handle),
+ CameraErrorFactory.ThrowIfError(Native.UnsetPreviewCallback(_handle),
"Unsetting preview callback failed");
_previewCallback = null;
}
#endregion Preview EventHandler
#region MediaPacketPreview EventHandler
- private Interop.Camera.MediaPacketPreviewCallback _mediaPacketPreviewCallback;
+ private Native.MediaPacketPreviewCallback _mediaPacketPreviewCallback;
private EventHandler<MediaPacketPreviewEventArgs> _mediaPacketPreview;
private object _mediaPacketPreviewEventLock = new object();
if (_mediaPacketPreview == null)
{
- CameraErrorFactory.ThrowIfError(Interop.Camera.UnsetMediaPacketPreviewCallback(_handle),
+ CameraErrorFactory.ThrowIfError(Native.UnsetMediaPacketPreviewCallback(_handle),
"Unsetting media packet preview callback failed");
_mediaPacketPreviewCallback = null;
}
{
if (display == null)
{
- return Interop.CameraDisplay.SetTarget(GetHandle(), DisplayType.None, IntPtr.Zero);
+ return CameraDisplay.SetTarget(GetHandle(), DisplayType.None, IntPtr.Zero);
}
return display.ApplyTo(this);
Debug.Assert(Enum.IsDefined(typeof(DisplayType), type));
- return Interop.CameraDisplay.SetTarget(GetHandle(), type, evasObject);
+ return CameraDisplay.SetTarget(GetHandle(), type, evasObject);
}
/// <summary>
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;
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;
{
ValidateState(CameraState.Preview);
- CameraErrorFactory.ThrowIfError(Interop.Camera.SetDisplayReuseHint(_handle, value),
+ CameraErrorFactory.ThrowIfError(Native.SetDisplayReuseHint(_handle, value),
"Failed to set display reuse hint.");
}
}
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;
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;
{
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");
}
{
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;
{
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;
{
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.
{
ValidateState(CameraState.Preview);
- CameraErrorFactory.ThrowIfError(Interop.Camera.StopPreview(_handle),
+ CameraErrorFactory.ThrowIfError(Native.StopPreview(_handle),
"Failed to stop the camera preview.");
SetState(CameraState.Created);
{
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);
{
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);
{
ValidateState(CameraState.Preview, CameraState.Captured);
- CameraErrorFactory.ThrowIfError(Interop.Camera.StartFocusing(_handle, continuous),
+ CameraErrorFactory.ThrowIfError(Native.StartFocusing(_handle, continuous),
"Failed to cancel the camera focus.");
}
{
ValidateState(CameraState.Preview, CameraState.Captured);
- CameraErrorFactory.ThrowIfError(Interop.Camera.CancelFocusing(_handle),
+ CameraErrorFactory.ThrowIfError(Native.CancelFocusing(_handle),
"Failed to cancel the camera focus.");
}
for (int i = 0; i < count; i++)
{
result.Add(new FaceDetectionData(current));
- current = IntPtr.Add(current, Marshal.SizeOf<Interop.Camera.DetectedFaceStruct>());
+ current = IntPtr.Add(current, Marshal.SizeOf<Native.DetectedFaceStruct>());
}
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");
}
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;
{
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");
}
{
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");
}
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");
}
{
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");
}
{
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");
}
}
{
_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");
}
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
* limitations under the License.
*/
-using System;
+using Native = Interop.CameraDisplay;
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraDisplay.SetMode(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetMode(_camera.GetHandle(), value),
"Failed to set camera display mode.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraDisplay.SetVisible(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetVisible(_camera.GetHandle(), value),
"Failed to set display visible.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraDisplay.SetRotation(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetRotation(_camera.GetHandle(), value),
"Failed to set display rotation.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraDisplay.SetFlip(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value),
"Failed to set display flip.");
}
}
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);
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.");
}
}
using System;
using System.Collections.Generic;
-using Tizen.Internals.Errors;
-
+using NativeFeatures = Interop.CameraFeatures;
+using NativeSettings = Interop.CameraSettings;
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)
{
_previewResolutions = new List<Size>();
- 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
{
_cameraResolutions = new List<Size>();
- 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
{
_captureFormats = new List<CameraPixelFormat>();
- 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
{
_previewFormats = new List<CameraPixelFormat>();
- 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
{
_fps = new List<CameraFps>();
- 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
{
_fpsByResolution = new List<CameraFps>();
- 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
{
_autoFocusModes = new List<CameraAutoFocusMode>();
- 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
{
_exposureModes = new List<CameraExposureMode>();
- 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
{
_isoLevels = new List<CameraIsoLevel>();
- 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
{
_theaterModes = new List<CameraTheaterMode>();
- 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
{
_whitebalances = new List<CameraWhiteBalance>();
- 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
{
_flashModes = new List<CameraFlashMode>();
- 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
{
_sceneModes = new List<CameraSceneMode>();
- 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
{
_effectModes = new List<CameraEffectMode>();
- 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
{
_streamRotations = new List<CameraRotation>();
- 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
{
_streamFlips = new List<CameraFlip>();
- 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
{
_ptzTypes = new List<CameraPtzType>();
- 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
*/
using System;
-using System.Linq;
using System.Runtime.InteropServices;
+using Native = Interop.CameraSettings;
+using static Interop.Camera;
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);
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
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.");
}
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
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.");
}
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void ClearFocusArea()
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.ClearAutoFocusArea(_camera.GetHandle()),
+ CameraErrorFactory.ThrowIfError(Native.ClearAutoFocusArea(_camera.GetHandle()),
"Failed to clear the autofocus area.");
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetAutoFocusMode(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetAutoFocusMode(_camera.GetHandle(), value),
"Failed to set camera autofocus mode.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetContrast(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetContrast(_camera.GetHandle(), value),
"Failed to set camera contrast value.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.EnableAutoContrast(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.EnableAutoContrast(_camera.GetHandle(), value),
"Failed to set camera enable auto contrast.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetBrightness(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetBrightness(_camera.GetHandle(), value),
"Failed to set camera brightness value.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetExposure(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetExposure(_camera.GetHandle(), value),
"Failed to set camera exposure value.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetExposureMode(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetExposureMode(_camera.GetHandle(), value),
"Failed to set camera exposure mode.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetZoom(_camera.GetHandle(), (int)value),
+ CameraErrorFactory.ThrowIfError(Native.SetZoom(_camera.GetHandle(), (int)value),
"Failed to set zoom level.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetWhitebalance(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetWhitebalance(_camera.GetHandle(), value),
"Failed to set camera whitebalance.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetIso(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetIso(_camera.GetHandle(), value),
"Failed to set camera Iso level.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetImageQuality(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetImageQuality(_camera.GetHandle(), value),
"Failed to set image quality.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetPreviewFps(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetPreviewFps(_camera.GetHandle(), value),
"Failed to set preview fps.");
}
}
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);
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.");
}
}
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);
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.Camera.SetPreviewPixelFormat(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(SetPreviewPixelFormat(_camera.GetHandle(), value),
"Failed to set preview format.");
}
}
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);
{
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.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.Camera.SetCaptureFormat(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(SetCaptureFormat(_camera.GetHandle(), value),
"Failed to set capture format.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetBitrate(_camera.GetHandle(), (int)value),
+ CameraErrorFactory.ThrowIfError(Native.SetBitrate(_camera.GetHandle(), (int)value),
"Failed to set encoded preview bitrate.");
}
}
{
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;
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.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetTheaterMode(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetTheaterMode(_camera.GetHandle(), value),
"Failed to set camera theater mode.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetEffect(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetEffect(_camera.GetHandle(), value),
"Failed to set camera effect.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetSceneMode(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetSceneMode(_camera.GetHandle(), value),
"Failed to set camera scene mode.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetFlashMode(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetFlashMode(_camera.GetHandle(), value),
"Failed to set camera flash mode.");
}
}
{
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;
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetStreamRotation(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetStreamRotation(_camera.GetHandle(), value),
"Failed to set camera stream rotation.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetFlip(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value),
"Failed to set camera flip.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetHdrMode(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetHdrMode(_camera.GetHandle(), value),
"Failed to set camera hdr mode.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.EnableAntiShake(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.EnableAntiShake(_camera.GetHandle(), value),
"Failed to set camera anti shake value.");
}
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.EnableVideoStabilization(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.EnableVideoStabilization(_camera.GetHandle(), value),
"Failed to set camera video stabilization.");
}
}
{
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.DisableShutterSound(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.DisableShutterSound(_camera.GetHandle(), value),
"Failed to set disable shutter sound.");
}
}
{
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetPtzType(_camera.GetHandle(), (int)value),
+ CameraErrorFactory.ThrowIfError(Native.SetPtzType(_camera.GetHandle(), (int)value),
"Failed to set camera ptz type.");
}
}
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
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.");
}
{
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;
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
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.");
}
{
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;
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.EnableTag(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.EnableTag(_camera.GetHandle(), value),
"Failed to set camera enable tag.");
}
}
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.");
}
}
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.");
}
}
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);
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.");
}
}
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void RemoveGeoTag()
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.RemoveGeotag(_camera.GetHandle()),
+ CameraErrorFactory.ThrowIfError(Native.RemoveGeotag(_camera.GetHandle()),
"Failed to remove the geotag\t.");
}
{
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;
set
{
- CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetTagOrientation(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.SetTagOrientation(_camera.GetHandle(), value),
"Failed to set camera tag orientation.");
}
}
*/
using System.Runtime.InteropServices;
+using static Interop.Camera;
namespace Tizen.Multimedia
{
/// </summary>
public class DoublePlane : IPreviewPlane
{
- internal DoublePlane(Interop.Camera.DoublePlaneStruct unmanaged)
+ internal DoublePlane(DoublePlaneStruct unmanaged)
{
Y = new byte[unmanaged.YLength];
UV = new byte[unmanaged.UVLength];
*/
using System.Runtime.InteropServices;
+using static Interop.Camera;
namespace Tizen.Multimedia
{
/// </summary>
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);
using System;
using System.Runtime.InteropServices;
+using static Interop.Camera;
namespace Tizen.Multimedia
{
{
internal FaceDetectionData(IntPtr ptr)
{
- var unmanagedStruct = Marshal.PtrToStructure<Interop.Camera.DetectedFaceStruct>(ptr);
+ var unmanagedStruct = Marshal.PtrToStructure<DetectedFaceStruct>(ptr);
Id = unmanagedStruct.Id;
Score = unmanagedStruct.Score;
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
+using static Interop.Camera;
namespace Tizen.Multimedia
{
{
internal ImageData(IntPtr ptr)
{
- var unmanagedStruct = Marshal.PtrToStructure<Interop.Camera.ImageDataStruct>(ptr);
+ var unmanagedStruct = Marshal.PtrToStructure<ImageDataStruct>(ptr);
Format = unmanagedStruct.Format;
Width = unmanagedStruct.Width;
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
-using static Tizen.Multimedia.Interop.Camera;
+using static Interop.Camera;
namespace Tizen.Multimedia
{
*/
using System.Runtime.InteropServices;
+using static Interop.Camera;
namespace Tizen.Multimedia
{
/// </summary>
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);
*/
using System.Runtime.InteropServices;
+using static Interop.Camera;
namespace Tizen.Multimedia
{
/// </summary>
public class TriplePlane : IPreviewPlane
{
- internal TriplePlane(Interop.Camera.TriplePlaneStruct unmanaged)
+ internal TriplePlane(TriplePlaneStruct unmanaged)
{
Y = new byte[unmanaged.YLength];
U = new byte[unmanaged.ULength];
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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);
+ }
+}
--- /dev/null
+/*
+ * 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);
+ }
+}
--- /dev/null
+/*
+ * 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);
+ }
+}
--- /dev/null
+/*
+ * 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";
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>netstandard1.3</TargetFramework>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <SignAssembly>True</SignAssembly>
+ <AssemblyOriginatorKeyFile>Tizen.Multimedia.Camera.snk</AssemblyOriginatorKeyFile>
+ <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
+ <GenerateReferenceAssembly>True</GenerateReferenceAssembly>
+ <DelaySign>False</DelaySign>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Tizen" Version="1.0.3" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Tizen.Multimedia\Tizen.Multimedia.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+<?xml version="1.0"?>
+<package>
+ <metadata>
+ <id>Tizen.Multimedia.Camera</id>
+ <version>$version$</version>
+ <authors>Samsung Electronics</authors>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+ <projectUrl>https://www.tizen.org/</projectUrl>
+ <iconUrl>https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png</iconUrl>
+ <copyright>© Samsung Electronics Co., Ltd All Rights Reserved</copyright>
+ <description>Provides the Multimedia Camera API for Tizen.Net</description>
+ <dependencies>
+ <dependency id="Tizen" version="1.0.2" />
+ <dependency id="Tizen.Multimedia" version="1.2.0" />
+ </dependencies>
+ </metadata>
+</package>
<description>Provides the Multimedia MediaCodec API for Tizen.Net</description>
<dependencies>
<dependency id="Tizen" version="1.0.2" />
- <dependency id="Tizen.Applications.Common" version="1.4.2" />
<dependency id="Tizen.Multimedia" version="1.1.0" />
</dependencies>
</metadata>
--- /dev/null
+/*
+ * 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";
+ }
+}
+
--- /dev/null
+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;
+ }
+ }
+}
* limitations under the License.
*/
using System;
+using static Interop;
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;
}
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;
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);
}
*/
using System;
using System.Diagnostics;
+using static Interop;
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;
$"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");
}
_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;
* limitations under the License.
*/
using System;
+using static Interop;
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");
}
}
*/
using System;
using System.Diagnostics;
+using static Interop;
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;
$"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;
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");
}
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
+using static Interop;
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");
}
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
* limitations under the License.
*/
using System;
+using static Interop;
namespace Tizen.Multimedia
{
/// If you provide an invalid uri, you won't receive an error until <see cref="Player.Start"/> is called.</remarks>
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));
}
/// <summary>
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");
}
}
}
using System.Diagnostics;
using System.IO;
using System.Threading;
-using static Tizen.Multimedia.Interop;
+using static Interop;
namespace Tizen.Multimedia
{
/// Occurs when playback of a media is finished.
/// </summary>
public event EventHandler<EventArgs> PlaybackCompleted;
- private Interop.Player.PlaybackCompletedCallback _playbackCompletedCallback;
+ private NativePlayer.PlaybackCompletedCallback _playbackCompletedCallback;
/// <summary>
/// Occurs when playback of a media is interrupted.
/// </summary>
public event EventHandler<PlaybackInterruptedEventArgs> PlaybackInterrupted;
- private Interop.Player.PlaybackInterruptedCallback _playbackInterruptedCallback;
+ private NativePlayer.PlaybackInterruptedCallback _playbackInterruptedCallback;
/// <summary>
/// Occurs when any error occurs.
/// </summary>
/// <remarks>The event handler will be executed on an internal thread.</remarks>
public event EventHandler<PlayerErrorOccurredEventArgs> ErrorOccurred;
- private Interop.Player.PlaybackErrorCallback _playbackErrorCallback;
+ private NativePlayer.PlaybackErrorCallback _playbackErrorCallback;
/// <summary>
/// Occurs when the video stream changed.
/// </summary>
/// <remarks>The event handler will be executed on an internal thread.</remarks>
public event EventHandler<VideoStreamChangedEventArgs> VideoStreamChanged;
- private Interop.Player.VideoStreamChangedCallback _videoStreamChangedCallback;
+ private NativePlayer.VideoStreamChangedCallback _videoStreamChangedCallback;
/// <summary>
/// Occurs when the subtitle is updated.
/// </summary>
/// <remarks>The event handler will be executed on an internal thread.</remarks>
public EventHandler<SubtitleUpdatedEventArgs> SubtitleUpdated;
- private Interop.Player.SubtitleUpdatedCallback _subtitleUpdatedCallback;
+ private NativePlayer.SubtitleUpdatedCallback _subtitleUpdatedCallback;
/// <summary>
/// Occurs when there is a change in the buffering status of streaming.
/// </summary>
public event EventHandler<BufferingProgressChangedEventArgs> BufferingProgressChanged;
- private Interop.Player.BufferingProgressCallback _bufferingProgressCallback;
+ private NativePlayer.BufferingProgressCallback _bufferingProgressCallback;
internal event EventHandler<MediaStreamBufferStatusChangedEventArgs> MediaStreamAudioBufferStatusChanged;
- private Interop.Player.MediaStreamBufferStatusCallback _mediaStreamAudioBufferStatusChangedCallback;
+ private NativePlayer.MediaStreamBufferStatusCallback _mediaStreamAudioBufferStatusChangedCallback;
internal event EventHandler<MediaStreamBufferStatusChangedEventArgs> MediaStreamVideoBufferStatusChanged;
- private Interop.Player.MediaStreamBufferStatusCallback _mediaStreamVideoBufferStatusChangedCallback;
+ private NativePlayer.MediaStreamBufferStatusCallback _mediaStreamVideoBufferStatusChangedCallback;
internal event EventHandler<MediaStreamSeekingOccurredEventArgs> MediaStreamAudioSeekingOccurred;
- private Interop.Player.MediaStreamSeekCallback _mediaStreamAudioSeekCallback;
+ private NativePlayer.MediaStreamSeekCallback _mediaStreamAudioSeekCallback;
internal event EventHandler<MediaStreamSeekingOccurredEventArgs> MediaStreamVideoSeekingOccurred;
- private Interop.Player.MediaStreamSeekCallback _mediaStreamVideoSeekCallback;
+ private NativePlayer.MediaStreamSeekCallback _mediaStreamVideoSeekCallback;
/// <summary>
/// Initialize a new instance of the Player class.
{
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);
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);
}
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;
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;
}
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));
}
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;
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;
}
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);
Debug.Assert(Enum.IsDefined(typeof(DisplayType), type));
- return Interop.Player.SetDisplay(Handle, type, evasObject);
+ return NativePlayer.SetDisplay(Handle, type, evasObject);
}
#endregion
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);
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");
}
/// <summary>
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);
$"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");
}
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;
}
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);
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);
}
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)
{
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");
}
/// <summary>
}
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)
{
}
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);
}
}
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);
}
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);
}
TaskCompletionSource<CapturedFrame> t = new TaskCompletionSource<CapturedFrame>();
- Interop.Player.VideoCaptureCallback cb = (data, width, height, size, _) =>
+ NativePlayer.VideoCaptureCallback cb = (data, width, height, size, _) =>
{
Debug.Assert(size <= int.MaxValue);
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;
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);
}
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)
bool immediateResult = _source is MediaStreamSource;
- Interop.Player.SeekCompletedCallback cb = _ => taskCompletionSource.TrySetResult(true);
+ NativePlayer.SeekCompletedCallback cb = _ => taskCompletionSource.TrySetResult(true);
using (var cbKeeper = ObjectKeeper.Get(cb))
{
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);
}
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
SubtitleUpdated?.Invoke(this, new SubtitleUpdatedEventArgs(duration, text));
};
- Interop.Player.SetSubtitleUpdatedCb(Handle, _subtitleUpdatedCallback).
+ NativePlayer.SetSubtitleUpdatedCb(Handle, _subtitleUpdatedCallback).
ThrowIfFailed("Failed to initialize the player");
}
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");
}
PlaybackInterrupted?.Invoke(this, new PlaybackInterruptedEventArgs(code));
};
- Interop.Player.SetInterruptedCb(Handle, _playbackInterruptedCallback).
+ NativePlayer.SetInterruptedCb(Handle, _playbackInterruptedCallback).
ThrowIfFailed("Failed to set PlaybackInterrupted");
}
ErrorOccurred?.Invoke(this, new PlayerErrorOccurredEventArgs((PlayerError)code));
};
- Interop.Player.SetErrorCb(Handle, _playbackErrorCallback).
+ NativePlayer.SetErrorCb(Handle, _playbackErrorCallback).
ThrowIfFailed("Failed to set PlaybackError");
}
private EventHandler<VideoFrameDecodedEventArgs> _videoFrameDecoded;
- private Interop.Player.VideoFrameDecodedCallback _videoFrameDecodedCallback;
+ private NativePlayer.VideoFrameDecodedCallback _videoFrameDecodedCallback;
/// <summary>
/// Occurs when a video frame is decoded
}
};
- Interop.Player.SetVideoFrameDecodedCb(Handle, _videoFrameDecodedCallback).
+ NativePlayer.SetVideoFrameDecodedCb(Handle, _videoFrameDecodedCallback).
ThrowIfFailed("Failed to register the VideoFrameDecoded");
}
#endregion
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");
}
BufferingProgressChanged?.Invoke(this, new BufferingProgressChangedEventArgs(percent));
};
- Interop.Player.SetBufferingCb(Handle, _bufferingProgressCallback).
+ NativePlayer.SetBufferingCb(Handle, _bufferingProgressCallback).
ThrowIfFailed("Failed to set BufferingProgress");
}
}
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");
}
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
*/
using System;
using System.Diagnostics;
+using static Interop;
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;
return;
}
- Interop.Player.SetDisplayVisible(Player.Handle, value).
+ NativePlayer.SetDisplayVisible(Player.Handle, value).
ThrowIfFailed("Failed to set the visible state of the display");
_isVisible = value;
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;
$"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");
}
}
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
+using static Interop;
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;
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);
}
finally
{
- Interop.Libc.Free(code);
+ LibcSupport.Free(code);
}
}
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;
_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");
}
*/
using System;
using System.Runtime.InteropServices;
+using static Interop;
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)
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)
}
finally
{
- Interop.Libc.Free(audioPtr);
- Interop.Libc.Free(videoPtr);
+ LibcSupport.Free(audioPtr);
+ LibcSupport.Free(videoPtr);
}
}
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);
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?
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?
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);
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);
}
}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>netstandard1.3</TargetFramework>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <SignAssembly>True</SignAssembly>
+ <AssemblyOriginatorKeyFile>Tizen.Multimedia.MediaPlayer.snk</AssemblyOriginatorKeyFile>
+ <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
+ <GenerateReferenceAssembly>True</GenerateReferenceAssembly>
+ <DelaySign>False</DelaySign>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Tizen" Version="1.0.3" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Tizen.Multimedia\Tizen.Multimedia.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+<?xml version="1.0"?>
+<package>
+ <metadata>
+ <id>Tizen.Multimedia.MediaPlayer</id>
+ <version>$version$</version>
+ <authors>Samsung Electronics</authors>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+ <projectUrl>https://www.tizen.org/</projectUrl>
+ <iconUrl>https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png</iconUrl>
+ <copyright>© Samsung Electronics Co., Ltd All Rights Reserved</copyright>
+ <description>Provides the Multimedia Player API for Tizen.Net</description>
+ <dependencies>
+ <dependency id="Tizen" version="1.0.2" />
+ <dependency id="Tizen.Multimedia" version="1.2.0" />
+ </dependencies>
+ </metadata>
+</package>
--- /dev/null
+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);
+ }
+}
--- /dev/null
+/*
+ * 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";
+ }
+}
--- /dev/null
+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);
+ }
+}
--- /dev/null
+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);
+ }
+}
using System;
using System.Diagnostics;
-using static Tizen.Multimedia.Interop.MetadataExtractor;
+using static Interop.MetadataExtractor;
namespace Tizen.Multimedia
{
/// Represents synchronized lyrics information of media.
/// </summary>
public class SyncLyrics
- {\r
+ {
/// <summary>
/// Initialize a new instance of the MetadataExtractor class with the specified lyrics and timestamp.
/// </summary>
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>netstandard1.3</TargetFramework>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <SignAssembly>True</SignAssembly>
+ <AssemblyOriginatorKeyFile>Tizen.Multimedia.Metadata.snk</AssemblyOriginatorKeyFile>
+ <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
+ <GenerateReferenceAssembly>True</GenerateReferenceAssembly>
+ <DelaySign>False</DelaySign>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Tizen" Version="1.0.3" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+<?xml version="1.0"?>
+<package>
+ <metadata>
+ <id>Tizen.Multimedia.Metadata</id>
+ <version>$version$</version>
+ <authors>Samsung Electronics</authors>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+ <projectUrl>https://www.tizen.org/</projectUrl>
+ <iconUrl>https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png</iconUrl>
+ <copyright>© Samsung Electronics Co., Ltd All Rights Reserved</copyright>
+ <description>Provides the Multimedia Metadata API for Tizen.Net</description>
+ <dependencies>
+ <dependency id="Tizen" version="1.0.2" />
+ </dependencies>
+ </metadata>
+</package>
--- /dev/null
+/*
+ * 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";
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>netstandard1.3</TargetFramework>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <SignAssembly>True</SignAssembly>
+ <AssemblyOriginatorKeyFile>Tizen.Multimedia.Radio.snk</AssemblyOriginatorKeyFile>
+ <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
+ <GenerateReferenceAssembly>True</GenerateReferenceAssembly>
+ <DelaySign>False</DelaySign>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Tizen" Version="1.0.3" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+<?xml version="1.0"?>
+<package>
+ <metadata>
+ <id>Tizen.Multimedia.Radio</id>
+ <version>$version$</version>
+ <authors>Samsung Electronics</authors>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+ <projectUrl>https://www.tizen.org/</projectUrl>
+ <iconUrl>https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png</iconUrl>
+ <copyright>© Samsung Electronics Co., Ltd All Rights Reserved</copyright>
+ <description>Provides the Multimedia Radio API for Tizen.Net</description>
+ <dependencies>
+ <dependency id="Tizen" version="1.0.2" />
+ </dependencies>
+ </metadata>
+</package>
--- /dev/null
+/*
+ * 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";
+ }
+}
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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);
+ }
+}
--- /dev/null
+/*
+ * 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);
+ }
+}
*/
using System;
-using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
-using System.Runtime.InteropServices;
+using Native = Interop.Recorder;
namespace Tizen.Multimedia
{
/// </privilege>
public Recorder()
{
- RecorderErrorFactory.ThrowIfError(Interop.Recorder.Create(out _handle),
+ RecorderErrorFactory.ThrowIfError(Native.Create(out _handle),
"Failed to create Audio recorder");
Feature = new RecorderFeatures(this);
/// </privilege>
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);
}
if (_handle != IntPtr.Zero)
{
- Interop.Recorder.Destroy(_handle);
+ Native.Destroy(_handle);
_handle = IntPtr.Zero;
}
_disposed = true;
/// Event that occurs when an error occurs during recorder operation.
/// </summary>
public event EventHandler<RecordingErrorOccurredEventArgs> ErrorOccurred;
- private Interop.Recorder.RecorderErrorCallback _errorOccuredCallback;
+ private Native.RecorderErrorCallback _errorOccuredCallback;
/// <summary>
/// Event that occurs when recorder is interrupted.
/// </summary>
public event EventHandler<RecorderInterruptedEventArgs> Interrupted;
- private Interop.Recorder.InterruptedCallback _interruptedCallback;
+ private Native.InterruptedCallback _interruptedCallback;
/// <summary>
/// This event occurs when recorder state is changed.
/// </summary>
public event EventHandler<RecorderStateChangedEventArgs> StateChanged;
- private Interop.Recorder.StatechangedCallback _stateChangedCallback;
+ private Native.StatechangedCallback _stateChangedCallback;
/// <summary>
/// Event that occurs when recording information changes.
/// </summary>
public event EventHandler<RecordingProgressEventArgs> RecordingProgress;
- private Interop.Recorder.RecordingProgressCallback _recordingProgressCallback;
+ private Native.RecordingProgressCallback _recordingProgressCallback;
/// <summary>
/// Event that occurs when audio stream data is being delivered.
/// </summary>
public event EventHandler<AudioStreamDeliveredEventArgs> AudioStreamDelivered;
- private Interop.Recorder.AudioStreamCallback _audioStreamCallback;
+ private Native.AudioStreamCallback _audioStreamCallback;
/// <summary>
/// Event that occurs when recording limit is reached.
/// </summary>
public event EventHandler<RecordingLimitReachedEventArgs> RecordingLimitReached;
- private Interop.Recorder.RecordingLimitReachedCallback _recordingLimitReachedCallback;
+ private Native.RecordingLimitReachedCallback _recordingLimitReachedCallback;
/// <summary>
/// Event that occurs when muxed stream data is being delivered.
/// </summary>
public event EventHandler<MuxedStreamDeliveredEventArgs> MuxedStreamDelivered;
- private Interop.Recorder.MuxedStreamCallback _muxedStreamCallback;
+ private Native.MuxedStreamCallback _muxedStreamCallback;
#endregion EventHandlers
#region Properties
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;
{
ValidateState(RecorderState.Created);
- RecorderErrorFactory.ThrowIfError(Interop.Recorder.Prepare(_handle),
+ RecorderErrorFactory.ThrowIfError(Native.Prepare(_handle),
"Failed to prepare media recorder for recording");
SetState(RecorderState.Ready);
{
ValidateState(RecorderState.Ready);
- RecorderErrorFactory.ThrowIfError(Interop.Recorder.Unprepare(_handle),
+ RecorderErrorFactory.ThrowIfError(Native.Unprepare(_handle),
"Failed to reset the media recorder");
SetState(RecorderState.Created);
{
ValidateState(RecorderState.Ready);
- RecorderErrorFactory.ThrowIfError(Interop.Recorder.Start(_handle),
+ RecorderErrorFactory.ThrowIfError(Native.Start(_handle),
"Failed to start the media recorder");
SetState(RecorderState.Recording);
{
ValidateState(RecorderState.Recording);
- RecorderErrorFactory.ThrowIfError(Interop.Recorder.Pause(_handle),
+ RecorderErrorFactory.ThrowIfError(Native.Pause(_handle),
"Failed to pause the media recorder");
SetState(RecorderState.Paused);
{
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);
{
ValidateState(RecorderState.Recording, RecorderState.Paused);
- RecorderErrorFactory.ThrowIfError(Interop.Recorder.Cancel(_handle),
+ RecorderErrorFactory.ThrowIfError(Native.Cancel(_handle),
"Failed to cancel the recording");
SetState(RecorderState.Ready);
{
ValidateNotDisposed();
- RecorderErrorFactory.ThrowIfError(Interop.Recorder.SetAudioStreamPolicy(_handle, policy.Handle),
+ RecorderErrorFactory.ThrowIfError(Native.SetAudioStreamPolicy(_handle, policy.Handle),
"Failed to set audio stream policy");
}
#endregion Methods
{
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");
}
{
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");
}
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");
}
{
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");
}
{
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");
}
{
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");
}
{
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
using System;
using System.Collections.Generic;
using System.Linq;
+using Native = Interop.RecorderFeatures;
namespace Tizen.Multimedia
{
{
_fileFormats = new List<RecorderFileFormat>();
- 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
{
_audioCodec = new List<RecorderAudioCodec>();
- 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
{
_videoCodec = new List<RecorderVideoCodec>();
- 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
{
_videoResolution = new List<Size>();
- 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
using System.Linq;
using System.Runtime.InteropServices;
using Tizen.Internals.Errors;
+using Native = Interop.RecorderSettings;
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;
set
{
- RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetAudioChannel(_recorder.GetHandle(), value),
+ RecorderErrorFactory.ThrowIfError(Native.SetAudioChannel(_recorder.GetHandle(), value),
"Failed to set audio channel");
}
}
{
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;
set
{
- RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetAudioDevice(_recorder.GetHandle(), value),
+ RecorderErrorFactory.ThrowIfError(Native.SetAudioDevice(_recorder.GetHandle(), value),
"Failed to set audio device.");
}
}
{
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;
{
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;
set
{
- RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetAudioSampleRate(_recorder.GetHandle(), value),
+ RecorderErrorFactory.ThrowIfError(Native.SetAudioSampleRate(_recorder.GetHandle(), value),
"Failed to set audio sample rate.");
}
}
{
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;
set
{
- RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetAudioEncoderBitrate(_recorder.GetHandle(), value),
+ RecorderErrorFactory.ThrowIfError(Native.SetAudioEncoderBitrate(_recorder.GetHandle(), value),
"Failed to set audio bitrate");
}
}
{
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;
set
{
- RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetVideoEncoderBitrate(_recorder.GetHandle(), value),
+ RecorderErrorFactory.ThrowIfError(Native.SetVideoEncoderBitrate(_recorder.GetHandle(), value),
"Failed to set video bitrate");
}
}
{
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;
set
{
- RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetAudioEncoder(_recorder.GetHandle(), value),
+ RecorderErrorFactory.ThrowIfError(Native.SetAudioEncoder(_recorder.GetHandle(), value),
"Failed to set audio codec");
}
}
{
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;
set
{
- RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetVideoEncoder(_recorder.GetHandle(), value),
+ RecorderErrorFactory.ThrowIfError(Native.SetVideoEncoder(_recorder.GetHandle(), value),
"Failed to set video codec");
}
}
{
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;
set
{
- RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetFileFormat(_recorder.GetHandle(), value),
+ RecorderErrorFactory.ThrowIfError(Native.SetFileFormat(_recorder.GetHandle(), value),
"Failed to set file format");
}
}
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");
}
}
{
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;
set
{
- RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetSizeLimit(_recorder.GetHandle(), value),
+ RecorderErrorFactory.ThrowIfError(Native.SetSizeLimit(_recorder.GetHandle(), value),
"Failed to set size limit");
}
}
{
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;
set
{
- RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetTimeLimit(_recorder.GetHandle(), value),
+ RecorderErrorFactory.ThrowIfError(Native.SetTimeLimit(_recorder.GetHandle(), value),
"Failed to set time limit.");
}
}
{
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");
}
}
{
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;
set
{
- RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetMotionRate(_recorder.GetHandle(), value),
+ RecorderErrorFactory.ThrowIfError(Native.SetMotionRate(_recorder.GetHandle(), value),
"Failed to set video motion rate");
}
}
{
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;
set
{
- RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetOrientationTag(_recorder.GetHandle(), value),
+ RecorderErrorFactory.ThrowIfError(Native.SetOrientationTag(_recorder.GetHandle(), value),
"Failed to set recorder orientation");
}
}
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);
{
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.");
}
}
/// </summary>
public class RecordingProgressEventArgs : EventArgs
{
- internal RecordingProgressEventArgs(ulong elapsedTime, ulong fileSize)
+ public RecordingProgressEventArgs(ulong elapsedTime, ulong fileSize)
{
ElapsedTime = elapsedTime;
FileSize = fileSize;
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>netstandard1.3</TargetFramework>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <SignAssembly>True</SignAssembly>
+ <AssemblyOriginatorKeyFile>Tizen.Multimedia.Recorder.snk</AssemblyOriginatorKeyFile>
+ <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
+ <GenerateReferenceAssembly>True</GenerateReferenceAssembly>
+ <DelaySign>False</DelaySign>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Tizen" Version="1.0.3" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Tizen.Multimedia.AudioIO\Tizen.Multimedia.AudioIO.csproj" />
+ <ProjectReference Include="..\Tizen.Multimedia.Camera\Tizen.Multimedia.Camera.csproj" />
+ <ProjectReference Include="..\Tizen.Multimedia\Tizen.Multimedia.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+<?xml version="1.0"?>
+<package>
+ <metadata>
+ <id>Tizen.Multimedia.Recorder</id>
+ <version>$version$</version>
+ <authors>Samsung Electronics</authors>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+ <projectUrl>https://www.tizen.org/</projectUrl>
+ <iconUrl>https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png</iconUrl>
+ <copyright>© Samsung Electronics Co., Ltd All Rights Reserved</copyright>
+ <description>Provides the Multimedia Recorder API for Tizen.Net</description>
+ <dependencies>
+ <dependency id="Tizen" version="1.0.2" />
+ <dependency id="Tizen.Multimedia.AudioIO" version="1.0.0" />
+ <dependency id="Tizen.Multimedia.Camera" version="1.0.0" />
+ </dependencies>
+ </metadata>
+</package>
--- /dev/null
+/*
+ * 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";
+ }
+}
+
--- /dev/null
+/*
+ * 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);
+ }
+}
--- /dev/null
+/*
+ * 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);
+ }
+}
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Tizen.Applications;
+using Native = Interop.MediaControllerClient;
namespace Tizen.Multimedia.MediaController
{
private bool _disposed = false;
private EventHandler<ServerUpdatedEventArgs> _serverUpdated;
- private Interop.MediaControllerClient.ServerUpdatedCallback _serverUpdatedCallback;
+ private Native.ServerUpdatedCallback _serverUpdatedCallback;
private EventHandler<PlaybackUpdatedEventArgs> _playbackUpdated;
- private Interop.MediaControllerClient.PlaybackUpdatedCallback _playbackUpdatedCallback;
+ private Native.PlaybackUpdatedCallback _playbackUpdatedCallback;
private EventHandler<MetadataUpdatedEventArgs> _metadataUpdated;
- private Interop.MediaControllerClient.MetadataUpdatedCallback _metadataUpdatedCallback;
+ private Native.MetadataUpdatedCallback _metadataUpdatedCallback;
private EventHandler<ShuffleModeUpdatedEventArgs> _shufflemodeUpdated;
- private Interop.MediaControllerClient.ShuffleModeUpdatedCallback _shufflemodeUpdatedCallback;
+ private Native.ShuffleModeUpdatedCallback _shufflemodeUpdatedCallback;
private EventHandler<RepeatModeUpdatedEventArgs> _repeatmodeUpdated;
- private Interop.MediaControllerClient.RepeatModeUpdatedCallback _repeatmodeUpdatedCallback;
+ private Native.RepeatModeUpdatedCallback _repeatmodeUpdatedCallback;
private EventHandler<CustomCommandReplyEventArgs> _customcommandReply;
- private Interop.MediaControllerClient.CommandReplyRecievedCallback _customcommandReplyCallback;
+ private Native.CommandReplyRecievedCallback _customcommandReplyCallback;
private bool IsValidHandle
{
public MediaControllerClient()
{
MediaControllerValidator.ThrowIfError(
- Interop.MediaControllerClient.Create(out _handle), "Create client failed");
+ Native.Create(out _handle), "Create client failed");
}
~MediaControllerClient()
if (IsValidHandle)
{
- Interop.MediaControllerClient.Destroy(_handle);
+ Native.Destroy(_handle);
_handle = IntPtr.Zero;
}
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);
}
}
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
if (playbackHandle != IntPtr.Zero)
{
MediaControllerValidator.ThrowIfError(
- Interop.MediaControllerClient.DestroyPlayback(playbackHandle), "Destroy playback failed");
+ Native.DestroyPlayback(playbackHandle), "Destroy playback failed");
}
}
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
if (metadataHandle != IntPtr.Zero)
{
MediaControllerValidator.ThrowIfError(
- Interop.MediaControllerClient.DestroyMetadata(metadataHandle), "Destroy metadata failed");
+ Native.DestroyMetadata(metadataHandle), "Destroy metadata failed");
}
}
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;
}
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;
}
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");
}
/// <summary>
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");
}
public void Subscribe(MediaControllerSubscriptionType type, string serverName)
{
MediaControllerValidator.ThrowIfError(
- Interop.MediaControllerClient.Subscribe(SafeHandle, type, serverName), "Subscribe failed");
+ Native.Subscribe(SafeHandle, type, serverName), "Subscribe failed");
}
/// <summary>
public void Unsubscribe(MediaControllerSubscriptionType type, string serverName)
{
MediaControllerValidator.ThrowIfError(
- Interop.MediaControllerClient.Unsubscribe(SafeHandle, type, serverName), "Unsubscribe failed");
+ Native.Unsubscribe(SafeHandle, type, serverName), "Unsubscribe failed");
}
/// <summary>
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()
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()
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()
};
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()
};
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<string> ForEachSubscribedServer(IntPtr handle, MediaControllerSubscriptionType subscriptionType)
{
List<string> subscribedServerCollections = new List<string>();
- 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;
{
List<string> activatedServerCollections = new List<string>();
- 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;
*/
using System;
-using System.Collections.Generic;
+using Native = Interop.MediaControllerClient;
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);
}
/// <summary>
* limitations under the License.
*/
-
using System;
+using Native = Interop.MediaControllerClient;
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;
using System;
using System.Runtime.InteropServices;
using Tizen.Applications;
+using Native = Interop.MediaControllerServer;
namespace Tizen.Multimedia.MediaController
{
private bool _disposed = false;
private EventHandler<PlaybackStateCommandEventArgs> _playbackCommand;
- private Interop.MediaControllerServer.PlaybackStateCommandRecievedCallback _playbackCommandCallback;
+ private Native.PlaybackStateCommandRecievedCallback _playbackCommandCallback;
private EventHandler<CustomCommandEventArgs> _customCommand;
- private Interop.MediaControllerServer.CustomCommandRecievedCallback _customCommandCallback;
+ private Native.CustomCommandRecievedCallback _customCommandCallback;
private bool IsValidHandle
{
public MediaControllerServer()
{
MediaControllerValidator.ThrowIfError(
- Interop.MediaControllerServer.Create(out _handle), "Create server failed");
+ Native.Create(out _handle), "Create server failed");
}
~MediaControllerServer()
if (IsValidHandle)
{
- Interop.MediaControllerServer.Destroy(_handle);
+ Native.Destroy(_handle);
_handle = IntPtr.Zero;
}
}
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");
}
/// <summary>
}
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");
}
/// <summary>
public void UpdateShuffleMode(MediaControllerShuffleMode mode)
{
MediaControllerValidator.ThrowIfError(
- Interop.MediaControllerServer.UpdateShuffleMode(SafeHandle, mode), "Update Shuffle Mode failed");
+ Native.UpdateShuffleMode(SafeHandle, mode), "Update Shuffle Mode failed");
}
/// <summary>
public void UpdateRepeatMode(MediaControllerRepeatMode mode)
{
MediaControllerValidator.ThrowIfError(
- Interop.MediaControllerServer.UpdateRepeatMode(SafeHandle, mode), "Update Repeat Mode failed");
+ Native.UpdateRepeatMode(SafeHandle, mode), "Update Repeat Mode failed");
}
/// <summary>
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()
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()
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);
}
}
}
*/
using System;
-using System.Runtime.InteropServices;
+using Native = Interop.ScreenMirroring;
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);
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);
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);
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);
using System;
using System.Diagnostics;
using System.Threading.Tasks;
+using Native = Interop.ScreenMirroring;
namespace Tizen.Multimedia
{
private bool _disposed = false;
private EventHandler<StateChangedEventArgs> _stateChanged;
- private Interop.ScreenMirroring.StateChangedCallback _stateChangedCallback;
+ private Native.StateChangedCallback _stateChangedCallback;
/// <summary>
/// Initializes a new instance of the ScreenMirroring class with parameters Ip, Port, Surface type and Display handle.
/// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
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");
_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);
/// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
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);
/// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
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);
Debug.Assert(Enum.IsDefined(typeof(DisplayType), type));
- return Interop.ScreenMirroring.SetDisplay(_handle, (int)type, evasObject);
+ return Native.SetDisplay(_handle, (int)type, evasObject);
}
/// <summary>
/// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
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");
/// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
public Task<bool> ConnectAsync()
{
- int ret = Interop.ScreenMirroring.ConnectAsync(_handle);
+ int ret = Native.ConnectAsync(_handle);
var task = new TaskCompletionSource<bool>();
Task.Factory.StartNew(() =>
/// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
public Task<bool> StartAsync()
{
- int ret = Interop.ScreenMirroring.StartAsync(_handle);
+ int ret = Native.StartAsync(_handle);
var task = new TaskCompletionSource<bool>();
Task.Factory.StartNew(() =>
/// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
public Task<bool> PauseAsync()
{
- int ret = Interop.ScreenMirroring.PauseAsync(_handle);
+ int ret = Native.PauseAsync(_handle);
var task = new TaskCompletionSource<bool>();
Task.Factory.StartNew(() =>
/// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
public Task<bool> ResumeAsync()
{
- int ret = Interop.ScreenMirroring.ResumeAsync(_handle);
+ int ret = Native.ResumeAsync(_handle);
var task = new TaskCompletionSource<bool>();
Task.Factory.StartNew(() =>
/// <exception cref="ArgumentException">Thrown when method fail due to no connection between devices</exception>
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");
/// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
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");
if (_handle != IntPtr.Zero)
{
- Interop.ScreenMirroring.Destroy(_handle);
+ Native.Destroy(_handle);
_handle = IntPtr.Zero;
}
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);
/// <exception cref="InvalidOperationException">Thrown when method fail due to an internal error</exception>
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);
*/
using System;
-using System.Runtime.InteropServices;
+using Native = Interop.ScreenMirroring;
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);
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);
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);
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);
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>netstandard1.3</TargetFramework>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <SignAssembly>True</SignAssembly>
+ <AssemblyOriginatorKeyFile>Tizen.Multimedia.Remoting.snk</AssemblyOriginatorKeyFile>
+ <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
+ <GenerateReferenceAssembly>True</GenerateReferenceAssembly>
+ <DelaySign>False</DelaySign>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Tizen" Version="1.0.3" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Tizen.Multimedia\Tizen.Multimedia.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+<?xml version="1.0"?>
+<package>
+ <metadata>
+ <id>Tizen.Multimedia.Remoting</id>
+ <version>$version$</version>
+ <authors>Samsung Electronics</authors>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+ <projectUrl>https://www.tizen.org/</projectUrl>
+ <iconUrl>https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png</iconUrl>
+ <copyright>© Samsung Electronics Co., Ltd All Rights Reserved</copyright>
+ <description>Provides the Multimedia Remoting API(MediaController, ScreenMirroring) for Tizen.Net</description>
+ <dependencies>
+ <dependency id="Tizen" version="1.0.2" />
+ <dependency id="Tizen.Multimedia" version="1.2.0" />
+ </dependencies>
+ </metadata>
+</package>
--- /dev/null
+/*
+ * 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";
+ }
+}
--- /dev/null
+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);
+ }
+}
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Tizen.Internals.Errors;
+using Native = Interop.StreamRecorder;
namespace Tizen.Multimedia
{
/// Occurred when recording is progressing for recording status.
/// </summary>
private EventHandler<RecordingProgressEventArgs> _recordingStatusChanged;
- private Interop.StreamRecorder.RecordingStatusCallback _recordingStatusCallback;
+ private Native.RecordingStatusCallback _recordingStatusCallback;
/// <summary>
/// Occurred when recording time or size reach limit.
/// </summary>
private EventHandler<StreamRecordingLimitReachedEventArgs> _recordingLimitReached;
- private Interop.StreamRecorder.RecordingLimitReachedCallback _recordingLimitReachedCallback;
+ private Native.RecordingLimitReachedCallback _recordingLimitReachedCallback;
/// <summary>
/// Occurred when streamrecorder complete to use pushed buffer.
/// </summary>
private EventHandler<StreamRecordingBufferConsumedEventArgs> _bufferConsumed;
- private Interop.StreamRecorder.BufferConsumedCallback _bufferConsumedCallback;
+ private Native.BufferConsumedCallback _bufferConsumedCallback;
/// <summary>
/// Occurred when streamrecorder state is changed.
/// </summary>
private EventHandler<StreamRecorderNotifiedEventArgs> _recorderNotified;
- private Interop.StreamRecorder.NotifiedCallback _notifiedCallback;
+ private Native.NotifiedCallback _notifiedCallback;
/// <summary>
/// Occurred when error is occured.
/// </summary>
private EventHandler<StreamRecordingErrorOccurredEventArgs> _recordingErrorOccurred;
- private Interop.StreamRecorder.RecorderErrorCallback _recorderErrorCallback;
+ private Native.RecorderErrorCallback _recorderErrorCallback;
private List<StreamRecorderFileFormat> _formats;
private List<StreamRecorderAudioCodec> _audioCodec;
/// </summary>
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<StreamRecorderFileFormat>();
_audioCodec = new List<StreamRecorderAudioCodec>();
- _videoCodec = new List<StreamRecorderVideoCodec> ();
- _resolutions = new List<StreamRecorderVideoResolution> ();
- _videoResolution = new StreamRecorderVideoResolution (_handle);
+ _videoCodec = new List<StreamRecorderVideoCodec>();
+ _resolutions = new List<StreamRecorderVideoResolution>();
+ _videoResolution = new StreamRecorderVideoResolution(_handle);
}
/// <summary>
/// </summary>
~StreamRecorder()
{
- Dispose (false);
+ Dispose(false);
}
/// <summary>
_recorderNotified -= value;
if (_recorderNotified == null)
{
- UnregisterStreamRecorderNotifiedEvent ();
+ UnregisterStreamRecorderNotifiedEvent();
}
}
}
_bufferConsumed -= value;
if (_bufferConsumed == null)
{
- UnregisterBufferComsumedEvent ();
+ UnregisterBufferComsumedEvent();
}
}
}
_recordingStatusChanged -= value;
if (_recordingStatusChanged == null)
{
- UnregisterRecordingStatusChangedEvent ();
+ UnregisterRecordingStatusChangedEvent();
}
}
}
_recordingLimitReached -= value;
if (_recordingLimitReached == null)
{
- UnregisterRecordingLimitReachedEvent ();
+ UnregisterRecordingLimitReachedEvent();
}
}
}
_recordingErrorOccurred -= value;
if (_recordingErrorOccurred == null)
{
- UnregisterRecordingErrorOccurredEvent ();
+ UnregisterRecordingErrorOccurredEvent();
}
}
}
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");
}
}
}
{
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;
}
{
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);
}
}
}
{
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);
}
}
}
{
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);
}
}
{
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");
}
}
}
{
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");
}
}
}
{
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");
}
}
}
{
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");
}
}
}
{
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");
}
}
}
{
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);
}
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);
{
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);
}
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);
{
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");
}
}
}
{
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;
{
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;
{
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;
{
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;
/// <seealso cref="Unprepare"/>
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");
}
}
/// <seealso cref="Prepare"/>
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");
}
}
/// <seealso cref="FileFormat"/>
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");
}
}
/// <seealso cref="Cancel"/>
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");
}
}
/// <seealso cref="Pause"/>
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");
}
}
/// <seealso cref="Pause"/>
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");
}
}
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");
/// </summary>
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");
}
if (_handle != IntPtr.Zero)
{
- Interop.StreamRecorder.Destroy (_handle);
+ Native.Destroy(_handle);
_handle = IntPtr.Zero;
}
_disposed = true;
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");
}
}
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");
}
}
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");
}
}
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");
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");
}
}
}
}
switch((StreamRecorderError)errorCode) {
case StreamRecorderError.InvalidParameter:
- throw new ArgumentException(errorMessage, paramName);\r
- case StreamRecorderError.OutOfMemory:\r
- throw new OutOfMemoryException(errorMessage);\r
- case StreamRecorderError.PermissionDenied:\r
- throw new UnauthorizedAccessException(errorMessage);\r
+ 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);\r
+ throw new NotSupportedException(errorMessage);
case StreamRecorderError.InvalidState:
case StreamRecorderError.InvalidOperation:
case StreamRecorderError.OutOfStorage:
*/
using System;
+using Native = Interop.StreamRecorder;
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());
}
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());
}
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());
}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>netstandard1.3</TargetFramework>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <SignAssembly>True</SignAssembly>
+ <AssemblyOriginatorKeyFile>Tizen.Multimedia.StreamRecorder.snk</AssemblyOriginatorKeyFile>
+ <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
+ <GenerateReferenceAssembly>True</GenerateReferenceAssembly>
+ <DelaySign>False</DelaySign>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Tizen" Version="1.0.3" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Tizen.Multimedia.Recorder\Tizen.Multimedia.Recorder.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+<?xml version="1.0"?>
+<package>
+ <metadata>
+ <id>Tizen.Multimedia.StreamRecorder</id>
+ <version>$version$</version>
+ <authors>Samsung Electronics</authors>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+ <projectUrl>https://www.tizen.org/</projectUrl>
+ <iconUrl>https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png</iconUrl>
+ <copyright>© Samsung Electronics Co., Ltd All Rights Reserved</copyright>
+ <description>Provides the Multimedia StreamRecorder API for Tizen.Net</description>
+ <dependencies>
+ <dependency id="Tizen" version="1.0.2" />
+ <dependency id="Tizen.Multimedia.Recorder" version="1.0.0" />
+ </dependencies>
+ </metadata>
+</package>
--- /dev/null
+/*
+ * 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();
+ }
+
+ /// <summary>
+ /// Utility method to check for error, returns false if failed and print warning messages
+ /// </summary>
+ /// <returns>true in case of no error, false otherwise</returns>
+ 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;
+ }
+
+ /// <summary>
+ /// Utility method to check for error, returns false if failed and throw exception
+ /// </summary>
+ /// <returns>true in case of no error</returns>
+ 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);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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<ImageColorSpace>(this.GetColorspace); }
+ set { NativeSet(this.SetColorspace, value); }
+ }
+
+ internal ImageRotation Rotation
+ {
+ get { return NativeGet<ImageRotation>(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);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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<ImageColorSpace> 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
--- /dev/null
+/*
+ * 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";
+ }
+}
--- /dev/null
+/*
+ * 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<T> PinnedTask<T>(TaskCompletionSource<T> 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<TProp>(out TProp value);
+ internal delegate ErrorCode SetterMethod<TProp>(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<TProp>(GetterMethod<TProp> getter, [CallerMemberName] string propertyName = "")
+ {
+ TProp value; getter(out value).ThrowIfFailed($"Failed to get {propertyName}");
+ return value;
+ }
+
+ internal string NativeGet(GetterMethod<string> getter, [CallerMemberName] string propertyName = "")
+ {
+ string value; getter(out value).ThrowIfFailed($"Failed to get {propertyName}");
+ return value;
+ }
+
+ internal void NativeSet<TProp>(SetterMethod<TProp> 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();
+ }
+ }
+}
--- /dev/null
+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);
+ }
+}
* limitations under the License.
*/
-
using System;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
+using Native = Interop.ThumbnailExtractor;
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;
}
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;
}
var task = new TaskCompletionSource<ThumbnailData>();
- Interop.ThumbnailExtractor.ThumbnailExtractCallback extractCallback = (ThumbnailExtractorError error,
+ Native.ThumbnailExtractCallback extractCallback = (ThumbnailExtractorError error,
string requestId,
int thumbWidth,
int thumbHeight,
}
finally
{
- Interop.Libc.Free(thumbData);
+ LibcSupport.Free(thumbData);
}
}
else
};
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;
}
if (_handle != IntPtr.Zero)
{
- Interop.ThumbnailExtractor.Destroy(_handle);
+ Native.Destroy(_handle);
_handle = IntPtr.Zero;
}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>netstandard1.3</TargetFramework>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <SignAssembly>True</SignAssembly>
+ <AssemblyOriginatorKeyFile>Tizen.Multimedia.Util.snk</AssemblyOriginatorKeyFile>
+ <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
+ <GenerateReferenceAssembly>True</GenerateReferenceAssembly>
+ <DelaySign>False</DelaySign>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Tizen" Version="1.0.3" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Tizen.Multimedia\Tizen.Multimedia.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+<?xml version="1.0"?>
+<package>
+ <metadata>
+ <id>Tizen.Multimedia.Util</id>
+ <version>$version$</version>
+ <authors>Samsung Electronics</authors>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+ <projectUrl>https://www.tizen.org/</projectUrl>
+ <iconUrl>https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png</iconUrl>
+ <copyright>© Samsung Electronics Co., Ltd All Rights Reserved</copyright>
+ <description>Provides the Multimedia Util API for Tizen.Net</description>
+ <dependencies>
+ <dependency id="Tizen" version="1.0.2" />
+ <dependency id="Tizen.Multimedia" version="1.2.0" />
+ </dependencies>
+ </metadata>
+</package>
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
namespace Tizen.Multimedia.Utility
{
/// <summary>
/// <summary>
/// YV12 - YCrCb planar format
/// </summary>
- Yv12 = Interop.ImageColorSpace.Yv12,
+ Yv12 = global::Interop.ImageColorSpace.Yv12,
/// <summary>
/// UYVY - packed
/// </summary>
- Uyvy = Interop.ImageColorSpace.Uyvy,
+ Uyvy = global::Interop.ImageColorSpace.Uyvy,
/// <summary>
/// YUYV - packed
/// </summary>
- Yuyv = Interop.ImageColorSpace.Yuyv,
+ Yuyv = global::Interop.ImageColorSpace.Yuyv,
/// <summary>
/// YUV422 - planar
/// </summary>
- Yuv422 = Interop.ImageColorSpace.Yuv422,
+ Yuv422 = global::Interop.ImageColorSpace.Yuv422,
/// <summary>
/// YUV420 - planar
/// </summary>
- I420 = Interop.ImageColorSpace.I420,
+ I420 = global::Interop.ImageColorSpace.I420,
/// <summary>
/// RGB565, high-byte is Blue
/// </summary>
- Rgb565 = Interop.ImageColorSpace.Rgb565,
+ Rgb565 = global::Interop.ImageColorSpace.Rgb565,
/// <summary>
/// RGB888, high-byte is Blue
/// </summary>
- Rgb888 = Interop.ImageColorSpace.Rgb888,
+ Rgb888 = global::Interop.ImageColorSpace.Rgb888,
/// <summary>
/// ARGB8888, high-byte is Blue
/// </summary>
- Argb8888 = Interop.ImageColorSpace.Argb8888,
+ Argb8888 = global::Interop.ImageColorSpace.Argb8888,
/// <summary>
/// BGRA8888, high-byte is Alpha
/// </summary>
- Bgra8888 = Interop.ImageColorSpace.Bgra8888,
+ Bgra8888 = global::Interop.ImageColorSpace.Bgra8888,
/// <summary>
/// RGBA8888, high-byte is Alpha
/// </summary>
- Rgba8888 = Interop.ImageColorSpace.Rgba8888,
+ Rgba8888 = global::Interop.ImageColorSpace.Rgba8888,
/// <summary>
/// BGRX8888, high-byte is X
/// </summary>
- Bgrx8888 = Interop.ImageColorSpace.Bgrx8888,
+ Bgrx8888 = global::Interop.ImageColorSpace.Bgrx8888,
/// <summary>
/// NV12- planar
/// </summary>
- Nv12 = Interop.ImageColorSpace.Nv12,
+ Nv12 = global::Interop.ImageColorSpace.Nv12,
/// <summary>
/// NV16- planar
/// </summary>
- Nv16 = Interop.ImageColorSpace.Nv16,
+ Nv16 = global::Interop.ImageColorSpace.Nv16,
/// <summary>
/// NV21- planar
/// </summary>
- Nv21 = Interop.ImageColorSpace.Nv21,
+ Nv21 = global::Interop.ImageColorSpace.Nv21,
/// <summary>
/// NV61- planar
/// </summary>
- Nv61 = Interop.ImageColorSpace.Nv61,
+ Nv61 = global::Interop.ImageColorSpace.Nv61,
}
}
\ No newline at end of file
*/
using System;
-using System.Diagnostics;
using Tizen.Common;
+using static Interop.ImageUtil;
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;
}
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);
}
using System;
using System.Threading.Tasks;
+using Native = Interop;
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();
}
/// <summary>
set
{
ValidateObjectNotDisposed();
- _handle.Colorspace = (Interop.ImageColorSpace)value;
+ _handle.Colorspace = (Native.ImageColorSpace)value;
_colorspace = value;
}
}
{
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");
}
}
Initialize();
TaskCompletionSource<ImageData> tcs = new TaskCompletionSource<ImageData>();
- Interop.ImageDecoderHandle.DecodeCompletedCallback callback = (errorCode, userData, width, height, size) =>
+ Native.ImageDecoderHandle.DecodeCompletedCallback callback = (errorCode, userData, width, height, size) =>
{
if (errorCode.IsSuccess())
{
}
};
- 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()
using System;
using System.Threading.Tasks;
+using Native = Interop;
namespace Tizen.Multimedia.Utility
{
/// <returns>Encoded image buffer</returns>
public Task<byte[]> 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");
Initialize(handle);
TaskCompletionSource<byte[]> tcs = new TaskCompletionSource<byte[]>();
- 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
{
}
};
- 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);
}
}
/// <returns>true if encoding is successful</returns>
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");
Initialize(handle);
TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
- Interop.ImageEncoderHandle.EncodeCompletedCallback callback = (errorCode, userData, size) =>
+ Native.ImageEncoderHandle.EncodeCompletedCallback callback = (errorCode, userData, size) =>
{
if (errorCode.IsSuccess())
{
}
};
- 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)
}
}
- internal override void Initialize(Interop.ImageEncoderHandle handle)
+ internal override void Initialize(Native.ImageEncoderHandle handle)
{
if (_quality != DefaultQuality)
{
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;
}
}
}
set { _gifFrameDelay = value; }
}
- internal override void Initialize(Interop.ImageEncoderHandle handle)
+ internal override void Initialize(Native.ImageEncoderHandle handle)
{
if (_gifFrameDelay != DefaultGifFrameDelay)
{
/// <summary>
/// JPEG image
/// </summary>
- Jpeg = Interop.ImageType.Jpeg,
+ Jpeg = global::Interop.ImageType.Jpeg,
/// <summary>
/// PNG image
/// </summary>
- Png = Interop.ImageType.Png,
+ Png = global::Interop.ImageType.Png,
/// <summary>
/// GIF image
/// </summary>
- Gif = Interop.ImageType.Gif,
+ Gif = global::Interop.ImageType.Gif,
/// <summary>
/// BMP image
/// </summary>
- Bmp = Interop.ImageType.Bmp,
+ Bmp = global::Interop.ImageType.Bmp,
}
}
\ No newline at end of file
/// <summary>
/// No rotation
/// </summary>
- None = Interop.ImageRotation.None,
+ None = global::Interop.ImageRotation.None,
/// <summary>
/// Rotate 90 degree
/// </summary>
- Rotate90 = Interop.ImageRotation.Rotate90,
+ Rotate90 = global::Interop.ImageRotation.Rotate90,
/// <summary>
/// Rotate 180 degree
/// </summary>
- Rotate180 = Interop.ImageRotation.Rotate180,
+ Rotate180 = global::Interop.ImageRotation.Rotate180,
/// <summary>
/// Rotate 270 degree
/// </summary>
- Rotate270 = Interop.ImageRotation.Rotate270,
+ Rotate270 = global::Interop.ImageRotation.Rotate270,
/// <summary>
/// Flip horizontal
/// </summary>
- FlipHorizontal = Interop.ImageRotation.FlipHorizontal,
+ FlipHorizontal = global::Interop.ImageRotation.FlipHorizontal,
/// <summary>
/// Flip vertical
/// </summary>
- FlipVertical = Interop.ImageRotation.FlipVertical,
+ FlipVertical = global::Interop.ImageRotation.FlipVertical,
}
}
\ No newline at end of file
using System;
using System.Threading.Tasks;
+using static Interop;
namespace Tizen.Multimedia.Utility
{
{
public static Task<MediaPacket> 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);
}
}
public static Task<MediaPacket> 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");
public static Task<MediaPacket> 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);
}
}
public static Task<MediaPacket> 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");
return CropAsync(packet, cropArea, false);
}
- private static Task<MediaPacket> TransformAsync(Interop.ImageTransformHandle handle, MediaPacket packet, bool useHardwareAcceleration)
+ private static Task<MediaPacket> TransformAsync(ImageTransformHandle handle, MediaPacket packet, bool useHardwareAcceleration)
{
if (useHardwareAcceleration)
{
}
TaskCompletionSource<MediaPacket> tcs = new TaskCompletionSource<MediaPacket>();
- Interop.ImageTransformHandle.TransformCompletedCallback callback = (nativehandle, errorCode, userData) =>
+ ImageTransformHandle.TransformCompletedCallback callback = (nativehandle, errorCode, userData) =>
{
if (errorCode.IsSuccess())
{
}
};
- 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
*/
using System.Collections.Generic;
+using static Interop;
namespace Tizen.Multimedia.Utility
{
public static IEnumerable<ImageColorSpace> GetSupportedColorspace(ImageFormat type)
{
var colorspaces = new List<ImageColorSpace>();
- Interop.ImageUtil.ForeachSupportedColorspace((Interop.ImageType)type, (colorspace) => colorspaces.Add((ImageColorSpace)colorspace));
+ ImageUtil.ForeachSupportedColorspace((ImageType)type, (colorspace) => colorspaces.Add((ImageColorSpace)colorspace));
return colorspaces;
}
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;
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
namespace Tizen.Multimedia.Utility
{
/// <summary>
/// <summary>
/// No downscale
/// </summary>
- NoDownscale = Interop.JpegDownscale.NoDownscale,
+ NoDownscale = global::Interop.JpegDownscale.NoDownscale,
/// <summary>
/// 1/2 downscale
/// </summary>
- OneHalf = Interop.JpegDownscale.OneHalf,
+ OneHalf = global::Interop.JpegDownscale.OneHalf,
/// <summary>
/// 1/4 downscale
/// </summary>
- OneFourth = Interop.JpegDownscale.OneFourth,
+ OneFourth = global::Interop.JpegDownscale.OneFourth,
/// <summary>
/// 1/8 downscale
/// </summary>
- OneEighth = Interop.JpegDownscale.OneEighth,
+ OneEighth = global::Interop.JpegDownscale.OneEighth,
}
}
\ No newline at end of file
/// <summary>
/// No Compression
/// </summary>
- NoCompression = Interop.PngCompression.NoCompression,
+ NoCompression = global::Interop.PngCompression.NoCompression,
/// <summary>
/// Compression Level 1. Best speed
/// </summary>
- Level1 = Interop.PngCompression.Level1,
+ Level1 = global::Interop.PngCompression.Level1,
/// <summary>
/// Compression Level 2
/// </summary>
- Level2 = Interop.PngCompression.Level2,
+ Level2 = global::Interop.PngCompression.Level2,
/// <summary>
/// Compression Level 3
/// </summary>
- Level3 = Interop.PngCompression.Level3,
+ Level3 = global::Interop.PngCompression.Level3,
/// <summary>
/// Compression Level 4
/// </summary>
- Level4 = Interop.PngCompression.Level4,
+ Level4 = global::Interop.PngCompression.Level4,
/// <summary>
/// Compression Level 5
/// </summary>
- Level5 = Interop.PngCompression.Level5,
+ Level5 = global::Interop.PngCompression.Level5,
/// <summary>
/// Compression Level 6
/// </summary>
- Level6 = Interop.PngCompression.Level6,
+ Level6 = global::Interop.PngCompression.Level6,
/// <summary>
/// Compression Level 7
/// </summary>
- Level7 = Interop.PngCompression.Level7,
+ Level7 = global::Interop.PngCompression.Level7,
/// <summary>
/// Compression Level 8
/// </summary>
- Level8 = Interop.PngCompression.Level8,
+ Level8 = global::Interop.PngCompression.Level8,
/// <summary>
/// Compression Level 9
/// </summary>
- Level9 = Interop.PngCompression.Level9,
+ Level9 = global::Interop.PngCompression.Level9,
}
}
--- /dev/null
+/*
+ * 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";
+ }
+}
--- /dev/null
+/*
+ * 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;
+
+/// <summary>
+/// Interop APIs
+/// </summary>
+internal static partial class Interop
+{
+ /// <summary>
+ /// Interop for media vision APIs
+ /// </summary>
+ internal static partial class MediaVision
+ {
+ /// <summary>
+ /// Interop for barcode detector APIs
+ /// </summary>
+ 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);
+ }
+
+ /// <summary>
+ /// Interop for barcode generator APIs
+ /// </summary>
+ 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);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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;
+
+/// <summary>
+/// Interop APIs
+/// </summary>
+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;
+ }
+
+ /// <summary>
+ /// Interop for media vision APIs
+ /// </summary>
+ 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;
+ }
+
+ /// <summary>
+ /// Interop for media vision source APIs
+ /// </summary>
+ 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);
+ }
+
+ /// <summary>
+ /// Interop for engine configuration APIs
+ /// </summary>
+ 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);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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;
+
+/// <summary>
+/// Interop APIs
+/// </summary>
+internal static partial class Interop
+{
+ /// <summary>
+ /// Interop for media vision APIs
+ /// </summary>
+ internal static partial class MediaVision
+ {
+ /// <summary>
+ /// Interop for Face APIs
+ /// </summary>
+ 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);
+ }
+
+ /// <summary>
+ /// Interop for FaceRecognitionModel APIs
+ /// </summary>
+ 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);
+ }
+
+ /// <summary>
+ /// Interop for FaceTrackingModel APIs
+ /// </summary>
+ 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);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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;
+
+/// <summary>
+/// Interop APIs
+/// </summary>
+internal static partial class Interop
+{
+ /// <summary>
+ /// Interop for Media vision APIs
+ /// </summary>
+ internal static partial class MediaVision
+ {
+ /// <summary>
+ /// Interop for Image APIs
+ /// </summary>
+ 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);
+ }
+
+ /// <summary>
+ /// Interop for ImageTrackingModel APIs
+ /// </summary>
+ 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);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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;
+
+/// <summary>
+/// Interop APIs
+/// </summary>
+internal static partial class Interop
+{
+ /// <summary>
+ /// Interop for media vision APIs
+ /// </summary>
+ internal static partial class MediaVision
+ {
+ /// <summary>
+ /// Interop for surveillance APIs
+ /// </summary>
+ 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);
+ }
+ }
+}
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
{
*/
using System;
-using InteropBarcode = Tizen.Multimedia.Interop.MediaVision.BarcodeGenerator;
+using InteropBarcode = Interop.MediaVision.BarcodeGenerator;
namespace Tizen.Multimedia
{
using System;
using Tizen.System;
using System.Runtime.InteropServices;
-using static Tizen.Multimedia.Interop.MediaVision;
+using static Interop.MediaVision;
namespace Tizen.Multimedia
{
}
finally
{
- Interop.Libc.Free(ptr);
+ LibcSupport.Free(ptr);
}
}
using System;
using System.Threading.Tasks;
-using InteropFace = Tizen.Multimedia.Interop.MediaVision.Face;
+using InteropFace = Interop.MediaVision.Face;
namespace Tizen.Multimedia
{
private static InteropFace.DetectedCallback GetCallback(TaskCompletionSource<Rectangle[]> tcs)
{
- return (IntPtr sourceHandle, IntPtr engineConfig, Interop.MediaVision.Rectangle[] facesLocations,
+ return (IntPtr sourceHandle, IntPtr engineConfig, global::Interop.MediaVision.Rectangle[] facesLocations,
int numberOfFaces, IntPtr _) =>
{
try
using System;
using System.IO;
using System.Runtime.InteropServices;
-using InteropModel = Tizen.Multimedia.Interop.MediaVision.FaceRecognitionModel;
+using InteropModel = Interop.MediaVision.FaceRecognitionModel;
namespace Tizen.Multimedia
{
{
if (unmangedArray != IntPtr.Zero)
{
- Interop.Libc.Free(unmangedArray);
+ LibcSupport.Free(unmangedArray);
}
}
}
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
{
Rectangle? faceLocation = null;
if (faceLocationPtr != IntPtr.Zero)
{
- var area = Marshal.PtrToStructure<Interop.MediaVision.Rectangle>(faceLocationPtr);
+ var area = Marshal.PtrToStructure<global::Interop.MediaVision.Rectangle>(faceLocationPtr);
faceLocation = area.ToApiStruct();
}
TaskCompletionSource<EyeCondition> tcs = new TaskCompletionSource<EyeCondition>();
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))
TaskCompletionSource<FacialExpression> tcsResult = new TaskCompletionSource<FacialExpression>();
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))
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
{
Quadrangle area = null;
if (locationPtr != IntPtr.Zero)
{
- area = Marshal.PtrToStructure<Interop.MediaVision.Quadrangle>(locationPtr).ToApiStruct();
+ area = Marshal.PtrToStructure<global::Interop.MediaVision.Quadrangle>(locationPtr).ToApiStruct();
}
Log.Info(MediaVisionLog.Tag, $"Tracked area : {area}, confidence : {confidence}");
using System;
using System.IO;
-using InteropModel = Tizen.Multimedia.Interop.MediaVision.FaceTrackingModel;
+using InteropModel = Interop.MediaVision.FaceTrackingModel;
namespace Tizen.Multimedia
{
using System;
using System.IO;
-using InteropImage = Tizen.Multimedia.Interop.MediaVision.Image;
+using InteropImage = Interop.MediaVision.Image;
namespace Tizen.Multimedia
{
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
{
for (int i = 0; i < numOfObjects; i++)
{
Quadrangle quadrangle = locations[i] != IntPtr.Zero ?
- Marshal.PtrToStructure<Interop.MediaVision.Quadrangle>(locations[i]).ToApiStruct() : null;
+ Marshal.PtrToStructure<global::Interop.MediaVision.Quadrangle>(locations[i]).ToApiStruct() : null;
results[i] = new ImageRecognitionResult(locations[i] != IntPtr.Zero, quadrangle);
}
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
{
Quadrangle region = null;
if (locationPtr != IntPtr.Zero)
{
- region = Marshal.PtrToStructure<Interop.MediaVision.Quadrangle>(locationPtr).ToApiStruct();
+ region = Marshal.PtrToStructure<global::Interop.MediaVision.Quadrangle>(locationPtr).ToApiStruct();
}
Log.Info(MediaVisionLog.Tag, $"Image tracked, region : {region}");
using System;
using System.IO;
-using InteropModel = Tizen.Multimedia.Interop.MediaVision.ImageTrackingModel;
+using InteropModel = Interop.MediaVision.ImageTrackingModel;
namespace Tizen.Multimedia
{
using System;
using System.Diagnostics;
-using InteropSource = Tizen.Multimedia.Interop.MediaVision.MediaSource;
+using InteropSource = Interop.MediaVision.MediaSource;
namespace Tizen.Multimedia
{
*/
using System;
-using static Tizen.Multimedia.Interop.MediaVision.Surveillance;
+using static Interop.MediaVision.Surveillance;
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)
*/
using System;
-using static Tizen.Multimedia.Interop.MediaVision.Surveillance;
+using static Interop.MediaVision.Surveillance;
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);
}
/// <summary>
*/
using System;
-using static Tizen.Multimedia.Interop.MediaVision.Surveillance;
+using static Interop.MediaVision.Surveillance;
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];
using System;
using System.Runtime.InteropServices;
-using static Tizen.Multimedia.Interop.MediaVision.Surveillance;
+using static Interop.MediaVision.Surveillance;
namespace Tizen.Multimedia
{
for (int i = 0; i < count; i++)
{
- points[i] = Marshal.PtrToStructure<Interop.MediaVision.Point>(iterPtr).ToApiStruct();
- iterPtr = IntPtr.Add(iterPtr, Marshal.SizeOf<Interop.MediaVision.Point>());
+ points[i] = Marshal.PtrToStructure<global::Interop.MediaVision.Point>(iterPtr).ToApiStruct();
+ iterPtr = IntPtr.Add(iterPtr, Marshal.SizeOf<global::Interop.MediaVision.Point>());
}
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");
}
*/
using System;
-using static Tizen.Multimedia.Interop.MediaVision.Surveillance;
+using static Interop.MediaVision.Surveillance;
namespace Tizen.Multimedia
{
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>netstandard1.3</TargetFramework>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <SignAssembly>True</SignAssembly>
+ <AssemblyOriginatorKeyFile>Tizen.Multimedia.Vision.snk</AssemblyOriginatorKeyFile>
+ <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
+ <GenerateReferenceAssembly>True</GenerateReferenceAssembly>
+ <DelaySign>False</DelaySign>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Tizen" Version="1.0.3" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Tizen.Multimedia\Tizen.Multimedia.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+<?xml version="1.0"?>
+<package>
+ <metadata>
+ <id>Tizen.Multimedia.Vision</id>
+ <version>$version$</version>
+ <authors>Samsung Electronics</authors>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+ <projectUrl>https://www.tizen.org/</projectUrl>
+ <iconUrl>https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png</iconUrl>
+ <copyright>© Samsung Electronics Co., Ltd All Rights Reserved</copyright>
+ <description>Provides the Multimedia Vision API for Tizen.Net</description>
+ <dependencies>
+ <dependency id="Tizen" version="1.0.2" />
+ <dependency id="Tizen.Multimedia" version="1.2.0" />
+ </dependencies>
+ </metadata>
+</package>
--- /dev/null
+/*
+ * 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
}
}
- internal IntPtr Handle {
+ public IntPtr Handle {
get {
return _streamInfo;
}
--- /dev/null
+
+using System;
+
+namespace Tizen.Multimedia
+{
+ internal static class LibcSupport
+ {
+ internal static void Free(IntPtr ptr)
+ {
+ Interop.Libc.Free(ptr);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.");
+ }
+ }
+}
*/
using System;
-using Tizen.System;
namespace Tizen.Multimedia
{
+++ /dev/null
-/*
- * 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")]
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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);
- }
- }
-}
+++ /dev/null
-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
+++ /dev/null
-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);
- }
- }
-}
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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<ImageColorSpace>(this.GetColorspace); }
- set { NativeSet(this.SetColorspace, value); }
- }
-
- internal ImageRotation Rotation
- {
- get { return NativeGet<ImageRotation>(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
+++ /dev/null
-/*
- * 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<ImageColorSpace> 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
--- /dev/null
+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
{
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";
}
}
}
+++ /dev/null
-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
+++ /dev/null
-/*
- * 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
-{
- /// <summary>
- /// Interop APIs
- /// </summary>
- internal static partial class Interop
- {
- /// <summary>
- /// Interop for media vision APIs
- /// </summary>
- internal static partial class MediaVision
- {
- /// <summary>
- /// Interop for barcode detector APIs
- /// </summary>
- 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);
- }
-
- /// <summary>
- /// Interop for barcode generator APIs
- /// </summary>
- 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
+++ /dev/null
-/*
- * 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
-{
- /// <summary>
- /// Interop APIs
- /// </summary>
- 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;
- }
-
- /// <summary>
- /// Interop for media vision APIs
- /// </summary>
- 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;
- }
-
- /// <summary>
- /// Interop for media vision source APIs
- /// </summary>
- 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);
- }
-
- /// <summary>
- /// Interop for engine configuration APIs
- /// </summary>
- 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
+++ /dev/null
-/*
- * 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
-{
- /// <summary>
- /// Interop APIs
- /// </summary>
- internal static partial class Interop
- {
- /// <summary>
- /// Interop for media vision APIs
- /// </summary>
- internal static partial class MediaVision
- {
- /// <summary>
- /// Interop for Face APIs
- /// </summary>
- 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);
- }
-
- /// <summary>
- /// Interop for FaceRecognitionModel APIs
- /// </summary>
- 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);
- }
-
- /// <summary>
- /// Interop for FaceTrackingModel APIs
- /// </summary>
- 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
+++ /dev/null
-/*
- * 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
-{
- /// <summary>
- /// Interop APIs
- /// </summary>
- internal static partial class Interop
- {
- /// <summary>
- /// Interop for Media vision APIs
- /// </summary>
- internal static partial class MediaVision
- {
- /// <summary>
- /// Interop for Image APIs
- /// </summary>
- 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);
- }
-
- /// <summary>
- /// Interop for ImageTrackingModel APIs
- /// </summary>
- 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
+++ /dev/null
-/*
- * 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
-{
- /// <summary>
- /// Interop APIs
- /// </summary>
- internal static partial class Interop
- {
- /// <summary>
- /// Interop for media vision APIs
- /// </summary>
- internal static partial class MediaVision
- {
- /// <summary>
- /// Interop for surveillance APIs
- /// </summary>
- 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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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;
- }
- }
- }
-}
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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);
- }
- }
-}
+++ /dev/null
-/*
- * 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<VideoFileFormat> 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<VideoCodec> 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<AudioCodec> 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
+++ /dev/null
-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
<projectUrl>https://www.tizen.org/</projectUrl>
<iconUrl>https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png</iconUrl>
<copyright>© Samsung Electronics Co., Ltd All Rights Reserved</copyright>
- <description>Provides the Multimedia API for Tizen.Net</description>
+ <description>Common classes and interfaces for the Tizen.Net Multimedia</description>
<dependencies>
<dependency id="Tizen" version="1.0.2" />
<dependency id="ElmSharp" version="1.0.14" />
+++ /dev/null
-/*
- * 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
-{
- /// <summary>
- /// Audio codec
- /// </summary>
- public enum AudioCodec
- {
- /// <summary>
- /// No trans-coding for audio
- /// </summary>
- None = Interop.AudioCodec.None,
- /// <summary>
- /// AAC
- /// </summary>
- Aac = Interop.AudioCodec.Aac,
- /// <summary>
- /// AMRNB
- /// </summary>
- Amrnb = Interop.AudioCodec.Amrnb,
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * 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
-{
- /// <summary>
- /// Video codec for trans-coding
- /// </summary>
- public enum VideoCodec
- {
- /// <summary>
- /// No trans-coding for video
- /// </summary>
- None = Interop.VideoCodec.None,
- /// <summary>
- /// MPEG4
- /// </summary>
- Mpeg4 = Interop.VideoCodec.Mpeg4,
- /// <summary>
- /// H263
- /// </summary>
- H263 = Interop.VideoCodec.H263,
- /// <summary>
- /// H264
- /// </summary>
- H264 = Interop.VideoCodec.H264,
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * 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
-{
- /// <summary>
- /// Video trans-coding utility
- /// </summary>
- 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;
-
- /// <summary>
- /// Creates Video trans-coder
- /// </summary>
- /// <exception cref="OutOfMemoryException">Thrown if framework failed to allocate memory</exception>
- /// <exception cref="NotSupportedException">Thrown if video trans-coding is not supported in device</exception>
- public VideoTranscoder()
- {
- _handle = new Interop.VideoTranscoderHandle();
- }
-
- /// <summary>
- /// Indicate if trans-coder is busy trans-coding
- /// </summary>
- public bool IsBusy { get; private set; }
-
- /// <summary>
- /// Indicates if accurate mode is enabled
- /// </summary>
- /// <remarks>Default is false, if set to true, next trans-coding will start from accurate frame for given the duration, otherwise from nearest i-frame</remarks>
- public bool IsAccurateModeEnabled { get; set; } = DefaultAccurateModeEnabled;
-
- /// <summary>
- /// Audio codec for encoding stream for next trans-coding
- /// </summary>
- /// <remarks>Default is AudioCodec.Aac</remarks>
- public AudioCodec AudioCodec { get; set; } = DetaultAudioCodec;
-
- /// <summary>
- /// Video codec for encoding stream for next trans-coding
- /// </summary>
- /// <remarks>Default is VideoCodec.Mpeg4</remarks>
- public VideoCodec VideoCodec { get; set; } = DetaultVideoCodec;
-
- /// <summary>
- /// File format for trans-coding media stream for next trans-coding
- /// </summary>
- /// <remarks>Default is VideoFileFormat.ThreeGp</remarks>
- public VideoFileFormat Format { get; set; } = DetaultFileFormat;
-
- /// <summary>
- /// Media resolution for next trans-coding
- /// </summary>
- /// <remarks>
- /// 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)
- /// </remarks>
- /// <exception cref="ArgumentOutOfRangeException">Thrown if value is not in valid range</exception>
- 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;
- }
- }
-
- /// <summary>
- /// Frame rate, in range [5-30] for next trans-coding
- /// </summary>
- /// <remarks>
- /// Default value is 0
- /// If fps is set 0, the default is original fps from source.
- /// </remarks>
- /// <exception cref="ArgumentOutOfRangeException">Thrown if value is not in valid range</exception>
- public int Fps
- {
- get { return _fps; }
- set
- {
- ValidateInputRange(value, 5, 30, "Fps");
- _fps = value;
- }
- }
-
- /// <summary>
- /// Supported audio codecs
- /// </summary>
- public IEnumerable<AudioCodec> SupportedAudioCodecs
- {
- get
- {
- var audioCodecs = new List<AudioCodec>();
- _handle.ForeachSupportedAudioCodec((codec) => audioCodecs.Add((AudioCodec)codec));
- return audioCodecs;
- }
- }
-
- /// <summary>
- /// Supported video codecs
- /// </summary>
- public IEnumerable<VideoCodec> SupportedVideoCodecs
- {
- get
- {
- var videoCodecs = new List<VideoCodec>();
- _handle.ForeachSupportedVideoCodec((codec) => videoCodecs.Add((VideoCodec)codec));
- return videoCodecs;
- }
- }
-
- /// <summary>
- /// Supported video file formats
- /// </summary>
- public IEnumerable<VideoFileFormat> SupportedVideoFileFormats
- {
- get
- {
- var videoFileFormats = new List<VideoFileFormat>();
- _handle.ForeachSupportedFileFormat((codec) => videoFileFormats.Add((VideoFileFormat)codec));
- return videoFileFormats;
- }
- }
-
- /// <summary>
- /// Trans-code video
- /// </summary>
- /// <param name="sourceFilePath">Source video file to trans-code</param>
- /// <param name="startPosition">Position to start trans-code in seconds</param>
- /// <param name="totalDuration">Total duration to trans-code, in seconds, if set to 0, trans-coding happens until end of the video</param>
- /// <param name="outputFile">Output file path</param>
- /// <param name="progress">progress update provider</param>
- /// <param name="cancelToken">Cancellation token, to be used to cancel trans-coding</param>
- /// <privilege>http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage</privilege>
- /// <privilege>http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage</privilege>
- /// <exception cref="UnauthorizedAccessException">Thrown if application does not have required privilege</exception>
- /// <exception cref="ArgumentNullException">Thrown if sourceFilePath or outputFile is null</exception>
- /// <exception cref="System.IO.FileNotFoundException">Thrown if sourceFilePath does not exist</exception>
- /// <exception cref="NotSupportedException">Thrown if video file format is not supported</exception>
- /// <exception cref="InvalidOperationException">Thrown if Trans-coder is busy trans-coding previous file</exception>
- /// <exception cref="TaskCanceledException">Thrown if trans-coding is canceled</exception>
- /// <returns>Trans-coding task</returns>
- public Task TranscodeAsync(string sourceFilePath, ulong startPosition, ulong totalDuration, string outputFile, IProgress<int> 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<bool>();
- 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);
- }
-
- /// <summary>
- /// Trans-code video from start position in input file till end of file.
- /// </summary>
- /// <param name="sourceFilePath">Source video file to trans-code</param>
- /// <param name="startPosition">Position to start trans-code in seconds</param>
- /// <param name="outputFile">Output file path</param>
- /// <param name="progress">progress update provider</param>
- /// <param name="cancelToken">Cancellation token, to be used to cancel trans-coding</param>
- /// <privilege>http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage</privilege>
- /// <privilege>http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage</privilege>
- /// <exception cref="UnauthorizedAccessException">Thrown if application does not have required privilege</exception>
- /// <exception cref="ArgumentNullException">Thrown if sourceFilePath or outputFile is null</exception>
- /// <exception cref="System.IO.FileNotFoundException">Thrown if sourceFilePath does not exist</exception>
- /// <exception cref="NotSupportedException">Thrown if video file format is not supported</exception>
- /// <exception cref="InvalidOperationException">Thrown if Trans-coder is busy trans-coding previous file</exception>
- /// <exception cref="TaskCanceledException">Thrown if trans-coding is canceled</exception>
- /// <returns>Trans-coding task</returns>
- public Task TranscodeAsync(string sourceFilePath, ulong startPosition, string outputFile, IProgress<int> progress, CancellationToken cancelToken)
- {
- return TranscodeAsync(sourceFilePath, startPosition, 0, outputFile, progress, cancelToken);
- }
-
- /// <summary>
- /// Trans-code video
- /// </summary>
- /// <param name="sourceFilePath">Source video file to trans-code</param>
- /// <param name="startPosition">Position to start trans-code in seconds</param>
- /// <param name="duration">Total duration to trans-code, in seconds, if set to 0, trans-coding happens until end of the video</param>
- /// <param name="outputFile">Output file path</param>
- /// <param name="progress">progress update provider</param>
- /// <privilege>http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage</privilege>
- /// <privilege>http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage</privilege>
- /// <exception cref="UnauthorizedAccessException">Thrown if application does not have required privilege</exception>
- /// <exception cref="ArgumentNullException">Thrown if sourceFilePath or outputFile is null</exception>
- /// <exception cref="System.IO.FileNotFoundException">Thrown if sourceFilePath does not exist</exception>
- /// <exception cref="NotSupportedException">Thrown if video file format is not supported</exception>
- /// <exception cref="InvalidOperationException">Thrown if Trans-coder is busy trans-coding previous file</exception>
- /// <returns>Trans-coding task</returns>
- public Task TranscodeAsync(string sourceFilePath, ulong startPosition, ulong duration, string outputFile, IProgress<int> progress)
- {
- return TranscodeAsync(sourceFilePath, startPosition, duration, outputFile, progress, CancellationToken.None);
- }
-
- /// <summary>
- /// Trans-code video
- /// </summary>
- /// <param name="sourceFilePath">Source video file to trans-code</param>
- /// <param name="startPosition">Position to start trans-code in seconds</param>
- /// <param name="outputFile">Output file path</param>
- /// <param name="progress">progress update provider</param>
- /// <privilege>http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage</privilege>
- /// <privilege>http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage</privilege>
- /// <exception cref="UnauthorizedAccessException">Thrown if application does not have required privilege</exception>
- /// <exception cref="ArgumentNullException">Thrown if sourceFilePath or outputFile is null</exception>
- /// <exception cref="System.IO.FileNotFoundException">Thrown if sourceFilePath does not exist</exception>
- /// <exception cref="NotSupportedException">Thrown if video file format is not supported</exception>
- /// <exception cref="InvalidOperationException">Thrown if Trans-coder is busy trans-coding previous file</exception>
- /// <returns>Trans-coding task</returns>
- public Task TranscodeAsync(string sourceFilePath, ulong startPosition, string outputFile, IProgress<int> 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>(T actualValue, T min, T max, string paramName) where T : IComparable<T>
- {
- if (min.CompareTo(actualValue) == 1 || max.CompareTo(actualValue) == -1)
- {
- throw new ArgumentOutOfRangeException(paramName, actualValue, $"Valid Range [{min} - {max}]");
- }
- }
-
- internal static void ValidateInputRange<T>(T actualValue, Func<bool> 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