summaryrefslogtreecommitdiff
path: root/avstream/sampledevicemft/multipinmfthelpers.h
blob: 4181bcca195b07cd7a5460a2494bb7db92c53c86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
//*@@@+++@@@@******************************************************************
//
// Microsoft Windows Media Foundation
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//*@@@---@@@@******************************************************************
//
#pragma once
#include "stdafx.h"
#include "common.h"
#include <deque>
using namespace std;
#include <functional>

typedef void(*DMFT_IMAGE_TRANSFORM_FN)(
    const RECT&             rcDest,          // Destination rectangle for the transformation.
    BYTE*                   pDest,           // Destination buffer.
    LONG                    lDestStride,     // Destination stride.
    const BYTE*             pSrc,            // Source buffer.
    LONG                    lSrcStride,      // Source stride.
    DWORD                   dwWidthInPixels, // Image width in pixels.
    DWORD                   dwHeightInPixels // Image height in pixels.
    );
//
//Queue class!!!
//
class Ctee;
//typedef CMFAttributesTrace CMediaTypeTrace; /* Only used for debug. take this out*/


template< typename T ,  HRESULT ( __stdcall T::*Func) ( IMFAsyncResult* ) >
class CDMFTAsyncCallback : public IMFAsyncCallback
{
public:
    CDMFTAsyncCallback( T* parent , DWORD dwWorkQueueId = MFASYNC_CALLBACK_QUEUE_STANDARD) :
        m_Parent(parent),
        m_dwQueueId(dwWorkQueueId)
    { }
    virtual ~CDMFTAsyncCallback() { }

    STDMETHODIMP QueryInterface(REFIID riid, void** ppv)
    {
        HRESULT hr = S_OK;
        if (ppv != nullptr)
        {
            *ppv = nullptr;
            if (riid == __uuidof(IMFAsyncCallback) || riid == __uuidof(IUnknown))
            {
                AddRef();
                *ppv = static_cast<IUnknown*>(this);
            }
            else
            {
                hr = E_NOINTERFACE;
            }
        }
        else
        {
            hr = E_POINTER;
        }
        return hr;
    }

    STDMETHODIMP_(ULONG) AddRef()
    {
        return InterlockedIncrement(&m_cRef);
    }
    STDMETHODIMP_(ULONG) Release()
    {
        long cRef = InterlockedDecrement(&m_cRef);
        if (cRef == 0)
        {
            delete this;
        }
        return cRef;
    }

    STDMETHODIMP GetParameters(DWORD* pdwFlags, DWORD* pdwQueue)
    {
        *pdwFlags = 0;
        *pdwQueue = m_dwQueueId;
        return E_NOTIMPL;
    }

    STDMETHODIMP Invoke( IMFAsyncResult* pAsyncResult )
    {
        ComPtr<T> spParent;
        {
            // Take a reference on the parent so that
            // shutdown may not yank it from us
            CAutoLock Lock(&m_Lock);
            spParent = m_Parent;
        }
        if (spParent.Get())
        {
            return ((spParent.Get())->*Func)(pAsyncResult);
        }
        return MF_E_SHUTDOWN;
    }
    VOID Shutdown()
    {
        CAutoLock Lock(&m_Lock);
        m_Parent = nullptr; //Break the reference
    }
    T GetParent()
    {
        return m_Parent;
    }
protected:
    CCritSec    m_Lock;
    ComPtr<T>   m_Parent; 
    long        m_cRef = 0;
    DWORD       m_dwQueueId = MFASYNC_CALLBACK_QUEUE_STANDARD;
};


class CPinQueue: public IUnknown{
public:
    CPinQueue(_In_ DWORD _inPinId, _In_ IMFDeviceTransform* pTransform=nullptr);
    ~CPinQueue();

    STDMETHODIMP_(VOID) InsertInternal  ( _In_  IMFSample *pSample = nullptr );
    STDMETHODIMP Insert                 ( _In_ IMFSample *pSample );
    STDMETHODIMP Remove                 (_Outptr_result_maybenull_ IMFSample **pSample);
    virtual STDMETHODIMP RecreateTee    (
        _In_  IMFMediaType *inMediatype,
        _In_ IMFMediaType *outMediatype,
        _In_opt_ IUnknown* punkManager);
#if ((defined NTDDI_WIN10_VB) && (NTDDI_VERSION >= NTDDI_WIN10_VB))
    STDMETHODIMP RecreateTeeByAllocatorMode(
        _In_  IMFMediaType* inMediatype,
        _In_ IMFMediaType* outMediatype,
        _In_opt_ IUnknown* punkManager,
        _In_ MFSampleAllocatorUsage allocatorUsage,
        _In_opt_ IMFVideoSampleAllocator* pAllcoator);
#endif
    STDMETHODIMP_(VOID) Clear();
  
