コード例 #1
0
ファイル: AudioRecorder.cs プロジェクト: prjung/TizenFX
        /// <summary>
        /// Sets the audio codec and the file format for recording.
        /// </summary>
        /// <param name="audioCodec">The codec for audio encoding.</param>
        /// <param name="fileFormat">The format of result file.</param>
        /// <exception cref="NotSupportedException">
        ///     <paramref name="audioCodec"/> is not supported.<br/>
        ///     -or-<br/>
        ///     <paramref name="fileFormat"/> is not supported with the specified audio codec.
        /// </exception>
        /// <exception cref="ArgumentException">
        ///     <paramref name="audioCodec"/> is not valid.<br/>
        ///     -or-<br/>
        ///     <paramref name="fileFormat"/> is not valid.
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        ///     <paramref name="audioCodec"/> is <see cref="RecorderAudioCodec.None"/>
        /// </exception>
        /// <seealso cref="Recorder.GetSupportedAudioCodecs"/>
        /// <seealso cref="Recorder.GetSupportedFileFormats"/>
        /// <seealso cref="RecorderExtensions.GetSupportedFileFormats(RecorderAudioCodec)"/>
        /// <seealso cref="Recorder.Start(string)"/>
        /// <since_tizen> 4 </since_tizen>
        public void SetFormatAndCodec(RecorderAudioCodec audioCodec, RecorderFileFormat fileFormat)
        {
            ThrowIfCodecAndFormatNotValid(audioCodec, fileFormat);

            AudioCodec = audioCodec;
            FileFormat = fileFormat;
        }
コード例 #2
0
 internal static void ValidateFileFormat(RecorderFileFormat format)
 {
     if (GetSupportedFileFormats().Contains(format) == false)
     {
         throw new NotSupportedException($"{format.ToString()} is not supported.");
     }
 }
コード例 #3
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);
            }

            throw new NotSupportedException($"{value.ToString()} is not supported.");
        }
コード例 #4
0
ファイル: AudioRecorder.cs プロジェクト: prjung/TizenFX
 /// <summary>
 /// Initializes a new instance of the <see cref="AudioRecorder"/> class with the specified audio codec and file format.
 /// </summary>
 /// <param name="audioCodec">The codec for audio encoding.</param>
 /// <param name="fileFormat">The format of result file.</param>
 /// <feature>http://tizen.org/feature/microphone</feature>
 /// <exception cref="InvalidOperationException">An internal error occurred.</exception>
 /// <exception cref="NotSupportedException">
 ///     A required feature is not supported.<br/>
 ///     -or-<br/>
 ///     <paramref name="audioCodec"/> is not supported.<br/>
 ///     -or-<br/>
 ///     <paramref name="fileFormat"/> is not supported with the specified audio codec.
 /// </exception>
 /// <exception cref="ArgumentException">
 ///     <paramref name="audioCodec"/> is not valid.<br/>
 ///     -or-<br/>
 ///     <paramref name="fileFormat"/> is not valid.
 /// </exception>
 /// <exception cref="ArgumentOutOfRangeException">
 ///     <paramref name="audioCodec"/> is <see cref="RecorderAudioCodec.None"/>
 /// </exception>
 /// <seealso cref="Recorder.GetSupportedAudioCodecs"/>
 /// <seealso cref="Recorder.GetSupportedFileFormats"/>
 /// <seealso cref="RecorderExtensions.GetSupportedFileFormats(RecorderAudioCodec)"/>
 /// <seealso cref="SetFormatAndCodec(RecorderAudioCodec, RecorderFileFormat)"/>
 /// <since_tizen> 4 </since_tizen>
 public AudioRecorder(RecorderAudioCodec audioCodec, RecorderFileFormat fileFormat) : base(CreateHandle())
 {
     SetFormatAndCodec(audioCodec, fileFormat);
 }
コード例 #5
0
ファイル: AudioRecorder.cs プロジェクト: prjung/TizenFX
        private static void ThrowIfCodecAndFormatNotValid(RecorderAudioCodec audioCodec, RecorderFileFormat fileFormat)
        {
            if (audioCodec == RecorderAudioCodec.None)
            {
                throw new ArgumentOutOfRangeException(nameof(audioCodec),
                                                      "RecorderAudioCodec.None is only available with VideoRecorder.");
            }

            audioCodec.ThrowIfFormatNotSupported(fileFormat);
        }
