[Mplayer-cvslog] CVS: main/loader/DirectShow DS_Filter.cpp,1.4,1.5 DS_Filter.h,1.3,1.4 DS_VideoDec.cpp,1.3,1.4 allocator.cpp,1.1.1.1,1.2 allocator.h,1.1.1.1,1.2 cmediasample.cpp,1.2,1.3 cmediasample.h,1.1.1.1,1.2 guids.cpp,1.1.1.1,1.2 interfaces.h,1.2,1.3 outputpin.cpp,1.1.1.1,1.2 outputpin.h,1.1.1.1,1.2

GEREOFFY arpi_esp at users.sourceforge.net
Sun May 6 23:43:47 CEST 2001


Update of /cvsroot/mplayer/main/loader/DirectShow
In directory usw-pr-cvs1:/tmp/cvs-serv10184/loader/DirectShow

Modified Files:
	DS_Filter.cpp DS_Filter.h DS_VideoDec.cpp allocator.cpp 
	allocator.h cmediasample.cpp cmediasample.h guids.cpp 
	interfaces.h outputpin.cpp outputpin.h 
Log Message:
avifile-0.6-CVS merge

Index: DS_Filter.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/DS_Filter.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** DS_Filter.cpp	2001/04/11 02:11:39	1.4
--- DS_Filter.cpp	2001/05/06 21:43:45	1.5
***************
*** 5,8 ****
--- 5,9 ----
  //#include "../loader/loader.h"
  #include <string>
+ #include <iostream>
  #define __MODULE__ "DirectShow generic filter"
  
***************
*** 13,17 ****
  
  extern "C" int STDCALL expLoadLibraryA(const char*);
- //extern "C" int WINAPI expLoadLibraryA(char* name);
  extern "C" STDCALL void* GetProcAddress(int, const char*);
  extern "C" int STDCALL FreeLibrary(int);
--- 14,17 ----
***************
*** 22,34 ****
  DS_Filter::DS_Filter()
      :m_iHandle(0), m_pFilter(0), m_pInputPin(0),
! 	m_pOutputPin(0), m_pSrcFilter(0), 
! 	m_pOurInput(0), m_pOurOutput(0),
! 	m_pImp(0), m_pAll(0), m_pParentFilter(0)
  {
  }
  
