Example #1
0
 /// <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>
 public StreamRecorderVideoOptions(RecorderVideoCodec codec, Size resolution,
                                   StreamRecorderVideoFormat sourceFormat, int frameRate, int bitRate)
 {
     Codec        = codec;
     Resolution   = resolution;
     SourceFormat = sourceFormat;
     FrameRate    = frameRate;
     BitRate      = bitRate;
 }
Example #2
0
        /// <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>
        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;
            }
        }
Example #3
0
 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));
 }
Example #4
0
 internal static extern StreamRecorderErrorCode SetVideoSourceFormat(StreamRecorderHandle handle,
                                                                     StreamRecorderVideoFormat format);
Example #5
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>
 public StreamRecorderVideoOptions(RecorderVideoCodec codec, Size resolution,
                                   StreamRecorderVideoFormat sourceFormat, int frameRate) :
     this(codec, resolution, sourceFormat, frameRate, DefaultBitRate)
 {
 }