ARX  1.0
The next-generation open source augmented reality toolkit.
Loading...
Searching...
No Matches
CaptureFrameGrabber.h
Go to the documentation of this file.
1//*@@@+++@@@@******************************************************************
2//
3// Microsoft Windows Media Foundation
4// Copyright (C) Microsoft Corporation. All rights reserved.
5//
6// Portions Copyright (c) Microsoft Open Technologies, Inc.
7//
8//*@@@---@@@@******************************************************************
9
10#pragma once
11
12#include "MFIncludes.h"
13
14
15namespace Media {
16
17class MediaSink;
18
20{
21 Preview = 0,
22 Record
23};
24
25ref class CaptureFrameGrabber sealed
26{
27public:
28
29 // IClosable
31
33
34internal:
35
36 static concurrency::task<CaptureFrameGrabber^> CreateAsync(_In_ WMC::MediaCapture^ capture, _In_ WMMp::VideoEncodingProperties^ props)
37 {
38 return CreateAsync(capture, props, CaptureStreamType::Preview);
39 }
40
41 static concurrency::task<CaptureFrameGrabber^> CreateAsync(_In_ WMC::MediaCapture^ capture, _In_ WMMp::VideoEncodingProperties^ props, CaptureStreamType streamType);
42
43 concurrency::task<MW::ComPtr<IMF2DBuffer2>> GetFrameAsync();
44 concurrency::task<void> FinishAsync();
45
46private:
47
48 CaptureFrameGrabber(_In_ WMC::MediaCapture^ capture, _In_ WMMp::VideoEncodingProperties^ props, CaptureStreamType streamType);
49
50 void ProcessSample(_In_ MediaSample^ sample);
51
52 Platform::Agile<WMC::MediaCapture> _capture;
53 ::Windows::Media::IMediaExtension^ _mediaExtension;
54
55 MW::ComPtr<MediaSink> _mediaSink;
56
57 CaptureStreamType _streamType;
58
59 enum class State
60 {
61 Created,
62 Started,
63 Closing,
64 Closed
65 } _state;
66
67 std::queue<concurrency::task_completion_event<MW::ComPtr<IMF2DBuffer2>>> _videoSampleRequestQueue;
68 AutoMF _mf;
69 MWW::SRWLock _lock;
70};
71
72}
Definition: MFIncludes.h:82
virtual ~CaptureFrameGrabber()
concurrency::task< MW::ComPtr< IMF2DBuffer2 > > GetFrameAsync()
static concurrency::task< CaptureFrameGrabber^> CreateAsync(_In_ WMC::MediaCapture^ capture, _In_ WMMp::VideoEncodingProperties^ props, CaptureStreamType streamType)
concurrency::task< void > FinishAsync()
void ShowCameraSettings()
Definition: CaptureFrameGrabber.h:15
CaptureStreamType
Definition: CaptureFrameGrabber.h:20