! void DS_Filter::Create(char* dllname, const GUID* id, AM_MEDIA_TYPE* in_fmt, AM_MEDIA_TYPE* out_fmt)
  {
  
      Setup_LDT_Keeper();
  
--- 22,72 ----
  DS_Filter::DS_Filter()
      :m_iHandle(0), m_pFilter(0), m_pInputPin(0),
!     m_pOutputPin(0), m_pSrcFilter(0), m_pParentFilter(0),
!     m_pOurInput(0), m_pOurOutput(0), m_pAll(0), m_pImp(0),
!     m_iState(0)
  {
  }
  
! void DS_Filter::clean()
  {
+     m_iState = 0;
  
+     if (m_pOurInput)
+ 	m_pOurInput->vt->Release((IUnknown*)m_pOurInput);
+     if (m_pInputPin)
+ 	m_pInputPin->vt->Disconnect(m_pInputPin);
+     if (m_pOutputPin)
+ 	m_pOutputPin->vt->Disconnect(m_pOutputPin);
+     if (m_pFilter)
+ 	m_pFilter->vt->Release((IUnknown*)m_pFilter);
+     if (m_pOutputPin)
+ 	m_pOutputPin->vt->Release((IUnknown*)m_pOutputPin);
+     if (m_pInputPin)
+ 	m_pInputPin->vt->Release((IUnknown*)m_pInputPin);
+     if (m_pImp)
+ 	m_pImp->vt->Release((IUnknown*)m_pImp);
+ 
+     delete m_pOurOutput;
+     delete m_pParentFilter;
+     delete m_pSrcFilter;
+ 
+     // FIXME - we are still leaving few things allocated!
+     if (m_iHandle)
+ 	FreeLibrary(m_iHandle);
+ 
+ }
+ 
+ DS_Filter::~DS_Filter()
+ {
+     //cout << "Destruction of DS_FILTER" << endl;
+     Stop();
+     if (m_iState == 1)
+ 	clean();
+     //cout << "Destruction of DS_FILTER done" << endl;
+ }
+ 
+ void DS_Filter::Create(char*  dllname, const GUID* id, AM_MEDIA_TYPE* in_fmt, AM_MEDIA_TYPE* out_fmt)
+ {
+ 
      Setup_LDT_Keeper();
  
***************
*** 38,75 ****
  //	_fullname+="/";
  //	_fullname+=dllname;
- //	m_iHandle= LoadLibraryA(_fullname.c_str());
  	m_iHandle= expLoadLibraryA(dllname);
! 	if(!m_iHandle)throw FATAL("Could not open DLL");
          GETCLASS func=(GETCLASS)GetProcAddress(m_iHandle, "DllGetClassObject");
! 	if(!func)throw FATAL("Illegal or corrupt DLL");
  
  	HRESULT result;
  	IClassFactory* factory=0;
- 	IUnknown* object=0;
- 
  	result=func(id, &IID_IClassFactory, (void**)&factory);
  	if(result || (!factory)) throw FATAL("No such class object");;
-         
- //            printf("# factory = %X\n",(unsigned int)factory);
- //            printf("# factory->vt = %X\n",(unsigned int)factory->vt);
- //            printf("# factory->vt->CreateInstance = %X\n",(unsigned int)factory->vt->CreateInstance);
- 
-              setup_FS_Segment();
- 
- //            printf("Calling factory->vt->CreateInstance()\n");
-             result=factory->vt->CreateInstance(factory, 0, &IID_IUnknown, (void**)&object);
- //            printf("Calling factory->vt->Release()\n");
- 	
- //	result=factory->vt->CreateInstance(factory, 0, &IID_IUnknown, (void**)&object);
  
! //        printf("CreateInstance ok %x\n",result);
  
  	factory->vt->Release((IUnknown*)factory);
  	if(result || (!object)) throw FATAL("Class factory failure");
! 	    
  	result=object->vt->QueryInterface(object, &IID_IBaseFilter, (void**)&m_pFilter);
  	object->vt->Release((IUnknown*)object);
  	if(result || (!m_pFilter)) throw FATAL("Object does not have IBaseFilter interface");
! 	
  	IEnumPins* enum_pins=0;
      //	enumerate pins
--- 76,110 ----
  //	_fullname+="/";
  //	_fullname+=dllname;
  	m_iHandle= expLoadLibraryA(dllname);
! 	if (!m_iHandle)
! 	{
! 	    char e[1024];
! 	    sprintf(e, "Could not open DirectShow DLL: %s", dllname);
! 	    throw FATAL(e);
! 	}
          GETCLASS func=(GETCLASS)GetProcAddress(m_iHandle, "DllGetClassObject");
! 	if (!func)
! 	{
! 	    char e[1024];
! 	    sprintf(e, "Illegal or corrupt DirectShow DLL: %s", dllname);
! 	    throw FATAL(e);
! 	}
  
  	HRESULT result;
  	IClassFactory* factory=0;
  	result=func(id, &IID_IClassFactory, (void**)&factory);
  	if(result || (!factory)) throw FATAL("No such class object");;
  
! 	setup_FS_Segment();
  
+ 	IUnknown* object=0;
+ 	result=factory->vt->CreateInstance(factory, 0, &IID_IUnknown, (void**)&object);
  	factory->vt->Release((IUnknown*)factory);
  	if(result || (!object)) throw FATAL("Class factory failure");
! 
  	result=object->vt->QueryInterface(object, &IID_IBaseFilter, (void**)&m_pFilter);
  	object->vt->Release((IUnknown*)object);
  	if(result || (!m_pFilter)) throw FATAL("Object does not have IBaseFilter interface");
! 
  	IEnumPins* enum_pins=0;
      //	enumerate pins
***************
*** 80,105 ****
  	enum_pins->vt->Reset(enum_pins);
  	result=enum_pins->vt->Next(enum_pins, (ULONG)256, (IPin**)array, &fetched);
! //	printf("Pins enumeration returned %d pins, error is %x\n", fetched, result);
! 	
! 	for(int i=0; i<fetched; i++)
  	{
! 	    int direction=-1;
  	    array[i]->vt->QueryDirection(array[i], (PIN_DIRECTION*)&direction);
! 	    if((!m_pInputPin)&&(direction==0))
  	    {
! 		m_pInputPin=array[i];
  		m_pInputPin->vt->AddRef((IUnknown*)m_pInputPin);
  	    }
! 	    if((!m_pOutputPin)&&(direction==1))
  	    {
! 		m_pOutputPin=array[i];
  		m_pOutputPin->vt->AddRef((IUnknown*)m_pOutputPin);
  	    }
  	    array[i]->vt->Release((IUnknown*)(array[i]));
  	}
! 	if(!m_pInputPin)throw FATAL("Input pin not found");
! 	if(!m_pOutputPin)throw FATAL("Output pin not found");
! 
! 	result=m_pInputPin->vt->QueryInterface((IUnknown*)m_pInputPin, &IID_IMemInputPin, (void**)&m_pImp);
          if(result)
  	    throw FATAL("Error getting IMemInputPin interface");
--- 115,144 ----
  	enum_pins->vt->Reset(enum_pins);
  	result=enum_pins->vt->Next(enum_pins, (ULONG)256, (IPin**)array, &fetched);
! 	Debug printf("Pins enumeration returned %ld pins, error is %x\n", fetched, (int)result);
! 
! 	for (unsigned i = 0; i < fetched; i++)
  	{
! 	    int direction = -1;
  	    array[i]->vt->QueryDirection(array[i], (PIN_DIRECTION*)&direction);
! 	    if (!m_pInputPin && direction == 0)
  	    {
! 		m_pInputPin = array[i];
  		m_pInputPin->vt->AddRef((IUnknown*)m_pInputPin);
  	    }
! 	    if (!m_pOutputPin && direction == 1)
  	    {
! 		m_pOutputPin = array[i];
  		m_pOutputPin->vt->AddRef((IUnknown*)m_pOutputPin);
  	    }
  	    array[i]->vt->Release((IUnknown*)(array[i]));
  	}
! 	if (!m_pInputPin)
! 	    throw FATAL("Input pin not found");
! 	if (!m_pOutputPin)
! 	    throw FATAL("Output pin not found");
! 
! 	result = m_pInputPin->vt->QueryInterface((IUnknown*)m_pInputPin,
! 						 &IID_IMemInputPin,
! 						 (void**)&m_pImp);
          if(result)
  	    throw FATAL("Error getting IMemInputPin interface");
***************
*** 107,111 ****
  	m_pDestType=out_fmt;
          result=m_pInputPin->vt->QueryAccept(m_pInputPin, m_pOurType);
! 	if(result) throw FATAL("Source format is not accepted");
  
  	m_pParentFilter=new CBaseFilter2;
--- 146,151 ----
  	m_pDestType=out_fmt;
          result=m_pInputPin->vt->QueryAccept(m_pInputPin, m_pOurType);
! 	if (result)
! 	    throw FATAL("Source format is not accepted");
  
  	m_pParentFilter=new CBaseFilter2;
***************
*** 113,187 ****
  	m_pOurInput=m_pSrcFilter->GetPin();
  	m_pOurInput->vt->AddRef((IUnknown*)m_pOurInput);
! 	
!     	result=m_pInputPin->vt->ReceiveConnection(m_pInputPin, m_pOurInput, m_pOurType);
! 	if(result) throw FATAL("Error connecting to input pin");
! 	
! 	m_pOurOutput=new COutputPin(*m_pDestType);
!         result=m_pOutputPin->vt->ReceiveConnection(m_pOutputPin,
! 	     m_pOurOutput, m_pDestType);
! 	if(result)throw FATAL("Error connecting to output pin");    
! 	m_iState=1;
      }
      catch(FatalError e)
      {
  	e.PrintAll();
!     	if(m_pFilter)m_pFilter->vt->Release((IUnknown*)m_pFilter);
! 	if(m_pOutputPin)m_pOutputPin->vt->Release((IUnknown*)m_pOutputPin);
! 	if(m_pInputPin)m_pInputPin->vt->Release((IUnknown*)m_pInputPin);
! 	if(m_pImp)m_pImp->vt->Release((IUnknown*)m_pImp);
! 	if(m_pOurInput)m_pOurInput->vt->Release((IUnknown*)m_pOurInput);
! 	delete m_pSrcFilter;
! 	delete m_pParentFilter;
! 	delete m_pOurOutput;
! 	if(m_iHandle)FreeLibrary(m_iHandle);
  	throw;
      }
  }
  void DS_Filter::Start()
  {
!     if(m_iState!=1)
  	return;
!     
      HRESULT hr=m_pFilter->vt->Run(m_pFilter, 0);
!     if(hr!=0)
      {
! 	cerr<<"WARNING: m_Filter->Run() failed, error code "<<hex<<hr<<dec<<endl;
      }
      hr=m_pImp->vt->GetAllocator(m_pImp, &m_pAll);
!     if(hr)
      {
!         cerr<<"Error getting IMemAllocator interface "<<hex<<hr<<dec<<endl;
          m_pImp->vt->Release((IUnknown*)m_pImp);
          return;
      }
      m_pImp->vt->NotifyAllocator(m_pImp, m_pAll,	0);
!     m_iState=2;
!     return;
  }
  void DS_Filter::Stop()
