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

Commit

Permalink
Added useful constructors for the CaptureEngineClassFactory and the C…
Browse files Browse the repository at this point in the history
…aptureEngine.
  • Loading branch information
jkoritzinsky committed Jan 3, 2017
1 parent 89cf255 commit 8d2906b
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Source/SharpDX.MediaFoundation/CaptureEngine.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SharpDX.MediaFoundation
{
public partial class CaptureEngine
{
/// <summary>
/// <p>Creates an instance of the capture engine.</p>
/// </summary>
/// <param name="clsid"><dd> <p>The CLSID of the object to create. Currently, this parameter must equal <strong><see cref="SharpDX.MediaFoundation.CaptureEngine.ClsidMFCaptureEngine"/></strong>.</p> </dd></param>
/// <param name="riid"><dd> <p>The IID of the requested interface. The capture engine supports the <strong><see cref="SharpDX.MediaFoundation.CaptureEngine"/></strong> interface.</p> </dd></param>
/// <param name="vObjectOut"><dd> <p>Receives a reference to the requested interface. The caller must release the interface.</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>Before calling this method, call the <strong><see cref="SharpDX.MediaFoundation.MediaFactory.Startup"/></strong> function.</p>
/// </remarks>
/// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='IMFCaptureEngineClassFactory::CreateInstance']/*"/>
/// <msdn-id>hh447848</msdn-id>
/// <unmanaged>HRESULT IMFCaptureEngineClassFactory::CreateInstance([In] const GUID&amp; clsid,[In] const GUID&amp; riid,[Out] void** ppvObject)</unmanaged>
/// <unmanaged-short>IMFCaptureEngineClassFactory::CreateInstance</unmanaged-short>
public CaptureEngine(CaptureEngineClassFactory factory)
{
IntPtr native;
factory.CreateInstance(ClsidMFCaptureEngine, Utilities.GetGuidFromType(typeof(CaptureEngine)), out native);
NativePointer = native;
}
}
}
18 changes: 18 additions & 0 deletions Source/SharpDX.MediaFoundation/CaptureEngineClassFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#if DESKTOP_APP
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SharpDX.MediaFoundation
{
public partial class CaptureEngineClassFactory
{
public CaptureEngineClassFactory()
{
Utilities.CreateComInstance(ClsidMFCaptureEngineClassFactory, Utilities.CLSCTX.ClsctxInproc, Utilities.GetGuidFromType(typeof(CaptureEngineClassFactory)), this);
}
}
}
#endif
3 changes: 3 additions & 0 deletions Source/SharpDX.MediaFoundation/Mapping-core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,8 @@
<const from-macro="MF_VERSION" class="SharpDX.MediaFoundation.MediaFactory" type="int" name="Version" />

<const from-guid="CLSID_MFMediaEngineClassFactory" visibility="internal" class="SharpDX.MediaFoundation.MediaEngineClassFactory" type="System.Guid" name="CLSID_MFMediaEngineClassFactory">new System.Guid("$1")</const>
<const from-guid="CLSID_MFCaptureEngineClassFactory" visibility="internal" class="SharpDX.MediaFoundation.CaptureEngineClassFactory" type="System.Guid" name="CLSID_MFCaptureEngineClassFactory">new System.Guid("$1")</const>
<const from-guid="CLSID_MFCaptureEngine" visibility="internal" class="SharpDX.MediaFoundation.CaptureEngine" type="System.Guid" name="CLSID_MFCaptureEngine">new System.Guid("$1")</const>

<const from-guid="MFSampleExtension_DescrambleData" class="SharpDX.MediaFoundation.SampleAttributeKeys" type="MediaAttributeKey&lt;long&gt;" name="DescrambleData">new MediaAttributeKey&lt;long&gt;("$1", "DescrambleData")</const>
<const from-guid="MFSampleExtension_SampleKeyID" class="SharpDX.MediaFoundation.SampleAttributeKeys" type="MediaAttributeKey&lt;int&gt;" name="SampleKeyID">new MediaAttributeKey&lt;int&gt;("$1", "SampleKeyID")</const>
Expand Down Expand Up @@ -755,6 +757,7 @@

<map method="IMFMediaEngineClassFactory::Create.*" visibility="internal"/>
<map param="IMFMediaEngineClassFactory::Create.*::pp.*" attribute="fast out"/>
<map method="IMFCaptureEngineClassFactory::Create.*" visibility="internal"/>

<map param="IMFMediaEngineClassFactory::CreateInstance::dwFlags" type="MF_MEDIA_ENGINE_CREATEFLAGS" name="flags"/>

Expand Down
2 changes: 2 additions & 0 deletions Source/SharpDX.MediaFoundation/SharpDX.MediaFoundation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<Compile Include="AudioDecoder.cs" />
<Compile Include="ByteStream.cs" />
<Compile Include="AsyncCallbackShadow.cs" />
<Compile Include="CaptureEngine.cs" />
<Compile Include="CaptureEngineClassFactory.cs" />
<Compile Include="CaptureEngineOnEventCallback.cs" />
<Compile Include="CaptureEngineOnEventCallbackShadow.cs" />
<Compile Include="CaptureEngineOnSampleCallback.cs" />
Expand Down

0 comments on commit 8d2906b

Please sign in to comment.