    //
    //Inline functions
    //
    __inline BOOL Empty()
    {
        return (!m_sampleList.size());
    }
    __inline DWORD pinStreamId()
    {
        return m_dwInPinId;
    }
    __inline GUID pinCategory()
    {
        if (IsEqualCLSID(m_streamCategory, GUID_NULL))
        {
            ComPtr<IMFAttributes> spAttributes;
            if (SUCCEEDED(m_pTransform->GetOutputStreamAttributes(pinStreamId(), spAttributes.ReleaseAndGetAddressOf())))
            {
                (VOID)spAttributes->GetGUID(MF_DEVICESTREAM_STREAM_CATEGORY, &m_streamCategory);

            }
        }
        return m_streamCategory;
    }

    STDMETHODIMP QueryInterface(REFIID riid, void** ppv)
    {
        HRESULT hr = S_OK;
        if (ppv != nullptr)
        {
            *ppv = nullptr;
            if (riid == __uuidof(IUnknown))
            {
                AddRef();
                *ppv = static_cast<IUnknown*>(this);
            }
            else
            {
                hr = E_NOINTERFACE;
            }
        }
        else
        {
            hr = E_POINTER;
        }
        return hr;
    }

    STDMETHODIMP_(ULONG) AddRef()
    {
        return InterlockedIncrement(&m_cRef);
    }
    STDMETHODIMP_(ULONG) Release()
    {
        long cRef = InterlockedDecrement(&m_cRef);
        if (cRef == 0)
        {
            delete this;
        }
        return cRef;
    }

private:
    DWORD                m_dwInPinId;           /* This is the input pin       */
    IMFSampleList        m_sampleList;          /* List storing the samples    */
    GUID                 m_streamCategory;
    ULONG                m_cRef;
protected:
    IMFDeviceTransform*  m_pTransform;          /* Weak reference to the the device MFT */
    ComPtr<Ctee>         m_spTeer;              /*Tee that acts as a passthrough or an XVP  */
 };


#ifdef MF_DEVICEMFT_ADD_GRAYSCALER_
class CPinQueueWithGrayScale:public  CPinQueue{
public:
    CPinQueueWithGrayScale(_In_ DWORD dwPinId, _In_ IMFDeviceTransform* pParent) :CPinQueue(dwPinId,pParent)
    {
    }
    STDMETHODIMP RecreateTee(_In_  IMFMediaType *inMediatype, _In_ IMFMediaType *outMediatype, _In_opt_ IUnknown* punkManager);
};
#endif
//
// Define these in different components
// The below classes are used to add the
// XVP and the Decoder components.
//
class Ctee: public IUnknown{
public:
    // This is a helper class to release the interface
    // It will first call shutdowntee to break any circular
    // references any components might have with their composed
    // objects
    static VOID ReleaseTee( _In_ ComPtr<Ctee> &tee)
    {
        if (tee)
        {
            tee->ShutdownTee();
            tee = nullptr;
        }
    }
    STDMETHOD(Start)()
    {
        return S_OK;
    }
    STDMETHOD(Stop)()
    {
        return S_OK;
    }
   virtual STDMETHODIMP PassThrough( _In_ IMFSample * ) = 0;

   STDMETHOD_(VOID, ShutdownTee)()
   {
       return; // NOOP
   }
   STDMETHODIMP QueryInterface(REFIID riid, void** ppv)
   {
       HRESULT hr = S_OK;
       if (ppv != nullptr)
       {
           *ppv = nullptr;
           if (riid == __uuidof(IUnknown))
           {
               AddRef();
               *ppv = static_cast<IUnknown*>(this);
           }
           else
           {
               hr = E_NOINTERFACE;
           }
       }
       else
       {
           hr = E_POINTER;
       }
       return hr;
   }
   Ctee()
   {
   }
   virtual ~Ctee()
   {}
   STDMETHODIMP_(ULONG) AddRef()
   {
       return InterlockedIncrement(&m_cRef);
   }
   STDMETHODIMP_(ULONG) Release()
   {
       long cRef = InterlockedDecrement(&m_cRef);
       if (cRef == 0)
       {
           delete this;
       }
       return cRef;
   }

protected:
    ULONG m_cRef = 0;
};