- {
-     if(m_iState!=2)
- 	return;
-     m_pAll->vt->Release((IUnknown*)m_pAll);
-     m_pAll=0;
-     m_pFilter->vt->Stop(m_pFilter);
-     m_iState=1;
-     return;
- }
- DS_Filter::~DS_Filter()
  {
!     if(m_iState==0)
! 	return;
!     if(m_iState==2)Stop();
!     if(m_pInputPin)m_pInputPin->vt->Disconnect(m_pInputPin);
!     if(m_pOutputPin)m_pOutputPin->vt->Disconnect(m_pOutputPin);
!     if(m_pFilter)m_pFilter->vt->Release((IUnknown*)m_pFilter);
!     if(m_pOutputPin)m_pOutputPin->vt->Release((IUnknown*)m_pOutputPin);
!     if(m_pInputPin)m_pInputPin->vt->Release((IUnknown*)m_pInputPin);
!     if(m_pOurInput)m_pOurInput->vt->Release((IUnknown*)m_pOurInput);
!     if(m_pImp)m_pImp->vt->Release((IUnknown*)m_pImp);
!     delete m_pSrcFilter;
!     delete m_pParentFilter;
!     delete m_pOurOutput;
!     if(m_iHandle)FreeLibrary(m_iHandle);
  }
