private void ConfigureVideo(VideoMediaFormat format, bool encoder, MediaCodecTypes supportType) { int codecType = (int)format.MimeType & CodecTypeMask; if (!Enum.IsDefined(typeof(SupportedCodecType), codecType)) { throw new NotSupportedException("The format is not supported." + $"mime type : { Enum.GetName(typeof(MediaFormatVideoMimeType), format.MimeType) }"); } DoConfigure(codecType, encoder, supportType); if (encoder) { int ret = Interop.MediaCodec.SetVideoEncoderInfo(_handle, format.Size.Width, format.Size.Height, format.FrameRate, format.BitRate / 1000); MultimediaDebug.AssertNoError(ret); } else { int ret = Interop.MediaCodec.SetVideoDecoderInfo(_handle, format.Size.Width, format.Size.Height); MultimediaDebug.AssertNoError(ret); } }
internal override void ValidateFormat(VideoMediaFormat format) { if (format.Size.Width < Region.Right || format.Size.Height < Region.Bottom) { throw new InvalidOperationException( $"Crop region is invalid; Source size({format.Size.ToString()}), Crop region({Region.ToString()})."); } }
private MediaPacketSourceConfiguration CreateVideoConfiguration(VideoMediaFormat format) { if (format == null) { return(null); } if (!SupportedVideoTypes.Contains(format.MimeType)) { throw new ArgumentException($"The video format is not supported, Type : {format.MimeType}."); } return(new MediaPacketSourceConfiguration(this)); }
private void ConfigureVideo(VideoMediaFormat format, bool encoder, MediaCodecTypes supportType) { int codecType = (int)format.MimeType & CodecTypeMask; if (!Enum.IsDefined(typeof(SupportedCodecType), codecType)) { throw new NotSupportedException("The format is not supported." + $"mime type : { Enum.GetName(typeof(MediaFormatVideoMimeType), format.MimeType) }"); } DoConfigure(codecType, encoder, supportType); if (encoder) { Native.SetVideoEncoderInfo(_handle, format.Size.Width, format.Size.Height, format.FrameRate, format.BitRate / 1000). ThrowIfFailed("Failed to set video encoder information."); } else { Native.SetVideoDecoderInfo(_handle, format.Size.Width, format.Size.Height). ThrowIfFailed("Failed to set video decoder information."); } }
internal override string GenerateNotSupportedErrorMessage(VideoMediaFormat format) => $"'{format.MimeType}' is not supported by ResizeTransform.";
/// <summary> /// Initializes a new instance of the MediaPacketSource class with the specified <see cref="VideoMediaFormat"/>. /// </summary> /// <param name="videoMediaFormat">The <see cref="VideoMediaFormat"/> for this source.</param> /// <exception cref="ArgumentNullException"><paramref name="videoMediaFormat"/> is null.</exception> /// <exception cref="ArgumentException"><paramref name="videoMediaFormat"/> is not supported.</exception> /// <seealso cref="SupportedVideoTypes"/> /// <since_tizen> 9 </since_tizen> public MediaPacketSource(VideoMediaFormat videoMediaFormat) : base(MediaType.Video) { _videoMediaFormat = videoMediaFormat ?? throw new ArgumentNullException(nameof(videoMediaFormat)); VideoConfiguration = CreateVideoConfiguration(videoMediaFormat); }
internal override string GenerateNotSupportedErrorMessage(VideoMediaFormat format) { return(null); }
internal override string GenerateNotSupportedErrorMessage(VideoMediaFormat format) { return($"'{format.MimeType}' is not supported by CropTransform."); }
internal override string GenerateNotSupportedErrorMessage(VideoMediaFormat format) => $"Converting colorspace from '{format.MimeType}' to '{ColorSpace.ToString()}' is not supported.";
internal virtual void ValidateFormat(VideoMediaFormat format) { }
internal abstract string GenerateNotSupportedErrorMessage(VideoMediaFormat format);