コード例 #6
0
ファイル: RecorderExtensions.cs プロジェクト: yunmiha/TizenFX
        internal static void ThrowIfFormatNotSupported(this RecorderVideoCodec videoCodec, RecorderFileFormat fileFormat)
        {
            ValidationUtil.ValidateEnum(typeof(RecorderFileFormat), fileFormat, nameof(fileFormat));

            if (videoCodec.GetSupportedFileFormats().Contains(fileFormat) == false)
            {
                throw new NotSupportedException($"{videoCodec} does not support {fileFormat}.");
            }
        }
コード例 #7
0
ファイル: VideoRecorder.cs プロジェクト: prjung/TizenFX
 /// <summary>
 /// Initializes a new instance of the <see cref="VideoRecorder"/> class with the specified
 /// camera, video codec, and file format.
 /// </summary>
 /// <remarks>
 /// If the state of <see cref="Camera"/> is <see cref="CameraState.Created"/>,
 /// the <see cref="CameraSettings.PreviewPixelFormat"/> will be changed to the recommended format for recording.<br/>
 /// <br/>
 /// The initial state of the Recorder will be <see cref="RecorderState.Ready"/>
 /// if the state of <see cref="Camera"/> is <see cref="CameraState.Preview"/> or <see cref="CameraState.Captured"/>.
 /// </remarks>
 /// <param name="camera">The camera object.</param>
 /// <param name="videoCodec">The codec for video encoding.</param>
 /// <param name="fileFormat">The format of result file.</param>
 /// <feature>http://tizen.org/feature/camera</feature>
 /// <exception cref="InvalidOperationException">An internal error occurred.</exception>
 /// <exception cref="NotSupportedException">
 ///     A required feature is not supported.<br/>
 ///     -or-<br/>
 ///     <paramref name="videoCodec"/> is not supported.<br/>
 ///     -or-<br/>
 ///     <paramref name="fileFormat"/> is not supported with the specified video codec.
 /// </exception>
 /// <exception cref="ArgumentException">
 ///     <paramref name="videoCodec"/> is not valid.<br/>
 ///     -or-<br/>
 ///     <paramref name="fileFormat"/> is not valid.<br/>
 ///     -or-<br/>
 ///     <paramref name="camera"/> is being used by another object.
 /// </exception>
 /// <exception cref="ObjectDisposedException"><paramref name="camera"/> has been disposed of.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="camera"/> is null.</exception>
 /// <seealso cref="GetSupportedVideoCodecs"/>
 /// <seealso cref="Recorder.GetSupportedFileFormats"/>
 /// <seealso cref="RecorderExtensions.GetSupportedFileFormats(RecorderVideoCodec)"/>
 /// <seealso cref="SetFormatAndCodec(RecorderVideoCodec, RecorderFileFormat)"/>
 /// <seealso cref="SetFormatAndCodec(RecorderVideoCodec, RecorderAudioCodec, RecorderFileFormat)"/>
 /// <since_tizen> 4 </since_tizen>
 public VideoRecorder(Camera camera, RecorderVideoCodec videoCodec, RecorderFileFormat fileFormat) :
     this(camera, videoCodec, RecorderAudioCodec.None, fileFormat)
 {
 }
コード例 #8
0
ファイル: VideoRecorder.cs プロジェクト: prjung/TizenFX
        private static void ThrowIfCodecAndFormatNotValid(RecorderVideoCodec videoCodec,
                                                          RecorderAudioCodec audioCodec, RecorderFileFormat fileFormat)
        {
            videoCodec.ThrowIfFormatNotSupported(fileFormat);

            if (audioCodec != RecorderAudioCodec.None)
            {
                audioCodec.ThrowIfFormatNotSupported(fileFormat);
            }
        }
