From 85cde4d7cf6992c1be6c5cc73ec7772a61f3442e Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 3 Dec 2006 16:30:41 +0000 Subject: [PATCH] *** empty log message *** --- dssourcepin.cc | 125 +++++++++++++++++++++++++------------------------ videowin.cc | 3 +- 2 files changed, 66 insertions(+), 62 deletions(-) diff --git a/dssourcepin.cc b/dssourcepin.cc index ed9780a..f6893c7 100644 --- a/dssourcepin.cc +++ b/dssourcepin.cc @@ -23,20 +23,20 @@ #include -class DsSFEnumMediaTypes: public IEnumMediaTypes { -public: - DsSFEnumMediaTypes(DsSourcePin* papa,ULONG pos=0); - virtual ~DsSFEnumMediaTypes(); +class DsSFEnumMediaTypes: public IEnumMediaTypes { +public: + DsSFEnumMediaTypes(DsSourcePin* papa,ULONG pos=0); + virtual ~DsSFEnumMediaTypes(); virtual HRESULT STDMETHODCALLTYPE Next(ULONG nummedia, AM_MEDIA_TYPE **pins,ULONG *fetched); virtual HRESULT STDMETHODCALLTYPE Skip(ULONG numpin); virtual HRESULT STDMETHODCALLTYPE Reset(); virtual HRESULT STDMETHODCALLTYPE Clone(IEnumMediaTypes **enuma); - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id,void ** object); + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id,void ** object); virtual ULONG STDMETHODCALLTYPE AddRef(); virtual ULONG STDMETHODCALLTYPE Release(); protected: DsSourcePin* parent; - ULONG curpos; + ULONG curpos; volatile long refs; }; @@ -47,25 +47,25 @@ DsSFEnumMediaTypes::DsSFEnumMediaTypes(DsSourcePin* papa,ULONG pos){ refs=0; } -DsSFEnumMediaTypes::~DsSFEnumMediaTypes(){ - parent->Release(); -} - -HRESULT STDMETHODCALLTYPE DsSFEnumMediaTypes::Next(ULONG numpin, AM_MEDIA_TYPE **pins,ULONG *fetched) { - int i; - - if (pins==NULL) return E_POINTER; - if (numpin!=1 && fetched==NULL) return E_INVALIDARG; - *fetched=0; - - for (i=0;(iGetMediaType(curpos+i,pins[i])!=S_OK) return S_FALSE; - curpos++; - if (fetched!=NULL) (*fetched)++; - } - return S_OK; -} +DsSFEnumMediaTypes::~DsSFEnumMediaTypes(){ + parent->Release(); +} + +HRESULT STDMETHODCALLTYPE DsSFEnumMediaTypes::Next(ULONG numpin, AM_MEDIA_TYPE **pins,ULONG *fetched) { + int i; + + if (pins==NULL) return E_POINTER; + if (numpin!=1 && fetched==NULL) return E_INVALIDARG; + *fetched=0; + + for (i=0;(iGetMediaType(curpos+i,pins[i])!=S_OK) return S_FALSE; + curpos++; + if (fetched!=NULL) (*fetched)++; + } + return S_OK; +} HRESULT STDMETHODCALLTYPE DsSFEnumMediaTypes::Skip(ULONG numpin){ curpos+=numpin; @@ -83,19 +83,19 @@ HRESULT STDMETHODCALLTYPE DsSFEnumMediaTypes::Clone(IEnumMediaTypes **enuma){ return S_OK; } -HRESULT STDMETHODCALLTYPE DsSFEnumMediaTypes::QueryInterface(REFIID id,void ** object){ - if (object==NULL) return E_POINTER; - if (id==IID_IUnknown ||id == IID_IEnumMediaTypes) { - *object=(IUnknown*)this; - ((IUnknown*)object)->AddRef(); - return NOERROR; - } else { - *object=NULL; - return E_NOINTERFACE; - } -} - - +HRESULT STDMETHODCALLTYPE DsSFEnumMediaTypes::QueryInterface(REFIID id,void ** object){ + if (object==NULL) return E_POINTER; + if (id==IID_IUnknown ||id == IID_IEnumMediaTypes) { + *object=(IUnknown*)this; + ((IUnknown*)object)->AddRef(); + return NOERROR; + } else { + *object=NULL; + return E_NOINTERFACE; + } +} + + ULONG STDMETHODCALLTYPE DsSFEnumMediaTypes::AddRef(){ InterlockedIncrement(&refs); @@ -150,22 +150,22 @@ DsSourcePin::~DsSourcePin() } -HRESULT STDMETHODCALLTYPE DsSourcePin::QueryInterface(REFIID id,void ** object){ - if (object==NULL) return E_POINTER; - if (id==IID_IUnknown) { - *object=(IUnknown*)this; - ((IUnknown*)object)->AddRef(); - return NOERROR; - } else if (id==IID_IPin) { - *object=(IPin*)this; - ((IPin*)object)->AddRef(); - return NOERROR; - } else { - *object=NULL; - return E_NOINTERFACE; - } -} - +HRESULT STDMETHODCALLTYPE DsSourcePin::QueryInterface(REFIID id,void ** object){ + if (object==NULL) return E_POINTER; + if (id==IID_IUnknown) { + *object=(IUnknown*)this; + ((IUnknown*)object)->AddRef(); + return NOERROR; + } else if (id==IID_IPin) { + *object=(IPin*)this; + ((IPin*)object)->AddRef(); + return NOERROR; + } else { + *object=NULL; + return E_NOINTERFACE; + } +} + ULONG STDMETHODCALLTYPE DsSourcePin::AddRef(){ return m_pFilter->AddRef(); @@ -208,9 +208,7 @@ HRESULT STDMETHODCALLTYPE DsSourcePin::Connect(IPin *pinempf,const AM_MEDIA_TYPE }else { IEnumMediaTypes * emt; EnumMediaTypes(&emt); - AM_MEDIA_TYPE emtype_np; AM_MEDIA_TYPE * emtype; - emtype=&emtype_np; ULONG fetched=0; pinempf->AddRef(); while (emt->Next(1,&emtype,&fetched)==S_OK) { @@ -219,12 +217,14 @@ HRESULT STDMETHODCALLTYPE DsSourcePin::Connect(IPin *pinempf,const AM_MEDIA_TYPE connected=pinempf; CopyMType(&medtype,emtype); CoTaskMemFree(emtype->pbFormat); + CoTaskMemFree(emtype); gotmt=true; break; } } CoTaskMemFree(emtype->pbFormat); + CoTaskMemFree(emtype); } emt->Release(); if (gotmt==false) { @@ -235,12 +235,14 @@ HRESULT STDMETHODCALLTYPE DsSourcePin::Connect(IPin *pinempf,const AM_MEDIA_TYPE connected=pinempf; CopyMType(&medtype,emtype); CoTaskMemFree(emtype->pbFormat); + CoTaskMemFree(emtype); gotmt=true; break; } } CoTaskMemFree(emtype->pbFormat); + CoTaskMemFree(emtype); } emt->Release(); if (gotmt==false) { @@ -373,10 +375,10 @@ HRESULT STDMETHODCALLTYPE DsSourcePin::ReceiveConnection(IPin *connect, else return S_FALSE; } HRESULT STDMETHODCALLTYPE DsSourcePin::EnumMediaTypes(IEnumMediaTypes **enuma){ -if (enuma==NULL) return E_POINTER; - *enuma=new DsSFEnumMediaTypes( this); - (*enuma)->AddRef(); - return S_OK; +if (enuma==NULL) return E_POINTER; + *enuma=new DsSFEnumMediaTypes( this); + (*enuma)->AddRef(); + return S_OK; } HRESULT STDMETHODCALLTYPE DsSourcePin::QueryInternalConnections(IPin **pin,ULONG *numpin){ @@ -479,7 +481,7 @@ HRESULT DsSourcePin::Active() { return VFW_E_NO_ALLOCATOR; } - + HRESULT DsSourcePin::Run(REFERENCE_TIME reftime){ return NOERROR; } @@ -546,3 +548,4 @@ HRESULT DsSourcePin::DecideBufferSize(IMemAllocator *pa,ALLOCATOR_PROPERTIES *al return S_OK; } + diff --git a/videowin.cc b/videowin.cc index 50e19d0..14d0566 100644 --- a/videowin.cc +++ b/videowin.cc @@ -314,7 +314,7 @@ int VideoWin::dsplay() dsgraphbuilder->QueryInterface(IID_IMediaControl,(void **) &dsmediacontrol); dsgraphbuilder->QueryInterface(IID_IBasicAudio,(void **) &dsbasicaudio); dsinited=true; - MILLISLEEP(100); + //MILLISLEEP(100); hresdeb=dsmediacontrol->Run(); iframemode=false;//exit iframe mode @@ -987,3 +987,4 @@ int VideoWin::test2() + -- 2.39.5