Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 30, 2019. It is now read-only.
/SharpDXPublic archive

Commitea30cbf

Browse files
committed
Added public Initialize method onto CaptureEngine.
1 parent14e70b9 commitea30cbf

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

‎Source/SharpDX.MediaFoundation/CaptureEngine.cs‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66

77
namespaceSharpDX.MediaFoundation
88
{
9+
publicdelegatevoidCaptureEngineOnEventDelegate(MediaEventmediaEvent);
10+
911
publicpartialclassCaptureEngine
1012
{
13+
privateCaptureEngineOnEventImplcaptureEngineOnEventImpl;
14+
1115
/// <summary>
1216
/// <p>Creates an instance of the capture engine.</p>
1317
/// </summary>
@@ -27,6 +31,50 @@ public CaptureEngine(CaptureEngineClassFactory factory)
2731
IntPtrnative;
2832
factory.CreateInstance(ClsidMFCaptureEngine,Utilities.GetGuidFromType(typeof(CaptureEngine)),outnative);
2933
NativePointer=native;
34+
35+
captureEngineOnEventImpl=newCaptureEngineOnEventImpl(this);
36+
}
37+
38+
/// <summary>
39+
/// <p>Initializes the capture engine.</p>
40+
/// </summary>
41+
/// <param name="eventCallbackRef"><dd> <p>A reference to the <strong><see cref="SharpDX.MediaFoundation.CaptureEngineOnEventCallback"/></strong> interface. The caller must implement this interface. The capture engine uses this interface to send asynchronous events to the caller.</p> </dd></param>
42+
/// <param name="attributesRef"><dd> <p>A reference to the <strong><see cref="SharpDX.MediaFoundation.MediaAttributes"/></strong> interface. This parameter can be <strong><c>null</c></strong>. </p> <p>You can use this parameter to configure the capture engine. Call <strong><see cref="SharpDX.MediaFoundation.MediaFactory.CreateAttributes"/></strong> to create an attribute store, and then set any of the following attributes.</p> <ul> <li> <see cref="SharpDX.MediaFoundation.CaptureEngineAttributeKeys.D3DManager"/> </li> <li> <see cref="SharpDX.MediaFoundation.CaptureEngineAttributeKeys.DisableDXVA"/> </li> <li> <see cref="SharpDX.MediaFoundation.CaptureEngineAttributeKeys.DisableHardwareTransforms"/> </li> <li> <see cref="SharpDX.MediaFoundation.CaptureEngineAttributeKeys.EncoderTransformFieldOfUseUnlockAttribute"/> </li> <li> <see cref="SharpDX.MediaFoundation.CaptureEngineAttributeKeys.EventGeneratorGuid"/> </li> <li> <see cref="SharpDX.MediaFoundation.CaptureEngineAttributeKeys.EventStreamIndex"/> </li> <li> <see cref="SharpDX.MediaFoundation.CaptureEngineAttributeKeys.MediaSourceConfig"/> </li> <li> <see cref="SharpDX.MediaFoundation.CaptureEngineAttributeKeys.RecordSinkAudioMaxProcessedSamples"/> </li> <li> <see cref="SharpDX.MediaFoundation.CaptureEngineAttributeKeys.RecordSinkAudioMaxUnprocessedSamples"/> </li> <li> <see cref="SharpDX.MediaFoundation.CaptureEngineAttributeKeys.RecordSinkVideoMaxProcessedSamples"/> </li> <li> <see cref="SharpDX.MediaFoundation.CaptureEngineAttributeKeys.RecordSinkVideoMaxUnprocessedSamples"/> </li> <li> <see cref="SharpDX.MediaFoundation.CaptureEngineAttributeKeys.UseAudioDeviceOnly"/> </li> <li> <see cref="SharpDX.MediaFoundation.CaptureEngineAttributeKeys.UseVideoDeviceOnly"/> </li> </ul> </dd></param>
43+
/// <param name="audioSourceRef"><dd> <p>An <strong><see cref="SharpDX.ComObject"/></strong> reference that specifies an audio-capture device. This parameter can be <strong><c>null</c></strong>.</p> <p>If you set the <see cref="SharpDX.MediaFoundation.CaptureEngineAttributeKeys.UseVideoDeviceOnly"/> attribute to <strong>TRUE</strong> in <em>pAttributes</em>, the capture engine does not use an audio device, and the <em>pAudioSource</em> parameter is ignored.</p> <p>Otherwise, if <em>pAudioSource</em> is <strong><c>null</c></strong>, the capture engine selects the microphone that is built into the video camera specified by <em>pVideoSource</em>. If the video camera does not have a microphone, the capture engine enumerates the audio-capture devices on the system and selects the first one.</p> <p>To override the default audio device, set <em>pAudioSource</em> to an <strong><see cref="SharpDX.MediaFoundation.MediaSource"/></strong> or <strong><see cref="SharpDX.MediaFoundation.Activate"/></strong> reference for the device. For more information, see Audio/Video Capture in Media Foundation.</p> </dd></param>
44+
/// <param name="videoSourceRef"><dd> <p>An <strong><see cref="SharpDX.ComObject"/></strong> reference that specifies a video-capture device. This parameter can be <strong><c>null</c></strong>.</p> <p>If you set the <see cref="SharpDX.MediaFoundation.CaptureEngineAttributeKeys.UseAudioDeviceOnly"/> attribute to <strong>TRUE</strong> in <em>pAttributes</em>, the capture engine does not use a video device, and the <em>pVideoSource</em> parameter is ignored.</p> <p>Otherwise, if <em>pVideoSource</em> is <strong><c>null</c></strong>, the capture engine enumerates the video-capture devices on the system and selects the first one.</p> <p>To override the default video device, set <em>pVideoSource</em> to an <strong><see cref="SharpDX.MediaFoundation.MediaSource"/></strong> or <strong><see cref="SharpDX.MediaFoundation.Activate"/></strong> reference for the device. For more information, see Enumerating Video Capture Devices.</p> </dd></param>
45+
/// <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.InvalidRequest"/></strong></dt> </dl> </td><td> <p>The <strong>Initialize</strong> method was already called.</p> </td></tr> <tr><td> <dl> <dt><strong><see cref="SharpDX.MediaFoundation.ResultCode.NoCaptureDevicesAvailable"/></strong></dt> </dl> </td><td> <p>No capture devices are available.</p> </td></tr> </table><p> </p></returns>
46+
/// <remarks>
47+
/// <p>You must call this method once before using the capture engine. Calling the method a second time returns <strong><see cref="SharpDX.MediaFoundation.ResultCode.InvalidRequest"/></strong>.</p><p>This method is asynchronous. If the method returns a success code, the caller will receive an <strong>MF_CAPTURE_ENGINE_INITIALIZED</strong> event through the <strong><see cref="SharpDX.MediaFoundation.CaptureEngineOnEventCallback.OnEvent"/></strong> method. The operation can fail asynchronously after the method succeeds. If so, the error code is conveyed through the <strong>OnEvent</strong> method.</p>
48+
/// </remarks>
49+
/// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='IMFCaptureEngine::Initialize']/*"/>
50+
/// <msdn-id>hh447855</msdn-id>
51+
/// <unmanaged>HRESULT IMFCaptureEngine::Initialize([In] IMFCaptureEngineOnEventCallback* pEventCallback,[In, Optional] IMFAttributes* pAttributes,[In, Optional] IUnknown* pAudioSource,[In, Optional] IUnknown* pVideoSource)</unmanaged>
52+
/// <unmanaged-short>IMFCaptureEngine::Initialize</unmanaged-short>
53+
publicvoidInitialize(MediaAttributesattributesRef,ComObjectaudioSourceRef,ComObjectvideoSourceRef)
54+
{
55+
Initialize_(CaptureEngineOnEventCallbackShadow.ToIntPtr(captureEngineOnEventImpl),attributesRef,audioSourceRef,videoSourceRef);
56+
}
57+
58+
publiceventCaptureEngineOnEventDelegateCaptureEngineEvent;
59+
60+
privatevoidOnEvent(MediaEventmediaEvent)
61+
{
62+
CaptureEngineEvent?.Invoke(mediaEvent);
63+
}
64+
65+
privateclassCaptureEngineOnEventImpl:CallbackBase,CaptureEngineOnEventCallback
66+
{
67+
privateCaptureEnginecaptureEngine;
68+
69+
publicCaptureEngineOnEventImpl(CaptureEnginecaptureEngine)
70+
{
71+
this.captureEngine=captureEngine;
72+
}
73+
74+
publicvoidOnEvent(MediaEventmediaEvent)
75+
{
76+
captureEngine.OnEvent(mediaEvent);
77+
}
3078
}
3179
}
3280
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp