public bool HasQueuedCallbacks(Thread thread) { var result = new RawBool(); HasQueuedCallbacks(thread, out result); return(result); }
/// <summary> /// Get an array of boolean variables. /// </summary> /// <param name="offset">Must be set to 0; this is reserved for future use. </param> /// <param name="count">The number of array elements to set. </param> /// <returns>Returns one of the following {{Direct3D 10 Return Codes}}. </returns> /// <unmanaged>HRESULT ID3D10EffectScalarVariable::GetBoolArray([Out, Buffer] BOOL* pData,[None] int Offset,[None] int Count)</unmanaged> public bool[] GetBoolArray(int offset, int count) { var temp = new RawBool[count]; GetBoolArray(temp, offset, count); return(Utilities.ConvertToBoolArray(temp)); }
public static RawBool[] ConvertToRawBoolArray(ReadOnlySpan <bool> array) { var length = array.Length; var temp = new RawBool[length]; for (var i = 0; i < length; i++) { temp[i] = array[i]; } return(temp); }
public void InitDefaults() { AutoDepthStencilFormat = Format.D24X8; BackBufferWidth = 800; BackBufferHeight = 600; BackBufferFormat = Format.X8R8G8B8; BackBufferCount = 1; DeviceWindowHandle = IntPtr.Zero; EnableAutoDepthStencil = true; PresentFlags = PresentFlags.None; PresentationInterval = PresentInterval.Immediate; SwapEffect = SwapEffect.Discard; Windowed = true; }
private static int SetGlyphOrientationImpl(IntPtr thisPtr, int textPosition, int textLength, GlyphOrientationAngle glyphOrientationAngle, byte adjustedBidiLevel, RawBool isSideways, RawBool isRightToLeft) { try { var shadow = ToShadow<TextAnalysisSink1Shadow>(thisPtr); var callback = (TextAnalysisSink1) shadow.Callback; callback.SetGlyphOrientation(textPosition, textLength, glyphOrientationAngle, adjustedBidiLevel, isSideways, isRightToLeft); } catch (Exception exception) { return (int) Result.GetResultFromException(exception); } return Result.Ok.Code; }
private static int SetGlyphOrientationImpl(IntPtr thisPtr, int textPosition, int textLength, GlyphOrientationAngle glyphOrientationAngle, byte adjustedBidiLevel, RawBool isSideways, RawBool isRightToLeft) { try { var shadow = ToShadow <TextAnalysisSink1Shadow>(thisPtr); var callback = (TextAnalysisSink1)shadow.Callback; callback.SetGlyphOrientation(textPosition, textLength, glyphOrientationAngle, adjustedBidiLevel, isSideways, isRightToLeft); } catch (Exception exception) { return((int)Result.GetResultFromException(exception)); } return(Result.Ok.Code); }
internal static unsafe extern Result vkGetPhysicalDeviceSurfaceSupportKHR(PhysicalDevice physicalDevice, uint queueFamilyIndex, Surface surface, RawBool* supported);
/// <summary> /// <p><strong>Applies to: </strong>desktop apps | Metro style apps</p><p>Selects or deselects one or more streams.</p> /// </summary> /// <param name="readerIndex"><dd> <p>The stream to set. The value can be any of the following.</p> <table> <tr><th>Value</th><th>Meaning</th></tr> <tr><td> <dl> <dt>0?0xFFFFFFFB</dt> </dl> </td><td> <p>The zero-based index of a stream.</p> </td></tr> <tr><td><dl> <dt><strong><strong><see cref="SharpDX.MediaFoundation.SourceReaderIndex.FirstVideoStream"/></strong></strong></dt> <dt>0xFFFFFFFC</dt> </dl> </td><td> <p>The first video stream.</p> </td></tr> <tr><td><dl> <dt><strong><strong><see cref="SharpDX.MediaFoundation.SourceReaderIndex.FirstAudioStream"/></strong></strong></dt> <dt>0xFFFFFFFD</dt> </dl> </td><td> <p>The first audio stream.</p> </td></tr> <tr><td><dl> <dt><strong><strong><see cref="SharpDX.MediaFoundation.SourceReaderIndex.AllStreams"/></strong></strong></dt> <dt>0xFFFFFFFE</dt> </dl> </td><td> <p>All streams.</p> </td></tr> </table> <p>?</p> </dd></param> /// <param name="fSelected"><dd> <p>Specify <strong>TRUE</strong> to select streams or <strong><see cref="SharpDX.Result.False"/></strong> to deselect streams. If a stream is deselected, it will not generate data.</p> </dd></param> /// <returns><p>If this method succeeds, it returns <strong><see cref="SharpDX.Result.Ok"/></strong>. Otherwise, it returns an <strong><see cref="SharpDX.Result"/></strong> error code.</p></returns> /// <remarks> /// <p>There are two common uses for this method:</p><ul> <li>To change the default stream selection. Some media files contain multiple streams of the same type. For example, a file might include audio streams for multiple languages. You can use this method to change which of the streams is selected. To get information about each stream, call <strong><see cref="SharpDX.MediaFoundation.SourceReader.GetPresentationAttribute"/></strong> or <strong><see cref="SharpDX.MediaFoundation.SourceReader.GetNativeMediaType"/></strong>.</li> <li>If you will not need data from one of the streams, it is a good idea to deselect that stream. If the stream is selected, the media source might hold onto a queue of unread data, and the queue might grow indefinitely, consuming memory. </li> </ul><p>For an example of deselecting a stream, see Tutorial: Decoding Audio.</p><p>If a stream is deselected, the <strong><see cref="SharpDX.MediaFoundation.SourceReader.ReadSample"/></strong> method returns <strong>MF_E_INVALIDREQUEST</strong> for that stream. Other <strong><see cref="SharpDX.MediaFoundation.SourceReader"/></strong> methods are valid for deselected streams.</p><p>Stream selection does not affect how the source reader loads or unloads decoders in memory. In particular, deselecting a stream does not force the source reader to unload the decoder for that stream.</p><p>This interface is available on Windows?Vista if Platform Update Supplement for Windows?Vista is installed.</p> /// </remarks> /// <msdn-id>dd374669</msdn-id> /// <unmanaged>HRESULT IMFSourceReader::SetStreamSelection([In] unsigned int dwStreamIndex,[In] BOOL fSelected)</unmanaged> /// <unmanaged-short>IMFSourceReader::SetStreamSelection</unmanaged-short> public void SetStreamSelection(SourceReaderIndex readerIndex, RawBool fSelected) { SetStreamSelection((int)readerIndex, fSelected); }
public void XInputEnable(RawBool enable) { Native.XInputEnable(enable); }
public unsafe static D3DXFont CreateFont(Direct3DDevice9 device, int height, int width, int weight, int mipLevels, RawBool italic, int charSet, int outputPrecision, int quality, int pitchAndFamily, string faceName) { var pFaceName = Marshal.StringToHGlobalUni(faceName); var nativePointer = IntPtr.Zero; var hr = (HRESULT)NativeMethods.D3DXCreateFontW_( (void *)(device == null ? IntPtr.Zero : device.NativePointer), height, width, weight, mipLevels, italic, charSet, outputPrecision, quality, pitchAndFamily, (void *)pFaceName, (void *)&nativePointer); Marshal.FreeHGlobal(pFaceName); hr.CheckError(); if (nativePointer == null) { return(null); } return(new D3DXFont(nativePointer)); }
internal void ExecuteCommandList(CommandList commandListRef, RawBool restoreContextState) { m_deviceContext.ExecuteCommandList(commandListRef, restoreContextState); CheckErrors(); }
/// <summary> /// <see cref="IDWriteTextLayout.Draw(IntPtr, IDWriteTextRenderer, float, float)"/> calls this application callback when it needs to draw an inline object. /// </summary> /// <param name="clientDrawingContext">The drawing context passed to <see cref="IDWriteTextLayout.Draw(IntPtr, IDWriteTextRenderer, float, float)"/>.</param> /// <param name="originX">X-coordinate at the top-left corner of the inline object.</param> /// <param name="originY">Y-coordinate at the top-left corner of the inline object.</param> /// <param name="inlineObject">The application-defined inline object set using <see cref="IDWriteTextLayout.SetInlineObject(IDWriteInlineObject, TextRange)"/> IDWriteTextFormat::SetInlineObject.</param> /// <param name="isSideways">A Boolean flag that indicates whether the object's baseline runs alongside the baseline axis of the line.</param> /// <param name="isRightToLeft">A Boolean flag that indicates whether the object is in a right-to-left context, hinting that the drawing may want to mirror the normal image.</param> /// <param name="clientDrawingEffect">Application-defined drawing effects for the glyphs to render. Usually this argument represents effects such as the foreground brush filling the interior of a line.</param> public virtual void DrawInlineObject(IntPtr clientDrawingContext, float originX, float originY, IDWriteInlineObject inlineObject, RawBool isSideways, RawBool isRightToLeft, IUnknown clientDrawingEffect) { }
private static unsafe int DrawInlineObject(IntPtr thisObject, IntPtr clientDrawingContext, float originX, float originY, GlyphOrientationAngle orientationAngle, IntPtr inlineObjectPtr, RawBool isSideways, RawBool isRightToLeft, IntPtr clientDrawingEffectPtr) { try { var shadow = ToShadow <IDWriteTextRenderer1Shadow>(thisObject); var callback = (IDWriteTextRenderer1)shadow.Callback; var inlineObject = inlineObjectPtr == IntPtr.Zero ? null : new IDWriteInlineObject(inlineObjectPtr); var clientDrawingEffect = clientDrawingEffectPtr == IntPtr.Zero ? null : new ComObject(clientDrawingEffectPtr); callback.DrawInlineObject(clientDrawingContext, originX, originY, orientationAngle, inlineObject, isSideways, isRightToLeft, clientDrawingEffect); return(Result.Ok.Code); } catch (Exception ex) { return(Result.GetResultFromException(ex).Code); } }
/// <summary> /// <p>Sets the reporting state of XInput.</p> /// </summary> /// <param name="enable"><dd> <p>If enable is <strong><see cref="F:SharpDX.Result.False" /></strong>, XInput will only send neutral data in response to <strong>XInputGetState</strong> (all buttons up, axes centered, and triggers at 0). <strong>XInputSetState</strong> calls will be registered but not sent to the device. Sending any value other than <strong><see cref="F:SharpDX.Result.False" /> </strong>will restore reading and writing functionality to normal.</p> </dd></param> /// <remarks> /// <p>This function is meant to be called when an application gains or loses focus (such as via <strong>WM_ACTIVATEAPP</strong>). Using this function, you will not have to change the XInput query loop in your application as neutral data will always be reported if XInput is disabled. /// </p><p>In a controller that supports vibration effects:</p><ul> <li>Passing <strong><see cref="F:SharpDX.Result.False" /></strong> will stop any vibration effects currently playing. In this state, calls to <strong>XInputSetState</strong> will be registered, but not passed to the device.</li> <li>Passing <strong>TRUE</strong> will pass the last vibration request (even if it is 0) sent to <strong>XInputSetState</strong> to the device.</li> </ul> /// </remarks> /// <doc-id>microsoft.directx_sdk.reference.xinputenable</doc-id> /// <unmanaged>void XInputEnable([In] BOOL enable)</unmanaged> /// <unmanaged-short>XInputEnable</unmanaged-short> public static void XInputEnable(RawBool enable) { XInputEnable_(enable); }
private static extern void XInputEnable_(RawBool param0);
private void ConvertMinFilter(TextureFilter filter, out Filter minFilter, out Filter magFilter, out SamplerMipmapMode mipmapMode, out RawBool enableComparison, out RawBool enableAnisotropy) { minFilter = magFilter = Filter.Nearest; mipmapMode = SamplerMipmapMode.Nearest; enableComparison = false; enableAnisotropy = false; switch (filter) { // Mip point case TextureFilter.Point: break; case TextureFilter.MinLinearMagMipPoint: minFilter = Filter.Linear; break; case TextureFilter.MinPointMagLinearMipPoint: magFilter = Filter.Linear; break; case TextureFilter.MinMagLinearMipPoint: minFilter = Filter.Linear; magFilter = Filter.Linear; break; // Mip linear case TextureFilter.MinMagPointMipLinear: mipmapMode = SamplerMipmapMode.Linear; break; case TextureFilter.MinLinearMagPointMipLinear: mipmapMode = SamplerMipmapMode.Linear; minFilter = Filter.Linear; break; case TextureFilter.MinPointMagMipLinear: mipmapMode = SamplerMipmapMode.Linear; magFilter = Filter.Linear; break; case TextureFilter.Linear: mipmapMode = SamplerMipmapMode.Linear; minFilter = Filter.Linear; magFilter = Filter.Linear; break; case TextureFilter.Anisotropic: enableAnisotropy = true; mipmapMode = SamplerMipmapMode.Linear; minFilter = Filter.Linear; magFilter = Filter.Linear; break; // Comparison mip point case TextureFilter.ComparisonPoint: enableComparison = true; break; case TextureFilter.ComparisonMinLinearMagMipPoint: enableComparison = true; minFilter = Filter.Linear; break; case TextureFilter.ComparisonMinPointMagLinearMipPoint: enableComparison = true; magFilter = Filter.Linear; break; case TextureFilter.ComparisonMinMagLinearMipPoint: enableComparison = true; minFilter = Filter.Linear; magFilter = Filter.Linear; break; // Comparison mip linear case TextureFilter.ComparisonMinMagPointMipLinear: enableComparison = true; mipmapMode = SamplerMipmapMode.Linear; break; case TextureFilter.ComparisonMinLinearMagPointMipLinear: enableComparison = true; mipmapMode = SamplerMipmapMode.Linear; minFilter = Filter.Linear; break; case TextureFilter.ComparisonMinPointMagMipLinear: enableComparison = true; mipmapMode = SamplerMipmapMode.Linear; magFilter = Filter.Linear; break; case TextureFilter.ComparisonLinear: enableComparison = true; mipmapMode = SamplerMipmapMode.Linear; minFilter = Filter.Linear; magFilter = Filter.Linear; break; case TextureFilter.ComparisonAnisotropic: enableComparison = true; enableAnisotropy = true; mipmapMode = SamplerMipmapMode.Linear; minFilter = Filter.Linear; magFilter = Filter.Linear; break; default: throw new ArgumentOutOfRangeException(); } }
public abstract void IsPixelSnappingDisabled(IntPtr clientDrawingContext, out RawBool isDisabled);
public void StepRange(RawBool bStepIn, CorDebugStepRange[] ranges) { StepRange(bStepIn, ranges, (uint)ranges.Length); }
void IDrawingSurfaceContentProviderNative.PrepareResources(DateTime presentTargetTime, out RawBool isContentDirty) { isContentDirty = true; }
public static extern void XInputEnable(RawBool arg0);
private void PlatformInitialize() { if (Topology != null) { return; } //MediaManagerState.CheckStartup(); MediaFactory.CreateTopology(out _topology); SharpDX.MediaFoundation.MediaSource mediaSource; { SourceResolver resolver = new SourceResolver(); ObjectType otype; ComObject source = resolver.CreateObjectFromURL(FileName, SourceResolverFlags.MediaSource, null, out otype); mediaSource = source.QueryInterface <SharpDX.MediaFoundation.MediaSource>(); resolver.Dispose(); source.Dispose(); } PresentationDescriptor presDesc; mediaSource.CreatePresentationDescriptor(out presDesc); for (var i = 0; i < presDesc.StreamDescriptorCount; i++) { RawBool selected = false; StreamDescriptor desc; presDesc.GetStreamDescriptorByIndex(i, out selected, out desc); if (selected) { TopologyNode sourceNode; MediaFactory.CreateTopologyNode(TopologyType.SourceStreamNode, out sourceNode); sourceNode.Set(TopologyNodeAttributeKeys.Source, mediaSource); sourceNode.Set(TopologyNodeAttributeKeys.PresentationDescriptor, presDesc); sourceNode.Set(TopologyNodeAttributeKeys.StreamDescriptor, desc); TopologyNode outputNode; MediaFactory.CreateTopologyNode(TopologyType.OutputNode, out outputNode); var majorType = desc.MediaTypeHandler.MajorType; if (majorType == MediaTypeGuids.Video) { Activate activate; SampleGrabber = new VideoSampleGrabber(); _mediaType = new MediaType(); _mediaType.Set(MediaTypeAttributeKeys.MajorType, MediaTypeGuids.Video); // Specify that we want the data to come in as RGB32. _mediaType.Set(MediaTypeAttributeKeys.Subtype, new Guid("00000016-0000-0010-8000-00AA00389B71")); MediaFactory.CreateSampleGrabberSinkActivate(_mediaType, SampleGrabber, out activate); outputNode.Object = activate; long frameSize = desc.MediaTypeHandler.CurrentMediaType.Get <long>(MediaTypeAttributeKeys.FrameSize); Width = (int)(frameSize >> 32); Height = (int)(frameSize & 0x0000FFFF); } if (majorType == MediaTypeGuids.Audio) { Activate activate; MediaFactory.CreateAudioRendererActivate(out activate); outputNode.Object = activate; } _topology.AddNode(sourceNode); _topology.AddNode(outputNode); sourceNode.ConnectOutput(0, outputNode, 0); Duration = new TimeSpan(presDesc.Get <long>(PresentationDescriptionAttributeKeys.Duration)); sourceNode.Dispose(); outputNode.Dispose(); } desc.Dispose(); } presDesc.Dispose(); mediaSource.Dispose(); VideoFrame = new Texture2D(Game.Instance.GraphicsDevice, Width, Height, ColorFormat.Bgra8, false); }
public void XInputEnable(RawBool enable) { XInput.XInputEnable(enable); }
public void DrawInlineObject(IntPtr clientDrawingContext, float originX, float originY, GlyphOrientationAngle orientationAngle, IDWriteInlineObject inlineObject, RawBool isSideways, RawBool isRightToLeft, IUnknown clientDrawingEffect) => DrawInlineObject_(clientDrawingContext, originX, originY, orientationAngle, inlineObject, isSideways, isRightToLeft, clientDrawingEffect);
public void XInputEnable(RawBool enable) { throw new NotSupportedException("Method not supported on XInput9.1.0"); }
public virtual void OnException(AppDomain appDomainRef, Thread threadRef, RawBool unhandled) { _handleEvent(ManagedCallbackType.OnException, new ExceptionEventArgs(appDomainRef, threadRef, unhandled, ManagedCallbackType.OnException)); }
public void GetFullscreenState(out RawBool fullscreen) { GetFullscreenState(out fullscreen, out _); }
public virtual void OnEditAndContinueRemap(AppDomain appDomainRef, Thread threadRef, Function functionRef, RawBool fAccurate) { Debug.Assert(false); //OBSOLETE callback }
public unsafe void WaitForFences(uint fenceCount, Fence* fences, RawBool waitAll, ulong timeout) { vkWaitForFences(this, fenceCount, fences, waitAll, timeout).CheckError(); }
internal static unsafe extern Result vkWaitForFences(Device device, uint fenceCount, Fence* fences, RawBool waitAll, ulong timeout);
/// <summary> /// Get an array of boolean variables. /// </summary> /// <param name="offset">Must be set to 0; this is reserved for future use. </param> /// <param name="count">The number of array elements to set. </param> /// <returns>Returns one of the following {{Direct3D 10 Return Codes}}. </returns> /// <unmanaged>HRESULT ID3D10EffectScalarVariable::GetBoolArray([Out, Buffer] BOOL* pData,[None] int Offset,[None] int Count)</unmanaged> public bool[] GetBoolArray(int offset, int count) { var temp = new RawBool[count]; GetBoolArray(temp, offset, count); return Utilities.ConvertToBoolArray(temp); }
public Result GetFullscreenState(out RawBool fullscreen) => GetFullscreenState(out fullscreen, out _);
public void GetFullscreenState(out RawBool fullscreen) { GetFullscreenState(out fullscreen, out var target); }
public abstract void PrepareResources(DateTime presentTargetTime, out RawBool isContentDirty);
protected unsafe DXGISwapchain( GraphicsDevice device, PresentationParameters presentationParameters, ComObject deviceOrCommandQueue, int bufferCount, int frameCount) : base(device) { _frameCount = frameCount; var width = Math.Max(presentationParameters.BackBufferWidth, 1); var height = Math.Max(presentationParameters.BackBufferHeight, 1); switch (presentationParameters.DeviceWindowHandle) { case IntPtr hwnd: { using (var dxgiDevice = deviceOrCommandQueue.QueryInterface <SharpDX.DXGI.Device>()) { using (var dxgiFactory = dxgiDevice.Adapter.GetParent <Factory2>()) { // Check tearing support. RawBool allowTearing = false; using (var factory5 = dxgiFactory.QueryInterfaceOrNull <DXGI.Factory5>()) { factory5.CheckFeatureSupport(DXGI.Feature.PresentAllowTearing, new IntPtr(&allowTearing), sizeof(RawBool) ); // Recommended to always use tearing if supported when using a sync interval of 0. _syncInterval = 0; _presentFlags |= DXGI.PresentFlags.AllowTearing; } var swapchainDesc = new SharpDX.DXGI.SwapChainDescription1() { Width = width, Height = height, Format = Format.B8G8R8A8_UNorm, Stereo = false, SampleDescription = new DXGI.SampleDescription(1, 0), Usage = DXGI.Usage.RenderTargetOutput, BufferCount = bufferCount, Scaling = Scaling.Stretch, SwapEffect = allowTearing ? SwapEffect.FlipDiscard : DXGI.SwapEffect.Discard, AlphaMode = AlphaMode.Ignore, Flags = allowTearing ? SwapChainFlags.AllowTearing : DXGI.SwapChainFlags.None, }; var fullscreenDescription = new DXGI.SwapChainFullScreenDescription { Windowed = true }; _swapChain = new DXGI.SwapChain1(dxgiFactory, deviceOrCommandQueue, hwnd, ref swapchainDesc, fullscreenDescription); dxgiFactory.MakeWindowAssociation(hwnd, DXGI.WindowAssociationFlags.IgnoreAll); } } } break; //case CoreWindow coreWindowHandle: // { // var coreWindow = coreWindowHandle.CoreWindow; // var swapchainDesc = new DXGI.SwapChainDescription1() // { // Width = width, // Height = height, // Format = DXGI.Format.B8G8R8A8_UNorm, // Stereo = false, // SampleDescription = new DXGI.SampleDescription(1, 0), // Usage = DXGI.Usage.RenderTargetOutput, // BufferCount = FrameCount, // Scaling = DXGI.Scaling.AspectRatioStretch, // SwapEffect = DXGI.SwapEffect.FlipDiscard, // AlphaMode = DXGI.AlphaMode.Ignore, // Flags = DXGI.SwapChainFlags.None, // }; // using (var comCoreWindow = new ComObject(coreWindow)) // { // _swapChain = new DXGI.SwapChain1( // factory, // device.D3DDevice, // comCoreWindow, // ref swapchainDesc); // } // } // break; } }
/// <summary> /// /// </summary> private void PlatformInitialize(byte[] bytes, Stream stream, string url) { if (Topology != null) { return; } MediaFactory.CreateTopology(out _topology); SharpDX.MediaFoundation.MediaSource mediaSource; { SourceResolver resolver = new SourceResolver(); ObjectType otype; ComObject source = null; if (url != null) { source = resolver.CreateObjectFromURL(url, SourceResolverFlags.MediaSource, null, out otype); } if (stream != null) { var bs = new ByteStream(stream); source = resolver.CreateObjectFromStream(bs, null, SourceResolverFlags.MediaSource, null, out otype); } if (bytes != null) { var bs = new ByteStream(bytes); source = resolver.CreateObjectFromStream(bs, null, SourceResolverFlags.MediaSource | SourceResolverFlags.ContentDoesNotHaveToMatchExtensionOrMimeType, null, out otype); } if (source == null) { throw new ArgumentException("'stream' and 'url' are null!"); } mediaSource = source.QueryInterface <SharpDX.MediaFoundation.MediaSource>(); resolver.Dispose(); source.Dispose(); } PresentationDescriptor presDesc; mediaSource.CreatePresentationDescriptor(out presDesc); for (var i = 0; i < presDesc.StreamDescriptorCount; i++) { RawBool selected = false; StreamDescriptor desc; presDesc.GetStreamDescriptorByIndex(i, out selected, out desc); if (selected) { TopologyNode sourceNode; MediaFactory.CreateTopologyNode(TopologyType.SourceStreamNode, out sourceNode); sourceNode.Set(TopologyNodeAttributeKeys.Source, mediaSource); sourceNode.Set(TopologyNodeAttributeKeys.PresentationDescriptor, presDesc); sourceNode.Set(TopologyNodeAttributeKeys.StreamDescriptor, desc); TopologyNode outputNode; MediaFactory.CreateTopologyNode(TopologyType.OutputNode, out outputNode); var majorType = desc.MediaTypeHandler.MajorType; if (majorType == MediaTypeGuids.Video) { Activate activate; sampleGrabber = new VideoSampleGrabber(); _mediaType = new MediaType(); _mediaType.Set(MediaTypeAttributeKeys.MajorType, MediaTypeGuids.Video); // Specify that we want the data to come in as RGB32. _mediaType.Set(MediaTypeAttributeKeys.Subtype, new Guid("00000016-0000-0010-8000-00AA00389B71")); MediaFactory.CreateSampleGrabberSinkActivate(_mediaType, SampleGrabber, out activate); outputNode.Object = activate; long frameSize = desc.MediaTypeHandler.CurrentMediaType.Get <long>(MediaTypeAttributeKeys.FrameSize); Width = (int)(frameSize >> 32); Height = (int)(frameSize & 0x0000FFFF); } if (majorType == MediaTypeGuids.Audio) { Activate activate; MediaFactory.CreateAudioRendererActivate(out activate); outputNode.Object = activate; } _topology.AddNode(sourceNode); _topology.AddNode(outputNode); sourceNode.ConnectOutput(0, outputNode, 0); Duration = new TimeSpan(presDesc.Get <long>(PresentationDescriptionAttributeKeys.Duration)); sourceNode.Dispose(); outputNode.Dispose(); } desc.Dispose(); } presDesc.Dispose(); mediaSource.Dispose(); videoFrame = new DynamicTexture(Game.Instance.RenderSystem, Width, Height, typeof(ColorBGRA), false, false); }