+++ /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 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);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_file_format")]
- internal static extern StreamRecorderErrorCode FileFormats(StreamRecorderHandle handle,
- FileFormatCallback callback, IntPtr userData = default(IntPtr));
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_audio_encoder")]
- internal static extern StreamRecorderErrorCode AudioEncoders(StreamRecorderHandle handle,
- AudioEncoderCallback callback, IntPtr userData = default(IntPtr));
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_video_encoder")]
- internal static extern StreamRecorderErrorCode VideoEncoders(StreamRecorderHandle handle,
- VideoEncoderCallback callback, IntPtr userData = default(IntPtr));
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_video_resolution")]
- internal static extern StreamRecorderErrorCode VideoResolution(StreamRecorderHandle handle,
- VideoResolutionCallback callback, IntPtr userData = default(IntPtr));
- }
-}
+++ /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(RecordingLimitType type, IntPtr userData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void RecordingStatusCallback(ulong elapsedTime, ulong fileSize, IntPtr userData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void NotifiedCallback(int previous, int current,
- StreamRecorderNotify notify, IntPtr userData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void RecorderErrorCallback(StreamRecorderErrorCode error,
- RecorderState current, IntPtr userData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void BufferConsumedCallback(IntPtr buffer, IntPtr userData);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_notify_cb")]
- internal static extern StreamRecorderErrorCode SetNotifiedCallback(StreamRecorderHandle handle,
- NotifiedCallback callback, IntPtr userData = default(IntPtr));
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_notify_cb")]
- internal static extern int UnsetNotifiedCallback(StreamRecorderHandle handle);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_status_cb")]
- internal static extern StreamRecorderErrorCode SetStatusChangedCallback(StreamRecorderHandle handle,
- RecordingStatusCallback callback, IntPtr userData = default(IntPtr));
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_recording_status_cb")]
- internal static extern int UnsetStatusChangedCallback(StreamRecorderHandle handle);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_limit_reached_cb")]
- internal static extern StreamRecorderErrorCode SetLimitReachedCallback(StreamRecorderHandle handle,
- RecordingLimitReachedCallback callback, IntPtr userData = default(IntPtr));
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_recording_limit_reached_cb")]
- internal static extern int UnsetLimitReachedCallback(StreamRecorderHandle handle);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_error_cb")]
- internal static extern StreamRecorderErrorCode SetErrorCallback(StreamRecorderHandle handle,
- RecorderErrorCallback callback, IntPtr userData = default(IntPtr));
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_error_cb")]
- internal static extern int UnsetErrorCallback(StreamRecorderHandle handle);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_buffer_consume_completed_cb")]
- internal static extern StreamRecorderErrorCode SetBufferConsumedCallback(StreamRecorderHandle handle,
- BufferConsumedCallback callback, IntPtr userData = default(IntPtr));
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_buffer_consume_completed_cb")]
- internal static extern int UnsetBufferConsumedCallback(StreamRecorderHandle handle);
- }
-}
+++ /dev/null
-using System;
-using System.Runtime.InteropServices;
-using Tizen.Multimedia;
-
-internal static partial class Interop
-{
- internal static partial class StreamRecorder
- {
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_filename")]
- internal static extern StreamRecorderErrorCode SetFileName(StreamRecorderHandle handle, string path);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_filename")]
- internal static extern int GetFileName(StreamRecorderHandle handle, out IntPtr path);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_file_format")]
- internal static extern StreamRecorderErrorCode SetFileFormat(StreamRecorderHandle handle,
- StreamRecorderFileFormat format);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_file_format")]
- internal static extern int GetFileFormat(StreamRecorderHandle handle, out int format);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_encoder")]
- internal static extern StreamRecorderErrorCode SetAudioEncoder(StreamRecorderHandle handle,
- StreamRecorderAudioCodec codec);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_encoder")]
- internal static extern int GetAudioEncoder(StreamRecorderHandle handle, out int codec);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_encoder")]
- internal static extern StreamRecorderErrorCode SetVideoEncoder(StreamRecorderHandle handle,
- StreamRecorderVideoCodec codec);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_encoder")]
- internal static extern int GetVideoEncoder(StreamRecorderHandle handle, out int codec);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_resolution")]
- internal static extern StreamRecorderErrorCode SetVideoResolution(StreamRecorderHandle handle,
- int width, int height);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_resolution")]
- internal static extern StreamRecorderErrorCode GetVideoResolution(StreamRecorderHandle handle,
- out int width, out int height);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_framerate")]
- internal static extern StreamRecorderErrorCode SetVideoFrameRate(StreamRecorderHandle handle, int framerate);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_framerate")]
- internal static extern int GetVideoFramerate(StreamRecorderHandle handle, out int framerate);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_source_format")]
- internal static extern StreamRecorderErrorCode SetVideoSourceFormat(StreamRecorderHandle handle,
- StreamRecorderVideoFormat format);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_source_format")]
- internal static extern int GetVideoSourceFormat(StreamRecorderHandle handle, out int format);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_limit")]
- internal static extern StreamRecorderErrorCode SetRecordingLimit(StreamRecorderHandle handle,
- RecordingLimitType type, int limit);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_recording_limit")]
- internal static extern int GetRecordingLimit(StreamRecorderHandle handle, int type, out int format);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_samplerate")]
- internal static extern StreamRecorderErrorCode SetAudioSampleRate(StreamRecorderHandle handle, int samplerate);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_samplerate")]
- internal static extern int GetAudioSampleRate(StreamRecorderHandle handle, out int samplerate);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_encoder_bitrate")]
- internal static extern StreamRecorderErrorCode SetAudioEncoderBitrate(StreamRecorderHandle handle, int bitrate);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_encoder_bitrate")]
- internal static extern int GetAudioEncoderBitrate(StreamRecorderHandle handle, out int bitrate);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_encoder_bitrate")]
- internal static extern StreamRecorderErrorCode SetVideoEncoderBitRate(StreamRecorderHandle handle, int bitrate);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_encoder_bitrate")]
- internal static extern int GetVideoEncoderBitrate(StreamRecorderHandle handle, out int bitrate);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_channel")]
- internal static extern StreamRecorderErrorCode SetAudioChannel(StreamRecorderHandle handle, int channel);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_channel")]
- internal static extern int GetAudioChannel(StreamRecorderHandle handle, out int channel);
- }
-}
+++ /dev/null
-using System;
-using System.Runtime.InteropServices;
-using Tizen.Multimedia;
-
-internal static partial class Interop
-{
- internal static partial class StreamRecorder
- {
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_create")]
- internal static extern StreamRecorderErrorCode Create(out StreamRecorderHandle handle);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_prepare")]
- internal static extern StreamRecorderErrorCode Prepare(StreamRecorderHandle handle);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unprepare")]
- internal static extern StreamRecorderErrorCode Unprepare(StreamRecorderHandle handle);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_start")]
- internal static extern StreamRecorderErrorCode Start(StreamRecorderHandle handle);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_pause")]
- internal static extern StreamRecorderErrorCode Pause(StreamRecorderHandle handle);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_commit")]
- internal static extern StreamRecorderErrorCode Commit(StreamRecorderHandle handle);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_cancel")]
- internal static extern StreamRecorderErrorCode Cancel(StreamRecorderHandle handle);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_push_stream_buffer")]
- internal static extern StreamRecorderErrorCode PushStreamBuffer(StreamRecorderHandle handle,
- IntPtr mediaPacketHandle);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_enable_source_buffer")]
- internal static extern StreamRecorderErrorCode EnableSourceBuffer(StreamRecorderHandle handle,
- StreamRecorderSourceType type);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_state")]
- internal static extern StreamRecorderErrorCode GetState(StreamRecorderHandle handle, out RecorderState state);
- }
-
- internal class StreamRecorderHandle : SafeHandle
- {
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_destroy")]
- private static extern StreamRecorderErrorCode Destroy(IntPtr handle);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_cancel")]
- private static extern StreamRecorderErrorCode Cancel(IntPtr handle);
-
- [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unprepare")]
- private static extern StreamRecorderErrorCode Unprepare(IntPtr handle);
-
- protected StreamRecorderHandle() : base(IntPtr.Zero, true)
- {
- }
-
- public override bool IsInvalid => handle == IntPtr.Zero;
-
- protected override bool ReleaseHandle()
- {
- try
- {
- Cancel(handle).Ignore(StreamRecorderErrorCode.InvalidState).ThrowIfError("Failed to cancel.");
- Unprepare(handle).Ignore(StreamRecorderErrorCode.InvalidState).ThrowIfError("Failed to unprepare.");
- Destroy(handle).ThrowIfError("Failed to destory.");
-
- return true;
- }
- catch (Exception e)
- {
- Tizen.Log.Debug(GetType().FullName, $"Failed to release native RecorderHandle; {e.Message}");
-
- return false;
- }
- }
- }
-}
+++ /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.Linq;
-using Native = Interop.StreamRecorder;
-
-namespace Tizen.Multimedia
-{
- public partial class StreamRecorder
- {
- internal void LoadCapabilities()
- {
- _videoCodecs = LoadVideoCodecs(this);
- _audioCodecs = LoadAudioCodecs(this);
- _fileFormats = LoadFileFormats(this);
- _videoResolutions = LoadResolutions(this);
- }
-
- private static IEnumerable<RecorderVideoCodec> LoadVideoCodecs(StreamRecorder recorder)
- {
- var result = new List<RecorderVideoCodec>();
- Native.VideoEncoderCallback callback = (codec, _) =>
- {
- result.Add(codec.ToRecorderEnum());
- return true;
- };
-
- Native.VideoEncoders(recorder.Handle, callback).ThrowIfError("Failed to get the supported video codecs.");
-
- return result.AsReadOnly();
- }
-
- private static IEnumerable<RecorderAudioCodec> LoadAudioCodecs(StreamRecorder recorder)
- {
- var result = new List<RecorderAudioCodec>();
-
- Native.AudioEncoders(recorder.Handle, (codec, _) =>
- {
- result.Add(codec.ToRecorderEnum());
- return true;
- }).ThrowIfError("Failed to get the supported audio codecs.");
-
- return result.AsReadOnly();
- }
-
- private static IEnumerable<RecorderFileFormat> LoadFileFormats(StreamRecorder recorder)
- {
- var result = new List<RecorderFileFormat>();
-
- Native.FileFormats(recorder.Handle, (fileFormat, _) =>
- {
- result.Add(fileFormat.ToRecorderEnum());
- return true;
- }).ThrowIfError("Failed to get the supported file formats.");
-
- return result.AsReadOnly();
- }
-
- private static IEnumerable<Size> LoadResolutions(StreamRecorder recorder)
- {
- List<Size> result = new List<Size>();
-
- Native.VideoResolutionCallback callback = (width, height, _) =>
- {
- result.Add(new Size(width, height));
- return true;
- };
-
- Native.VideoResolution(recorder.Handle, callback).
- ThrowIfError("Failed to get the supported video resolutions.");
-
- return result.AsReadOnly();
- }
-
- private IEnumerable<RecorderFileFormat> _fileFormats;
-
- /// <summary>
- /// Gets the file formats that the current device supports.
- /// </summary>
- /// <returns>An IEnumerable of <see cref="RecorderFileFormat"/> representing the supported file formats.</returns>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public IEnumerable<RecorderFileFormat> GetSupportedFileFormats() => _fileFormats;
-
- private IEnumerable<RecorderAudioCodec> _audioCodecs;
-
- /// <summary>
- /// Gets the audio codecs that the current device supports.
- /// </summary>
- /// <returns>An IEnumerable of <see cref="RecorderAudioCodec"/> representing the supported audio codecs.</returns>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public IEnumerable<RecorderAudioCodec> GetSupportedAudioCodecs() => _audioCodecs;
-
- private IEnumerable<RecorderVideoCodec> _videoCodecs;
-
- /// <summary>
- /// Gets the video codecs that the current device supports.
- /// </summary>
- /// <returns>An IEnumerable of <see cref="RecorderVideoCodec"/> representing the supported video codecs.</returns>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public IEnumerable<RecorderVideoCodec> GetSupportedVideoCodecs() => _videoCodecs;
-
- private IEnumerable<Size> _videoResolutions;
-
- /// <summary>
- /// Gets the video resolutions that the current device supports.
- /// </summary>
- /// <returns>An IEnumerable of <see cref="Size"/> representing the supported resolutions.</returns>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public IEnumerable<Size> GetSupportedVideoResolutions() => _videoResolutions;
-
- internal void ValidateFileFormat(RecorderFileFormat format)
- {
- if (_fileFormats.Contains(format) == false)
- {
- throw new NotSupportedException($"{format.ToString()} is not supported.");
- }
- }
-
- internal void ValidateAudioCodec(RecorderAudioCodec codec)
- {
- if (_audioCodecs.Contains(codec) == false)
- {
- throw new NotSupportedException($"{codec.ToString()} is not supported.");
- }
- }
-
- internal void ValidateVideoCodec(RecorderVideoCodec codec)
- {
- if (_videoCodecs.Contains(codec) == false)
- {
- throw new NotSupportedException($"{codec.ToString()} is not supported.");
- }
- }
-
- internal void ValidateVideoResolution(Size resolution)
- {
- if (_videoResolutions.Contains(resolution) == false)
- {
- throw new NotSupportedException($"Resolution({resolution.ToString()}) is not supported.");
- }
- }
- }
-}
\ 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 Native = Interop.StreamRecorder;
-
-namespace Tizen.Multimedia
-{
- /// <since_tizen> 3 </since_tizen>
- public partial class StreamRecorder
- {
- /// <summary>
- /// Occurs when <see cref="StreamRecorder"/> state is changed.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public event EventHandler<StreamRecorderStateChangedEventArgs> StateChanged;
-
-
- /// <summary>
- /// Occurs when a buffer had consumed completely.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public event EventHandler<StreamRecorderBufferConsumedEventArgs> BufferConsumed;
-
- /// <summary>
- /// Occurs when recording status is changed.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public event EventHandler<RecordingStatusChangedEventArgs> RecordingStatusChanged;
-
- /// <summary>
- /// Occurs when recording limit is reached.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public event EventHandler<RecordingLimitReachedEventArgs> RecordingLimitReached;
-
- /// <summary>
- /// Occurs when an error occurred during a recorder operation.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public event EventHandler<StreamRecorderErrorOccurredEventArgs> ErrorOccurred;
-
- private Native.RecordingLimitReachedCallback _recordingLimitReachedCallback;
- private Native.RecorderErrorCallback _recorderErrorCallback;
- private Native.RecordingStatusCallback _recordingStatusCallback;
- private Native.BufferConsumedCallback _bufferConsumedCallback;
- private Native.NotifiedCallback _notifiedCallback;
-
- private void RegisterStreamRecorderNotifiedEvent()
- {
- _notifiedCallback = (previous, current, notify, _) =>
- {
- if (previous == 0)
- {
- return;
- }
-
- StateChanged?.Invoke(this, new StreamRecorderStateChangedEventArgs(
- (RecorderState)previous, (RecorderState)current));
- };
-
- Native.SetNotifiedCallback(_handle, _notifiedCallback).
- ThrowIfError("Failed to initialize state changed event.");
- }
-
- private void RegisterBufferConsumedEvent()
- {
- _bufferConsumedCallback = (lockedPacketHandle, _) =>
- {
- MediaPacket packet = null;
-
- // Lock must be disposed here, note that the packet won't be disposed.
- using (MediaPacket.Lock packetLock =
- MediaPacket.Lock.FromHandle(lockedPacketHandle))
- {
- Debug.Assert(packetLock != null);
-
- packet = packetLock.MediaPacket;
- }
-
- BufferConsumed?.Invoke(this, new StreamRecorderBufferConsumedEventArgs(packet));
- };
-
- Native.SetBufferConsumedCallback(_handle, _bufferConsumedCallback).
- ThrowIfError("Failed to initialize buffer consumed event.");
- }
-
- private void RegisterRecordingStatusChangedEvent()
- {
- _recordingStatusCallback = (elapsedTime, fileSize, _) =>
- {
- RecordingStatusChanged?.Invoke(this, new RecordingStatusChangedEventArgs((long)elapsedTime, (long)fileSize));
- };
- Native.SetStatusChangedCallback(_handle, _recordingStatusCallback).
- ThrowIfError("Failed to initialize status changed event.");
- }
-
- private void RegisterRecordingLimitReachedEvent()
- {
- _recordingLimitReachedCallback = (type, _) =>
- {
- RecordingLimitReached?.Invoke(this, new RecordingLimitReachedEventArgs(type));
- };
-
- Native.SetLimitReachedCallback(_handle, _recordingLimitReachedCallback).
- ThrowIfError("Failed to initialize limit reached event.");
- }
-
- private void RegisterRecordingErrorOccurredEvent()
- {
- _recorderErrorCallback = (error, currentState, _) =>
- {
- ErrorOccurred?.Invoke(this, new StreamRecorderErrorOccurredEventArgs(
- error == StreamRecorderErrorCode.OutOfStorage ?
- StreamRecorderError.OutOfStorage : StreamRecorderError.InternalError, currentState));
- };
- Native.SetErrorCallback(_handle, _recorderErrorCallback).
- ThrowIfError("Failed to set error callback");
- }
- }
-}
+++ /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.Linq;
-using NativeHandle = Interop.StreamRecorderHandle;
-using Native = Interop.StreamRecorder;
-
-namespace Tizen.Multimedia
-{
- /// <summary>
- /// Provides the ability to record user buffer from application.
- /// </summary>
- /// <seealso cref="Recorder"/>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public partial class StreamRecorder : IDisposable
- {
- private NativeHandle _handle;
- private bool _disposed = false;
-
- private bool _audioEnabled;
- private bool _videoEnabled;
- private StreamRecorderVideoFormat _sourceFormat;
- private const string Feature = "http://tizen.org/feature/multimedia.stream_recorder";
-
- private static bool IsSupported()
- {
- return System.Information.TryGetValue(Feature, out bool isSupported) && isSupported;
- }
-
- /// <summary>
- /// Initialize a new instance of the <see cref="StreamRecorder"/> class.
- /// </summary>
- /// <exception cref="NotSupportedException">The feature is not supported.</exception>
- /// <since_tizen> 3 </since_tizen>
- /// <feature> http://tizen.org/feature/multimedia.stream_recorder </feature>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public StreamRecorder()
- {
- if (IsSupported() == false)
- {
- throw new NotSupportedException(
- $"The feature({Feature}) is not supported on the current device.");
- }
-
- try
- {
- Native.Create(out _handle).ThrowIfError("Failed to create stream recorder.");
- }
- catch (TypeLoadException)
- {
- throw new NotSupportedException("StreamRecorder is not supported.");
- }
-
- LoadCapabilities();
-
- RegisterStreamRecorderNotifiedEvent();
- RegisterBufferConsumedEvent();
- RegisterRecordingStatusChangedEvent();
- RegisterRecordingErrorOccurredEvent();
- RegisterRecordingLimitReachedEvent();
- }
-
- internal NativeHandle Handle
- {
- get
- {
- if (_disposed)
- {
- throw new ObjectDisposedException(nameof(StreamRecorder));
- }
-
- return _handle;
- }
- }
-
- /// <summary>
- /// Gets the current state of the stream recorder.
- /// </summary>
- /// <exception cref="ObjectDisposedException">The <see cref="StreamRecorder"/> has already been disposed.</exception>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public RecorderState State
- {
- get
- {
- Native.GetState(Handle, out var val).ThrowIfError("Failed to get the stream recorder state.");
-
- return val;
- }
- }
-
- private void ValidateState(params RecorderState[] required)
- {
- Debug.Assert(required.Length > 0);
-
- var curState = State;
- if (!required.Contains(curState))
- {
- throw new InvalidOperationException($"The stream recorder is not in a valid state. " +
- $"Current State : { curState }, Valid State : { string.Join(", ", required) }.");
- }
- }
-
- #region Operation methods
- /// <summary>
- /// Prepares the stream recorder with the specified options.
- /// </summary>
- /// <remarks>The recorder must be <see cref="RecorderState.Idle"/>.</remarks>
- /// <param name="options">The options for recording.</param>
- /// <exception cref="InvalidOperationException">The recorder is not in the valid state.</exception>
- /// <exception cref="ArgumentException">Both <see cref="StreamRecorderOptions.Audio"/> and
- /// <see cref="StreamRecorderOptions.Video"/> are null.
- /// </exception>
- /// <exception cref="NotSupportedException"><paramref name="options"/> contains a value which is not supported.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="StreamRecorder"/> has already been disposed.</exception>
- /// <seealso cref="Unprepare"/>
- /// <seealso cref="Start"/>
- /// <seealso cref="StreamRecorderOptions"/>
- /// <seealso cref="StreamRecorderAudioOptions"/>
- /// <seealso cref="StreamRecorderVideoOptions"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public void Prepare(StreamRecorderOptions options)
- {
- if (options == null)
- {
- throw new ArgumentNullException(nameof(options));
- }
-
- ValidateState(RecorderState.Idle);
-
- options.Apply(this);
-
- Native.Prepare(Handle).ThrowIfError("Failed to prepare stream recorder.");
-
- _audioEnabled = options.Audio != null;
- _videoEnabled = options.Video != null;
-
- if (options.Video != null)
- {
- _sourceFormat = options.Video.SourceFormat;
- }
- }
-
- /// <summary>
- /// Unprepares the stream recorder.
- /// </summary>
- /// <remarks>
- /// The recorder state must be <see cref="RecorderState.Ready"/> state by
- /// <see cref="Prepare(StreamRecorderOptions)"/>, <see cref="Cancel"/> and <see cref="Commit"/>.<br/>
- /// The recorder state will be <see cref="RecorderState.Idle"/>.<br/>
- /// <br/>
- /// It has no effect if the recorder is already in the <see cref="RecorderState.Idle"/> state.
- /// </remarks>
- /// <exception cref="InvalidOperationException">The recorder is not in the valid state.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="StreamRecorder"/> has already been disposed.</exception>
- /// <seealso cref="Prepare"/>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public void Unprepare()
- {
- if (State == RecorderState.Idle)
- {
- return;
- }
-
- ValidateState(RecorderState.Ready);
-
- Native.Unprepare(Handle).ThrowIfError("Failed to reset the stream recorder.");
- }
-
- /// <summary>
- /// Starts recording.
- /// </summary>
- /// <remarks>
- /// The recorder state must be <see cref="RecorderState.Ready"/> state by
- /// <see cref="Prepare(StreamRecorderOptions)"/> or
- /// <see cref="RecorderState.Paused"/> state by <see cref="Pause"/>.<br/>
- /// <br/>
- /// It has no effect if the recorder is already in the <see cref="RecorderState.Recording"/> state.
- /// </remarks>
- /// <exception cref="InvalidOperationException">The recorder is not in the valid state.</exception>
- /// <exception cref="UnauthorizedAccessException">The access of the resources can not be granted.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="StreamRecorder"/> has already been disposed.</exception>
- /// <seealso cref="Pause"/>
- /// <seealso cref="Commit"/>
- /// <seealso cref="Cancel"/>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public void Start()
- {
- if (State == RecorderState.Recording)
- {
- return;
- }
-
- ValidateState(RecorderState.Ready, RecorderState.Paused);
-
- Native.Start(Handle).ThrowIfError("Failed to start the stream recorder.");
- }
-
- /// <summary>
- /// Pauses recording.
- /// </summary>
- /// <remarks>
- /// Recording can be resumed with <see cref="Start"/>.<br/>
- /// <br/>
- /// The recorder state must be <see cref="RecorderState.Recording"/> state by <see cref="Start"/>.<br/>
- /// <br/>
- /// It has no effect if the recorder is already in the <see cref="RecorderState.Paused"/> state.
- /// </remarks>
- /// <exception cref="InvalidOperationException">The recorder is not in the valid state.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="StreamRecorder"/> has already been disposed.</exception>
- /// <seealso cref="Start"/>
- /// <seealso cref="Commit"/>
- /// <seealso cref="Cancel"/>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public void Pause()
- {
- if (State == RecorderState.Paused)
- {
- return;
- }
-
- ValidateState(RecorderState.Recording);
-
- Native.Pause(Handle).ThrowIfError("Failed to pause the stream recorder.");
- }
-
- /// <summary>
- /// Stops recording and saves the result.
- /// </summary>
- /// <remarks>
- /// The recorder state must be <see cref="RecorderState.Recording"/> state by <see cref="Start"/> or
- /// <see cref="RecorderState.Paused"/> state by <see cref="Pause"/>.<br/>
- /// <br/>
- /// The recorder state will be <see cref="RecorderState.Ready"/> after commit.
- /// <para>
- /// http://tizen.org/privilege/mediastorage is needed if the save path are relevant to media storage.
- /// http://tizen.org/privilege/externalstorage is needed if the save path are relevant to external storage.
- /// </para>
- /// </remarks>
- /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
- /// <privilege>http://tizen.org/privilege/externalstorage</privilege>
- /// <exception cref="InvalidOperationException">The recorder is not in the valid state.</exception>
- /// <exception cref="UnauthorizedAccessException">The access to the resources can not be granted.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="StreamRecorder"/> has already been disposed.</exception>
- /// <seealso cref="Start"/>
- /// <seealso cref="Pause"/>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public void Commit()
- {
- ValidateState(RecorderState.Paused, RecorderState.Recording);
-
- Native.Commit(Handle).ThrowIfError("Failed to commit.");
- }
-
- /// <summary>
- /// Cancels recording.
- /// The recording data is discarded and not written.
- /// </summary>
- /// <remarks>
- /// The recorder state must be <see cref="RecorderState.Recording"/> state by <see cref="Start"/> or
- /// <see cref="RecorderState.Paused"/> state by <see cref="Pause"/>.
- /// </remarks>
- /// <exception cref="InvalidOperationException">The recorder is not in the valid state.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="StreamRecorder"/> has already been disposed.</exception>
- /// <seealso cref="Start"/>
- /// <seealso cref="Pause"/>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public void Cancel()
- {
- ValidateState(RecorderState.Paused, RecorderState.Recording);
-
- Native.Cancel(Handle).ThrowIfError("Failed to cancel recording.");
- }
-
- private static bool AreVideoTypesMatched(StreamRecorderVideoFormat videoFormat, MediaFormatVideoMimeType mimeType)
- {
- return (videoFormat == StreamRecorderVideoFormat.Nv12 && mimeType == MediaFormatVideoMimeType.NV12) ||
- (videoFormat == StreamRecorderVideoFormat.Nv21 && mimeType == MediaFormatVideoMimeType.NV21) ||
- (videoFormat == StreamRecorderVideoFormat.I420 && mimeType == MediaFormatVideoMimeType.I420);
- }
-
- /// <summary>
- /// Pushes a packet as recording raw data.
- /// </summary>
- /// <param name="packet">An audio or video packet to record.</param>
- /// <remarks>
- /// The recorder state must be <see cref="RecorderState.Recording"/> state by <see cref="Start"/>.
- /// </remarks>
- /// <exception cref="InvalidOperationException">
- /// The recorder is not in the valid state.<br/>
- /// -or-<br/>
- /// <paramref name="packet"/> is an audio packet but audio recording is not enabled(See <see cref="StreamRecorderOptions.Audio"/>).<br/>
- /// -or-<br/>
- /// <paramref name="packet"/> is a video packet but video recording is not enabled(See <see cref="StreamRecorderOptions.Video"/>).<br/>
- /// -or-<br/>
- /// <paramref name="packet"/> is a video packet but the <see cref="VideoMediaFormat.MimeType"/> does not match the video source format.<br/>
- /// -or-<br/>
- /// An internal error occurs.
- /// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="StreamRecorder"/> has already been disposed.</exception>
- /// <see cref="Prepare(StreamRecorderOptions)"/>
- /// <seealso cref="StreamRecorderOptions.Audio"/>
- /// <seealso cref="StreamRecorderOptions.Video"/>
- /// <seealso cref="StreamRecorderVideoOptions.SourceFormat"/>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public void PushBuffer(MediaPacket packet)
- {
- if (packet == null)
- {
- throw new ArgumentNullException(nameof(packet));
- }
-
- ValidateState(RecorderState.Recording);
-
- switch (packet.Format.Type)
- {
- case MediaFormatType.Audio:
- if (_audioEnabled == false)
- {
- throw new InvalidOperationException("Audio option is not set.");
- }
- break;
-
- case MediaFormatType.Video:
- if (_videoEnabled == false)
- {
- throw new InvalidOperationException("Video option is not set.");
- }
-
- if (AreVideoTypesMatched(_sourceFormat, (packet.Format as VideoMediaFormat).MimeType) == false)
- {
- throw new InvalidOperationException("Video format does not match.");
- }
-
- break;
-
- default:
- throw new ArgumentException("Packet is not valid.");
- }
-
- Native.PushStreamBuffer(Handle, MediaPacket.Lock.Get(packet).GetHandle())
- .ThrowIfError("Failed to push buffer.");
- }
-
- #endregion
-
- #region Dispose support
- /// <summary>
- /// Release any unmanaged resources used by this object.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public void Dispose()
- {
- Dispose(true);
- }
-
- /// <summary>
- /// Releases the resources used by the StreamRecorder.
- /// </summary>
- /// <param name="disposing">
- /// true to release both managed and unmanaged resources; false to release only unmanaged resources.
- /// </param>
- /// <since_tizen> 3 </since_tizen>
- protected virtual void Dispose(bool disposing)
- {
- if (!_disposed)
- {
- _handle?.Dispose();
-
- _disposed = true;
- }
- }
- #endregion
- }
-}
+++ /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 Native = Interop.StreamRecorder;
-
-namespace Tizen.Multimedia
-{
- /// <summary>
- /// Specifies the options associated with audio recording.
- /// </summary>
- /// <seealso cref="StreamRecorder"/>
- /// <seealso cref="StreamRecorderOptions"/>
- /// <seealso cref="StreamRecorderVideoOptions"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public class StreamRecorderAudioOptions
- {
- private const int DefaultSampleRate = 0;
- private const int DefaultBitRate = 128000;
- private const int DefaultChannels = 2;
-
- /// <summary>
- /// Initialize a new instance of the <see cref="StreamRecorderAudioOptions"/> class with the specified codec.
- /// </summary>
- /// <param name="codec">The <see cref="RecorderAudioCodec"/> for encoding audio stream.</param>
- /// <remarks>
- /// <see cref="SampleRate"/>, <see cref="BitRate"/> and <see cref="Channels"/> will be set as default.
- /// </remarks>
- /// <exception cref="ArgumentException"><paramref name="codec"/> is not valid.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public StreamRecorderAudioOptions(RecorderAudioCodec codec) :
- this(codec, DefaultSampleRate, DefaultBitRate, DefaultChannels)
- {
- }
-
- /// <summary>
- /// Initialize a new instance of the <see cref="StreamRecorderAudioOptions"/> class with the specified
- /// codec, sample rate, bit rate, and channel value.
- /// </summary>
- /// <param name="codec">The <see cref="RecorderAudioCodec"/> for encoding audio stream.</param>
- /// <param name="sampleRate">The sample rate for encoding audio stream.</param>
- /// <param name="bitRate">The bit rate for encoding audio stream.</param>
- /// <param name="channels">The number of channels for encoding audio stream.</param>
- /// <exception cref="ArgumentException"><paramref name="codec"/> is not valid.</exception>
- /// <exception cref="ArgumentOutOfRangeException">
- /// <paramref name="sampleRate"/> is less than zero.<br/>
- /// -or-<br/>
- /// <paramref name="bitRate"/> is less than or equal to zero.<br/>
- /// -or-<br/>
- /// <paramref name="channels"/> is less than or equal to zero.
- /// </exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public StreamRecorderAudioOptions(RecorderAudioCodec codec, int sampleRate, int bitRate, int channels)
- {
- Codec = codec;
- SampleRate = sampleRate;
- BitRate = bitRate;
- Channels = channels;
- }
-
- private RecorderAudioCodec _codec;
-
- /// <summary>
- /// Gets or sets the audio codec for encoding an audio stream.
- /// </summary>
- /// <value>The codec for audio stream recording.</value>
- /// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
- /// <seealso cref="StreamRecorder.GetSupportedAudioCodecs"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public RecorderAudioCodec Codec
- {
- get => _codec;
- set
- {
- ValidationUtil.ValidateEnum(typeof(RecorderAudioCodec), value, nameof(value));
-
- if (value == RecorderAudioCodec.None)
- {
- throw new ArgumentException("Audio codec can't be None.");
- }
-
- _codec = value;
- }
- }
-
- private int _sampleRate;
-
- /// <summary>
- /// Gets or sets the sampling rate of the audio stream in hertz.
- /// </summary>
- /// <remarks>If the value is zero, the sample rate will be decided based on input buffers.</remarks>
- /// <value>The sample rate value for stream recorder. The default is zero.</value>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is less than zero.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public int SampleRate
- {
- get => _sampleRate;
- set
- {
- if (value < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(value), value,
- "Sample rate can't be less than or equal to zero.");
- }
-
- _sampleRate = value;
- }
- }
-
- private int _bitRate;
-
- /// <summary>
- /// Gets or sets the bit rate of the audio encoder in bits per second.
- /// </summary>
- /// <value>The bit rate value for audio stream recording. The default is 128000.</value>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is less than or equal to zero.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public int BitRate
- {
- get => _bitRate;
- set
- {
- if (value <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(value), value,
- "Bit rate can't be less than or equal to zero.");
- }
-
- _bitRate = value;
- }
- }
-
- private int _channels;
-
- /// <summary>
- /// Gets or sets the number of audio channels.
- /// </summary>
- /// <value>The number of audio channels for audio stream recording. The default is 2.</value>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is less than or equal to zero.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public int Channels
- {
- get => _channels;
- set
- {
- if (value <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(value), value,
- "Channels can't be less than or equal to zero.");
- }
-
- _channels = value;
- }
- }
-
- internal void Apply(StreamRecorder recorder)
- {
- recorder.ValidateAudioCodec(Codec);
-
- Native.SetAudioEncoder(recorder.Handle, Codec.ToStreamRecorderEnum()).
- ThrowIfError("Failed to set audio codec.");
-
- Native.SetAudioSampleRate(recorder.Handle, SampleRate).
- ThrowIfError("Failed to set audio sample rate.");
-
- Native.SetAudioEncoderBitrate(recorder.Handle, BitRate).
- ThrowIfError("Failed to set audio bit rate.");
-
- Native.SetAudioChannel(recorder.Handle, Channels).
- ThrowIfError("Failed to set audio channels.");
- }
- }
-
-}
+++ /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
-{
-
- /// <summary>
- /// Provides data for the <see cref="StreamRecorder.BufferConsumed"/> event.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public class StreamRecorderBufferConsumedEventArgs : EventArgs
- {
- internal StreamRecorderBufferConsumedEventArgs(MediaPacket packet)
- {
- Packet = packet;
- }
-
- /// <summary>
- /// Gets the packet that has consumed.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public MediaPacket Packet { get; }
- }
-}
+++ /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;
-
-namespace Tizen.Multimedia
-{
-
- /// <summary>
- /// Specifies errors for <see cref="StreamRecorder"/>/
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public enum StreamRecorderError
- {
- /// <summary>
- /// Internal error.
- /// </summary>
- InternalError = StreamRecorderErrorCode.InvalidOperation,
- /// <summary>
- /// Out of storage.
- /// </summary>
- OutOfStorage = StreamRecorderErrorCode.OutOfStorage
- }
-
- /// <summary>
- /// Specifies the video source formats for <see cref="StreamRecorder"/>.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public enum StreamRecorderVideoFormat
- {
- /// <summary>
- /// Nv12 format.
- /// </summary>
- Nv12,
- /// <summary>
- /// Nv21 format.
- /// </summary>
- Nv21,
- /// <summary>
- /// I420 format.
- /// </summary>
- I420
- }
-
- #region Internal enums
-
- /// <summary>
- /// Enumeration for Audio Codec.
- /// </summary>
- internal enum StreamRecorderAudioCodec
- {
- /// <summary>
- /// AMR codec.
- /// </summary>
- Amr = 0,
- /// <summary>
- /// AAC codec.
- /// </summary>
- Aac,
- /// <summary>
- /// PCM codec.
- /// </summary>
- Pcm
- }
-
- /// <summary>
- /// Enumeration for the file container format.
- /// </summary>
- internal enum StreamRecorderFileFormat
- {
- /// <summary>
- /// 3GP file format.
- /// </summary>
- ThreeGp,
- /// <summary>
- /// MP4 file format.
- /// </summary>
- Mp4,
- /// <summary>
- /// AMR file format.
- /// </summary>
- Amr,
- /// <summary>
- /// ADTS file format.
- /// </summary>
- Adts,
- /// <summary>
- /// WAV file format.
- /// </summary>
- Wav
- }
-
- /// <summary>
- /// Enumeration for the recorder notify type.
- /// </summary>
- internal enum StreamRecorderNotify
- {
- /// <summary>
- /// None.
- /// </summary>
- None = 0,
- /// <summary>
- /// State changed.
- /// </summary>
- StateChanged
- }
-
- /// <summary>
- /// Enumeration for video codec.
- /// </summary>
- internal enum StreamRecorderVideoCodec
- {
- /// <summary>
- /// H263 codec.
- /// </summary>
- H263,
- /// <summary>
- /// MPEG4 codec.
- /// </summary>
- Mpeg4
- }
-
- /// <summary>
- /// Enumeration for source type.
- /// </summary>
- internal enum StreamRecorderSourceType
- {
- /// <summary>
- /// Video source
- /// </summary>
- Video,
- /// <summary>
- /// Audio source
- /// </summary>
- Audio,
- /// <summary>
- /// Audio/Video both
- /// </summary>
- VideoAudio
- }
-
- internal static class StreamRecorderEnumExtensions
- {
- internal static RecorderVideoCodec ToRecorderEnum(this StreamRecorderVideoCodec value)
- {
- switch (value)
- {
- case StreamRecorderVideoCodec.H263:
- return RecorderVideoCodec.H263;
-
- case StreamRecorderVideoCodec.Mpeg4:
- return RecorderVideoCodec.Mpeg4;
-
- default:
- break;
- }
-
- Debug.Fail("Unknown video codec value.");
- return 0;
- }
-
- internal static StreamRecorderVideoCodec ToStreamRecorderEnum(this RecorderVideoCodec value)
- {
- switch (value)
- {
- case RecorderVideoCodec.H263:
- return StreamRecorderVideoCodec.H263;
-
- case RecorderVideoCodec.Mpeg4:
- return StreamRecorderVideoCodec.Mpeg4;
-
- default:
- break;
- }
-
- throw new NotSupportedException($"{value.ToString()} is not supported.");
- }
-
-
- internal static RecorderAudioCodec ToRecorderEnum(this StreamRecorderAudioCodec value)
- {
- switch (value)
- {
- case StreamRecorderAudioCodec.Aac:
- return RecorderAudioCodec.Aac;
-
- case StreamRecorderAudioCodec.Amr:
- return RecorderAudioCodec.Amr;
-
- case StreamRecorderAudioCodec.Pcm:
- return RecorderAudioCodec.Pcm;
-
- default:
- break;
- }
-
- Debug.Fail("Unknown audio codec value.");
- return 0;
- }
-
-
- internal static StreamRecorderAudioCodec ToStreamRecorderEnum(this RecorderAudioCodec value)
- {
- switch (value)
- {
- case RecorderAudioCodec.Aac:
- return StreamRecorderAudioCodec.Aac;
-
- case RecorderAudioCodec.Amr:
- return StreamRecorderAudioCodec.Amr;
-
- case RecorderAudioCodec.Pcm:
- return StreamRecorderAudioCodec.Pcm;
-
- default:
- break;
- }
-
- throw new NotSupportedException($"{value.ToString()} is not supported.");
- }
-
-
- internal static RecorderFileFormat ToRecorderEnum(this StreamRecorderFileFormat value)
- {
- switch (value)
- {
- case StreamRecorderFileFormat.ThreeGp:
- return RecorderFileFormat.ThreeGp;
-
- case StreamRecorderFileFormat.Mp4:
- return RecorderFileFormat.Mp4;
-
- case StreamRecorderFileFormat.Amr:
- return RecorderFileFormat.Amr;
-
- case StreamRecorderFileFormat.Adts:
- return RecorderFileFormat.Adts;
-
- case StreamRecorderFileFormat.Wav:
- return RecorderFileFormat.Wav;
-
- default:
- break;
- }
-
- Debug.Fail("Unknown file format value.");
- return 0;
- }
-
-
- internal static StreamRecorderFileFormat ToStreamRecorderEnum(this RecorderFileFormat value)
- {
- switch (value)
- {
- case RecorderFileFormat.ThreeGp:
- return StreamRecorderFileFormat.ThreeGp;
-
- case RecorderFileFormat.Mp4:
- return StreamRecorderFileFormat.Mp4;
-
- case RecorderFileFormat.Amr:
- return StreamRecorderFileFormat.Amr;
-
- case RecorderFileFormat.Adts:
- return StreamRecorderFileFormat.Adts;
-
- case RecorderFileFormat.Wav:
- return StreamRecorderFileFormat.Wav;
-
- default:
- break;
- }
-
- throw new NotSupportedException($"{value.ToString()} is not supported.");
- }
- }
- #endregion
-}
+++ /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 Tizen.Internals.Errors;
-
-namespace Tizen.Multimedia
-{
- internal enum StreamRecorderErrorCode
- {
- None = ErrorCode.None,
- InvalidParameter = ErrorCode.InvalidParameter,
- TizenErrorStreamRecorder = -0x01A10000,
- InvalidState = TizenErrorStreamRecorder | 0x01,
- OutOfMemory = ErrorCode.OutOfMemory,
- InvalidOperation = ErrorCode.InvalidOperation,
- OutOfStorage = TizenErrorStreamRecorder | 0x02,
- PermissionDenied = ErrorCode.PermissionDenied,
- NotSupported = ErrorCode.NotSupported,
- }
-
- internal static class StreamRecorderErrorExtensions
- {
- internal static StreamRecorderErrorCode Ignore(this StreamRecorderErrorCode errorCode, StreamRecorderErrorCode ignore)
- {
- return (ignore == errorCode) ? StreamRecorderErrorCode.None : errorCode;
- }
-
- internal static void ThrowIfError(this StreamRecorderErrorCode errorCode, string errorMessage)
- {
- if (errorCode == StreamRecorderErrorCode.None)
- {
- return;
- }
-
- switch (errorCode)
- {
- case StreamRecorderErrorCode.InvalidParameter:
- throw new ArgumentException(errorMessage);
-
- case StreamRecorderErrorCode.OutOfMemory:
- throw new OutOfMemoryException(errorMessage);
-
- case StreamRecorderErrorCode.PermissionDenied:
- throw new UnauthorizedAccessException(errorMessage);
-
- case StreamRecorderErrorCode.NotSupported:
- throw new NotSupportedException(errorMessage);
-
- case StreamRecorderErrorCode.InvalidState:
- case StreamRecorderErrorCode.InvalidOperation:
- throw new InvalidOperationException(errorMessage);
-
- case StreamRecorderErrorCode.OutOfStorage:
- throw new IOException(errorMessage);
-
- default:
- Log.Error("Tizen.Multimedia.StreamRecorder", $"Unknown error : {errorCode.ToString()}");
- break;
- }
- }
- }
-}
-
+++ /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
-{
- /// <summary>
- /// Provides data for the <see cref="StreamRecorder.ErrorOccurred"/> event.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public class StreamRecorderErrorOccurredEventArgs : EventArgs
- {
- internal StreamRecorderErrorOccurredEventArgs(StreamRecorderError error, RecorderState state)
- {
- Error = error;
- State = state;
- }
-
- /// <summary>
- /// Gets the error code.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public StreamRecorderError Error { get; }
-
- /// <summary>
- /// Gets the state of the recorder.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public RecorderState State { get; }
-
- }
-}
+++ /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 Native = Interop.StreamRecorder;
-
-namespace Tizen.Multimedia
-{
- /// <summary>
- /// Specifies the options associated with <see cref="StreamRecorder"/>.
- /// </summary>
- /// <seealso cref="StreamRecorder"/>
- /// <seealso cref="StreamRecorder.Prepare(StreamRecorderOptions)"/>
- /// <seealso cref="StreamRecorderAudioOptions"/>
- /// <seealso cref="StreamRecorderVideoOptions"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public class StreamRecorderOptions
- {
- /// <summary>
- /// Initialize a new instance of the <see cref="StreamRecorderOptions"/> class with the specified
- /// save path and file format.
- /// </summary>
- /// <param name="savePath">The path that the recording result is saved.</param>
- /// <param name="fileFormat">The file format of output file.</param>
- /// <exception cref="ArgumentNullException"><paramref name="savePath"/>is null.</exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="savePath"/>is an empty string.<br/>
- /// -or-<br/>
- /// <paramref name="fileFormat"/> is not valid.
- /// </exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public StreamRecorderOptions(string savePath, RecorderFileFormat fileFormat)
- {
- SavePath = savePath;
- FileFormat = fileFormat;
- }
-
- private string _savePath;
-
- /// <summary>
- /// Gets or sets the file path to record.
- /// </summary>
- /// <remarks>
- /// If the same file already exists in the file system, then old file will be overwritten.
- /// </remarks>
- /// <exception cref="ArgumentNullException"><paramref name="value"/>is null.</exception>
- /// <exception cref="ArgumentException"><paramref name="value"/>is an empty string.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public string SavePath
- {
- get => _savePath;
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
-
- if (string.IsNullOrWhiteSpace(value))
- {
- throw new ArgumentException("Path can't be an empty string.", nameof(value));
- }
-
- _savePath = value;
- }
- }
-
- private RecorderFileFormat _fileFormat;
-
- /// <summary>
- /// Gets or sets the file format for recording media stream.
- /// </summary>
- /// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
- /// <seealso cref="StreamRecorder.GetSupportedFileFormats"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public RecorderFileFormat FileFormat
- {
- get => _fileFormat;
- set
- {
- ValidationUtil.ValidateEnum(typeof(RecorderFileFormat), value, nameof(value));
-
- _fileFormat = value;
- }
- }
-
- private int _timeLimit;
-
- /// <summary>
- /// Gets or sets the time limit of recording.
- /// </summary>
- /// <value>
- /// The maximum time of recording in seconds, or 0 for unlimited time.
- /// </value>
- /// <remarks>
- /// After reaching the limitation, the data which is being recorded will
- /// be discarded and not written to the file.
- /// </remarks>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is less than zero.</exception>
- /// <seealso cref="StreamRecorder.RecordingLimitReached"/>
- /// <seealso cref="SizeLimit"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public int TimeLimit
- {
- get => _timeLimit;
- set
- {
- if (value < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(value), value,
- "Time limit can't be less than zero.");
- }
-
- _timeLimit = value;
- }
- }
-
- private int _sizeLimit;
-
- /// <summary>
- /// Gets or sets the maximum size of a recording file.
- /// </summary>
- /// <value>
- /// The maximum size of a recording file in kilobytes, or 0 for unlimited size.
- /// </value>
- /// <remarks>
- /// After reaching the limitation, the data which is being recorded will
- /// be discarded and not written to the file.
- /// </remarks>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is less than zero.</exception>
- /// <seealso cref="StreamRecorder.RecordingLimitReached"/>
- /// <seealso cref="TimeLimit"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public int SizeLimit
- {
- get => _sizeLimit;
- set
- {
- if (value < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(value), value,
- "Size limit can't be less than zero.");
- }
-
- _sizeLimit = value;
- }
- }
-
- /// <summary>
- /// Gets or sets the options for audio recording.
- /// </summary>
- /// <remarks>
- /// <see cref="Audio"/> or <see cref="Video"/> must be set for recording.
- /// </remarks>
- /// <seealso cref="Video"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public StreamRecorderAudioOptions Audio { get; set; }
-
- /// <summary>
- /// Gets or sets the options for video recording.
- /// </summary>
- /// <remarks>
- /// <see cref="Audio"/> or <see cref="Video"/> must be set for recording.
- /// </remarks>
- /// <seealso cref="Audio"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public StreamRecorderVideoOptions Video { get; set; }
-
- private StreamRecorderSourceType GetSourceType()
- {
- Debug.Assert(Audio != null || Video != null);
-
- if (Audio != null && Video != null)
- {
- return StreamRecorderSourceType.VideoAudio;
- }
-
- return Audio != null ? StreamRecorderSourceType.Audio : StreamRecorderSourceType.Video;
- }
-
- internal void Apply(StreamRecorder recorder)
- {
- if (Audio == null && Video == null)
- {
- throw new ArgumentException("Both Audio and Video are not set.");
- }
-
- Native.EnableSourceBuffer(recorder.Handle, GetSourceType()).ThrowIfError("Failed to apply options.");
-
- Native.SetFileName(recorder.Handle, SavePath).ThrowIfError("Failed to set save path.");
-
- recorder.ValidateFileFormat(FileFormat);
- Native.SetFileFormat(recorder.Handle, FileFormat.ToStreamRecorderEnum())
- .ThrowIfError("Failed to set file format.");
-
- Native.SetRecordingLimit(recorder.Handle, RecordingLimitType.Size, SizeLimit).
- ThrowIfError("Failed to set size limit.");
-
- Native.SetRecordingLimit(recorder.Handle, RecordingLimitType.Time, TimeLimit).
- ThrowIfError("Failed to set time limit.");
-
- Audio?.Apply(recorder);
-
- Video?.Apply(recorder);
- }
- }
-}
+++ /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
-{
- /// <summary>
- /// Provides data for the <see cref="StreamRecorder.StateChanged"/> event.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public class StreamRecorderStateChangedEventArgs : EventArgs
- {
- internal StreamRecorderStateChangedEventArgs(RecorderState previous, RecorderState current)
- {
- Previous = previous;
- Current = current;
- }
-
- /// <summary>
- /// Gets the previous state of the stream recorder.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public RecorderState Previous { get; }
-
- /// <summary>
- /// Gets the current state of the stream recorder.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public RecorderState Current { get; }
- }
-}
+++ /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 Native = Interop.StreamRecorder;
-
-namespace Tizen.Multimedia
-{
- /// <summary>
- /// Specifies the options associated with video recording.
- /// </summary>
- /// <seealso cref="StreamRecorder"/>
- /// <seealso cref="StreamRecorderOptions"/>
- /// <seealso cref="StreamRecorderAudioOptions"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public class StreamRecorderVideoOptions
- {
- private const int DefaultBitRate = 0;
-
- /// <summary>
- /// Initialize a new instance of the <see cref="StreamRecorderVideoOptions"/> class with the specified
- /// codec, resolution, source format, and frame rate.
- /// </summary>
- /// <param name="codec">The <see cref="RecorderVideoCodec"/> for encoding video stream.</param>
- /// <param name="resolution">The resolution of video recording.</param>
- /// <param name="sourceFormat">The format of source stream.</param>
- /// <param name="frameRate">The frame rate for encoding video stream.</param>
- /// <remarks>
- /// <see cref="BitRate"/> will be set as default.
- /// </remarks>
- /// <exception cref="ArgumentException">
- /// <paramref name="codec"/> is not valid.<br/>
- /// -or-<br/>
- /// <paramref name="sourceFormat"/> is not valid.
- /// </exception>
- /// <exception cref="ArgumentOutOfRangeException">
- /// Width or height of <paramref name="resolution"/> is less than or equal to zero.<br/>
- /// -or-<br/>
- /// <paramref name="frameRate"/> is less than or equal to zero.
- /// </exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public StreamRecorderVideoOptions(RecorderVideoCodec codec, Size resolution,
- StreamRecorderVideoFormat sourceFormat, int frameRate) :
- this(codec, resolution, sourceFormat, frameRate, DefaultBitRate)
- {
- }
-
- /// <summary>
- /// Initialize a new instance of the <see cref="StreamRecorderVideoOptions"/> class with the specified
- /// codec, resolution, source format, frame rate, and bit rate.
- /// </summary>
- /// <param name="codec">The <see cref="RecorderVideoCodec"/> for encoding video stream.</param>
- /// <param name="resolution">The resolution of video recording.</param>
- /// <param name="sourceFormat">The format of source stream.</param>
- /// <param name="frameRate">The frame rate for encoding video stream.</param>
- /// <param name="bitRate">The bit rate for encoding video stream.</param>
- /// <exception cref="ArgumentException">
- /// <paramref name="codec"/> is not valid.<br/>
- /// -or-<br/>
- /// <paramref name="sourceFormat"/> is not valid.<br/>
- /// </exception>
- /// <exception cref="ArgumentOutOfRangeException">
- /// Width or height of <paramref name="resolution"/> is less than or equal to zero.<br/>
- /// -or-<br/>
- /// <paramref name="frameRate"/> is less than or equal to zero.<br/>
- /// -or-<br/>
- /// <paramref name="bitRate"/> is less than zero.
- /// </exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public StreamRecorderVideoOptions(RecorderVideoCodec codec, Size resolution,
- StreamRecorderVideoFormat sourceFormat, int frameRate, int bitRate)
- {
- Codec = codec;
- Resolution = resolution;
- SourceFormat = sourceFormat;
- FrameRate = frameRate;
- BitRate = bitRate;
- }
-
- private RecorderVideoCodec _codec;
-
- /// <summary>
- /// Gets or sets the video codec for encoding video stream.
- /// </summary>
- /// <value>The codec for video stream recording.</value>
- /// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
- /// <seealso cref="StreamRecorder.GetSupportedVideoCodecs"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public RecorderVideoCodec Codec
- {
- get => _codec;
- set
- {
- ValidationUtil.ValidateEnum(typeof(RecorderVideoCodec), value, nameof(value));
-
- _codec = value;
- }
- }
-
- private Size _resolution;
-
- /// <summary>
- /// Gets or sets the resolution of the video recording.
- /// </summary>
- /// <value>The output resolution for video stream recording.</value>
- /// <exception cref="ArgumentOutOfRangeException">
- /// Width or height of <paramref name="value"/> is less than or equal to zero.
- /// </exception>
- /// <seealso cref="StreamRecorder.GetSupportedVideoResolutions"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public Size Resolution
- {
- get => _resolution;
- set
- {
- if (value.Width <= 0 || value.Height <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(value), value,
- "Resolution can't be less than or equal to zero.");
- }
-
- _resolution = value;
- }
- }
-
- private int _frameRate;
-
- /// <summary>
- /// Gets or sets the frame rate for recording media stream.
- /// </summary>
- /// <value>The frame rate value for video stream recording.</value>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is less than or equal to zero.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public int FrameRate
- {
- get => _frameRate;
- set
- {
- if (value <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(value), value,
- "Frame rate can't be less than or equal to zero.");
- }
- _frameRate = value;
- }
- }
-
- private StreamRecorderVideoFormat _sourceFormat;
-
- /// <summary>
- /// Gets or sets the video source format for recording media stream.
- /// </summary>
- /// <value>The source format of buffers for video stream recording.</value>
- /// <exception cref="ArgumentException"><paramref name="value"/> is not valid.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public StreamRecorderVideoFormat SourceFormat
- {
- get => _sourceFormat;
- set
- {
- ValidationUtil.ValidateEnum(typeof(StreamRecorderVideoFormat), value, nameof(value));
-
- _sourceFormat = value;
- }
- }
-
- private int _bitRate;
-
- /// <summary>
- /// The bit rate of the video encoder in bits per second.
- /// </summary>
- /// <value>The bit rate value for video stream recording. The default is 0.</value>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is less than zero.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API10; Will be removed in API12")]
- public int BitRate
- {
- get => _bitRate;
- set
- {
- if (value < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(value), value,
- "Bit rate can't be less than or equal to zero.");
- }
- _bitRate = value;
- }
- }
-
- internal void Apply(StreamRecorder recorder)
- {
- recorder.ValidateVideoCodec(Codec);
-
- Native.SetVideoEncoder(recorder.Handle, Codec.ToStreamRecorderEnum()).
- ThrowIfError("Failed to set video codec.");
-
- recorder.ValidateVideoResolution(Resolution);
-
- Native.SetVideoResolution(recorder.Handle, Resolution.Width, Resolution.Height).
- ThrowIfError("Failed to set video resolution.");
-
- Native.SetVideoFrameRate(recorder.Handle, FrameRate).
- ThrowIfError("Failed to set video frame rate.");
-
- Native.SetVideoEncoderBitRate(recorder.Handle, BitRate).
- ThrowIfError("Failed to set video bit rate.");
-
- Native.SetVideoSourceFormat(recorder.Handle, SourceFormat).
- ThrowIfError("Failed to set video source format.");
- }
- }
-
-}
+++ /dev/null
-<Project Sdk="Microsoft.NET.Sdk">
-
- <PropertyGroup>
- <TargetFramework>net6.0</TargetFramework>
- </PropertyGroup>
-
- <ItemGroup>
- <ProjectReference Include="..\Tizen.Multimedia.Recorder\Tizen.Multimedia.Recorder.csproj" />
- </ItemGroup>
-
-</Project>
\ No newline at end of file
+++ /dev/null
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26730.12
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.StreamRecorder", "Tizen.Multimedia.StreamRecorder.csproj", "{E637475F-BFC1-40F3-A903-D548C240F677}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.Recorder", "..\Tizen.Multimedia.Recorder\Tizen.Multimedia.Recorder.csproj", "{FF4886B5-3225-40C5-9314-1193E0ECAEDF}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{C983A5CA-797B-4C30-B9E0-A7A4B1275D88}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{AF762B89-151B-413B-B289-9909ABA04371}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{1413EA41-9936-41A5-9BCF-9E1DA243DB7B}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{BC2D0788-EF91-4E36-BFC6-B91E48A223E2}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.NUI", "..\Tizen.NUI\Tizen.NUI.csproj", "{F605BC25-8B3A-4C51-AF63-C49AABFB6793}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.SystemSettings", "..\Tizen.System.SystemSettings\Tizen.System.SystemSettings.csproj", "{3E60C6E2-D0C3-4471-9E2F-ADD1E3A8A3C7}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia", "..\Tizen.Multimedia\Tizen.Multimedia.csproj", "{36328359-B4AB-4AFD-A06E-4C0355B9472F}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "..\Tizen.System.Information\Tizen.System.Information.csproj", "{958093FF-C0C1-4CAA-9B89-EFFF00790535}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.AudioIO", "..\Tizen.Multimedia.AudioIO\Tizen.Multimedia.AudioIO.csproj", "{80C1392F-E71C-4539-A970-BDE3FF04B951}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.Camera", "..\Tizen.Multimedia.Camera\Tizen.Multimedia.Camera.csproj", "{EEA12578-E0D6-4852-90B8-020D238E29C4}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.ComponentBased", "..\Tizen.Applications.ComponentBased\Tizen.Applications.ComponentBased.csproj", "{F3A6EEC0-C363-4022-87F8-864A9BB9E2A4}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {E637475F-BFC1-40F3-A903-D548C240F677}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E637475F-BFC1-40F3-A903-D548C240F677}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E637475F-BFC1-40F3-A903-D548C240F677}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E637475F-BFC1-40F3-A903-D548C240F677}.Release|Any CPU.Build.0 = Release|Any CPU
- {FF4886B5-3225-40C5-9314-1193E0ECAEDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FF4886B5-3225-40C5-9314-1193E0ECAEDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FF4886B5-3225-40C5-9314-1193E0ECAEDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FF4886B5-3225-40C5-9314-1193E0ECAEDF}.Release|Any CPU.Build.0 = Release|Any CPU
- {C983A5CA-797B-4C30-B9E0-A7A4B1275D88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C983A5CA-797B-4C30-B9E0-A7A4B1275D88}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C983A5CA-797B-4C30-B9E0-A7A4B1275D88}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C983A5CA-797B-4C30-B9E0-A7A4B1275D88}.Release|Any CPU.Build.0 = Release|Any CPU
- {AF762B89-151B-413B-B289-9909ABA04371}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AF762B89-151B-413B-B289-9909ABA04371}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AF762B89-151B-413B-B289-9909ABA04371}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AF762B89-151B-413B-B289-9909ABA04371}.Release|Any CPU.Build.0 = Release|Any CPU
- {1413EA41-9936-41A5-9BCF-9E1DA243DB7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1413EA41-9936-41A5-9BCF-9E1DA243DB7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1413EA41-9936-41A5-9BCF-9E1DA243DB7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1413EA41-9936-41A5-9BCF-9E1DA243DB7B}.Release|Any CPU.Build.0 = Release|Any CPU
- {BC2D0788-EF91-4E36-BFC6-B91E48A223E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BC2D0788-EF91-4E36-BFC6-B91E48A223E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BC2D0788-EF91-4E36-BFC6-B91E48A223E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BC2D0788-EF91-4E36-BFC6-B91E48A223E2}.Release|Any CPU.Build.0 = Release|Any CPU
- {F605BC25-8B3A-4C51-AF63-C49AABFB6793}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F605BC25-8B3A-4C51-AF63-C49AABFB6793}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F605BC25-8B3A-4C51-AF63-C49AABFB6793}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F605BC25-8B3A-4C51-AF63-C49AABFB6793}.Release|Any CPU.Build.0 = Release|Any CPU
- {3E60C6E2-D0C3-4471-9E2F-ADD1E3A8A3C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3E60C6E2-D0C3-4471-9E2F-ADD1E3A8A3C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3E60C6E2-D0C3-4471-9E2F-ADD1E3A8A3C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3E60C6E2-D0C3-4471-9E2F-ADD1E3A8A3C7}.Release|Any CPU.Build.0 = Release|Any CPU
- {36328359-B4AB-4AFD-A06E-4C0355B9472F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {36328359-B4AB-4AFD-A06E-4C0355B9472F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {36328359-B4AB-4AFD-A06E-4C0355B9472F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {36328359-B4AB-4AFD-A06E-4C0355B9472F}.Release|Any CPU.Build.0 = Release|Any CPU
- {958093FF-C0C1-4CAA-9B89-EFFF00790535}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {958093FF-C0C1-4CAA-9B89-EFFF00790535}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {958093FF-C0C1-4CAA-9B89-EFFF00790535}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {958093FF-C0C1-4CAA-9B89-EFFF00790535}.Release|Any CPU.Build.0 = Release|Any CPU
- {80C1392F-E71C-4539-A970-BDE3FF04B951}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {80C1392F-E71C-4539-A970-BDE3FF04B951}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {80C1392F-E71C-4539-A970-BDE3FF04B951}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {80C1392F-E71C-4539-A970-BDE3FF04B951}.Release|Any CPU.Build.0 = Release|Any CPU
- {EEA12578-E0D6-4852-90B8-020D238E29C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {EEA12578-E0D6-4852-90B8-020D238E29C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {EEA12578-E0D6-4852-90B8-020D238E29C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {EEA12578-E0D6-4852-90B8-020D238E29C4}.Release|Any CPU.Build.0 = Release|Any CPU
- {F3A6EEC0-C363-4022-87F8-864A9BB9E2A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F3A6EEC0-C363-4022-87F8-864A9BB9E2A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F3A6EEC0-C363-4022-87F8-864A9BB9E2A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F3A6EEC0-C363-4022-87F8-864A9BB9E2A4}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {DD113101-5A21-474D-9B56-22610C624BDF}
- EndGlobalSection
-EndGlobal
[assembly: InternalsVisibleTo("Tizen.Multimedia.Recorder, " + PublicKey.Value)]
-[assembly: InternalsVisibleTo("Tizen.Multimedia.StreamRecorder, " + PublicKey.Value)]
-
[assembly: InternalsVisibleTo("Tizen.Multimedia.Remoting, " + PublicKey.Value)]
[assembly: InternalsVisibleTo("Tizen.Multimedia.Util, " + PublicKey.Value)]