private CuCallbackResult SequenceCallback( IntPtr data, ref CuVideoFormat format) { using var _ = _context.Push(); PrintInformation("CuVideoFormat", new Dictionary <string, object> { ["Codec"] = format.Codec, ["Bitrate"] = format.Bitrate, ["CodedWidth"] = format.CodedWidth, ["CodedHeight"] = format.CodedHeight, ["Framerate"] = format.FrameRateNumerator / format.FrameRateDenominator, }); if (!format.IsSupportedByDecoder(out var error, out var caps)) { Console.Error.WriteLine(error); Environment.Exit(-1); return(CuCallbackResult.Failure); } PrintInformation("CuVideoDecodeCaps", new Dictionary <string, object> { ["MaxWidth"] = caps.MaxWidth, ["MaxHeight"] = caps.MaxHeight, }); if (!_decoder.IsEmpty) { _decoder.Reconfigure(ref format); return(CuCallbackResult.Success); } _info = new CuVideoDecodeCreateInfo { CodecType = format.Codec, ChromaFormat = format.ChromaFormat, OutputFormat = format.GetSurfaceFormat(), BitDepthMinus8 = format.BitDepthLumaMinus8, DeinterlaceMode = format.ProgressiveSequence ? CuVideoDeinterlaceMode.Weave : CuVideoDeinterlaceMode.Adaptive, NumOutputSurfaces = 2, CreationFlags = CuVideoCreateFlags.PreferCUVID, NumDecodeSurfaces = format.MinNumDecodeSurfaces, VideoLock = _contextLock, Width = format.CodedWidth, Height = format.CodedHeight, MaxWidth = format.CodedWidth, MaxHeight = format.CodedHeight, TargetWidth = format.CodedWidth, TargetHeight = format.CodedHeight }; _decoder = CuVideoDecoder.Create(ref _info); return((CuCallbackResult)format.MinNumDecodeSurfaces); }
/// <inheritdoc cref="ReconfigureDecoder(CuVideoDecoder, ref CuVideoReconfigureDecoderInfo)"/> public void Reconfigure(ref CuVideoFormat format) { // TODO var info = new CuVideoReconfigureDecoderInfo { Width = format.CodedWidth, Height = format.CodedHeight, }; Reconfigure(ref info); }
public static extern CuResult GetSourceVideoFormat(CuVideoSource obj, ref CuVideoFormat pvidfmt, uint flags);