Added a framework for testing CreateProcess and a few tests.
[wine] / dlls / quartz / xform.h
1 /*
2  * Implements IBaseFilter for transform filters. (internal)
3  *
4  * Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #ifndef WINE_DSHOW_XFORM_H
22 #define WINE_DSHOW_XFORM_H
23
24 #include "iunk.h"
25 #include "basefilt.h"
26 #include "seekpass.h"
27
28
29 typedef struct CTransformBaseImpl CTransformBaseImpl;
30 typedef struct CTransformBaseInPinImpl CTransformBaseInPinImpl;
31 typedef struct CTransformBaseOutPinImpl CTransformBaseOutPinImpl;
32 typedef struct TransformBaseHandlers    TransformBaseHandlers;
33
34 /* {301056D0-6DFF-11D2-9EEB-006008039E37} */
35 DEFINE_GUID(CLSID_quartzMJPGDecompressor,
36 0x301056D0,0x6DFF,0x11D2,0x9E,0xEB,0x00,0x60,0x08,0x03,0x9E,0x37);
37 /* {FDFE9681-74A3-11D0-AFA7-00AA00B67A42} */
38 DEFINE_GUID(CLSID_quartzQuickTimeDecompressor,
39 0xFDFE9681,0x74A3,0x11D0,0xAF,0xA7,0x00,0xAA,0x00,0xB6,0x7A,0x42);
40
41
42 struct CTransformBaseImpl
43 {
44         QUARTZ_IUnkImpl unk;
45         CBaseFilterImpl basefilter;
46
47         CTransformBaseInPinImpl*        pInPin;
48         CTransformBaseOutPinImpl*       pOutPin;
49         CSeekingPassThru*       pSeekPass;
50
51         CRITICAL_SECTION        csReceive;
52         IMemAllocator*  m_pOutPinAllocator;
53         BOOL    m_bPreCopy; /* sample must be copied */
54         BOOL    m_bReuseSample; /* sample must be reused */
55         BOOL    m_bInFlush;
56         IMediaSample*   m_pSample;
57
58         BOOL    m_bFiltering;
59         const TransformBaseHandlers*    m_pHandler;
60         void*   m_pUserData;
61 };
62
63 struct CTransformBaseInPinImpl
64 {
65         QUARTZ_IUnkImpl unk;
66         CPinBaseImpl    pin;
67         CMemInputPinBaseImpl    meminput;
68
69         CTransformBaseImpl*     pFilter;
70 };
71
72 struct CTransformBaseOutPinImpl
73 {
74         QUARTZ_IUnkImpl unk;
75         CPinBaseImpl    pin;
76         CQualityControlPassThruImpl     qcontrol;
77         QUARTZ_IFDelegation     qiext;
78
79         CTransformBaseImpl*     pFilter;
80 };
81
82 struct TransformBaseHandlers
83 {
84         /* all methods must be implemented */
85
86         HRESULT (*pInit)( CTransformBaseImpl* pImpl );
87         HRESULT (*pCleanup)( CTransformBaseImpl* pImpl );
88
89         /* pmtOut may be NULL */
90         HRESULT (*pCheckMediaType)( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut );
91         /* get output types */
92         HRESULT (*pGetOutputTypes)( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE** ppmtAcceptTypes, ULONG* pcAcceptTypes );
93         /* get allocator properties */
94         HRESULT (*pGetAllocProp)( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, ALLOCATOR_PROPERTIES* pProp, BOOL* pbTransInPlace, BOOL* pbTryToReuseSample );
95
96         /* prepare the filter */
97         HRESULT (*pBeginTransform)( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, BOOL bReuseSample );
98         /* process a sample */
99         HRESULT (*pProcessReceive)( CTransformBaseImpl* pImpl, IMediaSample* pSampIn ); /* override Transform */
100         HRESULT (*pTransform)( CTransformBaseImpl* pImpl, IMediaSample* pSampIn, IMediaSample* pSampOut );
101         /* unprepare the filter */
102         HRESULT (*pEndTransform)( CTransformBaseImpl* pImpl );
103 };
104
105 #define CTransformBaseImpl_THIS(iface,member)   CTransformBaseImpl*     This = ((CTransformBaseImpl*)(((char*)iface)-offsetof(CTransformBaseImpl,member)))
106 #define CTransformBaseInPinImpl_THIS(iface,member)      CTransformBaseInPinImpl*        This = ((CTransformBaseInPinImpl*)(((char*)iface)-offsetof(CTransformBaseInPinImpl,member)))
107 #define CTransformBaseOutPinImpl_THIS(iface,member)     CTransformBaseOutPinImpl*       This = ((CTransformBaseOutPinImpl*)(((char*)iface)-offsetof(CTransformBaseOutPinImpl,member)))
108
109
110 HRESULT QUARTZ_CreateTransformBase(
111         IUnknown* punkOuter,void** ppobj,
112         const CLSID* pclsidTransformBase,
113         LPCWSTR pwszTransformBaseName,
114         LPCWSTR pwszInPinName,
115         LPCWSTR pwszOutPinName,
116         const TransformBaseHandlers* pHandler );
117 HRESULT QUARTZ_CreateTransformBaseInPin(
118         CTransformBaseImpl* pFilter,
119         CRITICAL_SECTION* pcsPin,
120         CRITICAL_SECTION* pcsPinReceive,
121         CTransformBaseInPinImpl** ppPin,
122         LPCWSTR pwszPinName );
123 HRESULT QUARTZ_CreateTransformBaseOutPin(
124         CTransformBaseImpl* pFilter,
125         CRITICAL_SECTION* pcsPin,
126         CTransformBaseOutPinImpl** ppPin,
127         LPCWSTR pwszPinName );
128
129
130 HRESULT QUARTZ_CreateAVIDec(IUnknown* punkOuter,void** ppobj);
131 HRESULT QUARTZ_CreateColour(IUnknown* punkOuter,void** ppobj);
132 HRESULT QUARTZ_CreateACMWrapper(IUnknown* punkOuter,void** ppobj);
133 HRESULT QUARTZ_CreateCMpegAudioCodec(IUnknown* punkOuter,void** ppobj);
134 HRESULT QUARTZ_CreateCMpegVideoCodec(IUnknown* punkOuter,void** ppobj);
135 HRESULT QUARTZ_CreateMJPGDecompressor(IUnknown* punkOuter,void** ppobj);
136 HRESULT QUARTZ_CreateQuickTimeDecompressor(IUnknown* punkOuter,void** ppobj);
137
138
139 #endif  /* WINE_DSHOW_XFORM_H */