--- 153,209 ----
  	m_pOurInput=m_pSrcFilter->GetPin();
  	m_pOurInput->vt->AddRef((IUnknown*)m_pOurInput);
! 
! 	result=m_pInputPin->vt->ReceiveConnection(m_pInputPin, m_pOurInput,
! 						  m_pOurType);
! 	if (result)
! 	    throw FATAL("Error connecting to input pin");
! 
! 	m_pOurOutput = new COutputPin(*m_pDestType);
! 
! 	result = m_pOutputPin->vt->ReceiveConnection(m_pOutputPin,
! 						     m_pOurOutput,
! 						     m_pDestType);
! 	if (result)
! 	    throw FATAL("Error connecting to output pin");
! 	cout << "Using DirectShow codec: " << dllname << endl;
! 	m_iState = 1;
      }
      catch(FatalError e)
      {
  	e.PrintAll();
!         clean();
  	throw;
      }
  }
+ 
  void DS_Filter::Start()
  {
!     if (m_iState != 1)
  	return;
! 
      HRESULT hr=m_pFilter->vt->Run(m_pFilter, 0);
!     if (hr != 0)
      {
! 	Debug cerr<<"WARNING: m_Filter->Run() failed, error code "<<hex<<hr<<dec<<endl;
      }
      hr=m_pImp->vt->GetAllocator(m_pImp, &m_pAll);
!     if (hr)
      {
!         Debug cerr<<"Error getting IMemAllocator interface "<<hex<<hr<<dec<<endl;
          m_pImp->vt->Release((IUnknown*)m_pImp);
          return;
      }
      m_pImp->vt->NotifyAllocator(m_pImp, m_pAll,	0);
!     m_iState = 2;
  }