class CNullTee:public Ctee{
public:
    CNullTee(_In_ CPinQueue* q)
        : m_Queue(q)
    {
    }
    STDMETHODIMP PassThrough( _In_ IMFSample* );

protected:
    // Store the queue here for simplicity
    ComPtr<CPinQueue> m_Queue;
};


class CWrapTee : public Ctee
{
public:
    CWrapTee( _In_ Ctee *tee=nullptr ) 
    : m_spObjectWrapped(tee)
    , m_pInputMediaType(nullptr)
    , m_pOutputMediaType(nullptr)
    {

    }
    virtual ~CWrapTee()
    {
    }

    STDMETHODIMP PassThrough        ( _In_ IMFSample* );
    virtual STDMETHODIMP Do         ( _In_ IMFSample* pSample, _Out_ IMFSample **) = 0;
    STDMETHODIMP SetMediaTypes(_In_ IMFMediaType* pInMediaType, _In_ IMFMediaType* pOutMediaType);
    //
    // Inline functions
    //
protected:
    
    __inline IMFMediaType* getInMediaType()
    {
        IMFMediaType* pmediaType = nullptr;
        m_pInputMediaType.CopyTo(&pmediaType);
        return pmediaType;
    }
    __inline IMFMediaType* getOutMediaType()
    {
        IMFMediaType* pmediaType = nullptr;
        m_pOutputMediaType.CopyTo(&pmediaType);
        return pmediaType;
    }

protected:
    
    ComPtr< IMFMediaType > m_pInputMediaType;
    ComPtr< IMFMediaType > m_pOutputMediaType;
    ComPtr<Ctee> m_spObjectWrapped;
};

//
// wrapper class for encoder and decoder
//
class CVideoProcTee: public CWrapTee
{
public:

    CVideoProcTee( _In_ Ctee* p,  _In_ GUID category = PINNAME_PREVIEW
        , _In_ IMFVideoSampleAllocator* sampleAllocator=nullptr
    )
        :CWrapTee(p)
        , m_bProducesSamples(FALSE)
        , m_asyncHresult(S_OK)
        , m_streamCategory(category)
        , m_fSetD3DManager(FALSE)
        , m_spDefaultAllocator(sampleAllocator)
    {}
    __inline IMFTransform* Transform()
    {
        return m_spVideoProcessor.Get();
    }

    VOID SetD3DManager( _In_opt_ IUnknown* pUnk )
    {
        m_spDeviceManagerUnk = pUnk;
    }

    STDMETHODIMP SetMediaTypes(_In_ IMFMediaType* pInMediaType, _In_ IMFMediaType* pOutMediaType);
    virtual STDMETHODIMP Configure(_In_ IMFMediaType *, _In_ IMFMediaType *, _Inout_ IMFTransform**) = 0;
    STDMETHOD(CreateAllocator)();
    STDMETHOD(Stop)()
    {
        HRESULT hr = S_OK;
        if (SUCCEEDED(hr = StopStreaming()))
        {
            if (m_spObjectWrapped)
            {
                hr = m_spObjectWrapped->Stop();
            }
        }
        return hr;
    }
    virtual ~CVideoProcTee();
protected:
    CCritSec m_Lock;
    __inline VOID SetAsyncStatus(_In_ HRESULT hrStatus)
    {
        InterlockedCompareExchange(&m_asyncHresult, hrStatus, S_OK);
    }
    HRESULT GetAsyncStatus()
    {
        return InterlockedCompareExchange(&m_asyncHresult, S_OK, S_OK);
    }
    STDMETHOD(StartStreaming)() = 0;
    STDMETHOD(StopStreaming)()  = 0;
    HRESULT              m_asyncHresult;
    ComPtr< IMFTransform > m_spVideoProcessor;
    ComPtr<IUnknown>       m_spDeviceManagerUnk;
    ComPtr<IMFVideoSampleAllocatorEx> m_spPrivateAllocator;
    ComPtr<IMFVideoSampleAllocator> m_spDefaultAllocator;

    BOOL                   m_bProducesSamples;
    GUID                   m_streamCategory;
    BOOL                   m_fSetD3DManager;
};

class CXvptee :public CVideoProcTee{
public:
    CXvptee( _In_ Ctee *, _In_ GUID category = PINNAME_PREVIEW );
    virtual ~CXvptee();
    STDMETHOD(StartStreaming)();
    STDMETHOD(StopStreaming)();
    STDMETHODIMP Do             (   _In_ IMFSample* pSample, _Outptr_ IMFSample **);
    STDMETHODIMP Configure      (   _In_opt_ IMFMediaType *, _In_opt_ IMFMediaType *, _Outptr_ IMFTransform** );

};

