コード例 #1
0
        private bool TestQsvNv12(AdapterInfo qsvAdapter)
        {
            try
            {
                var options = new VideoRenderOptions(VideoRenderType.HardwareSpecific, qsvAdapter.Name, IntPtr.Zero, false, 0);
                var dx      = DirectXContextFactory.CreateDevice(options);
                using var dxContext = new DirectXContext(dx.Item1, options, dx.Item2, dx.Item3, null);

                if (!dxContext.Nv12Supported)
                {
                    Core.LogInfo($"Device {qsvAdapter.Name} does not have n12 format support");
                }

                if (Test <EncoderContextQsvDx>("", "", EncoderContextQsvDx.TypeName, dxContext))
                {
                    Core.LogInfo($"Device {qsvAdapter.Name} successfully tested for nv12 support");
                    return(true);
                }
            }
            catch (Exception e)
            {
                Core.LogError(e, $"Device {qsvAdapter.Name} failed in test for nv12 support");
            }
            return(false);
        }
コード例 #2
0
        public static DirectXContext Create(VideoRenderOptions options, IStreamerBase streamerBase)
        {
            var device = CreateDevice(options);

            if (device.Item1 != null)
            {
                return(new DirectXContext(device.Item1, options, device.Item2, device.Item3, streamerBase));
            }
            return(null);
        }
コード例 #3
0
        public DirectXContext(Device device, VideoRenderOptions options, AdapterInfo item2, bool adapterIsEqualToWindowAdapter, IStreamerBase streamer)
        {
            AdapterIsEqualToWindowAdapter = AdapterIsEqualToWindowAdapter;
            _refCount       = 1;
            Device          = device;
            CreationOptions = options;
            ImagingFactory2 = new ImagingFactory();
            Pool            = new DirectXResourcePool(this);

            var nv12Support = device.CheckFormatSupport(SharpDX.DXGI.Format.NV12);

            AdapterInfo   = item2;
            _streamer     = streamer;
            Nv12Supported = nv12Support.HasFlag(FormatSupport.RenderTarget) && nv12Support.HasFlag(FormatSupport.Texture2D);
        }