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

Commit 8c168df

Browse files
authored
Merge pull request #977 from moritzuehling/master
TryAquireNextFrame-API for Desktop-Duplication-API.
2 parents 5e8b4a7 + ee8670d commit 8c168df

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

Source/SharpDX.DXGI/Mapping.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@
249249
<map param="IDXGIOutput4::CheckOverlayColorSpaceSupport::pFlags" return="true"/>
250250
<map param="IDXGIOutput3::CheckOverlaySupport::pFlags" return="true"/>
251251

252+
<map method="IDXGIOutputDuplication::AcquireNextFrame" hresult="true" check="false" visibility="public" name="TryAcquireNextFrame" />
253+
252254
<map param="ISurfaceImageSourceNative::BeginDraw::surface" return="true"/>
253255

254256
<map interface="IVirtualSurfaceUpdatesCallbackNative" visibility="internal" callback="true" callback-dual="true" />

Source/SharpDX.DXGI/OutputDuplication.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,26 @@ public DataRectangle MapDesktopSurface()
2929
MapDesktopSurface(out mappedRect);
3030
return new DataRectangle(mappedRect.PBits, mappedRect.Pitch);
3131
}
32+
33+
/// <summary>
34+
/// <p>Indicates that the application is ready to process the next desktop image.</p>
35+
/// </summary>
36+
/// <param name="timeoutInMilliseconds"><dd> <p>The time-out interval, in milliseconds. This interval specifies the amount of time that this method waits for a new frame before it returns to the caller. This method returns if the interval elapses, and a new desktop image is not available.</p> <p>For more information about the time-out interval, see Remarks.</p> </dd></param>
37+
/// <param name="frameInfoRef"><dd> <p>A reference to a memory location that receives the <strong><see cref="SharpDX.DXGI.OutputDuplicateFrameInformation"/></strong> structure that describes timing and presentation statistics for a frame.</p> </dd></param>
38+
/// <param name="desktopResourceOut"><dd> <p>A reference to a variable that receives the <strong><see cref="SharpDX.DXGI.Resource"/></strong> interface of the surface that contains the desktop bitmap.</p> </dd></param>
39+
/// <remarks>
40+
/// <p>When <strong>AcquireNextFrame</strong> returns successfully, the calling application can access the desktop image that <strong>AcquireNextFrame</strong> returns in the variable at <em>ppDesktopResource</em>.
41+
/// If the caller specifies a zero time-out interval in the <em>TimeoutInMilliseconds</em> parameter, <strong>AcquireNextFrame</strong> verifies whether there is a new desktop image available, returns immediately, and indicates its outcome with the return value. If the caller specifies an <strong>INFINITE</strong> time-out interval in the <em>TimeoutInMilliseconds</em> parameter, the time-out interval never elapses.</p><strong>Note</strong>??You cannot cancel the wait that you specified in the <em>TimeoutInMilliseconds</em> parameter. Therefore, if you must periodically check for other conditions (for example, a terminate signal), you should specify a non-<strong>INFINITE</strong> time-out interval. After the time-out interval elapses, you can check for these other conditions and then call <strong>AcquireNextFrame</strong> again to wait for the next frame.?<p><strong>AcquireNextFrame</strong> acquires a new desktop frame when the operating system either updates the desktop bitmap image or changes the shape or position of a hardware reference. The new frame that <strong>AcquireNextFrame</strong> acquires might have only the desktop image updated, only the reference shape or position updated, or both.</p>
42+
/// </remarks>
43+
/// <include file='.\..\..\Documentation\CodeComments.xml' path="/comments/comment[@id='IDXGIOutputDuplication::AcquireNextFrame']/*"/>
44+
/// <msdn-id>hh404615</msdn-id>
45+
/// <unmanaged>HRESULT IDXGIOutputDuplication::AcquireNextFrame([In] unsigned int TimeoutInMilliseconds,[Out] DXGI_OUTDUPL_FRAME_INFO* pFrameInfo,[Out] IDXGIResource** ppDesktopResource)</unmanaged>
46+
/// <unmanaged-short>IDXGIOutputDuplication::AcquireNextFrame</unmanaged-short>
47+
public void AcquireNextFrame(int timeoutInMilliseconds, out SharpDX.DXGI.OutputDuplicateFrameInformation frameInfoRef, out SharpDX.DXGI.Resource desktopResourceOut)
48+
{
49+
var result = this.TryAcquireNextFrame(timeoutInMilliseconds, out frameInfoRef, out desktopResourceOut);
50+
result.CheckError();
51+
}
3252
#endif
3353
}
3454
}

0 commit comments

Comments
 (0)