class CDecoderTee : public CVideoProcTee {
public:

    CDecoderTee(_In_ Ctee *t,_In_ DWORD dwQueueId,GUID category=PINNAME_PREVIEW) :
        CVideoProcTee(t)
        , m_fAsyncMFT(FALSE)
        , m_D3daware(FALSE)
        , m_hwMFT(FALSE)
        , m_asyncCallback(nullptr)
        , m_asyncHresult(S_OK)
        , m_lNeedInputRequest(0)
        , m_streamCategory(category)
        , m_bXvpAdded(FALSE)
        , m_dwMFTInputId(0)
        , m_dwMFTOutputId(0)
        , m_dwQueueId(dwQueueId)
        , m_dwCameraStreamWorkQueueId(0)
    {
        m_streamCategory = category;
    }
    virtual ~CDecoderTee();

    STDMETHODIMP Do(_In_ IMFSample* pSample, _Outptr_ IMFSample **);
    STDMETHODIMP Configure(_In_opt_ IMFMediaType *, _In_opt_ IMFMediaType *, _Outptr_ IMFTransform**);
    STDMETHODIMP Invoke(_In_ IMFAsyncResult*);
protected:
    STDMETHODIMP StartStreaming();
    STDMETHODIMP StopStreaming();
    HRESULT GetSample( _Outptr_result_maybenull_ IMFSample**);
    HRESULT ConfigDecoder( _In_ IMFTransform* ,_In_ GUID guidSubType = GUID_NULL);
    HRESULT ConfigRealTimeMFT(_In_ IMFTransform* );
    HRESULT ProcessOutputSync( _COM_Outptr_opt_ IMFSample** );
    HRESULT ProcessFormatChange();
    STDMETHOD_(VOID, ShutdownTee)();

    BOOL                 m_fAsyncMFT;
    BOOL                 m_D3daware;
    BOOL                 m_hwMFT;
    ComPtr<CDMFTAsyncCallback<CDecoderTee, &CDecoderTee::Invoke> >     m_asyncCallback;
    HRESULT              m_asyncHresult;
    DWORD                m_lNeedInputRequest;
    GUID                 m_streamCategory; // Needed for bind flags
    BOOL                 m_bXvpAdded;
    ComPtr<CVideoProcTee> m_spXvp;
    DWORD                m_dwMFTInputId;
    DWORD                m_dwMFTOutputId;
    ComPtr<IMFSample>    m_spUnprocessedSample;
    DWORD                m_dwQueueId;
    DWORD                m_dwCameraStreamWorkQueueId;
    std::deque<ComPtr<IMFSample> > m_InputSampleList;

};

class CSampleCopytee :public CVideoProcTee {
public:
    CSampleCopytee(_In_ Ctee*, _In_ GUID category = PINNAME_PREVIEW
        , _In_ IMFVideoSampleAllocator* sampleAllocator = nullptr
    );
    ~CSampleCopytee();
    STDMETHOD(StartStreaming)();
    STDMETHOD(StopStreaming)();
    STDMETHODIMP Do(_In_ IMFSample* pSample, _Outptr_ IMFSample **);
    STDMETHODIMP Configure(_In_opt_ IMFMediaType *, _In_opt_ IMFMediaType *, _Outptr_ IMFTransform**);
};

#ifdef MF_DEVICEMFT_ADD_GRAYSCALER_
class CGrayTee : public CWrapTee {
public:
    CGrayTee(Ctee*);
    ~CGrayTee() {
    }

