public ID3D12VideoDecoder?CreateVideoDecoder(VideoDecoderDescription description) { Result result = CreateVideoDecoder(ref description, typeof(ID3D12VideoDecoder).GUID, out IntPtr nativePtr); if (result.Failure) { return(default);
public ID3D12VideoDecoder1?CreateVideoDecoder1(VideoDecoderDescription description, ID3D12ProtectedResourceSession protectedResourceSession) { Result result = CreateVideoDecoder1(ref description, protectedResourceSession, typeof(ID3D12VideoDecoder1).GUID, out IntPtr nativePtr); if (result.Failure) { return(default);
public Result CreateVideoDecoder1 <T>(VideoDecoderDescription description, ID3D12ProtectedResourceSession protectedResourceSession, out T?videoDecoder) where T : ID3D12VideoDecoder1 { Result result = CreateVideoDecoder1(ref description, protectedResourceSession, typeof(T).GUID, out IntPtr nativePtr); if (result.Failure) { videoDecoder = default; return(result); } videoDecoder = MarshallingHelpers.FromPointer <T>(nativePtr); return(result); }
public Result CreateVideoDecoder(VideoDecoderDescription description, out ID3D12VideoDecoder?videoDecoder) { Result result = CreateVideoDecoder(ref description, typeof(ID3D12VideoDecoder).GUID, out IntPtr nativePtr); if (result.Failure) { videoDecoder = default; return(result); } videoDecoder = new ID3D12VideoDecoder(nativePtr); return(result); }
public Result GetVideoDecoderConfig(VideoDecoderDescription description, int index, out VideoDecoderConfig config) { return(GetVideoDecoderConfig(ref description, index, out config)); }
public VideoDecoderConfig GetVideoDecoderConfig(VideoDecoderDescription description, int index) { GetVideoDecoderConfig(ref description, index, out VideoDecoderConfig config).CheckError(); return(config); }
public Result CreateVideoDecoder(VideoDecoderDescription description, VideoDecoderConfig config, out ID3D11VideoDecoder decoder) { return(CreateVideoDecoder(ref description, ref config, out decoder)); }
public ID3D11VideoDecoder CreateVideoDecoder(VideoDecoderDescription description, VideoDecoderConfig config) { CreateVideoDecoder(ref description, ref config, out ID3D11VideoDecoder decoder).CheckError(); return(decoder); }
public Result GetVideoDecoderConfigCount(VideoDecoderDescription description, out int count) { return(GetVideoDecoderConfigCount(ref description, out count)); }
public int GetVideoDecoderConfigCount(VideoDecoderDescription description) { GetVideoDecoderConfigCount(ref description, out int count).CheckError(); return(count); }
private void CreateHarwareAccelerationContext(GraphicsDevice graphicsDevice, AVCodecContext *pAVCodecContext, AVCodec *pCodec) { var videoDevice = graphicsDevice?.NativeDevice?.QueryInterface <VideoDevice1>(); var videoContext = graphicsDevice?.NativeDeviceContext?.QueryInterface <VideoContext1>(); if (videoDevice == null || videoContext == null) { return; } foreach (var profile in FindVideoFormatCompatibleProfiles(videoDevice, *pCodec)) { // Create and configure the video decoder var videoDecoderDescription = new VideoDecoderDescription { Guid = profile, SampleWidth = pAVCodecContext->width, SampleHeight = pAVCodecContext->height, OutputFormat = DecoderOuputFormat, }; videoDevice.GetVideoDecoderConfigCount(ref videoDecoderDescription, out var configCount); for (var i = 0; i < configCount; ++i) { // get and check the decoder configuration for the profile videoDevice.GetVideoDecoderConfig(ref videoDecoderDescription, i, out var decoderConfig); //if (check to performe on the config) // continue; // create the decoder from the configuration videoDevice.CreateVideoDecoder(ref videoDecoderDescription, ref decoderConfig, out videoHardwareDecoder); // create the decoder output view var videoDecoderOutputViewDescription = new VideoDecoderOutputViewDescription { DecodeProfile = profile, Dimension = VdovDimension.Texture2D, Texture2D = new Texture2DVdov { ArraySlice = 0, }, }; DecoderOutputTexture = Texture.New2D(graphicsDevice, pAVCodecContext->width, pAVCodecContext->height, (PixelFormat)DecoderOuputFormat, TextureFlags.RenderTarget | TextureFlags.ShaderResource); videoDevice.CreateVideoDecoderOutputView(DecoderOutputTexture.NativeResource, ref videoDecoderOutputViewDescription, out videoHardwareDecoderView); // Create and fill the hardware context var contextd3d11 = ffmpeg.av_d3d11va_alloc_context(); var iVideoContext = new ID3D11VideoContext { lpVtbl = (ID3D11VideoContextVtbl *)videoContext.NativePointer }; videoContextHandle = new PinnedObject <ID3D11VideoContext>(iVideoContext); contextd3d11->video_context = (ID3D11VideoContext *)videoContextHandle.Pointer; var iVideoDecoder = new ID3D11VideoDecoder { lpVtbl = (ID3D11VideoDecoderVtbl *)videoHardwareDecoder.NativePointer }; videoDecoderHandle = new PinnedObject <ID3D11VideoDecoder>(iVideoDecoder); contextd3d11->decoder = (ID3D11VideoDecoder *)videoDecoderHandle.Pointer; decoderConfigHandle = new PinnedObject <D3D11_VIDEO_DECODER_CONFIG>(decoderConfig.ToFFmpegDecoderConfig()); contextd3d11->cfg = (D3D11_VIDEO_DECODER_CONFIG *)decoderConfigHandle.Pointer; var iVideoOutputView = new ID3D11VideoDecoderOutputView { lpVtbl = (ID3D11VideoDecoderOutputViewVtbl *)videoHardwareDecoderView.NativePointer }; decoderOuputViewsHandle = new PinnedObject <ID3D11VideoDecoderOutputView>(iVideoOutputView, true); contextd3d11->surface = (ID3D11VideoDecoderOutputView **)decoderOuputViewsHandle.Pointer; contextd3d11->surface_count = 1; pAVCodecContext->hwaccel_context = contextd3d11; } } }
public T CreateVideoDecoder1 <T>(VideoDecoderDescription description, ID3D12ProtectedResourceSession protectedResourceSession) where T : ID3D12VideoDecoder1 { CreateVideoDecoder1(ref description, protectedResourceSession, typeof(T).GUID, out IntPtr nativePtr).CheckError(); return(MarshallingHelpers.FromPointer <T>(nativePtr)); }
public ID3D12VideoDecoder1 CreateVideoDecoder1(VideoDecoderDescription description, ID3D12ProtectedResourceSession protectedResourceSession) { CreateVideoDecoder1(ref description, protectedResourceSession, typeof(ID3D12VideoDecoder1).GUID, out IntPtr nativePtr).CheckError(); return(new ID3D12VideoDecoder1(nativePtr)); }
public T CreateVideoDecoder <T>(VideoDecoderDescription description) where T : ID3D12VideoDecoder { CreateVideoDecoder(ref description, typeof(T).GUID, out IntPtr nativePtr).CheckError(); return(MarshallingHelpers.FromPointer <T>(nativePtr)); }
public ID3D12VideoDecoder CreateVideoDecoder(VideoDecoderDescription description) { CreateVideoDecoder(ref description, typeof(ID3D12VideoDecoder).GUID, out IntPtr nativePtr).CheckError(); return(new ID3D12VideoDecoder(nativePtr)); }