From 6cc309e69c0a24d6b634857c7f78ee51f69fe304 Mon Sep 17 00:00:00 2001 From: "DESKTOP-5OA5OTK\\myutw" Date: Wed, 11 Apr 2018 17:41:56 +0100 Subject: [PATCH] [MediaFoundation] SinkWriter.GetStatistics fix --- .../SharpDX.MediaFoundation/Mapping-core.xml | 3 ++ Source/SharpDX.MediaFoundation/SinkWriter.cs | 36 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 Source/SharpDX.MediaFoundation/SinkWriter.cs diff --git a/Source/SharpDX.MediaFoundation/Mapping-core.xml b/Source/SharpDX.MediaFoundation/Mapping-core.xml index 699b8deae..a2cf862ef 100644 --- a/Source/SharpDX.MediaFoundation/Mapping-core.xml +++ b/Source/SharpDX.MediaFoundation/Mapping-core.xml @@ -787,6 +787,9 @@ + + + diff --git a/Source/SharpDX.MediaFoundation/SinkWriter.cs b/Source/SharpDX.MediaFoundation/SinkWriter.cs new file mode 100644 index 000000000..1bd5a17c1 --- /dev/null +++ b/Source/SharpDX.MediaFoundation/SinkWriter.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SharpDX.MediaFoundation +{ + public partial class SinkWriter + { + /// + ///

Gets statistics about the performance of the sink writer.

+ ///
+ ///

The zero-based index of a stream to query, or to query the media sink itself.

+ ///

A reference to an structure. Before calling the method, set the cb member to the size of the structure in bytes. The method fills the structure with statistics from the sink writer.

+ ///

This method can return one of these values.

Return codeDescription

Success.

Invalid stream number.

?

+ /// + ///

This interface is available on Windows?Vista if Platform Update Supplement for Windows?Vista is installed.

+ ///
+ /// + /// dd374650 + /// HRESULT IMFSinkWriter::GetStatistics([In] unsigned int dwStreamIndex,[Out] MF_SINK_WRITER_STATISTICS* pStats) + /// IMFSinkWriter::GetStatistics + public void GetStatistics(int dwStreamIndex, out SharpDX.MediaFoundation.SinkWriterStatistics statsRef) + { + unsafe + { + statsRef = new SharpDX.MediaFoundation.SinkWriterStatistics(); + statsRef.Cb = sizeof(SharpDX.MediaFoundation.SinkWriterStatistics); + fixed (void* statsRefPtr = &statsRef) + { + GetStatistics_(dwStreamIndex, new IntPtr(statsRefPtr)); + } + } + } + } +}