    STDMETHODIMP Do(_In_ IMFSample* pSample, _Out_ IMFSample **);
    STDMETHODIMP Configure(_In_opt_ IMFMediaType *, _In_opt_ IMFMediaType *, _Outptr_ IMFTransform**);
private:
    // Function pointer for the function that transforms the image.
    DMFT_IMAGE_TRANSFORM_FN m_transformfn;
    RECT m_rect;
};
#endif
/*
################## EVENT HANDLING #############################################
Events are usually divided into two categories by the Capture Pipeline
1) Regular Event / Manual Reset Event
2) One Shot Event

Regular events are set and cleared by the pipeline
One shot Events will only be set by the pipeline and it should be cleared
by the Component managing the Event Store i.e. KS or DMFT. For Redstone
The pipeline should not send any Non One shot events.This sample however
does show the handling of Regular/ Manual Reset events

This clearing of One shot events is done when the event is fired..
E.g before sending the warm start command The pipeline will send a one shot event
KSPROPERTY_CAMERACONTROL_EXTENDED_WARMSTART and when the operation completes the
event should be fired.
The Device MFT should usually keep a watch for one shot events sent by the Pipeline
for Async Extended controls..The list of Asynchronous controls are as follows..

KSPROPERTY_CAMERACONTROL_EXTENDED_PHOTOMODE
KSPROPERTY_CAMERACONTROL_EXTENDED_PHOTOMAXFRAMERATE
KSPROPERTY_CAMERACONTROL_EXTENDED_FOCUSMODE
KSPROPERTY_CAMERACONTROL_REGION_OF_INTEREST_PROPERTY_ID
KSPROPERTY_CAMERACONTROL_EXTENDED_ISO
KSPROPERTY_CAMERACONTROL_EXTENDED_ISO_ADVANCED
KSPROPERTY_CAMERACONTROL_EXTENDED_EVCOMPENSATION
KSPROPERTY_CAMERACONTROL_EXTENDED_WHITEBALANCEMODE
KSPROPERTY_CAMERACONTROL_EXTENDED_EXPOSUREMODE
KSPROPERTY_CAMERACONTROL_EXTENDED_SCENEMODE
KSPROPERTY_CAMERACONTROL_EXTENDED_PHOTOTHUMBNAIL
KSPROPERTY_CAMERACONTROL_EXTENDED_WARMSTART
KSPROPERTY_CAMERACONTROL_EXTENDED_ROI_ISPCONTROL
KSPROPERTY_CAMERACONTROL_EXTENDED_PROFILE
The complete list can be found from the Camera DDI spec
###############################################################################
*/

typedef struct _DMFTEventEntry{
    ULONG   m_ulEventId;        // KSEVENT->Id
    PVOID   m_pEventData;       // Lookup for events in the data structure
    HANDLE  m_hHandle;          // The duplicate handle stored from the event
    //
    // Constructor. We simply cache the handles, the property id and the KSEVENTDATA buffer sent from the user mode
    //
    _DMFTEventEntry( _In_ ULONG ulEventId, _In_ PVOID pEventData, _In_ HANDLE pHandle):m_pEventData(pEventData)
        , m_ulEventId(ulEventId)
        , m_hHandle(pHandle)
    {
    }
    ~_DMFTEventEntry()
    {
        if ( m_hHandle != nullptr )
        {
            CloseHandle(m_hHandle);
            m_hHandle = nullptr;
        }
    }

}DMFTEventEntry, *PDMFTEventEntry;

//
// Handler for one shot events and Normal events
//
class CDMFTEventHandler{
public:
    //
    // Handle the events here
    //
    HRESULT KSEvent( _In_reads_bytes_(ulEventLength) PKSEVENT pEvent,
        _In_ ULONG ulEventLength,
        _Inout_updates_bytes_opt_(ulDataLength) LPVOID pEventData,
        _In_ ULONG ulDataLength,
        _Inout_ ULONG* pBytesReturned);
    HRESULT SetOneShot(ULONG);
    HRESULT SetRegularEvent(ULONG);
    HRESULT Clear();
protected:
    HRESULT Dupe (_In_ HANDLE hEventHandle, _Outptr_ LPHANDLE lpTargetHandle);
private:
    map< ULONG, HANDLE >        m_OneShotEventMap;
    vector< PDMFTEventEntry >   m_RegularEventList;
};

class CMultipinMft;
class CInPin;
class COutPin;

class CPinCreationFactory {
protected:
    ComPtr<CMultipinMft> m_spDeviceTransform;
public:
    typedef enum _type_pin {
        DMFT_PIN_INPUT,
        DMFT_PIN_OUTPUT,
        DMFT_PIN_CUSTOM,
        DMFT_PIN_ALLOCATOR_PIN,
        DMFT_MAX
    }type_pin;
    HRESULT CreatePin( _In_ ULONG ulInputStreamId, _In_ ULONG ulOutStreamId, _In_ type_pin type,_Outptr_ CBasePin** ppPin, _In_ BOOL& isCustom);
    CPinCreationFactory(_In_ CMultipinMft* pDeviceTransform):m_spDeviceTransform(pDeviceTransform){
    }
};
HRESULT CheckPinType(_In_ IMFAttributes* pAttributes, _In_ GUID pinType, _Out_ PBOOL pbIsImagePin);
BOOL    CheckImagePin(_In_ IMFAttributes* pAttributes, _Out_ PBOOL pbIsImagePin);
HRESULT CheckPreviewPin(_In_ IMFAttributes* pAttributes, _Out_ PBOOL pbIsPreviewPin);