ReactOS 0.4.16-dev-297-gc569aee
output_pin.cpp File Reference
#include "precomp.h"
Include dependency graph for output_pin.cpp:

Go to the source code of this file.

Classes

class  COutputPin
 

Functions

DWORD WINAPI COutputPin_IoThreadStartup (LPVOID lpParameter)
 
HRESULT STDMETHODCALLTYPE COutputPin_SetState (IPin *Pin, KSSTATE State)
 
HRESULT WINAPI COutputPin_Constructor (IBaseFilter *ParentFilter, LPCWSTR PinName, ULONG PinId, KSPIN_COMMUNICATION Communication, REFIID riid, LPVOID *ppv)
 

Function Documentation

◆ COutputPin_Constructor()

HRESULT WINAPI COutputPin_Constructor ( IBaseFilter ParentFilter,
LPCWSTR  PinName,
ULONG  PinId,
KSPIN_COMMUNICATION  Communication,
REFIID  riid,
LPVOID ppv 
)

Definition at line 2801 of file output_pin.cpp.

2808{
2809 COutputPin * handler = new COutputPin(ParentFilter, PinName, PinId, Communication);
2810
2811 if (!handler)
2812 return E_OUTOFMEMORY;
2813
2814 if (FAILED(handler->QueryInterface(riid, ppv)))
2815 {
2816 /* not supported */
2817 delete handler;
2818 return E_NOINTERFACE;
2819 }
2820
2821 return S_OK;
2822}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7512
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define E_NOINTERFACE
Definition: winerror.h:2364

Referenced by CKsProxy::CreatePins().

◆ COutputPin_IoThreadStartup()

DWORD WINAPI COutputPin_IoThreadStartup ( LPVOID  lpParameter)

Definition at line 2554 of file output_pin.cpp.

2556{
2557 COutputPin * Pin = (COutputPin*)lpParameter;
2558 assert(Pin);
2559
2560 return Pin->IoProcessRoutine();
2561}
#define assert(x)
Definition: debug.h:53
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:428

◆ COutputPin_SetState()

HRESULT STDMETHODCALLTYPE COutputPin_SetState ( IPin Pin,
KSSTATE  State 
)

Definition at line 2607 of file output_pin.cpp.