コード例 #9
0
ファイル: VideoRecorder.cs プロジェクト: prjung/TizenFX
 /// <summary>
 /// Sets the video codec and the file format for recording. Audio will not be recorded.
 /// </summary>
 /// <param name="videoCodec">The codec for video encoding.</param>
 /// <param name="fileFormat">The format of result file.</param>
 /// <exception cref="NotSupportedException">
 ///     <paramref name="videoCodec"/> is not supported.<br/>
 ///     -or-<br/>
 ///     <paramref name="fileFormat"/> is not supported with the specified video codec.
 /// </exception>
 /// <exception cref="ArgumentException">
 ///     <paramref name="videoCodec"/> is not valid.<br/>
 ///     -or-<br/>
 ///     <paramref name="fileFormat"/> is not valid.
 /// </exception>
 /// <seealso cref="GetSupportedVideoCodecs"/>
 /// <seealso cref="Recorder.GetSupportedFileFormats"/>
 /// <seealso cref="RecorderExtensions.GetSupportedFileFormats(RecorderVideoCodec)"/>
 /// <seealso cref="SetFormatAndCodec(RecorderVideoCodec, RecorderAudioCodec, RecorderFileFormat)"/>
 /// <seealso cref="Recorder.Start(string)"/>
 /// <since_tizen> 4 </since_tizen>
 public void SetFormatAndCodec(RecorderVideoCodec videoCodec, RecorderFileFormat fileFormat)
 {
     SetFormatAndCodec(videoCodec, RecorderAudioCodec.None, fileFormat);
 }
コード例 #10
0
ファイル: VideoRecorder.cs プロジェクト: prjung/TizenFX
 /// <summary>
 /// Initializes a new instance of the <see cref="VideoRecorder"/> class with the specified
 /// camera, video codec, audio codec, and file format.
 /// </summary>
 /// <remarks>
 /// If the state of <see cref="Camera"/> is <see cref="CameraState.Created"/>,
 /// the <see cref="CameraSettings.PreviewPixelFormat"/> will be changed to the recommended format for recording.<br/>
 /// <br/>
 /// The initial state of the Recorder will be <see cref="RecorderState.Ready"/>
 /// if the state of <see cref="Camera"/> is <see cref="CameraState.Preview"/> or <see cref="CameraState.Captured"/>.
 /// </remarks>
 /// <param name="camera">The camera object.</param>
 /// <param name="videoCodec">The codec for video encoding.</param>
 /// <param name="audioCodec">The codec for audio encoding.</param>
 /// <param name="fileFormat">The format of result file.</param>
 /// <feature>http://tizen.org/feature/camera</feature>
 /// <exception cref="InvalidOperationException">An internal error occurred.</exception>
 /// <exception cref="NotSupportedException">
 ///     A required feature is not supported.<br/>
 ///     -or-<br/>
 ///     <paramref name="videoCodec"/> is not supported.<br/>
 ///     -or-<br/>
 ///     <paramref name="audioCodec"/> is not supported.<br/>
 ///     -or-<br/>
 ///     <paramref name="fileFormat"/> is not supported with the specified video codec.<br/>
 ///     -or-<br/>
 ///     <paramref name="fileFormat"/> is not supported with the specified audio codec.
 /// </exception>
 /// <exception cref="ArgumentException">
 ///     <paramref name="videoCodec"/> is not valid.<br/>
 ///     -or-<br/>
 ///     <paramref name="audioCodec"/> is not valid.<br/>
 ///     -or-<br/>
 ///     <paramref name="fileFormat"/> is not valid.
 /// </exception>
 /// <exception cref="ObjectDisposedException"><paramref name="camera"/> has been disposed of.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="camera"/> is null.</exception>
 /// <seealso cref="Recorder.GetSupportedAudioCodecs"/>
 /// <seealso cref="GetSupportedVideoCodecs"/>
 /// <seealso cref="Recorder.GetSupportedFileFormats"/>
 /// <seealso cref="RecorderExtensions.GetSupportedFileFormats(RecorderAudioCodec)"/>
 /// <seealso cref="RecorderExtensions.GetSupportedFileFormats(RecorderVideoCodec)"/>
 /// <seealso cref="SetFormatAndCodec(RecorderVideoCodec, RecorderFileFormat)"/>
 /// <seealso cref="SetFormatAndCodec(RecorderVideoCodec, RecorderAudioCodec, RecorderFileFormat)"/>
 /// <since_tizen> 4 </since_tizen>
 public VideoRecorder(Camera camera, RecorderVideoCodec videoCodec,
                      RecorderAudioCodec audioCodec, RecorderFileFormat fileFormat) : base(CreateHandle(camera))
 {
     SetFormatAndCodec(videoCodec, RecorderAudioCodec.None, fileFormat);
 }
コード例 #11
0
 /// <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>
 public StreamRecorderOptions(string savePath, RecorderFileFormat fileFormat)
 {
     SavePath   = savePath;
     FileFormat = fileFormat;
 }
コード例 #12
0
 internal static extern RecorderErrorCode SetFileFormat(RecorderHandle handle, RecorderFileFormat format);