| ARX 1.0 The next-generation open source augmented reality toolkit.

Loading...
Searching...
No Matches
MediaStreamSink.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 namespace Media {
15
16 class MediaStreamSink WrlSealed :
17 public Microsoft::WRL::RuntimeClass<
18 Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
19 IMFStreamSink,
20 IMFMediaEventGenerator,
21 IMFMediaTypeHandler
22 >
23{
24 public:
25
26 MediaStreamSink(
27 __in const MW::ComPtr<IMFMediaSink>& sink,
28 __in DWORD id,
29 __in const MW::ComPtr<IMFMediaType>& mt,
30 __in MediaSampleHandler^ sampleHandler
31 );
32
33 //
34 // IMFStreamSink
35 //
36
37 IFACEMETHODIMP GetMediaSink(__deref_out IMFMediaSink **sink);
38 IFACEMETHODIMP GetIdentifier(__out DWORD *identifier);
39 IFACEMETHODIMP GetMediaTypeHandler(__deref_out IMFMediaTypeHandler **handler);
40 IFACEMETHODIMP ProcessSample(__in_opt IMFSample *sample);
41 IFACEMETHODIMP PlaceMarker(__in MFSTREAMSINK_MARKER_TYPE markerType, __in const PROPVARIANT * markerValue, __in const PROPVARIANT * contextValue);
42 IFACEMETHODIMP Flush();
43
44 //
45 // IMFMediaEventGenerator
46 //
47
48 IFACEMETHODIMP GetEvent(__in DWORD flags, __deref_out IMFMediaEvent **event);
49 IFACEMETHODIMP BeginGetEvent(__in IMFAsyncCallback *callback, __in_opt IUnknown *state);
50 IFACEMETHODIMP EndGetEvent(__in IMFAsyncResult *result, __deref_out IMFMediaEvent **event);
51 IFACEMETHODIMP QueueEvent(__in MediaEventType met, __in REFGUID extendedType, __in HRESULT status, __in_opt const PROPVARIANT *value);
52
53 //
54 // IMFMediaTypeHandler
55 //
56
57 IFACEMETHODIMP IsMediaTypeSupported(__in IMFMediaType *mediaType, __deref_out_opt IMFMediaType **closestMediaType);
58 IFACEMETHODIMP GetMediaTypeCount(__out DWORD *typeCount);
59 IFACEMETHODIMP GetMediaTypeByIndex(__in DWORD index, __deref_out IMFMediaType **mediaType);
60 IFACEMETHODIMP SetCurrentMediaType(__in IMFMediaType *mediaType);
61 IFACEMETHODIMP GetCurrentMediaType(__deref_out_opt IMFMediaType **mediaType);
62 IFACEMETHODIMP GetMajorType(__out GUID *majorType);
63
64 //
65 // Misc
66 //
67
68 void InternalSetCurrentMediaType(__in const MW::ComPtr<IMFMediaType>& mediaType);
69 void RequestSample();
70 void Shutdown();
71
72 private:
73
74 bool _IsMediaTypeSupported(__in const MW::ComPtr<IMFMediaType>& mt) const;
75 void _UpdateMediaType(__in const MW::ComPtr<IMFMediaType>& mt);
76
77 void _VerifyNotShutdown()
78 {
79 if (_shutdown)
80 {
81 CHK(MF_E_SHUTDOWN);
82 }
83 }
84
85 MW::ComPtr<IMFMediaSink> _sink;
86 MW::ComPtr<IMFMediaEventQueue> _eventQueue;
87 MW::ComPtr<IMFMediaType> _curMT;
88
89 MediaSampleHandler^ _sampleHandler;
90
91 GUID _majorType;
92 GUID _subType;
93 unsigned int _width;
94 unsigned int _height;
95 DWORD _id;
96 bool _shutdown;
97
98 MWW::SRWLock _lock;
99};
100
101}
MFIncludes.h
CHK
#define CHK(statement)
Definition: MFIncludes.h:39
Media::WrlSealed::GetMajorType
IFACEMETHODIMP GetMajorType(__out GUID *majorType)
Media::WrlSealed::RequestSample
void RequestSample()
Media::WrlSealed::Flush
IFACEMETHODIMP Flush()
Media::WrlSealed::QueueEvent
IFACEMETHODIMP QueueEvent(__in MediaEventType met, __in REFGUID extendedType, __in HRESULT status, __in_opt const PROPVARIANT *value)
Media::WrlSealed::GetIdentifier
IFACEMETHODIMP GetIdentifier(__out DWORD *identifier)
Media::WrlSealed::GetMediaSink
IFACEMETHODIMP GetMediaSink(__deref_out IMFMediaSink **sink)
Media::WrlSealed::GetMediaTypeHandler
IFACEMETHODIMP GetMediaTypeHandler(__deref_out IMFMediaTypeHandler **handler)
Media::WrlSealed::PlaceMarker
IFACEMETHODIMP PlaceMarker(__in MFSTREAMSINK_MARKER_TYPE markerType, __in const PROPVARIANT *markerValue, __in const PROPVARIANT *contextValue)
Media::WrlSealed::EndGetEvent
IFACEMETHODIMP EndGetEvent(__in IMFAsyncResult *result, __deref_out IMFMediaEvent **event)
Media::WrlSealed::SetCurrentMediaType
IFACEMETHODIMP SetCurrentMediaType(__in IMFMediaType *mediaType)
Media::WrlSealed::GetMediaTypeCount
IFACEMETHODIMP GetMediaTypeCount(__out DWORD *typeCount)
Media::WrlSealed::Shutdown
void Shutdown()
Media::WrlSealed::ProcessSample
IFACEMETHODIMP ProcessSample(__in_opt IMFSample *sample)
Media::WrlSealed::InternalSetCurrentMediaType
void InternalSetCurrentMediaType(__in const MW::ComPtr< IMFMediaType > &mediaType)
Media::WrlSealed::GetCurrentMediaType
IFACEMETHODIMP GetCurrentMediaType(__deref_out_opt IMFMediaType **mediaType)
Media::WrlSealed::IsMediaTypeSupported
IFACEMETHODIMP IsMediaTypeSupported(__in IMFMediaType *mediaType, __deref_out_opt IMFMediaType **closestMediaType)
Media::WrlSealed::BeginGetEvent
IFACEMETHODIMP BeginGetEvent(__in IMFAsyncCallback *callback, __in_opt IUnknown *state)
Media::WrlSealed::GetEvent
IFACEMETHODIMP GetEvent(__in DWORD flags, __deref_out IMFMediaEvent **event)
Media::WrlSealed::GetMediaTypeByIndex
IFACEMETHODIMP GetMediaTypeByIndex(__in DWORD index, __deref_out IMFMediaType **mediaType)
Media::WrlSealed::MediaStreamSink
MediaStreamSink(__in const MW::ComPtr< IMFMediaSink > &sink, __in DWORD id, __in const MW::ComPtr< IMFMediaType > &mt, __in MediaSampleHandler^ sampleHandler)
Media
Definition: CaptureFrameGrabber.h:15