| 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
15 namespace Media {
16
17 class MediaSink;
18
19 enum class CaptureStreamType
20{
21 Preview = 0,
22 Record
23};
24
25 ref class CaptureFrameGrabber sealed
26{
27 public:
28
29 // IClosable
30 virtual ~CaptureFrameGrabber();
31
32 void ShowCameraSettings();
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
46 private:
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}
MFIncludes.h
AutoMF
Definition: MFIncludes.h:82
Media::sealed::~CaptureFrameGrabber
virtual ~CaptureFrameGrabber()
Media::sealed::GetFrameAsync
concurrency::task< MW::ComPtr< IMF2DBuffer2 > > GetFrameAsync()
Media::sealed::CreateAsync
static concurrency::task< CaptureFrameGrabber^> CreateAsync(_In_ WMC::MediaCapture^ capture, _In_ WMMp::VideoEncodingProperties^ props, CaptureStreamType streamType)
Media::sealed::FinishAsync
concurrency::task< void > FinishAsync()
Media::sealed::ShowCameraSettings
void ShowCameraSettings()
Media
Definition: CaptureFrameGrabber.h:15
Media::CaptureStreamType
CaptureStreamType
Definition: CaptureFrameGrabber.h:20
Media::CaptureStreamType::Preview
@ Preview
Media::CaptureStreamType::Record
@ Record