annotate loader/dshow/DS_Filter.c @ 1440:bd6ea9bd3f80

debug printf() removed
author arpi
date Sat, 04 Aug 2001 13:53:26 +0000
parents bf973bffe240
children 9525bff8bea8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
1 #include <stdio.h>
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
2 #include <string.h>
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
3 #include "DS_Filter.h"
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
4 #include <except.h>
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
5 //#include "../loader/loader.h"
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
6 #include <string>
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
7 #include <iostream>
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
8 #define __MODULE__ "DirectShow generic filter"
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
9
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
10 using namespace std;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
11
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
12 typedef long STDCALL (*GETCLASS) (const GUID*, const GUID*, void**);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
13 extern "C" char* def_path;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
14
342
ac9bfa4a1005 using expLoadLibraryA instead of LoadLibraryA
arpi_esp
parents: 340
diff changeset
15 extern "C" int STDCALL expLoadLibraryA(const char*);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
16 extern "C" STDCALL void* GetProcAddress(int, const char*);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
17 extern "C" int STDCALL FreeLibrary(int);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
18
244
1c3029be6713 Setup_FS fix for directshow
arpi_esp
parents: 168
diff changeset
19 extern "C" void Setup_LDT_Keeper();
1c3029be6713 Setup_FS fix for directshow
arpi_esp
parents: 168
diff changeset
20 extern "C" void setup_FS_Segment();
1c3029be6713 Setup_FS fix for directshow
arpi_esp
parents: 168
diff changeset
21
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
22 DS_Filter::DS_Filter()
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
23 :m_iHandle(0), m_pFilter(0), m_pInputPin(0),
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
24 m_pOutputPin(0), m_pSrcFilter(0), m_pParentFilter(0),
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
25 m_pOurInput(0), m_pOurOutput(0), m_pAll(0), m_pImp(0),
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
26 m_iState(0)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
27 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
28 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
29
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
30 void DS_Filter::clean()
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
31 {
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
32 m_iState = 0;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
33
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
34 if (m_pOurInput)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
35 m_pOurInput->vt->Release((IUnknown*)m_pOurInput);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
36 if (m_pInputPin)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
37 m_pInputPin->vt->Disconnect(m_pInputPin);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
38 if (m_pOutputPin)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
39 m_pOutputPin->vt->Disconnect(m_pOutputPin);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
40 if (m_pFilter)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
41 m_pFilter->vt->Release((IUnknown*)m_pFilter);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
42 if (m_pOutputPin)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
43 m_pOutputPin->vt->Release((IUnknown*)m_pOutputPin);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
44 if (m_pInputPin)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
45 m_pInputPin->vt->Release((IUnknown*)m_pInputPin);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
46 if (m_pImp)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
47 m_pImp->vt->Release((IUnknown*)m_pImp);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
48
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
49 delete m_pOurOutput;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
50 delete m_pParentFilter;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
51 delete m_pSrcFilter;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
52
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
53 // FIXME - we are still leaving few things allocated!
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
54 if (m_iHandle)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
55 FreeLibrary(m_iHandle);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
56
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
57 }
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
58
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
59 DS_Filter::~DS_Filter()
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
60 {
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
61 //cout << "Destruction of DS_FILTER" << endl;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
62 Stop();
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
63 if (m_iState == 1)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
64 clean();
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
65 //cout << "Destruction of DS_FILTER done" << endl;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
66 }
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
67
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
68 void DS_Filter::Create(char* dllname, const GUID* id, AM_MEDIA_TYPE* in_fmt, AM_MEDIA_TYPE* out_fmt)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
69 {
244
1c3029be6713 Setup_FS fix for directshow
arpi_esp
parents: 168
diff changeset
70
1c3029be6713 Setup_FS fix for directshow
arpi_esp
parents: 168
diff changeset
71 Setup_LDT_Keeper();
1c3029be6713 Setup_FS fix for directshow
arpi_esp
parents: 168
diff changeset
72
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
73 try
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
74 {
342
ac9bfa4a1005 using expLoadLibraryA instead of LoadLibraryA
arpi_esp
parents: 340
diff changeset
75 // string _fullname=def_path;
ac9bfa4a1005 using expLoadLibraryA instead of LoadLibraryA
arpi_esp
parents: 340
diff changeset
76 // _fullname+="/";
ac9bfa4a1005 using expLoadLibraryA instead of LoadLibraryA
arpi_esp
parents: 340
diff changeset
77 // _fullname+=dllname;
ac9bfa4a1005 using expLoadLibraryA instead of LoadLibraryA
arpi_esp
parents: 340
diff changeset
78 m_iHandle= expLoadLibraryA(dllname);
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
79 if (!m_iHandle)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
80 {
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
81 char e[1024];
1096
bf973bffe240 some possible buffer overflow places fixed
al3x
parents: 713
diff changeset
82 snprintf(e, 1024, "Could not open DirectShow DLL: %s", dllname);
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
83 throw FATAL(e);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
84 }
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
85 GETCLASS func=(GETCLASS)GetProcAddress(m_iHandle, "DllGetClassObject");
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
86 if (!func)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
87 {
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
88 char e[1024];
1096
bf973bffe240 some possible buffer overflow places fixed
al3x
parents: 713
diff changeset
89 snprintf(e, 1024, "Illegal or corrupt DirectShow DLL: %s", dllname);
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
90 throw FATAL(e);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
91 }
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
92
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
93 HRESULT result;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
94 IClassFactory* factory=0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
95 result=func(id, &IID_IClassFactory, (void**)&factory);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
96 if(result || (!factory)) throw FATAL("No such class object");;
244
1c3029be6713 Setup_FS fix for directshow
arpi_esp
parents: 168
diff changeset
97
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
98 setup_FS_Segment();
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
99
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
100 IUnknown* object=0;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
101 result=factory->vt->CreateInstance(factory, 0, &IID_IUnknown, (void**)&object);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
102 factory->vt->Release((IUnknown*)factory);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
103 if(result || (!object)) throw FATAL("Class factory failure");
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
104
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
105 result=object->vt->QueryInterface(object, &IID_IBaseFilter, (void**)&m_pFilter);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
106 object->vt->Release((IUnknown*)object);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
107 if(result || (!m_pFilter)) throw FATAL("Object does not have IBaseFilter interface");
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
108
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
109 IEnumPins* enum_pins=0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
110 // enumerate pins
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
111 result=m_pFilter->vt->EnumPins(m_pFilter, &enum_pins);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
112 if(result || (!enum_pins)) throw FATAL("Could not enumerate pins");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
113 IPin* array[256];
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
114 ULONG fetched;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
115 enum_pins->vt->Reset(enum_pins);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
116 result=enum_pins->vt->Next(enum_pins, (ULONG)256, (IPin**)array, &fetched);
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
117 Debug printf("Pins enumeration returned %ld pins, error is %x\n", fetched, (int)result);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
118
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
119 for (unsigned i = 0; i < fetched; i++)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
120 {
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
121 int direction = -1;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
122 array[i]->vt->QueryDirection(array[i], (PIN_DIRECTION*)&direction);
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
123 if (!m_pInputPin && direction == 0)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
124 {
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
125 m_pInputPin = array[i];
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
126 m_pInputPin->vt->AddRef((IUnknown*)m_pInputPin);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
127 }
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
128 if (!m_pOutputPin && direction == 1)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
129 {
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
130 m_pOutputPin = array[i];
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
131 m_pOutputPin->vt->AddRef((IUnknown*)m_pOutputPin);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
132 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
133 array[i]->vt->Release((IUnknown*)(array[i]));
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
134 }
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
135 if (!m_pInputPin)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
136 throw FATAL("Input pin not found");
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
137 if (!m_pOutputPin)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
138 throw FATAL("Output pin not found");
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
139
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
140 result = m_pInputPin->vt->QueryInterface((IUnknown*)m_pInputPin,
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
141 &IID_IMemInputPin,
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
142 (void**)&m_pImp);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
143 if(result)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
144 throw FATAL("Error getting IMemInputPin interface");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
145 m_pOurType=in_fmt;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
146 m_pDestType=out_fmt;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
147 result=m_pInputPin->vt->QueryAccept(m_pInputPin, m_pOurType);
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
148 if (result)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
149 throw FATAL("Source format is not accepted");
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
150
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
151 m_pParentFilter=new CBaseFilter2;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
152 m_pSrcFilter=new CBaseFilter(*m_pOurType, m_pParentFilter);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
153 m_pOurInput=m_pSrcFilter->GetPin();
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
154 m_pOurInput->vt->AddRef((IUnknown*)m_pOurInput);
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
155
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
156 result=m_pInputPin->vt->ReceiveConnection(m_pInputPin, m_pOurInput,
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
157 m_pOurType);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
158 if (result)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
159 throw FATAL("Error connecting to input pin");
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
160
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
161 m_pOurOutput = new COutputPin(*m_pDestType);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
162
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
163 result = m_pOutputPin->vt->ReceiveConnection(m_pOutputPin,
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
164 m_pOurOutput,
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
165 m_pDestType);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
166 if (result)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
167 throw FATAL("Error connecting to output pin");
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
168 cout << "Using DirectShow codec: " << dllname << endl;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
169 m_iState = 1;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
170 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
171 catch(FatalError e)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
172 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
173 e.PrintAll();
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
174 clean();
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
175 throw;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
176 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
177 }
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
178
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
179 void DS_Filter::Start()
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
180 {
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
181 if (m_iState != 1)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
182 return;
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
183
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
184 HRESULT hr=m_pFilter->vt->Run(m_pFilter, 0);
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
185 if (hr != 0)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
186 {
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
187 Debug cerr<<"WARNING: m_Filter->Run() failed, error code "<<hex<<hr<<dec<<endl;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
188 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
189 hr=m_pImp->vt->GetAllocator(m_pImp, &m_pAll);
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
190 if (hr)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
191 {
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
192 Debug cerr<<"Error getting IMemAllocator interface "<<hex<<hr<<dec<<endl;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
193 m_pImp->vt->Release((IUnknown*)m_pImp);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
194 return;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
195 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
196 m_pImp->vt->NotifyAllocator(m_pImp, m_pAll, 0);
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
197 m_iState = 2;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
198 }
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
199
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
200 void DS_Filter::Stop()
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
201 {
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
202 if (m_iState == 2)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
203 {
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
204 m_pAll->vt->Release((IUnknown*)m_pAll);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
205 m_pAll=0;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
206 m_pFilter->vt->Stop(m_pFilter);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
207 m_iState=1;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 342
diff changeset
208 }
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
209 }