Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1005 from battlebottle/SinkWriter_GetStatistics_fix
Browse files Browse the repository at this point in the history
[MediaFoundation] SinkWriter.GetStatistics fix
  • Loading branch information
xoofx committed Apr 23, 2018
2 parents 265f955 + 6cc309e commit 109bd7f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/SharpDX.MediaFoundation/Mapping-core.xml
Expand Up @@ -788,6 +788,9 @@
<map interface="IMFAsyncCallbackLogging" name="IAsyncCallbackLogging" callback="true"/>

<map param="IMFByteStream::*.*::pb" type="void" attribute="in"/>

<map method="IMFSinkWriter::GetStatistics" name="GetStatistics_" check="false" visibility="internal"/>
<map param="IMFSinkWriter::GetStatistics::pStats" type="void" attribute="in"/>

<map param="IMFByteStream::Begin[RW].*::punkState" type="void"/>

Expand Down
36 changes: 36 additions & 0 deletions 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
{
/// <summary>
/// <p>Gets statistics about the performance of the sink writer.</p>
/// </summary>
/// <param name="dwStreamIndex"><dd> <p>The zero-based index of a stream to query, or <strong><see cref="SharpDX.MediaFoundation.SinkWriterIndex.AllStreams"/> </strong> to query the media sink itself.</p> </dd></param>
/// <param name="statsRef"><dd> <p>A reference to an <strong><see cref="SharpDX.MediaFoundation.SinkWriterStatistics"/></strong> structure. Before calling the method, set the <strong>cb</strong> member to the size of the structure in bytes. The method fills the structure with statistics from the sink writer.</p> </dd></param>
/// <returns><p>This method can return one of these values.</p><table> <tr><th>Return code</th><th>Description</th></tr> <tr><td> <dl> <dt><strong><see cref="SharpDX.Result.Ok"/></strong></dt> </dl> </td><td> <p>Success.</p> </td></tr> <tr><td> <dl> <dt><strong><see cref="SharpDX.MediaFoundation.ResultCode.InvalidStreamNumber"/></strong></dt> </dl> </td><td> <p>Invalid stream number.</p> </td></tr> </table><p>?</p></returns>
/// <remarks>
/// <p>This interface is available on Windows?Vista if Platform Update Supplement for Windows?Vista is installed.</p>
/// </remarks>
/// <include file='.\..\..\Documentation\CodeComments.xml' path="/comments/comment[@id='IMFSinkWriter::GetStatistics']/*"/>
/// <msdn-id>dd374650</msdn-id>
/// <unmanaged>HRESULT IMFSinkWriter::GetStatistics([In] unsigned int dwStreamIndex,[Out] MF_SINK_WRITER_STATISTICS* pStats)</unmanaged>
/// <unmanaged-short>IMFSinkWriter::GetStatistics</unmanaged-short>
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));
}
}
}
}
}

0 comments on commit 109bd7f

Please sign in to comment.