+ 
  void DS_Filter::Stop()
  {
!     if (m_iState == 2)
!     {
! 	m_pAll->vt->Release((IUnknown*)m_pAll);
! 	m_pAll=0;
! 	m_pFilter->vt->Stop(m_pFilter);
! 	m_iState=1;
!     }
  }

Index: DS_Filter.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/DS_Filter.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** DS_Filter.h	2001/04/11 02:11:39	1.3
--- DS_Filter.h	2001/05/06 21:43:45	1.4
***************
*** 6,10 ****
  #include "outputpin.h"
  #include <string>
! using namespace std;
  /**
      User will allocate and fill format structures, call Create(),
--- 6,10 ----
  #include "outputpin.h"
  #include <string>
! 
  /**
      User will allocate and fill format structures, call Create(),
***************
*** 13,21 ****
  class DS_Filter
  {
- protected:
  public:
      DS_Filter();
      virtual ~DS_Filter();
-     void Create(char* dllname, const GUID* id, AM_MEDIA_TYPE* in_fmt, AM_MEDIA_TYPE* out_fmt);
      void Start();
      void Stop();
--- 13,19 ----
***************
*** 34,40 ****
      IMemInputPin* m_pImp;
      int m_iState;
- protected:
- };    
  
! #endif
  
--- 32,41 ----
      IMemInputPin* m_pImp;
      int m_iState;
  
!     void Create(char* dllname, const GUID* id, AM_MEDIA_TYPE* in_fmt, AM_MEDIA_TYPE* out_fmt);
!     void SetPointer(char* pointer);
! private:
!     void clean();
! };
  
+ #endif

Index: DS_VideoDec.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/DS_VideoDec.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** DS_VideoDec.cpp	2001/04/16 02:55:57	1.3
--- DS_VideoDec.cpp	2001/05/06 21:43:45	1.4
***************
*** 80,84 ****
  	m_obh.biSize=sizeof(m_obh);
  
! 	memset(&m_sVhdr, 0, sizeof m_sVhdr);
  	m_sVhdr.bmiHeader=m_bh;
  	m_sVhdr.rcSource.left=m_sVhdr.rcSource.top=0;
--- 80,84 ----
  	m_obh.biSize=sizeof(m_obh);
  
! 	memset(&m_sVhdr, 0, sizeof(m_sVhdr));
  	m_sVhdr.bmiHeader=m_bh;
  	m_sVhdr.rcSource.left=m_sVhdr.rcSource.top=0;
***************
*** 94,98 ****
  	m_sOurType.bTemporalCompression=true;
  	m_sOurType.pUnk=0;
!         m_sOurType.cbFormat=sizeof m_sVhdr;
          m_sOurType.pbFormat=(char*)&m_sVhdr;
  
--- 94,98 ----
  	m_sOurType.bTemporalCompression=true;
  	m_sOurType.pUnk=0;
!         m_sOurType.cbFormat=sizeof(m_sVhdr);
          m_sOurType.pbFormat=(char*)&m_sVhdr;
  
***************
*** 102,106 ****
  	m_sVhdr2->bmiHeader.biBitCount=24;
  
! 	memset(&m_sDestType, 0, sizeof m_sDestType);
  	m_sDestType.majortype=MEDIATYPE_Video;
  	m_sDestType.subtype=MEDIASUBTYPE_RGB24;
--- 102,106 ----
  	m_sVhdr2->bmiHeader.biBitCount=24;
  
! 	memset(&m_sDestType, 0, sizeof(m_sDestType));
  	m_sDestType.majortype=MEDIATYPE_Video;
  	m_sDestType.subtype=MEDIASUBTYPE_RGB24;
***************
*** 120,136 ****
  	HRESULT result;
  
  	if(!flip)
  	{
  	    m_sVhdr2->bmiHeader.biHeight*=-1;
  	    m_obh.biHeight*=-1;
! //	    result=m_pOutputPin->vt->QueryAccept(m_pOutputPin, &m_sDestType);
! //	    if(result)
! //		throw FATAL("Decoder does not support upside-down frames");
  	}	
  
-         dsf=new DS_Filter();
-         
- 	dsf->Create(dllname, guid, &m_sOurType, &m_sDestType);
- 
  #if 0
  	m_sVhdr2->bmiHeader.biBitCount=16;
--- 120,137 ----
  	HRESULT result;
  
+         dsf=new DS_Filter();
+ 	dsf->Create(dllname, guid, &m_sOurType, &m_sDestType);
+ 
  	if(!flip)
  	{
  	    m_sVhdr2->bmiHeader.biHeight*=-1;
  	    m_obh.biHeight*=-1;
! 	    result=dsf->m_pOutputPin->vt->QueryAccept(dsf->m_pOutputPin, &m_sDestType);
! 	    if(result){
!                 printf("DShow: Decoder does not support upside-down frames");
!                 m_obh.biHeight*=-1;
!             }
  	}	
  
  #if 0
  	m_sVhdr2->bmiHeader.biBitCount=16;
***************
*** 183,187 ****
      if(dsf->m_iState!=2) return;
      dsf->Stop();
!     dsf->m_pOurOutput->SetFramePointer(0);
  //    free(m_outFrame->data());
      //m_outFrame->release();//just in case
--- 184,188 ----
      if(dsf->m_iState!=2) return;
      dsf->Stop();
! //    dsf->m_pOurOutput->SetFramePointer(0);
  //    free(m_outFrame->data());
      //m_outFrame->release();//just in case

Index: allocator.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/allocator.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** allocator.cpp	2001/03/20 00:05:32	1.1.1.1
--- allocator.cpp	2001/05/06 21:43:45	1.2
***************
*** 3,6 ****
--- 3,8 ----
  #include <com.h>
  #define E_NOTIMPL 0x80004001
+ using namespace std;
+ 
  class AllocatorKeeper
  {
***************
*** 37,40 ****
--- 39,45 ----
      props.cbBuffer=65536;/* :/ */
      props.cbAlign=props.cbPrefix=0;