2610{
2611 HRESULT hr = S_OK;
2613 KSSTATE CurState;
2615 COutputPin * pPin = (COutputPin*)Pin;
2616
2617#ifdef KSPROXY_TRACE
2618 WCHAR Buffer[200];
2619#endif
2620
2624
2626
2627 if (pPin->m_State <= State)
2628 {
2629 if (pPin->m_State == KSSTATE_STOP)
2630 {
2631 hr = pPin->InitializeIOThread();
2632 if (FAILED(hr))
2633 {
2634 // failed to initialize I/O thread
2635#ifdef KSPROXY_TRACE
2636 OutputDebugStringW(L"Failed to initialize I/O Thread\n");
2637#endif
2639 return hr;
2640 }
2641 CurState = KSSTATE_ACQUIRE;
2642 hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
2643
2644#ifdef KSPROXY_TRACE
2645 swprintf(Buffer, L"COutputPin_SetState Setting State CurState: KSSTATE_STOP KSSTATE_ACQUIRE PinName %s hr %lx\n", pPin->m_PinName, hr);
2647#endif
2648
2649 if (FAILED(hr))
2650 {
2652 return hr;
2653 }
2654
2655 pPin->m_State = CurState;
2656
2657 if (pPin->m_State == State)
2658 {
2660 return hr;
2661 }
2662 }
2663 if (pPin->m_State == KSSTATE_ACQUIRE)
2664 {
2665 CurState = KSSTATE_PAUSE;
2666 hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
2667
2668#ifdef KSPROXY_TRACE
2669 swprintf(Buffer, L"COutputPin_SetState Setting State CurState KSSTATE_ACQUIRE KSSTATE_PAUSE PinName %s hr %lx\n", pPin->m_PinName, hr);
2671#endif
2672
2673 if (FAILED(hr))
2674 {
2676 return hr;
2677 }
2678
2679 pPin->m_State = CurState;
2680
2681 if (pPin->m_State == State)
2682 {
2684 return hr;
2685 }
2686 }
2687 if (State == KSSTATE_RUN && pPin->m_State == KSSTATE_PAUSE)
2688 {
2689 CurState = KSSTATE_RUN;
2690 hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
2691
2692#ifdef KSPROXY_TRACE
2693 swprintf(Buffer, L"COutputPin_SetState Setting State CurState: KSSTATE_PAUSE KSSTATE_RUN PinName %s hr %lx\n", pPin->m_PinName, hr);
2695#endif
2696
2697 if (SUCCEEDED(hr))
2698 {
2699 pPin->m_State = CurState;
2700 // signal start event
2701 SetEvent(pPin->m_hStartEvent);
2702 }
2703 }
2704
2706 return hr;
2707 }
2708 else
2709 {
2710 if (pPin->m_State == KSSTATE_RUN)
2711 {
2712 // setting pending stop flag
2713 pPin->m_StopInProgress = true;
2714
2715 // release any waiting threads
2717
2718 // wait until i/o thread is done
2720
2721 CurState = KSSTATE_PAUSE;
2722 hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
2723
2724#ifdef KSPROXY_TRACE
2725 swprintf(Buffer, L"COutputPin_SetState Setting State CurState: KSSTATE_RUN KSSTATE_PAUSE PinName %s hr %lx\n", pPin->m_PinName, hr);
2727#endif
2728
2729 if (FAILED(hr))
2730 {
2732 return hr;
2733 }
2734
2735 pPin->m_State = CurState;
2736
2737 if (FAILED(hr))
2738 {
2740 return hr;
2741 }
2742 }
2743 if (pPin->m_State == KSSTATE_PAUSE)
2744 {
2745 CurState = KSSTATE_ACQUIRE;
2746 hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
2747
2748#ifdef KSPROXY_TRACE
2749 swprintf(Buffer, L"COutputPin_SetState Setting State CurState: KSSTATE_PAUSE KSSTATE_ACQUIRE PinName %s hr %lx\n", pPin->m_PinName, hr);
2751#endif
2752
2753 if (FAILED(hr))
2754 {
2756 return hr;
2757 }
2758
2759 pPin->m_State = CurState;
2760
2761 if (pPin->m_State == State)
2762 {
2764 return hr;
2765 }
2766 }
2767
2771
2772 /* close event handles */
2773 pPin->m_hStopEvent = NULL;
2774 pPin->m_hStartEvent = NULL;
2775 pPin->m_hBufferAvailable = NULL;
2776
2777 CurState = KSSTATE_STOP;
2778 hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
2779
2780#ifdef KSPROXY_TRACE
2781 swprintf(Buffer, L"COutputPin_SetState Setting State CurState: KSSTATE_ACQUIRE KSSTATE_STOP PinName %s hr %lx\n", pPin->m_PinName, hr);
2783#endif
2784
2785 if (SUCCEEDED(hr))
2786 {
2787 // store state
2788 pPin->m_State = CurState;
2789 }
2790
2791 // unset pending stop flag
2792 pPin->m_StopInProgress = false;
2793
2795 return hr;
2796 }
2797}
Definition: bufpool.h:45
HRESULT STDMETHODCALLTYPE KsProperty(PKSPROPERTY Property, ULONG PropertyLength, LPVOID PropertyData, ULONG DataLength, ULONG *BytesReturned)
BOOL m_StopInProgress
Definition: output_pin.cpp:201
HANDLE m_hStartEvent
Definition: output_pin.cpp:198
HANDLE m_hBufferAvailable
Definition: output_pin.cpp:199
HRESULT WINAPI InitializeIOThread()
HANDLE m_hStopEvent
Definition: output_pin.cpp:200
KSSTATE m_State
Definition: output_pin.cpp:204
CRITICAL_SECTION m_Lock
Definition: output_pin.cpp:205
LPCWSTR m_PinName
Definition: output_pin.cpp:176
#define NULL
Definition: types.h:112
#define CloseHandle
Definition: compat.h:739
#define swprintf
Definition: precomp.h:40
#define INFINITE
Definition: serial.h:102
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
#define SUCCEEDED(hr)
Definition: intsafe.h:50
@ KSPROPERTY_CONNECTION_STATE
Definition: ks.h:349
KSSTATE
Definition: ks.h:1214
@ KSSTATE_ACQUIRE
Definition: ks.h:1216
@ KSSTATE_PAUSE
Definition: ks.h:1217
@ KSSTATE_RUN
Definition: ks.h:1218
@ KSSTATE_STOP
Definition: ks.h:1215
#define KSPROPSETID_Connection
Definition: ks.h:346
#define L(x)
Definition: ntvdm.h:50
HRESULT hr
Definition: shlfolder.c:183
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_ ULONG _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesReturned
Definition: wdfiotarget.h:1052
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CKsProxy::SetPinState().