+     
+     new_pointer=0;
+     modified_sample=0;
  }
  
***************
*** 132,135 ****
--- 137,148 ----
      *ppBuffer=*it;
      (*ppBuffer)->vt->AddRef((IUnknown*)*ppBuffer);
+     if(me->new_pointer)
+     {
+ 	if(me->modified_sample)
+ 	    me->modified_sample->ResetPointer();
+         (*it)->SetPointer(me->new_pointer);
+ 	me->modified_sample=*it;
+ 	me->new_pointer=0;
+     }
      me->free_list.remove(*it);
      return 0;

Index: allocator.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/allocator.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** allocator.h	2001/03/20 00:05:37	1.1.1.1
--- allocator.h	2001/05/06 21:43:45	1.2
***************
*** 7,16 ****
  #include "iunk.h"
  #include "default.h"
! using namespace std;
  class MemAllocator: public IMemAllocator
  {
      ALLOCATOR_PROPERTIES props;
!     list<CMediaSample*> used_list;
!     list<CMediaSample*> free_list;
      static GUID interfaces[];
      DECLARE_IUNKNOWN(MemAllocator)
--- 7,18 ----
  #include "iunk.h"
  #include "default.h"
! 
  class MemAllocator: public IMemAllocator
  {
      ALLOCATOR_PROPERTIES props;
!     std::list<CMediaSample*> used_list;
!     std::list<CMediaSample*> free_list;
!     char* new_pointer;
!     CMediaSample* modified_sample;
      static GUID interfaces[];
      DECLARE_IUNKNOWN(MemAllocator)
***************
*** 19,23 ****
      ~MemAllocator(){delete vt;}
      static long CreateAllocator(GUID* clsid, GUID* iid, void** ppv);
! 
      static HRESULT STDCALL SetProperties ( 
          IMemAllocator * This,
--- 21,33 ----
      ~MemAllocator(){delete vt;}
      static long CreateAllocator(GUID* clsid, GUID* iid, void** ppv);
!     void SetPointer(char* pointer) { new_pointer=pointer; }
!     void ResetPointer() 
!     { 
! 	if(modified_sample) 
! 	{
! 	    modified_sample->ResetPointer(); 
! 	    modified_sample=0;
! 	}
!     }
      static HRESULT STDCALL SetProperties ( 
          IMemAllocator * This,

Index: cmediasample.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/cmediasample.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** cmediasample.cpp	2001/03/20 02:04:33	1.2
--- cmediasample.cpp	2001/05/06 21:43:45	1.3
***************
*** 34,37 ****
--- 34,38 ----
      type_valid=0;
      block=new char[size];    
+     old_block=0;
      Debug printf("%x: Creating media sample with size %d, buffer 0x%x\n", this, _size, block);
  }
***************
*** 40,43 ****
--- 41,46 ----
      Debug printf("%x: CMediaSample::~CMediaSample() called\n", this);
      delete vt;
+     if(old_block)
+ 	block=old_block;
      delete[] block;
      if(media_type.pbFormat)

Index: cmediasample.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/cmediasample.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** cmediasample.h	2001/03/20 00:05:37	1.1.1.1
--- cmediasample.h	2001/05/06 21:43:45	1.2
***************
*** 11,14 ****
--- 11,15 ----
      int actual_size;
      char* block;
+     char* old_block;
      int refcount;
      int isPreroll;
***************
*** 19,22 ****
--- 20,25 ----
      CMediaSample(IMemAllocator* allocator, long _size);
      ~CMediaSample();
+     void SetPointer(char* pointer) { old_block=block; block=pointer; }
+     void ResetPointer() { block=old_block; old_block=0; }
  
      static long STDCALL QueryInterface ( 

Index: guids.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/guids.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** guids.cpp	2001/03/20 00:05:23	1.1.1.1
--- guids.cpp	2001/05/06 21:43:45	1.2
***************
*** 56,60 ****
      {0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45}};
  GUID IID_DivxHidden={0x598eba01, 0xb49a, 0x11d2,
!     {0xa1, 0xc1, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa
}};
  GUID IID_Iv50Hidden={0x665a4442, 0xd905, 0x11d0,
      {0xa3, 0x0e, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}};
--- 56,60 ----
      {0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45}};
  GUID IID_DivxHidden={0x598eba01, 0xb49a, 0x11d2,
!     {0xa1, 0xc1, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}};
  GUID IID_Iv50Hidden={0x665a4442, 0xd905, 0x11d0,
      {0xa3, 0x0e, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}};

Index: interfaces.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/interfaces.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** interfaces.h	2001/04/07 16:59:36	1.2
--- interfaces.h	2001/05/06 21:43:45	1.3
***************
*** 405,407 ****
  };
  #endif
- 
--- 405,406 ----

Index: outputpin.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/outputpin.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** outputpin.cpp	2001/03/20 00:05:32	1.1.1.1
--- outputpin.cpp	2001/05/06 21:43:45	1.2
***************
*** 1,7 ****
  #include "outputpin.h"
- #include <string.h>
- #include <stdio.h>
  #include "allocator.h"
  #include "iunk.h"
  #define E_NOTIMPL 0x80004001
  /*
--- 1,10 ----
+ 
+ #include <cstdio>
+ #include <string>
+ 
  #include "outputpin.h"
  #include "allocator.h"
  #include "iunk.h"
+ 
  #define E_NOTIMPL 0x80004001
  /*
***************
*** 113,117 ****
  COutputPin::COutputPin(const AM_MEDIA_TYPE& vh) :refcount(1), type(vh), remote(0), frame_pointer(0), frame_size_pointer(0)
  {
!     IPin::vt=new IPin_vt;
      IPin::vt->QueryInterface = QueryInterface;
      IPin::vt->AddRef = AddRef;
--- 116,120 ----
  COutputPin::COutputPin(const AM_MEDIA_TYPE& vh) :refcount(1), type(vh), remote(0), frame_pointer(0), frame_size_pointer(0)
  {
!     IPin::vt = new IPin_vt;
      IPin::vt->QueryInterface = QueryInterface;
      IPin::vt->AddRef = AddRef;
***************
*** 143,148 ****
--- 146,160 ----
      IMemInputPin::vt->ReceiveMultiple = ReceiveMultiple;
      IMemInputPin::vt->ReceiveCanBlock = ReceiveCanBlock;
+     
+     pAllocator = 0;
+     frame_pointer = 0;
  }
  
+ COutputPin::~COutputPin()
+ {
+     delete IPin::vt;
+     delete IMemInputPin::vt;
+ }
+ 
  // IPin->IUnknown methods
  
***************
*** 165,175 ****
  
      Debug printf("Unknown interface : %08x-%04x-%04x-%02x%02x-" \
! 			"%02x%02x%02x%02x%02x%02x\n",
! 	 iid->f1,  iid->f2,  iid->f3,
!     	 (unsigned char)iid->f4[1], (unsigned char)iid->f4[0],
! 	(unsigned char)iid->f4[2],(unsigned char)iid->f4[3],(unsigned char)iid->f4[4],	  
! 	(unsigned char)iid->f4[5],(unsigned char)iid->f4[6],(unsigned char)iid->f4[7]);
      return 0x80004002;
  }
  HRESULT STDCALL COutputPin::AddRef(IUnknown* This)
  {
--- 177,189 ----
  
      Debug printf("Unknown interface : %08x-%04x-%04x-%02x%02x-" \
! 		 "%02x%02x%02x%02x%02x%02x\n",
! 		 iid->f1,  iid->f2,  iid->f3,
! 		 (unsigned char)iid->f4[1], (unsigned char)iid->f4[0],
! 		 (unsigned char)iid->f4[2], (unsigned char)iid->f4[3],
! 		 (unsigned char)iid->f4[4], (unsigned char)iid->f4[5],
! 		 (unsigned char)iid->f4[6], (unsigned char)iid->f4[7]);
      return 0x80004002;
  }
+ 
  HRESULT STDCALL COutputPin::AddRef(IUnknown* This)
  {
***************
*** 178,181 ****
--- 192,196 ----
      return 0;
  }
+ 
  HRESULT STDCALL COutputPin::Release(IUnknown* This)
  {
***************
*** 279,283 ****
  }
  
- 
  HRESULT STDCALL COutputPin::QueryAccept ( 
      IPin * This,
--- 294,297 ----
***************
*** 427,430 ****
--- 441,446 ----
  {
      Debug printf("COutputPin::NotifyAllocator() called\n");
+     COutputPin* pPin=(COutputPin*)This;
+     pPin->pAllocator=(MemAllocator*)pAllocator;
      return 0;
  }
***************
*** 451,455 ****
      if(len==0)len=pSample->vt->GetSize(pSample);//for iv50
      //if(me.frame_pointer)memcpy(me.frame_pointer, pointer, len);
!     *me.frame_pointer=pointer;
      if(me.frame_size_pointer)*me.frame_size_pointer=len;
  /*
--- 467,472 ----
      if(len==0)len=pSample->vt->GetSize(pSample);//for iv50
      //if(me.frame_pointer)memcpy(me.frame_pointer, pointer, len);
!     if(me.frame_pointer)
! 	*me.frame_pointer=pointer;
      if(me.frame_size_pointer)*me.frame_size_pointer=len;
  /*

Index: outputpin.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/outputpin.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** outputpin.h	2001/03/20 00:05:44	1.1.1.1
--- outputpin.h	2001/05/06 21:43:45	1.2
***************
*** 6,10 ****
  #include "guids.h"
  #include "default.h"
! 
  class COutputPin: public IPin, public IMemInputPin
  {
--- 6,10 ----
  #include "guids.h"
  #include "default.h"
! #include "allocator.h"
  class COutputPin: public IPin, public IMemInputPin
  {
***************
*** 14,21 ****
      char** frame_pointer;
      long* frame_size_pointer;
  public:
      COutputPin(const AM_MEDIA_TYPE& vhdr);
!     ~COutputPin(){delete IPin::vt; delete IMemInputPin::vt;}
      void SetFramePointer(char** z){frame_pointer=z;}
      void SetFrameSizePointer(long* z){frame_size_pointer=z;}
      void SetNewFormat(const AM_MEDIA_TYPE& a){type=a;}
--- 14,23 ----
      char** frame_pointer;
      long* frame_size_pointer;
+     MemAllocator* pAllocator;
  public:
      COutputPin(const AM_MEDIA_TYPE& vhdr);
!     ~COutputPin();
      void SetFramePointer(char** z){frame_pointer=z;}
+     void SetPointer2(char* p) { if(pAllocator) pAllocator->SetPointer(p); }
      void SetFrameSizePointer(long* z){frame_size_pointer=z;}
      void SetNewFormat(const AM_MEDIA_TYPE& a){type=a;}


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list