[Mplayer-cvslog] CVS: main/loader/DirectShow DS_AudioDecoder.cpp,NONE,1.1 DS_AudioDecoder.h,NONE,1.1 DS_VideoDecoder.cpp,NONE,1.1 DS_VideoDecoder.h,NONE,1.1 libwin32.h,NONE,1.1 DS_AudioDec.cpp,1.4,1.5 DS_Filter.cpp,1.7,1.8 DS_Filter.h,1.4,1.5 DS_VideoDec.cpp,1.9,1.10 Makefile,1.10,1.11 allocator.cpp,1.2,1.3 allocator.h,1.2,1.3 cmediasample.cpp,1.3,1.4 cmediasample.h,1.2,1.3 guids.h,1.1.1.1,1.2 inputpin.cpp,1.1.1.1,1.2 inputpin.h,1.1.1.1,1.2 interfaces.h,1.3,1.4 iunk.h,1.1.1.1,1.2 outputpin.cpp,1.3,1.4 outputpin.h,1.2,1.3 BitmapInfo.h,1.4,NONE default.h,1.4,NONE except.h,1.1.1.1,NONE formats.h,1.4,NONE

Arpi of Ize arpi at mplayer.dev.hu
Thu Aug 16 02:50:06 CEST 2001


Update of /cvsroot/mplayer/main/loader/DirectShow
In directory mplayer:/var/tmp.root/cvs-serv15693

Modified Files:
	DS_AudioDec.cpp DS_Filter.cpp DS_Filter.h DS_VideoDec.cpp 
	Makefile allocator.cpp allocator.h cmediasample.cpp 
	cmediasample.h guids.h inputpin.cpp inputpin.h interfaces.h 
	iunk.h outputpin.cpp outputpin.h 
Added Files:
	DS_AudioDecoder.cpp DS_AudioDecoder.h DS_VideoDecoder.cpp 
	DS_VideoDecoder.h libwin32.h 
Removed Files:
	BitmapInfo.h default.h except.h formats.h 
Log Message:
big avifile sync - from now we have common code

--- NEW FILE ---
/********************************************************

         DirectShow audio decoder
	 Copyright 2001 Eugene Kuznetsov  (divx at euro.ru)

*********************************************************/
#include "DS_AudioDecoder.h"

#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#define __MODULE__ "DirectShow audio decoder"
const GUID FORMAT_WaveFormatEx = {
    0x05589f81, 0xc356, 0x11CE,
    { 0xBF, 0x01, 0x00, 0xAA, 0x00, 0x55, 0x59, 0x5A }
};
const GUID MEDIATYPE_Audio = {
    0x73647561, 0x0000, 0x0010,
    { 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 }
};
const GUID MEDIASUBTYPE_PCM = {
    0x00000001, 0x0000, 0x0010,
    { 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 }
};

using namespace std;

typedef long STDCALL (*GETCLASS) (GUID*, GUID*, void**);

DS_AudioDecoder::DS_AudioDecoder(const CodecInfo& info, const WAVEFORMATEX* wf)
    : IAudioDecoder(info, wf), m_pDS_Filter(0), m_sVhdr(0), m_sVhdr2(0)
{
    m_sVhdr=new char[18 + wf->cbSize];
    memcpy(m_sVhdr, wf, 18 + wf->cbSize);
    m_sVhdr2=new char[18 + wf->cbSize];
    memcpy(m_sVhdr2, m_sVhdr, 18 + wf->cbSize);
    WAVEFORMATEX* pWF=(WAVEFORMATEX*)m_sVhdr2;
    pWF->wFormatTag=1;
    pWF->wBitsPerSample=16;
    pWF->nBlockAlign=2*pWF->nChannels;
    pWF->cbSize=0;
    in_fmt=*wf;

    memset(&m_sOurType, 0, sizeof(m_sOurType));
    m_sOurType.majortype=MEDIATYPE_Audio;
    m_sOurType.subtype=MEDIASUBTYPE_PCM;
    m_sOurType.subtype.f1=wf->wFormatTag;
    m_sOurType.formattype=FORMAT_WaveFormatEx;
    m_sOurType.lSampleSize=wf->nBlockAlign;
    m_sOurType.bFixedSizeSamples=true;
    m_sOurType.bTemporalCompression=false;
    m_sOurType.pUnk=0;
    m_sOurType.cbFormat=18+wf->cbSize;
    m_sOurType.pbFormat=m_sVhdr;

    memset(&m_sDestType, 0, sizeof(m_sDestType));
    m_sDestType.majortype=MEDIATYPE_Audio;
    m_sDestType.subtype=MEDIASUBTYPE_PCM;
    m_sDestType.formattype=FORMAT_WaveFormatEx;
    m_sDestType.bFixedSizeSamples=true;
    m_sDestType.bTemporalCompression=false;
    m_sDestType.lSampleSize=2*wf->nChannels;
    m_sDestType.pUnk=0;
    m_sDestType.cbFormat=18;
    m_sDestType.pbFormat=m_sVhdr2;

    try
    {
        m_pDS_Filter = new DS_Filter();
	m_pDS_Filter->Create(info.dll.c_str(), &info.guid, &m_sOurType, &m_sDestType);
	m_pDS_Filter->Start();

	ALLOCATOR_PROPERTIES props, props1;
	props.cBuffers=1;
        props.cbBuffer=m_sOurType.lSampleSize;
	props.cbAlign=props.cbPrefix=0;
	m_pDS_Filter->m_pAll->vt->SetProperties(m_pDS_Filter->m_pAll, &props, &props1);
	m_pDS_Filter->m_pAll->vt->Commit(m_pDS_Filter->m_pAll);
    }
    catch (FatalError e)
    {
	e.PrintAll();
	delete[] m_sVhdr;
	delete[] m_sVhdr2;
	delete m_pDS_Filter;
	throw;
    }
}

DS_AudioDecoder::~DS_AudioDecoder()
{
    delete[] m_sVhdr;
    delete[] m_sVhdr2;
    delete m_pDS_Filter;
}

int DS_AudioDecoder::Convert(const void* in_data, size_t in_size,
			void* out_data, size_t out_size,
			size_t* size_read, size_t* size_written)
{
    if (!in_data || !out_data)
	return -1;

    size_t written = 0;
    size_t read = 0;
    in_size -= in_size%in_fmt.nBlockAlign;
    while (in_size>0)
    {
	size_t frame_size=0;
	char* frame_pointer;
//	m_pOurOutput->SetFramePointer(out_data+written);
	m_pDS_Filter->m_pOurOutput->SetFramePointer(&frame_pointer);
	m_pDS_Filter->m_pOurOutput->SetFrameSizePointer((long*)&frame_size);
	IMediaSample* sample=0;
	m_pDS_Filter->m_pAll->vt->GetBuffer(m_pDS_Filter->m_pAll, &sample, 0, 0, 0);
	if(!sample)
	{
	    Debug cerr<<"DS_AudioDecoder::Convert() Error: null sample"<<endl;
	    break;
	}
	char* ptr;
	sample->vt->GetPointer(sample, (BYTE **)&ptr);
	memcpy(ptr, (const uint8_t*)in_data + read, in_fmt.nBlockAlign);
	sample->vt->SetActualDataLength(sample, in_fmt.nBlockAlign);
	sample->vt->SetSyncPoint(sample, true);
	sample->vt->SetPreroll(sample, 0);
	int result = m_pDS_Filter->m_pImp->vt->Receive(m_pDS_Filter->m_pImp, sample);
        if (result)
	    Debug printf("DS_AudioDecoder::Convert() Error: putting data into input pin %x\n", result);
	if ((written + frame_size) > out_size)
	{
	    sample->vt->Release((IUnknown*)sample);
	    break;
	}
	memcpy((uint8_t*)out_data + written, frame_pointer, frame_size);
        sample->vt->Release((IUnknown*)sample);
	read+=in_fmt.nBlockAlign;
	written+=frame_size;
    }
    if (size_read)
	*size_read = read;
    if (size_written)
	*size_written = written;
    return 0;
}

int DS_AudioDecoder::GetSrcSize(int dest_size)
{
    double efficiency = (double) in_fmt.nAvgBytesPerSec
	/ (in_fmt.nSamplesPerSec*in_fmt.nBlockAlign);
    int frames = int(dest_size*efficiency);
    if (frames < 1)
	frames = 1;
    return frames * in_fmt.nBlockAlign;
}

--- NEW FILE ---
#ifndef AVIFILE_DSHOW_H
#define AVIFILE_DSHOW_H

#include <libwin32.h>
#include "DS_Filter.h"

class DS_AudioDecoder : public IAudioDecoder
{
public:
    DS_AudioDecoder(const CodecInfo& info, const WAVEFORMATEX*);
    virtual ~DS_AudioDecoder();
    virtual int Convert(const void*, size_t, void*, size_t, size_t*, size_t*);
    virtual int GetSrcSize(int);
protected:
    AM_MEDIA_TYPE m_sOurType, m_sDestType;
    DS_Filter* m_pDS_Filter;
    char* m_sVhdr;
    char* m_sVhdr2;
};

#endif

--- NEW FILE ---
/********************************************************

	DirectShow Video decoder implementation
	Copyright 2000 Eugene Kuznetsov  (divx at euro.ru)

*********************************************************/

#include "guids.h"
#include "interfaces.h"

#include "DS_VideoDecoder.h"
#include <wine/winerror.h>
#include <libwin32.h>
//#include <cpuinfo.h>

#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <cstdio>
#include <iostream>
#include <strstream>

#define __MODULE__ "DirectShow_VideoDecoder"

extern "C" char* def_path;
extern "C" void setup_FS_Segment();

using namespace std;

DS_VideoDecoder::DS_VideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& format, int flip)
    :IVideoDecoder(info, format)
{
    m_sVhdr2 = 0;
    m_iLastQuality = -1;
    //memset(&m_obh, 0, sizeof(m_obh));
    //m_obh.biSize = sizeof(m_obh);
    try
    {
	m_pDS_Filter = new DS_Filter();

	unsigned bihs = (format.biSize < (int) sizeof(BITMAPINFOHEADER)) ?
	    sizeof(BITMAPINFOHEADER) : format.biSize;
        bihs = sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER) + bihs;

	m_sVhdr = (VIDEOINFOHEADER*) new char[bihs];
	memset(m_sVhdr, 0, bihs);
	memcpy(&m_sVhdr->bmiHeader, m_bh, m_bh->biSize);
	m_sVhdr->rcSource.left = m_sVhdr->rcSource.top = 0;
	m_sVhdr->rcSource.right = m_sVhdr->bmiHeader.biWidth;
        m_sVhdr->rcSource.bottom = m_sVhdr->bmiHeader.biHeight;
	m_sVhdr->rcTarget = m_sVhdr->rcSource;

	m_sOurType.majortype = MEDIATYPE_Video;
	m_sOurType.subtype = MEDIATYPE_Video;
        m_sOurType.subtype.f1 = m_sVhdr->bmiHeader.biCompression;
	m_sOurType.formattype = FORMAT_VideoInfo;
        m_sOurType.bFixedSizeSamples = false;
	m_sOurType.bTemporalCompression = true;
	m_sOurType.pUnk = 0;
        m_sOurType.cbFormat = bihs;
        m_sOurType.pbFormat = (char*)m_sVhdr;

	m_sVhdr2 = (VIDEOINFOHEADER*)(new char[sizeof(VIDEOINFOHEADER)+12]);
	memcpy(m_sVhdr2, m_sVhdr, sizeof(VIDEOINFOHEADER)+12);
	m_sVhdr2->bmiHeader.biCompression = 0;
	m_sVhdr2->bmiHeader.biBitCount = 24;

	memset(&m_sDestType, 0, sizeof(m_sDestType));
	m_sDestType.majortype = MEDIATYPE_Video;
	m_sDestType.subtype = MEDIASUBTYPE_RGB24;
	m_sDestType.formattype = FORMAT_VideoInfo;
	m_sDestType.bFixedSizeSamples = true;
	m_sDestType.bTemporalCompression = false;
	m_sDestType.lSampleSize = abs(m_sVhdr2->bmiHeader.biWidth*m_sVhdr2->bmiHeader.biHeight
				      * ((m_sVhdr2->bmiHeader.biBitCount + 7) / 8));
	m_sVhdr2->bmiHeader.biSizeImage = m_sDestType.lSampleSize;
	m_sDestType.pUnk = 0;
	m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
        m_sDestType.pbFormat = (char*)m_sVhdr2;
	memcpy(&m_obh, m_bh, sizeof(m_obh));
	m_obh.SetBits(24);

	HRESULT result;

	m_pDS_Filter->Create(info.dll.c_str(), &info.guid, &m_sOurType, &m_sDestType);

	if (!flip)
	{
	    m_sVhdr2->bmiHeader.biHeight *= -1;
	    m_obh.biHeight *= -1;
	    result = m_pDS_Filter->m_pOutputPin->vt->QueryAccept(m_pDS_Filter->m_pOutputPin, &m_sDestType);
	    if (result)
	    {
		cerr << "Decoder does not support upside-down frames" << endl;
		m_sVhdr2->bmiHeader.biHeight *= -1;
		m_obh.biHeight *= -1;
	    }
	}

	m_decoder = m_obh;

	switch (m_bh->biCompression)
	{
	case fccDIV3:
	case fccDIV4:
	case fccDIV5:
	case fccMP42:
	case fccWMV2:
	    //YV12 seems to be broken for DivX :-) codec
	case fccIV50:
	    //produces incorrect picture
	    //m_Caps = (CAPS) (m_Caps & ~CAP_YV12);
	    m_Caps = CAP_YUY2; // | CAP_I420;
	    break;
	default:
	    struct ct {
		unsigned int bits;
		fourcc_t fcc;
		GUID subtype;
		CAPS cap;
	    } check[] = {
		{16, fccYUY2, MEDIASUBTYPE_YUY2, CAP_YUY2},
		{12, fccIYUV, MEDIASUBTYPE_IYUV, CAP_IYUV},
		{16, fccUYVY, MEDIASUBTYPE_UYVY, CAP_UYVY},
		{12, fccYV12, MEDIASUBTYPE_YV12, CAP_YV12},
		{16, fccYV12, MEDIASUBTYPE_YV12, CAP_YV12},
		{16, fccYVYU, MEDIASUBTYPE_YVYU, CAP_YVYU},
		//{12, fccI420, MEDIASUBTYPE_I420, CAP_I420},
		{0},
	    };

	    m_Caps = CAP_NONE;

	    for (ct* c = check; c->bits; c++)
	    {
		m_sVhdr2->bmiHeader.biBitCount = c->bits;
		m_sVhdr2->bmiHeader.biCompression = c->fcc;
		m_sDestType.subtype = c->subtype;
		result = m_pDS_Filter->m_pOutputPin->vt->QueryAccept(m_pDS_Filter->m_pOutputPin, &m_sDestType);
		if (!result)
		    m_Caps = (CAPS)(m_Caps | c->cap);
	    }
	}

	if (m_Caps != CAP_NONE)
	    cout << "Decoder is capable of YUV output ( flags 0x"<<hex<<(int)m_Caps<<dec<<" )"<<endl;

	m_sVhdr2->bmiHeader.biBitCount = 24;
	m_sVhdr2->bmiHeader.biCompression = 0;
	m_sDestType.subtype = MEDIASUBTYPE_RGB24;

	m_bIsDivX = ((info.dll == string("divxcvki.ax"))
		     || (info.dll == string("divx_c32.ax"))
		     || (info.dll == string("wmvds32.ax"))
		     || (info.dll == string("wmv8ds32.ax")));
    }
    catch (FatalError& error)
    {
	delete[] m_sVhdr2;
        delete m_pDS_Filter;
	throw;
    }
}

DS_VideoDecoder::~DS_VideoDecoder()
{
    Stop();
    delete[] m_sVhdr2;
    delete m_pDS_Filter;
}

void DS_VideoDecoder::StartInternal()
{
    //cout << "DSSTART" << endl;
    m_pDS_Filter->Start();
    ALLOCATOR_PROPERTIES props, props1;
    props.cBuffers = 1;
    props.cbBuffer = m_sDestType.lSampleSize;
    //don't know how to do this correctly
    props.cbAlign = props.cbPrefix = 0;
    m_pDS_Filter->m_pAll->vt->SetProperties(m_pDS_Filter->m_pAll, &props, &props1);
    m_pDS_Filter->m_pAll->vt->Commit(m_pDS_Filter->m_pAll);
}

void DS_VideoDecoder::StopInternal()
{
    //cout << "DSSTOP" << endl;
    m_pDS_Filter->Stop();
    //??? why was this here ??? m_pOurOutput->SetFramePointer(0);
}

int DS_VideoDecoder::DecodeInternal(void* src, size_t size, int is_keyframe, CImage* pImage)
{
    IMediaSample* sample = 0;

    m_pDS_Filter->m_pAll->vt->GetBuffer(m_pDS_Filter->m_pAll, &sample, 0, 0, 0);

    if (!sample)
    {
	Debug cerr << "ERROR: null sample" << endl;
	return -1;
    }

    //cout << "DECODE " << (void*) pImage << "   d: " << (void*) pImage->Data() << endl;
    if (pImage)
    {
	if (!(pImage->Data()))
	{
	    Debug cout << "no m_outFrame??" << endl;
	}
	else
	    m_pDS_Filter->m_pOurOutput->SetPointer2((char*)pImage->Data());
    }

    char* ptr;
    sample->vt->GetPointer(sample, (BYTE **)&ptr);
    memcpy(ptr, src, size);
    sample->vt->SetActualDataLength(sample, size);
    sample->vt->SetSyncPoint(sample, is_keyframe);
    sample->vt->SetPreroll(sample, pImage ? 0 : 1);
    // sample->vt->SetMediaType(sample, &m_sOurType);

    // FIXME: - crashing with YV12 at this place decoder will crash
    //          while doing this call
    // %FS register was not setup for calling into win32 dll. Are all
    // crashes inside ...->Receive() fixed now?
    //
    // nope - but this is surely helpfull - I'll try some more experiments
    setup_FS_Segment();
#if 0
    if (!m_pDS_Filter || !m_pDS_Filter->m_pImp
	|| !m_pDS_Filter->m_pImp->vt
	|| !m_pDS_Filter->m_pImp->vt->Receive)
	printf("DecodeInternal ERROR???\n");
#endif
    int result = m_pDS_Filter->m_pImp->vt->Receive(m_pDS_Filter->m_pImp, sample);
    if (result)
    {
	Debug printf("DS_VideoDecoder::DecodeInternal() error putting data into input pin %x\n", result);
    }

    sample->vt->Release((IUnknown*)sample);

    if (m_bIsDivX)
    {
	int q;
	IHidden* hidden=(IHidden*)((int)m_pDS_Filter->m_pFilter + 0xb8);
	// always check for actual value
	// this seems to be the only way to know the actual value
	hidden->vt->GetSmth2(hidden, &m_iLastQuality);
	if (m_iLastQuality > 9)
	    m_iLastQuality -= 10;

	if (m_iLastQuality < 0)
	    m_iLastQuality = 0;
	else if (m_iLastQuality > 4)
	    m_iLastQuality = 4;

	//cout << " Qual: " << m_iLastQuality << endl;
	m_fQuality = m_iLastQuality / 4.0;
    }

    // FIXME: last_quality currently works only for DivX movies
    // more general approach is needed here
    // cout << "Q: " << m_iLastQuality << "  rt: " << m_Mode << " dp: " << decpos << endl;
    // also accesing vbuf doesn't look very nice at this place
    // FIXME later - do it as a virtual method

    if (m_Mode == IVideoDecoder::REALTIME_QUALITY_AUTO)
    {
	// adjust Quality - depends on how many cached frames we have
	int buffered = m_iDecpos - m_iPlaypos;

	if (m_bIsDivX)
	{
	    //cout << "qual " << q << "  " << buffered << endl;
	    if (buffered < (m_iLastQuality * 2 + QMARKLO - 1)
		|| buffered > ((m_iLastQuality + 1) * 2 + QMARKLO))
	    {
		// removed old code which was present here
		// and replaced with this new uptodate one

		int to = (buffered - QMARKLO) / 2;
		if (to < 0)
		    to = 0;
		else if (to > 4)
		    to = 4;
		if (m_iLastQuality != to)
		{
		    IHidden* hidden=(IHidden*)((int)m_pDS_Filter->m_pFilter + 0xb8);
		    hidden->vt->SetSmth(hidden, to, 0);
#ifndef QUIET
		    //cout << "Switching quality " << m_iLastQuality <<  " -> " << to << "  b:" << buffered << endl;
#endif
		}
	    }
	}
    }


    return 0;
}

/*
 * bits == 0   - leave unchanged
 */
int DS_VideoDecoder::SetDestFmt(int bits, fourcc_t csp)
{
    if (!CImage::Supported(csp, bits))
	return -1;

    // BitmapInfo temp = m_obh;
    if (bits != 0)
    {
	bool ok = true;

	switch (bits)
        {
	case 15:
	    m_sDestType.subtype = MEDIASUBTYPE_RGB555;
    	    break;
	case 16:
	    m_sDestType.subtype = MEDIASUBTYPE_RGB565;
	    break;
	case 24:
	    m_sDestType.subtype = MEDIASUBTYPE_RGB24;
	    break;
	case 32:
	    m_sDestType.subtype = MEDIASUBTYPE_RGB32;
	    break;
	default:
            ok = false;
	    break;
	}

        if (ok)
	    m_obh.SetBits(bits);
	//.biSizeImage=abs(temp.biWidth*temp.biHeight*((temp.biBitCount+7)/8));
    }

    if (csp != 0)
    {
        bool ok = true;
	switch (csp)
	{
	case fccYUY2:
	    m_sDestType.subtype = MEDIASUBTYPE_YUY2;
	    break;
	case fccYV12:
	    m_sDestType.subtype = MEDIASUBTYPE_YV12;
	    break;
	case fccIYUV:
	    m_sDestType.subtype = MEDIASUBTYPE_IYUV;
	    break;
	case fccUYVY:
	    m_sDestType.subtype = MEDIASUBTYPE_UYVY;
	    break;
	case fccYVYU:
	    m_sDestType.subtype = MEDIASUBTYPE_YVYU;
	    break;
	default:
	    ok = false;
            break;
	}

        if (ok)
	    m_obh.SetSpace(csp);
    }
    m_sDestType.lSampleSize = m_obh.biSizeImage;
    memcpy(&(m_sVhdr2->bmiHeader), &m_obh, sizeof(m_obh));
    m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
    if (m_sVhdr2->bmiHeader.biCompression == 3)
        m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12;
    else
        m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);

    HRESULT result;
    bool should_test=true;
    switch(csp)
    {
    case fccYUY2:
	if(!(m_Caps & CAP_YUY2))
	    should_test=false;
	break;
    case fccYV12:
	if(!(m_Caps & CAP_YV12))
	    should_test=false;
	break;
    case fccIYUV:
	if(!(m_Caps & CAP_IYUV))
	    should_test=false;
	break;
    case fccUYVY:
	if(!(m_Caps & CAP_UYVY))
	    should_test=false;
	break;
    case fccYVYU:
	if(!(m_Caps & CAP_YVYU))
	    should_test=false;
	break;
    }
    if(should_test)
	result = m_pDS_Filter->m_pOutputPin->vt->QueryAccept(m_pDS_Filter->m_pOutputPin, &m_sDestType);
    else
	result = -1;

    if (result != 0)
    {
	if (csp)
	    cerr << "Warning: unsupported color space" << endl;
	else
	    cerr << "Warning: unsupported bit depth" << endl;

	m_sDestType.lSampleSize = m_decoder.biSizeImage;
	memcpy(&(m_sVhdr2->bmiHeader), &m_decoder, sizeof(m_decoder));
	m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
	if(m_sVhdr2->bmiHeader.biCompression == 3)
    	    m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12;
	else
    	    m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);

	return 1;
    }

    m_decoder = m_obh;

//    m_obh=temp;
//    if(csp)
//	m_obh.biBitCount=BitmapInfo::BitCount(csp);
    m_bh->biBitCount = bits;

    //Restart();
    bool stoped = false;
    if (m_State == START)
    {
	Stop();
        stoped = true;
    }

    m_pDS_Filter->m_pInputPin->vt->Disconnect(m_pDS_Filter->m_pInputPin);
    m_pDS_Filter->m_pOutputPin->vt->Disconnect(m_pDS_Filter->m_pOutputPin);
    m_pDS_Filter->m_pOurOutput->SetNewFormat(m_sDestType);
    result = m_pDS_Filter->m_pInputPin->vt->ReceiveConnection(m_pDS_Filter->m_pInputPin,
							      m_pDS_Filter->m_pOurInput,
							      &m_sOurType);
    if (result)
    {
	cerr<<"Error reconnecting input pin "<<hex<<result<<dec<<endl;
	return -1;
    }
    result = m_pDS_Filter->m_pOutputPin->vt->ReceiveConnection(m_pDS_Filter->m_pOutputPin,
							       m_pDS_Filter->m_pOurOutput,
							       &m_sDestType);
    if (result)
    {
	cerr<<"Error reconnecting output pin "<<hex<<result<<dec<<endl;
	return -1;
    }

    if (stoped)
	Start();

    return 0;
}

HRESULT DS_VideoDecoder::GetValue(const char* name, int& value)
{
    if (m_bIsDivX)
    {
	if (m_State != START)
	    return VFW_E_NOT_RUNNING;
// brightness 87
// contrast 74
// hue 23
// saturation 20
// post process mode 0
// get1 0x01
// get2 10
// get3=set2 86
// get4=set3 73
// get5=set4 19
// get6=set5 23
	IHidden* hidden=(IHidden*)((int)m_pDS_Filter->m_pFilter+0xb8);
	if (strcmp(name, "Brightness") == 0)
	    return hidden->vt->GetSmth3(hidden, &value);
	if (strcmp(name, "Contrast") == 0)
	    return hidden->vt->GetSmth4(hidden, &value);
	if (strcmp(name, "Hue") == 0)
	    return hidden->vt->GetSmth6(hidden, &value);
	if (strcmp(name, "Saturation") == 0)
	    return hidden->vt->GetSmth5(hidden, &value);
	if (strcmp(name, "Quality") == 0)
	{
#warning NOT SURE
	    int r = hidden->vt->GetSmth2(hidden, &value);
	    if (value >= 10)
		value -= 10;
	    return 0;
	}
    }
    else if (record.dll == string("ir50_32.dll"))
    {
	IHidden2* hidden = 0;
	if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_Iv50Hidden, (void**)&hidden))
	{
	    cerr << "No such interface" << endl;
	    return -1;
	}
#warning FIXME
	int recordpar[30];
	recordpar[0]=0x7c;
	recordpar[1]=fccIV50;
	recordpar[2]=0x10005;
	recordpar[3]=2;
	recordpar[4]=1;
	recordpar[5]=0x80000000;

	if (strcmp(name, "Brightness") == 0)
	    recordpar[5]|=0x20;
	else if (strcmp(name, "Saturation") == 0)
	    recordpar[5]|=0x40;
	else if (strcmp(name, "Contrast") == 0)
	    recordpar[5]|=0x80;
	if (!recordpar[5])
	{
	    hidden->vt->Release((IUnknown*)hidden);
	    return -1;
	}
	if (hidden->vt->DecodeSet(hidden, recordpar))
	    return -1;

	if (strcmp(name, "Brightness") == 0)
	    value = recordpar[18];
	else if (strcmp(name, "Saturation") == 0)
	    value = recordpar[19];
	else if (strcmp(name, "Contrast") == 0)
	    value = recordpar[20];

	hidden->vt->Release((IUnknown*)hidden);
    }

    return 0;
}

HRESULT DS_VideoDecoder::SetValue(const char* name, int value)
{
    if (m_bIsDivX)
    {
	if (m_State != START)
	    return VFW_E_NOT_RUNNING;

	//cout << "set value " << name << "  " << value << endl;
// brightness 87
// contrast 74
// hue 23
// saturation 20
// post process mode 0
// get1 0x01
// get2 10
// get3=set2 86
// get4=set3 73
// get5=set4 19
// get6=set5 23
    	IHidden* hidden = (IHidden*)((int)m_pDS_Filter->m_pFilter + 0xb8);
	if (strcmp(name, "Quality") == 0)
	{
            m_iLastQuality = value;
	    return hidden->vt->SetSmth(hidden, value, 0);
	}
	if (strcmp(name, "Brightness") == 0)
	    return hidden->vt->SetSmth2(hidden, value, 0);
	if (strcmp(name, "Contrast") == 0)
	    return hidden->vt->SetSmth3(hidden, value, 0);
	if (strcmp(name, "Saturation") == 0)
	    return hidden->vt->SetSmth4(hidden, value, 0);
	if (strcmp(name, "Hue") == 0)
	    return hidden->vt->SetSmth5(hidden, value, 0);
    }
    else if (record.dll == string("ir50_32.dll"))
    {
	IHidden2* hidden = 0;
	if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_Iv50Hidden, (void**)&hidden))
	{
	    Debug cerr << "No such interface" << endl;
	    return -1;
	}
	int recordpar[30];
	recordpar[0]=0x7c;
	recordpar[1]=fccIV50;
	recordpar[2]=0x10005;
	recordpar[3]=2;
	recordpar[4]=1;
	recordpar[5]=0x80000000;
	if (strcmp(name, "Brightness") == 0)
	{
	    recordpar[5]|=0x20;
	    recordpar[18]=value;
	}
	else if (strcmp(name, "Saturation") == 0)
	{
	    recordpar[5]|=0x40;
	    recordpar[19]=value;
	}
	else if (strcmp(name, "Contrast") == 0)
	{
	    recordpar[5]|=0x80;
	    recordpar[20]=value;
	}
	if(!recordpar[5])
	{
	    hidden->vt->Release((IUnknown*)hidden);
    	    return -1;
	}
	HRESULT result = hidden->vt->DecodeSet(hidden, recordpar);
	hidden->vt->Release((IUnknown*)hidden);

	return result;
    }
    return 0;
}
/*
vim: tabstop=8
*/

--- NEW FILE ---
#ifndef AVIFILE_DS_VIDEODECODER_H
#define AVIFILE_DS_VIDEODECODER_H

#include <libwin32.h>
#include <DS_Filter.h>

class DS_VideoDecoder: public IVideoDecoder, public IRtConfig
{
public:
    DS_VideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& format, int flip);
    ~DS_VideoDecoder();
    int SetDestFmt(int bits = 24, fourcc_t csp = 0);
    CAPS GetCapabilities() const {return m_Caps;}
    int DecodeInternal(void* src, size_t size, int is_keyframe, CImage* pImage);
    void StartInternal();
    void StopInternal();
    //void Restart();
    int SetDirection(int d)
    {
	m_obh.biHeight = d ? m_bh->biHeight : -m_bh->biHeight;
	m_sVhdr2->bmiHeader.biHeight = m_obh.biHeight;
	return 0;
    }
    // IRtConfig interface
    virtual HRESULT GetValue(const char*, int&);
    virtual HRESULT SetValue(const char*, int);
protected:
    DS_Filter* m_pDS_Filter;
    AM_MEDIA_TYPE m_sOurType, m_sDestType;
    VIDEOINFOHEADER* m_sVhdr;
    VIDEOINFOHEADER* m_sVhdr2;
    CAPS m_Caps;                // capabilities of DirectShow decoder
    int m_iLastQuality;         // remember last quality as integer
    bool m_bIsDivX;             // for speed
};

#endif /* AVIFILE_DS_VIDEODECODER_H */

--- NEW FILE ---
#ifndef __LIBWIN32_H
#define __LIBWIN32_H

#define VFW_E_INVALIDMEDIATYPE  	0x80040200
#define VFW_E_INVALIDSUBTYPE    	0x80040201
#define VFW_E_ALREADY_CONNECTED         0x80040204
#define VFW_E_FILTER_ACTIVE             0x80040205
#define VFW_E_NO_ACCEPTABLE_TYPES       0x80040207
#define VFW_E_NOT_CONNECTED             0x80040209
#define VFW_E_NO_ALLOCATOR              0x8004020A
#define VFW_E_NOT_RUNNING               0x80040226
#define VFW_E_TYPE_NOT_ACCEPTED         0x8004022A
#define VFW_E_SAMPLE_REJECTED           0x8004022B

#include <sys/types.h>
#include <inttypes.h>

#ifndef NOAVIFILE_HEADERS
#include <audiodecoder.h>
#include <audioencoder.h>
#include <videodecoder.h>
#include <videoencoder.h>
#include <except.h>
#include <fourcc.h>

#else
// code for mplayer team

#define FATAL(a)  // you don't need exception - if you want - just fill more code
#include <wine/mmreg.h>
#include <wine/winreg.h>
#include <wine/vfw.h>
#include <com.h>
#include <string>

typedef unsigned int fourcc_t;
struct FatalError
{
    FatalError();
    void PrintAll() {}
};

struct CodecInfo
{
    std::string dll;
    GUID guid;
};

struct CImage { // public  your_libvo_mem
    char* ptr;
    char* Data() { return ptr; }  // pointer to memory block
	/* if you support such surface: */
    static bool Supported(fourcc_t csp, int bits) { return true; }
};

// might be minimalized to contain just those which are needed by DS_VideoDecoder

#ifndef mmioFOURCC
#define mmioFOURCC( ch0, ch1, ch2, ch3 )				\
		( (long)(unsigned char)(ch0) | ( (long)(unsigned char)(ch1) << 8 ) |	\
		( (long)(unsigned char)(ch2) << 16 ) | ( (long)(unsigned char)(ch3) << 24 ) )
#endif /* mmioFOURCC */

/* OpenDivX */
#define fccMP4S	mmioFOURCC('M', 'P', '4', 'S')
#define fccmp4s	mmioFOURCC('m', 'p', '4', 's')
#define fccDIVX	mmioFOURCC('D', 'I', 'V', 'X')
#define fccdivx	mmioFOURCC('d', 'i', 'v', 'x')
#define fccDIV1	mmioFOURCC('D', 'I', 'V', '1')
#define fccdiv1	mmioFOURCC('d', 'i', 'v', '1')

/* DivX codecs */
#define fccDIV2 mmioFOURCC('D', 'I', 'V', '2')
#define fccdiv2 mmioFOURCC('d', 'i', 'v', '2')
#define fccDIV3 mmioFOURCC('D', 'I', 'V', '3')
#define fccdiv3 mmioFOURCC('d', 'i', 'v', '3')
#define fccDIV4 mmioFOURCC('D', 'I', 'V', '4')
#define fccdiv4 mmioFOURCC('d', 'i', 'v', '4')
#define fccDIV5 mmioFOURCC('D', 'I', 'V', '5')
#define fccdiv5 mmioFOURCC('d', 'i', 'v', '5')
#define fccDIV6 mmioFOURCC('D', 'I', 'V', '6')
#define fccdiv6 mmioFOURCC('d', 'i', 'v', '6')
#define fccMP41	mmioFOURCC('M', 'P', '4', '1')
#define fccmp41	mmioFOURCC('m', 'p', '4', '1')
#define fccMP43	mmioFOURCC('M', 'P', '4', '3')
#define fccmp43 mmioFOURCC('m', 'p', '4', '3')
/* old ms mpeg-4 codecs */
#define fccMP42	mmioFOURCC('M', 'P', '4', '2')
#define fccmp42	mmioFOURCC('m', 'p', '4', '2')
#define fccMPG4	mmioFOURCC('M', 'P', 'G', '4')
#define fccmpg4	mmioFOURCC('m', 'p', 'g', '4')
/* Windows media codecs */
#define fccWMV1 mmioFOURCC('W', 'M', 'V', '1')
#define fccwmv1 mmioFOURCC('w', 'm', 'v', '1')
#define fccWMV2 mmioFOURCC('W', 'M', 'V', '2')
#define fccwmv2 mmioFOURCC('w', 'm', 'v', '2')
#define fccMWV1 mmioFOURCC('M', 'W', 'V', '1')

/* Angel codecs */
#define fccAP41	mmioFOURCC('A', 'P', '4', '1')
#define fccap41	mmioFOURCC('a', 'p', '4', '1')
#define fccAP42	mmioFOURCC('A', 'P', '4', '2')
#define fccap42	mmioFOURCC('a', 'p', '4', '2')

/* other codecs	*/
#define fccIV31 mmioFOURCC('I', 'V', '3', '1')
#define fcciv31 mmioFOURCC('i', 'v', '3', '1')
#define fccIV32 mmioFOURCC('I', 'V', '3', '2')
#define fcciv32 mmioFOURCC('i', 'v', '3', '2')
#define fccIV41 mmioFOURCC('I', 'V', '4', '1')
#define fcciv41 mmioFOURCC('i', 'v', '4', '1')
#define fccIV50 mmioFOURCC('I', 'V', '5', '0')
#define fcciv50 mmioFOURCC('i', 'v', '5', '0')
#define fccI263 mmioFOURCC('I', '2', '6', '3')
#define fcci263 mmioFOURCC('i', '2', '6', '3')

#define fccMJPG mmioFOURCC('M', 'J', 'P', 'G')
#define fccmjpg mmioFOURCC('m', 'j', 'p', 'g')

#define fccHFYU mmioFOURCC('H', 'F', 'Y', 'U')

#define fcccvid mmioFOURCC('c', 'v', 'i', 'd')
#define fccdvsd mmioFOURCC('d', 'v', 's', 'd')

/* Ati codecs */
#define fccVCR2 mmioFOURCC('V', 'C', 'R', '2')
#define fccVCR1 mmioFOURCC('V', 'C', 'R', '1')
#define fccVYUY mmioFOURCC('V', 'Y', 'U', 'Y')
#define fccYVU9 mmioFOURCC('I', 'Y', 'U', '9')

/* Asus codecs */
#define fccASV1 mmioFOURCC('A', 'S', 'V', '1')
#define fccASV2 mmioFOURCC('A', 'S', 'V', '2')

/* Microsoft video */
#define fcccram mmioFOURCC('c', 'r', 'a', 'm')
#define fccCRAM mmioFOURCC('C', 'R', 'A', 'M')
#define fccMSVC mmioFOURCC('M', 'S', 'V', 'C')


#define fccMSZH mmioFOURCC('M', 'S', 'Z', 'H')

#define fccZLIB mmioFOURCC('Z', 'L', 'I', 'B')

#define fccTM20 mmioFOURCC('T', 'M', '2', '0')

#define fccYUV  mmioFOURCC('Y', 'U', 'V', ' ')
#define fccYUY2 mmioFOURCC('Y', 'U', 'Y', '2')
#define fccYV12 mmioFOURCC('Y', 'V', '1', '2')/* Planar mode: Y + V + U  (3 planes) */
#define fccI420 mmioFOURCC('I', '4', '2', '0')
#define fccIYUV mmioFOURCC('I', 'Y', 'U', 'V')/* Planar mode: Y + U + V  (3 planes) */
#define fccUYVY mmioFOURCC('U', 'Y', 'V', 'Y')/* Packed mode: U0+Y0+V0+Y1 (1 plane) */
#define fccYVYU mmioFOURCC('Y', 'V', 'Y', 'U')/* Packed mode: Y0+V0+Y1+U0 (1 plane) */


struct BitmapInfo : public BITMAPINFOHEADER
{
    int colors[3];

    void SetBitFields16(){	
	biSize=sizeof(BITMAPINFOHEADER)+12;
	biCompression=3;//BI_BITFIELDS
	biBitCount=16;
	biSizeImage=abs((int)(2*biWidth*biHeight));
	colors[0]=0xF800;
	colors[1]=0x07E0;
	colors[2]=0x001F;
    }	
    void SetBitFields15(){	
	biSize=sizeof(BITMAPINFOHEADER)+12;
	biCompression=3;//BI_BITFIELDS
	biBitCount=16;
	biSizeImage=abs((int)(2*biWidth*biHeight));
	colors[0]=0x7C00;
	colors[1]=0x03E0;
	colors[2]=0x001F;
    }	
    void SetRGB(){
	biSize = sizeof(BITMAPINFOHEADER);
	biCompression = 0;	//BI_RGB
	//biHeight = labs(biHeight);
	biSizeImage = labs(biWidth * biHeight) * ((biBitCount + 7) / 8);
    }
    void SetBits(int bits) { 
        switch (bits){
	    case 15: SetBitFields15();break;
	    case 16: SetBitFields16();break;
	    default: biBitCount = bits; SetRGB();break;
        }
    }
    void SetSpace(int csp,int bits) {
	biSize = sizeof(BITMAPINFOHEADER);
	biCompression=csp;
	biBitCount=bits;
	biSizeImage=labs(biBitCount*biWidth*biHeight)>>3;
    }
    void SetSpace(int csp) {
	int bits=0;
	switch(csp){
	case fccYUV:
	    bits=24;break;
	case fccYUY2:
	case fccUYVY:
	case fccYVYU:
	    bits=16;break;
	case fccYV12:
	case fccIYUV:
	case fccI420:
	    bits=12;break;
	}
	if (csp != 0 && csp != 3 && biHeight > 0)
    	    biHeight *= -1; // YUV formats uses should have height < 0
	SetSpace(csp,bits);
    }

};

struct IAudioDecoder
{
    WAVEFORMATEX in_fmt;
    const CodecInfo& record;
    IAudioDecoder(const CodecInfo& r, const WAVEFORMATEX* w) : record(r)
    {
        in_fmt = *w;
    }
};

struct IAudioEncoder
{
    IAudioEncoder(const CodecInfo&, WAVEFORMATEX*) {}
    // you do not need this one...
};

struct IVideoDecoder
{
    int VBUFSIZE;
    int QMARKHI;
    int QMARKLO;
    int DMARKHI;
    int DMARKLO;

    enum CAPS
    {
	CAP_NONE = 0,
	CAP_YUY2 = 1,
	CAP_YV12 = 2,
	CAP_IYUV = 4,
	CAP_UYVY = 8,
	CAP_YVYU = 16,
	CAP_I420 = 32,
    };
    enum DecodingMode
    {
	DIRECT = 0,
	REALTIME,
	REALTIME_QUALITY_AUTO,
    };
    enum DecodingState
    {
	STOP = 0,
	START,
    };
    IVideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& format) : record(info)
    {
        // implement init part
     unsigned bihs = (format.biSize < (int) sizeof(BITMAPINFOHEADER)) ?
	  sizeof(BITMAPINFOHEADER) : format.biSize;
     m_bh = (BITMAPINFOHEADER*) new char[bihs];
     memcpy(m_bh, &format, bihs);
     m_State = STOP;
     //m_pFrame = 0;
     m_Mode = DIRECT;
     m_iDecpos = 0;
     m_iPlaypos = -1;
     m_fQuality = 0.0f;
     m_bCapable16b = true;

    }
    virtual ~IVideoDecoder(){};
    virtual void StartInternal()=0;
    virtual void StopInternal()=0;
    void Stop(){ StopInternal();}
    void Start(){StartInternal();}

    const CodecInfo& record;
    DecodingMode m_Mode;	// should we do precaching (or even change Quality on the fly)
    DecodingState m_State;
    int m_iDecpos;
    int m_iPlaypos;
    float m_fQuality;           // quality for the progress bar 0..1(best)
    bool m_bCapable16b;

    BITMAPINFOHEADER* m_bh;	// format of input data (might be larger - e.g. huffyuv)
    BitmapInfo m_decoder;	// format of decoder output
    BitmapInfo m_obh;		// format of returned frames
};

struct IRtConfig
{
};



#endif

#endif

Index: DS_AudioDec.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/DS_AudioDec.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DS_AudioDec.cpp	10 Jun 2001 00:37:18 -0000	1.4
+++ DS_AudioDec.cpp	16 Aug 2001 00:50:02 -0000	1.5
@@ -1,188 +1,63 @@
-/********************************************************
 
-	DirectShow Audio decoder implementation
-	Copyright 2000 Eugene Kuznetsov  (divx at euro.ru)
-        Converted  C++ --> C  :) by A'rpi/ESP-team
-
-*********************************************************/
-
-//#include <config.h>
-
-//#include "DS_AudioDecoder.h"
-//#include <string.h>
-using namespace std;
-#include <stdlib.h>
-#include <except.h>
-#define __MODULE__ "DirectShow_AudioDecoder"
+#include "guids.h"
+#include "interfaces.h"
+
+#include "DS_AudioDecoder.h"
+#include <wine/winerror.h>
+#include <libwin32.h>
+//#include <cpuinfo.h>
 
-#include <errno.h>
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-//#include <loader.h>
-//#include <wine/winbase.h>
-#include <stdio.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <strstream>
-#include <dlfcn.h>
+#include <errno.h>
 #include <sys/types.h>
 #include <sys/mman.h>
+#include <cstdio>
+#include <iostream>
+#include <strstream>
 
-#include <registry.h>
-#include <wine/winreg.h>
+#include "DS_AudioDec.h"
 
-#include "guids.h"
-#include "interfaces.h"
-#include "DS_Filter.h"
+//    DS_Decoder(const CodecInfo& info, const WAVEFORMATEX*);
+//    virtual ~DS_Decoder();
+//    virtual int Convert(const void*, size_t, void*, size_t, size_t*, size_t*);
+//    virtual int GetSrcSize(int);
 
-#include "BitmapInfo.h"
+static void* _handle;
 
-#include <string>
-#include <default.h>
+extern "C" void Setup_LDT_Keeper();
+extern "C" void setup_FS_Segment();
 
-#include "DS_AudioDec.h"
+extern "C" int DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf){
+
+    Setup_LDT_Keeper();
+    setup_FS_Segment();
 
-const GUID FORMAT_WaveFormatEx={
-0x05589f81, 0xc356, 0x11ce, 0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a};
-const GUID MEDIATYPE_Audio={
-0x73647561, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71};
-const GUID MEDIASUBTYPE_PCM={
-0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71};
-
-
-extern "C" char* def_path;
-
-    static DS_Filter* dsf=0;
-
-    static AM_MEDIA_TYPE m_sOurType, m_sDestType;
-//    static void* m_pCust;
-    static char* m_sVhdr;
-    static char* m_sVhdr2;
-
-    static WAVEFORMATEX in_fmt;
-
-//    int m_iState=0;
-
-extern "C" int DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf)
-{
-
-    m_sVhdr=new char[18+wf->cbSize];
-    memcpy(m_sVhdr, wf, 18+wf->cbSize);
-    m_sVhdr2=new char[18];
-    memcpy(m_sVhdr2, m_sVhdr, 18);
-    WAVEFORMATEX* pWF=(WAVEFORMATEX*)m_sVhdr2;
-    pWF->wFormatTag=1;
-    pWF->wBitsPerSample=16;
-    pWF->nBlockAlign=2*pWF->nChannels;
-    pWF->cbSize=0;
-    in_fmt=*wf;
-
-    memset(&m_sOurType, 0, sizeof m_sOurType);
-    m_sOurType.majortype=MEDIATYPE_Audio;
-    m_sOurType.subtype=MEDIASUBTYPE_PCM;
-    m_sOurType.subtype.f1=wf->wFormatTag;
-    m_sOurType.formattype=FORMAT_WaveFormatEx;
-    m_sOurType.lSampleSize=wf->nBlockAlign;
-    m_sOurType.bFixedSizeSamples=true;
-    m_sOurType.bTemporalCompression=false;
-    m_sOurType.pUnk=0;
-    m_sOurType.cbFormat=18+wf->cbSize;
-    m_sOurType.pbFormat=m_sVhdr;
-
-    memset(&m_sDestType, 0, sizeof m_sDestType);
-    m_sDestType.majortype=MEDIATYPE_Audio;
-    m_sDestType.subtype=MEDIASUBTYPE_PCM;
-    m_sDestType.formattype=FORMAT_WaveFormatEx;
-    m_sDestType.bFixedSizeSamples=true;
-    m_sDestType.bTemporalCompression=false;
-    m_sDestType.lSampleSize=2*wf->nChannels;
-    m_sDestType.pUnk=0;
-    m_sDestType.cbFormat=18;
-    m_sDestType.pbFormat=m_sVhdr2;
-
-    try
-    {
-
-        dsf=new DS_Filter();
-	dsf->Create(dllname, guid, &m_sOurType, &m_sDestType);
-        dsf->Start();
-
-	ALLOCATOR_PROPERTIES props, props1;
-	props.cBuffers=1;
-        props.cbBuffer=m_sOurType.lSampleSize;
-	props.cbAlign=props.cbPrefix=0;
-	dsf->m_pAll->vt->SetProperties(dsf->m_pAll, &props, &props1);
-	dsf->m_pAll->vt->Commit(dsf->m_pAll);
-    }
-    catch(FatalError e)
-    {
-	e.PrintAll();
-	delete[] m_sVhdr;
-	delete[] m_sVhdr2;
-        return 1;
-    }
+    CodecInfo ci;
+    ci.dll=dllname;
+    ci.guid=*guid;
+
+    DS_AudioDecoder* dec=new DS_AudioDecoder(ci, wf);
+    _handle=(void*)dec;
 
     return 0;
 }
 
 extern "C" void DS_AudioDecoder_Close(){
-    delete[] m_sVhdr;
-    delete[] m_sVhdr2;
 }
 
-extern "C" int DS_AudioDecoder_GetSrcSize(int dest_size)
-{
-    double efficiency=in_fmt.nAvgBytesPerSec/double(in_fmt.nSamplesPerSec*in_fmt.nBlockAlign);
-    int frames=(int)(dest_size*efficiency);
-    if(frames<1)frames=1;
-    return frames*in_fmt.nBlockAlign;
+extern "C" int DS_AudioDecoder_GetSrcSize(int dest_size){
+    DS_AudioDecoder* dec=(DS_AudioDecoder*)_handle;
+    return dec->GetSrcSize(dest_size);
 }
 
-
 extern "C" int DS_AudioDecoder_Convert(unsigned char* in_data, unsigned in_size,
 	     unsigned char* out_data, unsigned out_size,
-	    unsigned* size_read, unsigned* size_written)
-{
-    if(in_data==0)return -1;
-    if(out_data==0)return -1;
-    int written=0;
-    int read=0;
-    in_size-=in_size%in_fmt.nBlockAlign;
-    while(in_size>0)
-    {
-	long frame_size=0;
-	char* frame_pointer;
-//	m_pOurOutput->SetFramePointer(out_data+written);
-	dsf->m_pOurOutput->SetFramePointer(&frame_pointer);
-	dsf->m_pOurOutput->SetFrameSizePointer(&frame_size);
-	IMediaSample* sample=0;
-	dsf->m_pAll->vt->GetBuffer(dsf->m_pAll, &sample, 0, 0, 0);
-	if(!sample)
-	{
-	    cerr<<"ERROR: null sample"<<endl;
-	    break;
-	}
-	char* ptr;
-	sample->vt->GetPointer(sample, (BYTE **)&ptr);
-	memcpy(ptr, in_data+read, in_fmt.nBlockAlign);
-	sample->vt->SetActualDataLength(sample, in_fmt.nBlockAlign);
-	sample->vt->SetSyncPoint(sample, true);
-	sample->vt->SetPreroll(sample, 0);
-        int result=dsf->m_pImp->vt->Receive(dsf->m_pImp, sample);
-        if(result) printf("Error putting data into input pin %x\n", result);
-	if(written+frame_size>out_size)
-	{
-	    sample->vt->Release((IUnknown*)sample);
-	    break;
-	}
-	memcpy(out_data+written, frame_pointer, frame_size);
-        sample->vt->Release((IUnknown*)sample);
-	read+=in_fmt.nBlockAlign;
-	written+=frame_size;
-    }
-    if(size_read) *size_read=read;
-    if(size_written) *size_written=written;
-    return 0;
+	     unsigned* size_read, unsigned* size_written){
+    DS_AudioDecoder* dec=(DS_AudioDecoder*)_handle;
+    setup_FS_Segment();
+    return dec->Convert( (void*)in_data,(size_t)in_size,
+			 (void*)out_data,(size_t)out_size,
+			 (size_t*)size_read, (size_t*)size_written );
 }
 

Index: DS_Filter.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/DS_Filter.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DS_Filter.cpp	15 Aug 2001 00:38:01 -0000	1.7
+++ DS_Filter.cpp	16 Aug 2001 00:50:02 -0000	1.8
@@ -1,34 +1,49 @@
-#include <stdio.h>
-#include <string.h>
 #include "DS_Filter.h"
-#include <except.h>
 //#include "../loader/loader.h"
+#include <libwin32.h>
 #include <string>
-#include <iostream>
+#include <stdio.h>
+#include <string.h>
+
 #define __MODULE__ "DirectShow generic filter"
 
 using namespace std;
 
-typedef long STDCALL (*GETCLASS) (const GUID*, const GUID*, void**);
-extern "C" char* def_path;
-
 extern "C" int STDCALL expLoadLibraryA(const char*);
-extern "C" STDCALL void* GetProcAddress(int, const char*);
-extern "C" int STDCALL FreeLibrary(int);
 
-extern "C" void Setup_LDT_Keeper();
-extern "C" void setup_FS_Segment();
+typedef long STDCALL (*GETCLASS) (const GUID*, const GUID*, void**);
+
+//extern "C" int STDCALL LoadLibraryA(const char*);
+//extern "C" STDCALL void* GetProcAddress(int, const char*); // STDCALL has to be first NetBSD
+//extern "C" int STDCALL FreeLibrary(int);
 
 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)
 {
+    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()
+DS_Filter::~DS_Filter()
 {
+    //cout << "Destruction of DS_FILTER" << endl;
+    Stop();
+    destroy();
+    //cout << "Destruction of DS_FILTER done" << endl;
+}
+
+void DS_Filter::destroy()
+{
+    if (m_iState == 0)
+	return;
     m_iState = 0;
 
     if (m_pOurInput)
@@ -53,67 +68,56 @@
     // FIXME - we are still leaving few things allocated!
     if (m_iHandle)
 	FreeLibrary(m_iHandle);
-
 }
 
-DS_Filter::~DS_Filter()
+void DS_Filter::Create(const char* dllname, const GUID* id,
+		       AM_MEDIA_TYPE* in_fmt,
+		       AM_MEDIA_TYPE* out_fmt)
 {
-    //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();
-
     try
     {
-//	string _fullname=def_path;
-//	_fullname+="/";
-//	_fullname+=dllname;
-	m_iHandle= expLoadLibraryA(dllname);
+	m_iHandle = expLoadLibraryA(dllname);
 	if (!m_iHandle)
 	{
-	    char e[1024];
-	    snprintf(e, 1024, "Could not open DirectShow DLL: %s", dllname);
+	    char e[256];
+	    printf("Could not open DirectShow DLL: %.200s", dllname);
 	    throw FATAL(e);
 	}
-        GETCLASS func=(GETCLASS)GetProcAddress(m_iHandle, "DllGetClassObject");
+        GETCLASS func = (GETCLASS)GetProcAddress(m_iHandle, "DllGetClassObject");
 	if (!func)
 	{
-	    char e[1024];
-	    snprintf(e, 1024, "Illegal or corrupt DirectShow DLL: %s", dllname);
+	    char e[256];
+	    printf("Illegal or corrupt DirectShow DLL: %.200s", 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();
+	IClassFactory* factory = 0;
+	result = func(id, &IID_IClassFactory, (void**)&factory);
+	if (result || !factory)
+	    throw FATAL("No such class object");;
 
-	IUnknown* object=0;
-	result=factory->vt->CreateInstance(factory, 0, &IID_IUnknown, (void**)&object);
+	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");
+	if (result || !object)
+	    throw FATAL("Class factory failure");
 
-	result=object->vt->QueryInterface(object, &IID_IBaseFilter, (void**)&m_pFilter);
+	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");
+	if (result || !m_pFilter)
+	    throw FATAL("Object does not have IBaseFilter interface");
+
+	IEnumPins* enum_pins = 0;
+	// enumerate pins
+	result = m_pFilter->vt->EnumPins(m_pFilter, &enum_pins);
+	if (result || !enum_pins)
+	    throw FATAL("Could not enumerate pins");
 
-	IEnumPins* enum_pins=0;
-    //	enumerate pins
-	result=m_pFilter->vt->EnumPins(m_pFilter, &enum_pins);
-	if(result || (!enum_pins)) throw FATAL("Could not enumerate pins");
 	IPin* array[256];
 	ULONG fetched;
 	enum_pins->vt->Reset(enum_pins);
-	result=enum_pins->vt->Next(enum_pins, (ULONG)256, (IPin**)array, &fetched);
+	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++)
@@ -140,38 +144,45 @@
 	result = m_pInputPin->vt->QueryInterface((IUnknown*)m_pInputPin,
 						 &IID_IMemInputPin,
 						 (void**)&m_pImp);
-        if(result)
+        if (result)
 	    throw FATAL("Error getting IMemInputPin interface");
-	m_pOurType=in_fmt;
-	m_pDestType=out_fmt;
-        result=m_pInputPin->vt->QueryAccept(m_pInputPin, m_pOurType);
+	m_pOurType = in_fmt;
+	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;
-        m_pSrcFilter=new CBaseFilter(*m_pOurType, m_pParentFilter);
-	m_pOurInput=m_pSrcFilter->GetPin();
+	m_pParentFilter = new CBaseFilter2;
+        m_pSrcFilter = new CBaseFilter(*m_pOurType, m_pParentFilter);
+	m_pOurInput = m_pSrcFilter->GetPin();
 	m_pOurInput->vt->AddRef((IUnknown*)m_pOurInput);
 
-	result=m_pInputPin->vt->ReceiveConnection(m_pInputPin, m_pOurInput,
-						  m_pOurType);
+	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);
 
+	//extern void trapbug();
+	//trapbug();
 	result = m_pOutputPin->vt->ReceiveConnection(m_pOutputPin,
 						     m_pOurOutput,
 						     m_pDestType);
 	if (result)
+	{
+	    //printf("Tracking ACELP %d  0%x\n", result);
 	    throw FATAL("Error connecting to output pin");
-	cout << "Using DirectShow codec: " << dllname << endl;
+	}
+
+	printf("Using DirectShow codec: %s\n", dllname);
 	m_iState = 1;
     }
-    catch(FatalError e)
+    catch (FatalError e)
     {
-	e.PrintAll();
-        clean();
+	//e.PrintAll();
+	destroy();
 	throw;
     }
 }
@@ -181,22 +192,19 @@
     if (m_iState != 1)
 	return;
 
-    m_pFilter->vt->Pause(m_pFilter);
-
     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;
+	Debug printf("WARNING: m_Filter->Run() failed, error code %x\n", (int)hr);
     }
-    hr=m_pImp->vt->GetAllocator(m_pImp, &m_pAll);
+    hr = m_pImp->vt->GetAllocator(m_pImp, &m_pAll);
     if (hr)
     {
-        Debug cerr<<"Error getting IMemAllocator interface "<<hex<<hr<<dec<<endl;
+	Debug printf("Error getting IMemAllocator interface %x\n", (int)hr);
         m_pImp->vt->Release((IUnknown*)m_pImp);
         return;
     }
     m_pImp->vt->NotifyAllocator(m_pImp, m_pAll,	0);
-    
     m_iState = 2;
 }
 
@@ -205,8 +213,8 @@
     if (m_iState == 2)
     {
 	m_pAll->vt->Release((IUnknown*)m_pAll);
-	m_pAll=0;
-	m_pFilter->vt->Stop(m_pFilter);
-	m_iState=1;
+	m_pFilter->vt->Stop(m_pFilter); // causes weird crash ??? FIXME
+	m_pAll = 0;
+	m_iState = 1;
     }
 }

Index: DS_Filter.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/DS_Filter.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DS_Filter.h	6 May 2001 21:43:45 -0000	1.4
+++ DS_Filter.h	16 Aug 2001 00:50:02 -0000	1.5
@@ -1,22 +1,22 @@
-#ifndef DS_Filter_H
-#define DS_Filter_H
+#ifndef DS_FILTER_H
+#define DS_FILTER_H
 
 #include "interfaces.h"
 #include "inputpin.h"
 #include "outputpin.h"
-#include <string>
 
 /**
-    User will allocate and fill format structures, call Create(),
-    and then set up m_pAll.
-**/    
-class DS_Filter
+   User will allocate and fill format structures, call Create(),
+   and then set up m_pAll.
+ **/
+
+struct DS_Filter
 {
-public:
     DS_Filter();
     virtual ~DS_Filter();
     void Start();
     void Stop();
+
     int m_iHandle;
     IBaseFilter* m_pFilter;
     IPin* m_pInputPin;
@@ -32,10 +32,10 @@
     IMemInputPin* m_pImp;
     int m_iState;
 
-    void Create(char* dllname, const GUID* id, AM_MEDIA_TYPE* in_fmt, AM_MEDIA_TYPE* out_fmt);
+    void Create(const char* dllname, const GUID* id, AM_MEDIA_TYPE* in_fmt, AM_MEDIA_TYPE* out_fmt);
     void SetPointer(char* pointer);
-private:
-    void clean();
+
+    void destroy();
 };
 
-#endif
+#endif /* DS_FILTER_H */

Index: DS_VideoDec.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/DS_VideoDec.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DS_VideoDec.cpp	15 Aug 2001 00:38:01 -0000	1.9
+++ DS_VideoDec.cpp	16 Aug 2001 00:50:02 -0000	1.10
@@ -1,414 +1,78 @@
-/********************************************************
-
-	DirectShow Video decoder implementation
-	Copyright 2000 Eugene Kuznetsov  (divx at euro.ru)
-        Converted  C++ --> C  :) by A'rpi/ESP-team
-
-*********************************************************/
-
-//#include <config.h>
-
-//#include "DS_VideoDecoder.h"
-//#include <string.h>
-using namespace std;
-#include <stdlib.h>
-#include <except.h>
-#define __MODULE__ "DirectShow_VideoDecoder"
+#include "guids.h"
+#include "interfaces.h"
 
+#include "DS_VideoDecoder.h"
+#include <wine/winerror.h>
+#include <libwin32.h>
+//#include <cpuinfo.h>
 
-#include <errno.h>
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-//#include <loader.h>
-//#include <wine/winbase.h>
-#include <stdio.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <strstream>
-#include <dlfcn.h>
+#include <errno.h>
 #include <sys/types.h>
 #include <sys/mman.h>
+#include <cstdio>
+#include <iostream>
+#include <strstream>
 
 #include <registry.h>
-#include <wine/winreg.h>
-
-#include "guids.h"
-#include "interfaces.h"
-#include "DS_Filter.h"
-
-#include "BitmapInfo.h"
-
-#include <string>
-#include <default.h>
+//#include <wine/winreg.h>
 
 #include "DS_VideoDec.h"
 
+static void* _handle; // will be parameter later...
+static char** _d_ptr;  // will be parameter later...
 
-extern "C" char* def_path;
-
-    static char** m_destptr=0;
-
-    static DS_Filter* dsf=0;
+extern "C" void Setup_LDT_Keeper();
+extern "C" void setup_FS_Segment();
 
-    static AM_MEDIA_TYPE m_sOurType, m_sDestType;
-    static VIDEOINFOHEADER *m_sVhdr;
-    static VIDEOINFOHEADER *m_sVhdr2;
-    static void* m_pCust;
+extern "C" int DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER* format, int flip,char** d_ptr){
 
-    static BITMAPINFOHEADER *m_bh;//format of input data
-    static BitmapInfo m_decoder;//format of decoder output
-    static BitmapInfo m_obh;  //format of returned frames
-//    CImage* m_outFrame;
+    Setup_LDT_Keeper();
 
-//    int m_iState=0;
-
-extern "C" int DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER* format, int flip,char** d_ptr)
-//    :IVideoDecoder(info), m_sVhdr2(0)
-{
-
-    m_destptr=d_ptr;
+    CodecInfo ci;
+    ci.dll=dllname;
+    ci.guid=*guid;
     
-    //m_outFrame=0;
-    //decpos = 0;
-    //playpos = 0;
-    //realtime = 0;
-
-    try
-    {
-	m_bh=format;
-	memset(&m_obh, 0, sizeof(m_obh));
-	m_obh.biSize=sizeof(m_obh);
-
-#if 0
-	memset(&m_sVhdr, 0, sizeof(m_sVhdr));
-	m_sVhdr.bmiHeader=m_bh;
-	m_sVhdr.rcSource.left=m_sVhdr.rcSource.top=0;
-	m_sVhdr.rcSource.right=m_sVhdr.bmiHeader.biWidth;
-        m_sVhdr.rcSource.bottom=m_sVhdr.bmiHeader.biHeight;
-	m_sVhdr.rcTarget=m_sVhdr.rcSource;
-#else
-        unsigned bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ?
-            sizeof(BITMAPINFOHEADER) : format->biSize;
-         bihs = sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER) + bihs;
-
-        m_sVhdr = (VIDEOINFOHEADER*) new char[bihs];
-        memset(m_sVhdr, 0, bihs);
-        memcpy(&m_sVhdr->bmiHeader, m_bh, m_bh->biSize);
-	
-        m_sVhdr->rcSource.left = m_sVhdr->rcSource.top = 0;
-        m_sVhdr->rcSource.right = m_sVhdr->bmiHeader.biWidth;
-        m_sVhdr->rcSource.bottom = m_sVhdr->bmiHeader.biHeight;
-        m_sVhdr->rcTarget = m_sVhdr->rcSource;
-#endif
-        m_sOurType.majortype=MEDIATYPE_Video;
-	m_sOurType.subtype=MEDIATYPE_Video;
-        m_sOurType.subtype.f1=m_sVhdr->bmiHeader.biCompression;
-	m_sOurType.formattype=FORMAT_VideoInfo;
-        m_sOurType.bFixedSizeSamples=false;
-	m_sOurType.bTemporalCompression=true;
-	m_sOurType.pUnk=0;
-//        m_sOurType.cbFormat=sizeof(m_sVhdr);
-//        m_sOurType.pbFormat=(char*)&m_sVhdr;
-        m_sOurType.cbFormat = bihs;
-        m_sOurType.pbFormat = (char*)m_sVhdr;
-
-	m_sVhdr2=(VIDEOINFOHEADER*)(new char[sizeof(VIDEOINFOHEADER)+12]);
-//	*m_sVhdr2=m_sVhdr;
-        memcpy(m_sVhdr2, m_sVhdr, sizeof(VIDEOINFOHEADER)+12);
-	m_sVhdr2->bmiHeader.biCompression=0;
-	m_sVhdr2->bmiHeader.biBitCount=24;
-
-	memset(&m_sDestType, 0, sizeof(m_sDestType));
-	m_sDestType.majortype=MEDIATYPE_Video;
-	m_sDestType.subtype=MEDIASUBTYPE_RGB24;
-	m_sDestType.formattype=FORMAT_VideoInfo;
-	m_sDestType.bFixedSizeSamples=true;
-	m_sDestType.bTemporalCompression=false;
-	m_sDestType.lSampleSize=abs(m_sVhdr2->bmiHeader.biWidth*m_sVhdr2->bmiHeader.biHeight*
-	((m_sVhdr2->bmiHeader.biBitCount+7)/8));
-	m_sVhdr2->bmiHeader.biSizeImage=m_sDestType.lSampleSize;
-	m_sDestType.pUnk=0;
-	m_sDestType.cbFormat=sizeof(VIDEOINFOHEADER);
-        m_sDestType.pbFormat=(char*)m_sVhdr2;
-	m_obh = *m_bh;
-	m_obh.setBits(24);	
-        
-	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;
-	m_sVhdr2->bmiHeader.biCompression=fccYUY2;
-	m_sDestType.subtype=MEDIASUBTYPE_YUY2;
-	result=dsf->m_pOutputPin->vt->QueryAccept(dsf->m_pOutputPin, &m_sDestType);
-//	if(!result) caps=(CAPS)(caps | CAP_YUY2);
-#endif
-
-	m_sVhdr2->bmiHeader.biBitCount=24;
-	m_sVhdr2->bmiHeader.biCompression=0;
-	m_sDestType.subtype=MEDIASUBTYPE_RGB24;
-	m_decoder=m_obh;	
-	//qual = 0-1;
-    }
-    catch(FatalError& error)
-    {
-	delete[] m_sVhdr2;
-        return 1;
-    }	    
+    DS_VideoDecoder* dec=new DS_VideoDecoder(ci, *format, flip);
+    
+    _d_ptr=d_ptr;
+    _handle=(void*)dec;
+
     return 0;
 }
 
 extern "C" void DS_VideoDecoder_Start(){
-    if(dsf->m_iState!=1) return;
-    dsf->Start();
-
-    ALLOCATOR_PROPERTIES props, props1;
-    props.cBuffers=1;
-    props.cbBuffer=1024*1024; //m_sDestType.lSampleSize;//don't know how to do this correctly
-    props.cbAlign=props.cbPrefix=0;
-    dsf->m_pAll->vt->SetProperties(dsf->m_pAll, &props, &props1);
-    dsf->m_pAll->vt->Commit(dsf->m_pAll);
-
-//    m_outFrame=new CImage(&m_decoder,(unsigned char *)malloc(m_sDestType.lSampleSize),false);
-    //m_outFrame=new CImage(&m_decoder, 0, false);
-//    printf("Datap %x\n",m_outFrame->getaddr());
-
-
-//    dsf->m_pOurOutput->SetFramePointer((char **)m_outFrame->getaddr()); //!FIXME!
-    dsf->m_pOurOutput->SetFramePointer(m_destptr); //!FIXME!
-
-//    filling = realtime;
-    
-    dsf->m_iState=2;
-    return;
+    DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle;
+    dec->StartInternal();
 }
 
 extern "C" void DS_VideoDecoder_Stop(){
-    if(dsf->m_iState!=2) return;
-    dsf->Stop();
-//    dsf->m_pOurOutput->SetFramePointer(0);
-//    free(m_outFrame->data());
-    //m_outFrame->release();//just in case
-    //m_outFrame=0;
-//    FlushCache();
-    dsf->m_iState=1;
-    return;
+    DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle;
+    dec->StopInternal();
 }
 
 extern "C" void DS_VideoDecoder_Restart(){
-    if(dsf->m_iState!=2) return;
-
-    dsf->Stop();
-    dsf->Start();
-
-    ALLOCATOR_PROPERTIES props, props1;
-    props.cBuffers=1;
-    props.cbBuffer=m_sDestType.lSampleSize;//don't know how to do this correctly
-    props.cbAlign=props.cbPrefix=0;
-    dsf->m_pAll->vt->SetProperties(dsf->m_pAll, &props, &props1);
-    dsf->m_pAll->vt->Commit(dsf->m_pAll);
 }
 
 extern "C" void DS_VideoDecoder_Close(){
-    if(dsf->m_iState==0) return;
-    if(dsf->m_iState==2) DS_VideoDecoder_Stop();
-    delete[] m_sVhdr2;
-//    delete m_outFrame;
 }
 
 extern "C" int DS_VideoDecoder_DecodeFrame(char* src, int size, int is_keyframe, int render){
-
-    if(!size)return 0;
-
-        m_bh->biSizeImage=size;
-
-        IMediaSample* sample=0;
-        //printf("GetBuffer... (m_pAll=%X) ",dsf->m_pAll);fflush(stdout);
-	dsf->m_pAll->vt->GetBuffer(dsf->m_pAll, &sample, 0, 0, 0);
-        //printf("OK!\n");
-	if(!sample)
-	{
-	    Debug cerr<<"ERROR: null sample"<<endl;
-	    return -1;
-	}
-        char* ptr;
-        //printf("GetPtr...");fflush(stdout);
-	sample->vt->GetPointer(sample, (BYTE **)&ptr);
-        //printf("OK!\n");
-	memcpy(ptr, src, size);
-        //printf("memcpy OK!\n");
-	sample->vt->SetActualDataLength(sample, size);
-        //printf("SetActualDataLength OK!\n");
-        sample->vt->SetSyncPoint(sample, is_keyframe);
-        //printf("SetSyncPoint OK!\n");
-	sample->vt->SetPreroll(sample, !render);
-//    sample->vt->SetMediaType(sample, &m_sOurType);
-        int result=dsf->m_pImp->vt->Receive(dsf->m_pImp, sample);
-	if(result)
-	    printf("Error putting data into input pin %x\n", result);
-
-        sample->vt->Release((IUnknown*)sample);
-
-        return 0;
+    DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle;
+    CImage image;
+    image.ptr=*_d_ptr;
+    return dec->DecodeInternal((void*)src,(size_t)size,is_keyframe,&image);
 }
 
 extern "C" int DS_VideoDecoder_SetDestFmt(int bits, int csp){
-    if(dsf->m_iState==0) return -1;
-//    if(!CImage::supported(csp, bits)) return -1;
-    HRESULT result;
-//    BitmapInfo temp=m_obh;
-    if(csp==0)
-    {
-	switch(bits)
-        {
-	case 15:
-	    m_sDestType.subtype=MEDIASUBTYPE_RGB555;
-    	    break;	    
-	case 16:
-	    m_sDestType.subtype=MEDIASUBTYPE_RGB565;
-	    break;	    
-	case 24:
-	    m_sDestType.subtype=MEDIASUBTYPE_RGB24;
-	    break;
-	case 32:
-	    m_sDestType.subtype=MEDIASUBTYPE_RGB32;
-	    break;
-        default:
-	    break;
-        }
-	m_obh.setBits(bits);
-//        .biSizeImage=abs(temp.biWidth*temp.biHeight*((temp.biBitCount+7)/8));
-    }	
-    else
-    {
-	m_obh.setSpace(csp,bits);
-	switch(csp)
-	{
-	    case fccYUY2:
-		m_sDestType.subtype=MEDIASUBTYPE_YUY2;
-                printf("DShow: using YUY2 colorspace\n");
-		break;
-	    case fccYV12:
-		m_sDestType.subtype=MEDIASUBTYPE_YV12;
-                printf("DShow: using YV12 colorspace\n");
-		break;
-	    case fccIYUV:
-		m_sDestType.subtype=MEDIASUBTYPE_IYUV;
-                printf("DShow: using IYUV colorspace\n");
-		break;
-	    case fccUYVY:
-		m_sDestType.subtype=MEDIASUBTYPE_UYVY;
-                printf("DShow: using UYVY colorspace\n");
-		break;
-	    case fccYVYU:
-		m_sDestType.subtype=MEDIASUBTYPE_YVYU;
-                printf("DShow: using YVYU colorspace\n");
-		break;
-	}
-    }
-
-    m_sDestType.lSampleSize=m_obh.biSizeImage;
-    memcpy(&(m_sVhdr2->bmiHeader), &m_obh, sizeof(m_obh));
-    m_sVhdr2->bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
-    if(m_sVhdr2->bmiHeader.biCompression==3)
-        m_sDestType.cbFormat=sizeof(VIDEOINFOHEADER)+12;
-    else
-        m_sDestType.cbFormat=sizeof(VIDEOINFOHEADER);
-    
-    result=dsf->m_pOutputPin->vt->QueryAccept(dsf->m_pOutputPin, &m_sDestType);
-
-    if(result!=0)
-    {
-	if(csp)
-	    cerr<<"Warning: unsupported color space"<<endl;
-	else
-	    cerr<<"Warning: unsupported bit depth"<<endl;
-
-	m_sDestType.lSampleSize=m_decoder.biSizeImage;
-	memcpy(&(m_sVhdr2->bmiHeader), &m_decoder, sizeof(m_decoder));
-	m_sVhdr2->bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
-	if(m_sVhdr2->bmiHeader.biCompression==3)
-    	    m_sDestType.cbFormat=sizeof(VIDEOINFOHEADER)+12;
-	else
-    	    m_sDestType.cbFormat=sizeof(VIDEOINFOHEADER);
-	return 1;
-    }   
-    
-    m_decoder=m_obh; 
-//    m_obh=temp;
-//    if(csp)
-//	m_obh.biBitCount=BitmapInfo::BitCount(csp);
-    m_bh->biBitCount=bits;
-    if(dsf->m_iState>0)
-    {
-	int old_state=dsf->m_iState;
-	if(dsf->m_iState==2) DS_VideoDecoder_Stop();
-	dsf->m_pInputPin->vt->Disconnect(dsf->m_pInputPin);
-	dsf->m_pOutputPin->vt->Disconnect(dsf->m_pOutputPin);
-	dsf->m_pOurOutput->SetNewFormat(m_sDestType);
-    	result=dsf->m_pInputPin->vt->ReceiveConnection(dsf->m_pInputPin, dsf->m_pOurInput, &m_sOurType);
-	if(result)
-	{
-	    cerr<<"Error reconnecting input pin "<<hex<<result<<dec<<endl;
-	    return -1;
-	}	
-        result=dsf->m_pOutputPin->vt->ReceiveConnection(dsf->m_pOutputPin,
-	     dsf->m_pOurOutput, &m_sDestType);
-	if(result)
-	{
-	    cerr<<"Error reconnecting output pin "<<hex<<result<<dec<<endl;
-	    return -1;
-	}		
-	if(old_state==2) DS_VideoDecoder_Start();
-    }
-    return 0; 
+    DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle;
+    return dec->SetDestFmt(bits,(fourcc_t)csp);
 }
 
-
 extern "C" int DS_SetValue_DivX(char* name, int value){
-	int temp;
-	if(dsf->m_iState!=2) return VFW_E_NOT_RUNNING;
-// brightness 87
-// contrast 74
-// hue 23
-// saturation 20
-// post process mode 0
-// get1 0x01
-// get2 10
-// get3=set2 86
-// get4=set3 73
-// get5=set4 19
-// get6=set5 23
-//        printf("DivX setting: %s = %d\n",name,value);
-
-    	IHidden* hidden=(IHidden*)((int)dsf->m_pFilter+0xb8);
-	if(strcmp(name, "Brightness")==0)
-	    return hidden->vt->SetSmth2(hidden, value, 0);
-	if(strcmp(name, "Contrast")==0)
-	    return hidden->vt->SetSmth3(hidden, value, 0);
-	if(strcmp(name, "Hue")==0)
-	    return hidden->vt->SetSmth5(hidden, value, 0);
-	if(strcmp(name, "Saturation")==0)
-	    return hidden->vt->SetSmth4(hidden, value, 0);
-	if(strcmp(name, "Quality")==0)
-	    return hidden->vt->SetSmth(hidden, value, 0);
-            
-        printf("Invalid setting!\n");
-        return -200;
+    DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle;
+    return (int) dec->SetValue(name,value);
 }
 
 extern "C" int DS_SetAttr_DivX(char* attribute, int value){

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/Makefile,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Makefile	26 Jun 2001 23:15:58 -0000	1.10
+++ Makefile	16 Aug 2001 00:50:02 -0000	1.11
@@ -3,12 +3,13 @@
 
 include ../../config.mak
 
-SRCS	= DS_AudioDec.cpp DS_VideoDec.cpp DS_Filter.cpp allocator.cpp cmediasample.cpp guids.cpp inputpin.cpp outputpin.cpp
+# DS_AudioDec.cpp 
+SRCS	= DS_AudioDec.cpp DS_AudioDecoder.cpp DS_VideoDec.cpp DS_Filter.cpp DS_VideoDecoder.cpp allocator.cpp cmediasample.cpp guids.cpp inputpin.cpp outputpin.cpp
 OBJS = $(SRCS:.cpp=.o)
 
 # OBJS	= DS_AudioDec.o DS_VideoDec.o DS_Filter.o allocator.o cmediasample.o guids.o inputpin.o outputpin.o
 
-INCLUDE = -I. -I.. -I../wine $(EXTRA_INC)
+INCLUDE = -I. -I.. $(EXTRA_INC) -DNOAVIFILE_HEADERS
 CFLAGS  = $(OPTFLAGS) $(INCLUDE) -fexceptions 
 
 .SUFFIXES: .cpp .o
@@ -43,3 +44,4 @@
 ifneq ($(wildcard .depend),)
 include .depend
 endif
+

Index: allocator.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/allocator.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- allocator.cpp	6 May 2001 21:43:45 -0000	1.2
+++ allocator.cpp	16 Aug 2001 00:50:02 -0000	1.3
@@ -1,47 +1,35 @@
-#include <stdio.h>
 #include "allocator.h"
 #include <com.h>
-#define E_NOTIMPL 0x80004001
+#include <wine/winerror.h>
+#include <stdio.h>
+
+//#undef Debug
+//#define Debug
+
 using namespace std;
 
 class AllocatorKeeper
 {
 public:
     AllocatorKeeper()
-    {	
+    {
 	RegisterComClass(&CLSID_MemoryAllocator, MemAllocator::CreateAllocator);
     }
+    ~AllocatorKeeper()
+    {
+	UnregisterComClass(&CLSID_MemoryAllocator, MemAllocator::CreateAllocator);
+    }
 };
 static AllocatorKeeper keeper;
+
+
 GUID MemAllocator::interfaces[]=
 {
     IID_IUnknown,
     IID_IMemAllocator,
 };
-IMPLEMENT_IUNKNOWN(MemAllocator)
 
-MemAllocator::MemAllocator()
-    :refcount(1)
-{
-    Debug printf("MemAllocator::MemAllocator() called\n");
-    vt=new IMemAllocator_vt;
-    vt->QueryInterface = QueryInterface;
-    vt->AddRef = AddRef;
-    vt->Release = Release;
-    vt->SetProperties = SetProperties;
-    vt->GetProperties = GetProperties;
-    vt->Commit = Commit;
-    vt->Decommit = Decommit;
-    vt->GetBuffer = GetBuffer;
-    vt->ReleaseBuffer = ReleaseBuffer;
-    
-    props.cBuffers=1;
-    props.cbBuffer=65536;/* :/ */
-    props.cbAlign=props.cbPrefix=0;
-    
-    new_pointer=0;
-    modified_sample=0;
-}
+IMPLEMENT_IUNKNOWN(MemAllocator)
 
 long MemAllocator::CreateAllocator(GUID* clsid, GUID* iid, void** ppv)
 {
@@ -49,7 +37,7 @@
     *ppv=0;
     if(memcmp(clsid, &CLSID_MemoryAllocator, sizeof(GUID)))
 	return -1;
-    
+
     IMemAllocator* p=new MemAllocator;
     int result=p->vt->QueryInterface((IUnknown*)p, iid, ppv);
     p->vt->Release((IUnknown*)p);
@@ -57,56 +45,52 @@
 }
 
 
-/*
-    long cBuffers;
-    long cbBuffer;
-    long cbAlign;
-    long cbPrefix;
-*/
-HRESULT STDCALL MemAllocator::SetProperties ( 
-    IMemAllocator * This,
-    /* [in] */ ALLOCATOR_PROPERTIES *pRequest,
-    /* [out] */ ALLOCATOR_PROPERTIES *pActual)
-{
-    Debug printf("MemAllocator::SetProperties() called\n");
-    if(!pRequest)return 0x80004003;
-    if(!pActual)return 0x80004003;
-    if(pRequest->cBuffers<=0)return -1;
-    if(pRequest->cbBuffer<=0)return -1;
-    MemAllocator* me=(MemAllocator*)This;
-    if(me->used_list.size() || me->free_list.size())return -1;
-    me->props=*pRequest;
-    *pActual=*pRequest;
+static HRESULT STDCALL MemAllocator_SetProperties(IMemAllocator * This,
+						  /* [in] */ ALLOCATOR_PROPERTIES *pRequest,
+						  /* [out] */ ALLOCATOR_PROPERTIES *pActual)
+{
+    Debug printf("MemAllocator_SetProperties() called\n");
+    if (!pRequest || !pActual)
+	return E_INVALIDARG;
+    if (pRequest->cBuffers<=0 || pRequest->cbBuffer<=0)
+	return E_FAIL;
+    MemAllocator* me = (MemAllocator*)This;
+    if (me->used_list.size() || me->free_list.size())
+	return E_FAIL;
+    me->props = *pRequest;
+    *pActual = *pRequest;
     return 0;
 }
 
-HRESULT STDCALL MemAllocator::GetProperties ( 
-    IMemAllocator * This,
-    /* [out] */ ALLOCATOR_PROPERTIES *pProps)
-{
-    Debug printf("MemAllocator::GetProperties() called\n");
-    if(!pProps)return -1;
-    if(((MemAllocator*)This)->props.cbBuffer<0)return -1;
+static HRESULT STDCALL MemAllocator_GetProperties(IMemAllocator * This,
+						  /* [out] */ ALLOCATOR_PROPERTIES *pProps)
+{
+    Debug printf("MemAllocator_GetProperties(%p) called\n", This);
+    if (!pProps)
+	return E_INVALIDARG;
+    if (((MemAllocator*)This)->props.cbBuffer<0)
+	return E_FAIL;
     *pProps=((MemAllocator*)This)->props;
     return 0;
 }
 
-HRESULT STDCALL MemAllocator::Commit ( 
-    IMemAllocator * This)
+static HRESULT STDCALL MemAllocator_Commit(IMemAllocator * This)
 {
-    Debug printf("MemAllocator::Commit() called\n");
+    Debug printf("MemAllocator_Commit(%p) called\n", This);
     MemAllocator* me=(MemAllocator*)This;
-    if(((MemAllocator*)This)->props.cbBuffer<0)return -1;
-    if(me->used_list.size() || me->free_list.size())return -1;
-    for(int i=0; i<me->props.cBuffers; i++)
+    if (((MemAllocator*)This)->props.cbBuffer < 0)
+	return E_FAIL;
+    if (me->used_list.size() || me->free_list.size())
+	return E_INVALIDARG;
+    for(int i = 0; i<me->props.cBuffers; i++)
 	me->free_list.push_back(new CMediaSample(me, me->props.cbBuffer));
+
     return 0;
 }
 
-HRESULT STDCALL MemAllocator::Decommit ( 
-    IMemAllocator * This)
+static HRESULT STDCALL MemAllocator_Decommit(IMemAllocator * This)
 {
-    Debug printf("MemAllocator::Decommit() called\n");
+    Debug printf("MemAllocator_Decommit(%p) called\n", This);
     MemAllocator* me=(MemAllocator*)This;
     list<CMediaSample*>::iterator it;
     for(it=me->free_list.begin(); it!=me->free_list.end(); it++)
@@ -114,54 +98,81 @@
     for(it=me->used_list.begin(); it!=me->used_list.end(); it++)
 	delete *it;
     me->free_list.clear();
-    me->used_list.clear();	
+    me->used_list.clear();
     return 0;
 }
 
-HRESULT STDCALL MemAllocator::GetBuffer ( 
-    IMemAllocator * This,
-    /* [out] */ IMediaSample **ppBuffer,
-    /* [in] */ REFERENCE_TIME *pStartTime,
-    /* [in] */ REFERENCE_TIME *pEndTime,
-    /* [in] */ DWORD dwFlags)
-{
-    Debug printf("%x: MemAllocator::GetBuffer() called\n", This);
-    MemAllocator* me=(MemAllocator*)This;
-    if(me->free_list.size()==0)
+static HRESULT STDCALL MemAllocator_GetBuffer(IMemAllocator * This,
+					      /* [out] */ IMediaSample **ppBuffer,
+					      /* [in] */ REFERENCE_TIME *pStartTime,
+					      /* [in] */ REFERENCE_TIME *pEndTime,
+					      /* [in] */ DWORD dwFlags)
+{
+    Debug printf("MemAllocator_GetBuffer(%p) called\n", This);
+    MemAllocator* me = (MemAllocator*)This;
+    if (me->free_list.size() == 0)
     {
 	Debug printf("No samples available\n");
-	return -1;//should block here if no samples are available
-    }	
-    list<CMediaSample*>::iterator it=me->free_list.begin();
+	return E_FAIL;//should block here if no samples are available
+    }
+    list<CMediaSample*>::iterator it = me->free_list.begin();
     me->used_list.push_back(*it);
-    *ppBuffer=*it;
+    *ppBuffer = *it;
     (*ppBuffer)->vt->AddRef((IUnknown*)*ppBuffer);
-    if(me->new_pointer)
+    if (me->new_pointer)
     {
 	if(me->modified_sample)
 	    me->modified_sample->ResetPointer();
-        (*it)->SetPointer(me->new_pointer);
+	(*it)->SetPointer(me->new_pointer);
 	me->modified_sample=*it;
-	me->new_pointer=0;
+	me->new_pointer = 0;
     }
     me->free_list.remove(*it);
     return 0;
 }
 
-HRESULT STDCALL MemAllocator::ReleaseBuffer ( 
-    IMemAllocator * This,
-    /* [in] */ IMediaSample *pBuffer)
+static HRESULT STDCALL MemAllocator_ReleaseBuffer(IMemAllocator * This,
+						  /* [in] */ IMediaSample *pBuffer)
 {
-    Debug printf("%x: MemAllocator::ReleaseBuffer() called\n", This);
-    MemAllocator* me=(MemAllocator*)This;
+    Debug printf("MemAllocator_ReleaseBuffer(%p) called\n", This);
+    MemAllocator* me = (MemAllocator*)This;
     list<CMediaSample*>::iterator it;
-    for(it=me->used_list.begin(); it!=me->used_list.end(); it++)
-	if(*it==pBuffer)
+    for (it = me->used_list.begin(); it != me->used_list.end(); it++)
+	if (*it == pBuffer)
 	{
 	    me->used_list.erase(it);
 	    me->free_list.push_back((CMediaSample*)pBuffer);
 	    return 0;
 	}
     Debug printf("Releasing unknown buffer\n");
-    return -1;
+    return E_FAIL;
+}
+
+MemAllocator::MemAllocator()
+{
+    Debug printf("MemAllocator::MemAllocator() called\n");
+    vt = new IMemAllocator_vt;
+    vt->QueryInterface = QueryInterface;
+    vt->AddRef = AddRef;
+    vt->Release = Release;
+    vt->SetProperties = MemAllocator_SetProperties;
+    vt->GetProperties = MemAllocator_GetProperties;
+    vt->Commit = MemAllocator_Commit;
+    vt->Decommit = MemAllocator_Decommit;
+    vt->GetBuffer = MemAllocator_GetBuffer;
+    vt->ReleaseBuffer = MemAllocator_ReleaseBuffer;
+
+    refcount = 1;
+    props.cBuffers = 1;
+    props.cbBuffer = 65536; /* :/ */
+    props.cbAlign = props.cbPrefix = 0;
+
+    new_pointer=0;
+    modified_sample=0;
+}
+
+MemAllocator::~MemAllocator()
+{
+    Debug printf("MemAllocator::~MemAllocator() called\n");
+    delete vt;
 }

Index: allocator.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/allocator.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- allocator.h	6 May 2001 21:43:45 -0000	1.2
+++ allocator.h	16 Aug 2001 00:50:02 -0000	1.3
@@ -1,13 +1,13 @@
-#ifndef ALLOCATOR_H
-#define ALLOCATOR_H
+#ifndef DS_ALLOCATOR_H
+#define DS_ALLOCATOR_H
 
 #include "interfaces.h"
 #include "cmediasample.h"
-#include <list>
 #include "iunk.h"
-#include "default.h"
 
-class MemAllocator: public IMemAllocator
+#include <list>
+
+struct MemAllocator: public IMemAllocator
 {
     ALLOCATOR_PROPERTIES props;
     std::list<CMediaSample*> used_list;
@@ -16,44 +16,20 @@
     CMediaSample* modified_sample;
     static GUID interfaces[];
     DECLARE_IUNKNOWN(MemAllocator)
-public:
+
     MemAllocator();
-    ~MemAllocator(){delete vt;}
-    static long CreateAllocator(GUID* clsid, GUID* iid, void** ppv);
+    ~MemAllocator();
     void SetPointer(char* pointer) { new_pointer=pointer; }
     void ResetPointer() 
     { 
-	if(modified_sample) 
+	if (modified_sample)
 	{
 	    modified_sample->ResetPointer(); 
 	    modified_sample=0;
 	}
     }
-    static HRESULT STDCALL SetProperties ( 
-        IMemAllocator * This,
-        /* [in] */ ALLOCATOR_PROPERTIES *pRequest,
-        /* [out] */ ALLOCATOR_PROPERTIES *pActual);
-    
-    static HRESULT STDCALL GetProperties ( 
-        IMemAllocator * This,
-        /* [out] */ ALLOCATOR_PROPERTIES *pProps);
-    
-    static HRESULT STDCALL Commit ( 
-        IMemAllocator * This);
-    
-    static HRESULT STDCALL Decommit ( 
-        IMemAllocator * This);
-    
-    static HRESULT STDCALL GetBuffer ( 
-        IMemAllocator * This,
-        /* [out] */ IMediaSample **ppBuffer,
-        /* [in] */ REFERENCE_TIME *pStartTime,
-        /* [in] */ REFERENCE_TIME *pEndTime,
-        /* [in] */ DWORD dwFlags);
-    
-    static HRESULT STDCALL ReleaseBuffer ( 
-        IMemAllocator * This,
-        /* [in] */ IMediaSample *pBuffer);
+
+    static long CreateAllocator(GUID* clsid, GUID* iid, void** ppv);
 };
 
-#endif
+#endif /* DS_ALLOCATOR_H */

Index: cmediasample.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/cmediasample.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- cmediasample.cpp	6 May 2001 21:43:45 -0000	1.3
+++ cmediasample.cpp	16 Aug 2001 00:50:02 -0000	1.4
@@ -1,195 +1,139 @@
+#include "cmediasample.h"
+#include <wine/winerror.h>
 #include <stdio.h>
 #include <string.h>
-#include "cmediasample.h"
-//#define E_NOTIMPL 0x80004003
-CMediaSample::CMediaSample(IMemAllocator* allocator, long _size):refcount(0)
-{
-    vt=new IMediaSample_vt;
-    
-    vt->QueryInterface=QueryInterface;
-    vt->AddRef=AddRef;
-    vt->Release=Release;
-    vt->GetPointer=GetPointer ; 
-    vt->GetSize=GetSize ; 
-    vt->GetTime=GetTime ; 
-    vt->SetTime=SetTime ; 
-    vt->IsSyncPoint=IsSyncPoint ; 
-    vt->SetSyncPoint=SetSyncPoint; 
-    vt->IsPreroll=IsPreroll; 
-    vt->SetPreroll=SetPreroll; 
-    vt->GetActualDataLength=GetActualDataLength; 
-    vt->SetActualDataLength=SetActualDataLength; 
-    vt->GetMediaType=GetMediaType; 
-    vt->SetMediaType=SetMediaType; 
-    vt->IsDiscontinuity=IsDiscontinuity; 
-    vt->SetDiscontinuity=SetDiscontinuity; 
-    vt->GetMediaTime=GetMediaTime; 
-    vt->SetMediaTime=SetMediaTime; 
-    
-    all=allocator;
-    size=_size;
-    actual_size=0;
-    media_type.pbFormat=0;
-    isPreroll=0;
-    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);
-}
-CMediaSample::~CMediaSample()
-{
-    Debug printf("%x: CMediaSample::~CMediaSample() called\n", this);
-    delete vt;
-    if(old_block)
-	block=old_block;
-    delete[] block;
-    if(media_type.pbFormat)
-	CoTaskMemFree(media_type.pbFormat);
-}
 
-long STDCALL CMediaSample::QueryInterface ( 
-    IUnknown * This,
-    /* [in] */ IID* iid,
-    /* [iid_is][out] */ void **ppv)
-{
-    Debug printf("CMediaSample::QueryInterface() called\n");
-    if(!ppv)return 0x80004003;
-    if(!memcmp(iid, &IID_IUnknown, 16))
+static long STDCALL CMediaSample_QueryInterface(IUnknown * This,
+						/* [in] */ IID* iid,
+						/* [iid_is][out] */ void **ppv)
+{
+    Debug printf("CMediaSample_QueryInterface() called\n");
+    if (!ppv)
+	return E_INVALIDARG;
+    if (!memcmp(iid, &IID_IUnknown, 16))
     {
 	*ppv=(void*)This;
 	This->vt->AddRef(This);
 	return 0;
     }
-    if(!memcmp(iid, &IID_IMediaSample, 16))
+    if (!memcmp(iid, &IID_IMediaSample, 16))
     {
 	*ppv=(void*)This;
 	This->vt->AddRef(This);
 	return 0;
     }
-    return 0x80004002;
+    return E_NOINTERFACE;
 }
 
-long STDCALL CMediaSample::AddRef ( 
-    IUnknown * This)
+static long STDCALL CMediaSample_AddRef(IUnknown* This)
 {
-    Debug printf("CMediaSample::AddRef() called\n");
+    Debug printf("CMediaSample_AddRef() called\n");
     ((CMediaSample*)This)->refcount++;
     return 0;
 }
-        
-long STDCALL CMediaSample::Release ( 
-    IUnknown * This)
+
+static long STDCALL CMediaSample_Release(IUnknown* This)
 {
-    Debug printf("%x: CMediaSample::Release() called, new refcount %d\n", This, 
-	((CMediaSample*)This)->refcount-1);
+    Debug printf("%p: CMediaSample_Release() called, new refcount %d\n",
+		 This, ((CMediaSample*)This)->refcount-1);
     CMediaSample* parent=(CMediaSample*)This;
-    if(--((CMediaSample*)This)->refcount==0)
-	parent->
-	    all->
-		vt->
-		    ReleaseBuffer(
-			(IMemAllocator*)(parent->all), 
-			    (IMediaSample*)This);
+    if (--((CMediaSample*)This)->refcount==0)
+	parent->all->vt->ReleaseBuffer((IMemAllocator*)(parent->all),
+				       (IMediaSample*)This);
     return 0;
 }
-HRESULT STDCALL CMediaSample::GetPointer ( 
-    IMediaSample * This,
-    /* [out] */ BYTE **ppBuffer)
+
+static HRESULT STDCALL CMediaSample_GetPointer(IMediaSample * This,
+					       /* [out] */ BYTE **ppBuffer)
 {
-    Debug printf("%x: CMediaSample::GetPointer() called\n", This);
-    if(!ppBuffer)return 0x80004003;
+    Debug printf("%p: CMediaSample_GetPointer() called\n", This);
+    if (!ppBuffer)
+	return E_INVALIDARG;
     *ppBuffer=(BYTE *)((CMediaSample*)This)->block;
     return 0;
 }
 
-long STDCALL CMediaSample::GetSize ( 
-    IMediaSample * This)
+static long STDCALL CMediaSample_GetSize(IMediaSample * This)
 {
-    Debug printf("%x: CMediaSample::GetSize() called -> %d\n", This, ((CMediaSample*)This)->size);
+    Debug printf("%p: CMediaSample_GetSize() called -> %d\n",
+		 This, ((CMediaSample*)This)->size);
     return ((CMediaSample*)This)->size;
 }
 
-HRESULT STDCALL CMediaSample::GetTime ( 
-    IMediaSample * This,
-    /* [out] */ REFERENCE_TIME *pTimeStart,
-    /* [out] */ REFERENCE_TIME *pTimeEnd)
+static HRESULT STDCALL CMediaSample_GetTime(IMediaSample * This,
+					    /* [out] */ REFERENCE_TIME *pTimeStart,
+					    /* [out] */ REFERENCE_TIME *pTimeEnd)
 {
-    Debug printf("%x: CMediaSample::GetTime() called\n", This);
+    Debug printf("%p: CMediaSample_GetTime() called\n", This);
     return E_NOTIMPL;
 }
 
-HRESULT STDCALL CMediaSample::SetTime ( 
-    IMediaSample * This,
-    /* [in] */ REFERENCE_TIME *pTimeStart,
-    /* [in] */ REFERENCE_TIME *pTimeEnd)
+static HRESULT STDCALL CMediaSample_SetTime(IMediaSample * This,
+					    /* [in] */ REFERENCE_TIME *pTimeStart,
+					    /* [in] */ REFERENCE_TIME *pTimeEnd)
 {
-    Debug printf("%x: CMediaSample::SetTime() called\n", This);
+    Debug printf("%p: CMediaSample_SetTime() called\n", This);
     return E_NOTIMPL;
 }
 
-HRESULT STDCALL CMediaSample::IsSyncPoint ( 
-    IMediaSample * This)
+static HRESULT STDCALL CMediaSample_IsSyncPoint(IMediaSample * This)
 {
-    Debug printf("%x: CMediaSample::IsSyncPoint() called\n", This);
-    if(((CMediaSample*)This)->isSyncPoint)return 0;
+    Debug printf("%p: CMediaSample_IsSyncPoint() called\n", This);
+    if (((CMediaSample*)This)->isSyncPoint)
+	return 0;
     return 1;
 }
 
-HRESULT STDCALL CMediaSample::SetSyncPoint ( 
-    IMediaSample * This,
-    long bIsSyncPoint)
+static HRESULT STDCALL CMediaSample_SetSyncPoint(IMediaSample * This,
+						 long bIsSyncPoint)
 {
-    Debug printf("%x: CMediaSample::SetSyncPoint() called\n", This);
+    Debug printf("%p: CMediaSample_SetSyncPoint() called\n", This);
     ((CMediaSample*)This)->isSyncPoint=bIsSyncPoint;
     return 0;
 }
 
-HRESULT STDCALL CMediaSample::IsPreroll ( 
-    IMediaSample * This)
+static HRESULT STDCALL CMediaSample_IsPreroll(IMediaSample * This)
 {
-    Debug printf("%x: CMediaSample::IsPreroll() called\n", This);
-    if(((CMediaSample*)This)->isPreroll==0)
-	return 1;//S_FALSE
-    else
+    Debug printf("%p: CMediaSample_IsPreroll() called\n", This);
+
+    if (((CMediaSample*)This)->isPreroll)
 	return 0;//S_OK
+
+    return 1;//S_FALSE
 }
 
-HRESULT STDCALL CMediaSample::SetPreroll ( 
-    IMediaSample * This,
-    long bIsPreroll)
+static HRESULT STDCALL CMediaSample_SetPreroll(IMediaSample * This,
+					       long bIsPreroll)
 {
-    Debug printf("%x: CMediaSample::SetPreroll() called\n", This);
+    Debug printf("%p: CMediaSample_SetPreroll() called\n", This);
     ((CMediaSample*)This)->isPreroll=bIsPreroll;
     return 0;
 }
 
-long STDCALL CMediaSample::GetActualDataLength ( 
-    IMediaSample * This)
+static long STDCALL CMediaSample_GetActualDataLength(IMediaSample * This)
 {
-    Debug printf("%x: CMediaSample::GetActualDataLength() called -> %d\n", This, ((CMediaSample*)This)->actual_size);
+    Debug printf("%p: CMediaSample_GetActualDataLength() called -> %d\n", This, ((CMediaSample*)This)->actual_size);
     return ((CMediaSample*)This)->actual_size;
 }
 
-HRESULT STDCALL CMediaSample::SetActualDataLength ( 
-    IMediaSample * This,
-    long __MIDL_0010)
+static HRESULT STDCALL CMediaSample_SetActualDataLength(IMediaSample * This,
+							long __MIDL_0010)
 {
-    Debug printf("%x: CMediaSample::SetActualDataLength(%d) called\n", This, __MIDL_0010);
-    if(__MIDL_0010>((CMediaSample*)This)->size)
+    Debug printf("%p: CMediaSample_SetActualDataLength(%ld) called\n", This, __MIDL_0010);
+    if (__MIDL_0010 > ((CMediaSample*)This)->size)
     {
-	printf("%x: ERROR: CMediaSample buffer overflow\n", This);
+	printf("%p: ERROR: CMediaSample buffer overflow\n", This);
     }
     ((CMediaSample*)This)->actual_size=__MIDL_0010;
     return 0;
 }
 
-HRESULT STDCALL CMediaSample::GetMediaType ( 
-    IMediaSample * This,
-    AM_MEDIA_TYPE **ppMediaType)
+static HRESULT STDCALL CMediaSample_GetMediaType(IMediaSample * This,
+						 AM_MEDIA_TYPE **ppMediaType)
 {
-    Debug printf("%x: CMediaSample::GetMediaType() called\n", This);
+    Debug printf("%p: CMediaSample_GetMediaType() called\n", This);
     if(!ppMediaType)
-	return 0x80004003;
+	return E_INVALIDARG;
     if(!((CMediaSample*)This)->type_valid)
     {
 	*ppMediaType=0;
@@ -200,55 +144,101 @@
     (*ppMediaType)=(AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
     memcpy(*ppMediaType, &t, sizeof(AM_MEDIA_TYPE));
     (*ppMediaType)->pbFormat=(char*)CoTaskMemAlloc(t.cbFormat);
-    memcpy((*ppMediaType)->pbFormat, t.pbFormat, t.cbFormat);    
+    memcpy((*ppMediaType)->pbFormat, t.pbFormat, t.cbFormat);
 //    *ppMediaType=0; //media type was not changed
-    return 0;    
+    return 0;
 }
 
-HRESULT STDCALL CMediaSample::SetMediaType ( 
-    IMediaSample * This,
-    AM_MEDIA_TYPE *pMediaType)
+static HRESULT STDCALL CMediaSample_SetMediaType(IMediaSample * This,
+						 AM_MEDIA_TYPE *pMediaType)
 {
-    Debug printf("%x: CMediaSample::SetMediaType() called\n", This);
-    if(!pMediaType)return 0x80004003;
-    AM_MEDIA_TYPE& t=((CMediaSample*)This)->media_type;
-    if(t.pbFormat)CoTaskMemFree(t.pbFormat);
-    t=*pMediaType;
-    t.pbFormat=(char*)CoTaskMemAlloc(t.cbFormat);
-    memcpy(t.pbFormat, pMediaType->pbFormat, t.cbFormat);     
+    Debug printf("%p: CMediaSample_SetMediaType() called\n", This);
+    if (!pMediaType)
+	return E_INVALIDARG;
+    AM_MEDIA_TYPE& t = ((CMediaSample*)This)->media_type;
+    if (t.pbFormat)
+	CoTaskMemFree(t.pbFormat);
+    t = *pMediaType;
+    t.pbFormat = (char*)CoTaskMemAlloc(t.cbFormat);
+    memcpy(t.pbFormat, pMediaType->pbFormat, t.cbFormat);
     ((CMediaSample*)This)->type_valid=1;
+
     return 0;
 }
 
-HRESULT STDCALL CMediaSample::IsDiscontinuity ( 
-    IMediaSample * This)
+static HRESULT STDCALL CMediaSample_IsDiscontinuity(IMediaSample * This)
 {
-    Debug printf("%x: CMediaSample::IsDiscontinuity() called\n", This);
+    Debug printf("%p: CMediaSample_IsDiscontinuity() called\n", This);
     return 1;
 }
 
-HRESULT STDCALL CMediaSample::SetDiscontinuity ( 
-    IMediaSample * This,
-    long bDiscontinuity)
+static HRESULT STDCALL CMediaSample_SetDiscontinuity(IMediaSample * This,
+						     long bDiscontinuity)
 {
-    Debug printf("%x: CMediaSample::SetDiscontinuity() called\n", This);
+    Debug printf("%p: CMediaSample_SetDiscontinuity() called\n", This);
     return E_NOTIMPL;
 }
 
-HRESULT STDCALL CMediaSample::GetMediaTime ( 
-    IMediaSample * This,
-    /* [out] */ LONGLONG *pTimeStart,
-    /* [out] */ LONGLONG *pTimeEnd)
+static HRESULT STDCALL CMediaSample_GetMediaTime(IMediaSample * This,
+						 /* [out] */ LONGLONG *pTimeStart,
+						 /* [out] */ LONGLONG *pTimeEnd)
 {
-    Debug printf("%x: CMediaSample::GetMediaTime() called\n", This);
+    Debug printf("%p: CMediaSample_GetMediaTime() called\n", This);
     return E_NOTIMPL;
 }
 
-HRESULT STDCALL CMediaSample::SetMediaTime ( 
-    IMediaSample * This,
-    /* [in] */ LONGLONG *pTimeStart,
-    /* [in] */ LONGLONG *pTimeEnd)    
+static HRESULT STDCALL CMediaSample_SetMediaTime(IMediaSample * This,
+						 /* [in] */ LONGLONG *pTimeStart,
+						 /* [in] */ LONGLONG *pTimeEnd)
 {
-    Debug printf("%x: CMediaSample::SetMediaTime() called\n", This);
+    Debug printf("%p: CMediaSample_SetMediaTime() called\n", This);
     return E_NOTIMPL;
+}
+
+CMediaSample::CMediaSample(IMemAllocator* allocator, long _size)
+{
+    vt = new IMediaSample_vt;
+
+    vt->QueryInterface = CMediaSample_QueryInterface;
+    vt->AddRef = CMediaSample_AddRef;
+    vt->Release = CMediaSample_Release;
+    vt->GetPointer = CMediaSample_GetPointer;
+    vt->GetSize = CMediaSample_GetSize;
+    vt->GetTime = CMediaSample_GetTime;
+    vt->SetTime = CMediaSample_SetTime;
+    vt->IsSyncPoint = CMediaSample_IsSyncPoint;
+    vt->SetSyncPoint = CMediaSample_SetSyncPoint;
+    vt->IsPreroll = CMediaSample_IsPreroll;
+    vt->SetPreroll = CMediaSample_SetPreroll;
+    vt->GetActualDataLength = CMediaSample_GetActualDataLength;
+    vt->SetActualDataLength = CMediaSample_SetActualDataLength;
+    vt->GetMediaType = CMediaSample_GetMediaType;
+    vt->SetMediaType = CMediaSample_SetMediaType;
+    vt->IsDiscontinuity = CMediaSample_IsDiscontinuity;
+    vt->SetDiscontinuity = CMediaSample_SetDiscontinuity;
+    vt->GetMediaTime = CMediaSample_GetMediaTime;
+    vt->SetMediaTime = CMediaSample_SetMediaTime;
+
+    all = allocator;
+    size = _size;
+    refcount = 0;
+    actual_size = 0;
+    media_type.pbFormat = 0;
+    isPreroll = 0;
+    type_valid = 0;
+    own_block = new char[size];
+    block = own_block;
+    Debug printf("%p: Creating media sample with size %ld, buffer %p\n",
+		 this, _size, block);
+}
+
+CMediaSample::~CMediaSample()
+{
+    Debug printf("%p: CMediaSample::~CMediaSample() called\n", this);
+    if (!vt)
+        printf("Second delete of CMediaSample()!!|\n");
+    delete vt;
+    delete own_block;
+    if (media_type.pbFormat)
+	CoTaskMemFree(media_type.pbFormat);
 }

Index: cmediasample.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/cmediasample.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- cmediasample.h	6 May 2001 21:43:45 -0000	1.2
+++ cmediasample.h	16 Aug 2001 00:50:02 -0000	1.3
@@ -1,99 +1,25 @@
-#ifndef _CMEDIASAMPLE_H
-#define _CMEDIASAMPLE_H
+#ifndef DS_CMEDIASAMPLE_H
+#define DS_CMEDIASAMPLE_H
 
 #include "interfaces.h"
 #include "guids.h"
-#include "default.h"
-class CMediaSample: public IMediaSample
+
+struct CMediaSample: public IMediaSample
 {
     IMemAllocator* all;
     int size;
     int actual_size;
     char* block;
-    char* old_block;
+    char* own_block;
     int refcount;
     int isPreroll;
     int isSyncPoint;
     AM_MEDIA_TYPE media_type;
     int type_valid;
-public:
     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 ( 
-        IUnknown * This,
-        /* [in] */ IID* riid,
-        /* [iid_is][out] */ void **ppvObject);
-    
-    static long STDCALL AddRef ( 
-        IUnknown * This);
-        
-    static long STDCALL Release ( 
-        IUnknown * This);
-    
-    static HRESULT STDCALL GetPointer ( 
-        IMediaSample * This,
-        /* [out] */ BYTE **ppBuffer);
-    
-    static long STDCALL GetSize ( 
-        IMediaSample * This);
-    
-    static HRESULT STDCALL GetTime ( 
-        IMediaSample * This,
-        /* [out] */ REFERENCE_TIME *pTimeStart,
-        /* [out] */ REFERENCE_TIME *pTimeEnd);
-    
-    static HRESULT STDCALL SetTime ( 
-        IMediaSample * This,
-        /* [in] */ REFERENCE_TIME *pTimeStart,
-        /* [in] */ REFERENCE_TIME *pTimeEnd);
-    
-    static HRESULT STDCALL IsSyncPoint ( 
-        IMediaSample * This);
-    
-    static HRESULT STDCALL SetSyncPoint ( 
-        IMediaSample * This,
-        long bIsSyncPoint);
-    
-    static HRESULT STDCALL IsPreroll ( 
-        IMediaSample * This);
-    
-    static HRESULT STDCALL SetPreroll ( 
-        IMediaSample * This,
-        long bIsPreroll);
-    
-    static long STDCALL GetActualDataLength ( 
-        IMediaSample * This);
-    
-    static HRESULT STDCALL SetActualDataLength ( 
-        IMediaSample * This,
-        long __MIDL_0010);
-    
-    static HRESULT STDCALL GetMediaType ( 
-        IMediaSample * This,
-        AM_MEDIA_TYPE **ppMediaType);
-    
-    static HRESULT STDCALL SetMediaType ( 
-        IMediaSample * This,
-        AM_MEDIA_TYPE *pMediaType);
-    
-    static HRESULT STDCALL IsDiscontinuity ( 
-        IMediaSample * This);
-    
-    static HRESULT STDCALL SetDiscontinuity ( 
-        IMediaSample * This,
-        long bDiscontinuity);
-    
-    static HRESULT STDCALL GetMediaTime ( 
-        IMediaSample * This,
-        /* [out] */ LONGLONG *pTimeStart,
-        /* [out] */ LONGLONG *pTimeEnd);
-    
-    static HRESULT STDCALL SetMediaTime ( 
-        IMediaSample * This,
-        /* [in] */ LONGLONG *pTimeStart,
-        /* [in] */ LONGLONG *pTimeEnd);    
+    void SetPointer(char* pointer) { block = pointer; }
+    void ResetPointer() { block = own_block; }
 };
-#endif
+
+#endif /* DS_CMEDIASAMPLE_H */

Index: guids.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/guids.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- guids.h	20 Mar 2001 00:05:39 -0000	1.1.1.1
+++ guids.h	16 Aug 2001 00:50:02 -0000	1.2
@@ -1,9 +1,12 @@
 #ifndef GUIDS_H
 #define GUIDS_H
-//#include <loader.h>
-//#include <wine/winbase.h>
+
 #include <com.h>
-#include <formats.h>
+#include <wine/winbase.h>
+#include <wine/windef.h>
+#include <wine/winuser.h>
+#include <wine/vfw.h>
+//#include <formats.h>
 extern int DSHOW_DEBUG;
 #define Debug if(DSHOW_DEBUG)
 
@@ -20,43 +23,46 @@
     unsigned long     cbFormat;		//0x40
     char *pbFormat;			//0x44
 } AM_MEDIA_TYPE;
+
 typedef enum
 {
     PINDIR_INPUT	= 0,
     PINDIR_OUTPUT	= PINDIR_INPUT + 1
 } PIN_DIRECTION;
+
 typedef long long REFERENCE_TIME;
-//typedef long long LONGLONG;
+
 struct RECT32
 {
     int left, top, right, bottom;
 };
+
 typedef struct tagVIDEOINFOHEADER {
 
     RECT32            rcSource;          // The bit we really want to use
     RECT32            rcTarget;          // Where the video should go
     unsigned long     dwBitRate;         // Approximate bit data rate
     unsigned long     dwBitErrorRate;    // Bit error rate for this stream
-    REFERENCE_TIME  AvgTimePerFrame;   // Average time per frame (100ns units)
-
+    REFERENCE_TIME    AvgTimePerFrame;   // Average time per frame (100ns units)
     BITMAPINFOHEADER bmiHeader;
-
 } VIDEOINFOHEADER;
+
 typedef struct _AllocatorProperties
 {
     long cBuffers;
     long cbBuffer;
     long cbAlign;
     long cbPrefix;
-}   ALLOCATOR_PROPERTIES;
+} ALLOCATOR_PROPERTIES;
+
 struct IBaseFilter;
+
 typedef struct _PinInfo
 {
     IBaseFilter *pFilter;
     PIN_DIRECTION dir;
-    unsigned short achName[ 128 ];
-}   PIN_INFO;
-
+    unsigned short achName[128];
+} PIN_INFO;
 
 extern GUID IID_IBaseFilter;
 extern GUID IID_IEnumPins;

Index: inputpin.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/inputpin.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- inputpin.cpp	20 Mar 2001 00:05:28 -0000	1.1.1.1
+++ inputpin.cpp	16 Aug 2001 00:50:02 -0000	1.2
@@ -1,40 +1,41 @@
 #include "inputpin.h"
+#include <wine/winerror.h>
+#include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
-#define E_NOTIMPL 0x80004001
+
 GUID CInputPin::interfaces[]=
 {
- IID_IUnknown,
+    IID_IUnknown,
 };
-IMPLEMENT_IUNKNOWN(CInputPin) 
+IMPLEMENT_IUNKNOWN(CInputPin)
 
 GUID CRemotePin::interfaces[]=
-{ 
- IID_IUnknown,
+{
+    IID_IUnknown,
 };
 IMPLEMENT_IUNKNOWN(CRemotePin)
- 
+
 GUID CRemotePin2::interfaces[]=
 {
- IID_IUnknown,
-}; 
+    IID_IUnknown,
+};
 IMPLEMENT_IUNKNOWN(CRemotePin2)
- 
+
 GUID CBaseFilter::interfaces[]=
 {
- IID_IUnknown,
- IID_IBaseFilter,
+    IID_IUnknown,
+    IID_IBaseFilter,
 };
 IMPLEMENT_IUNKNOWN(CBaseFilter)
 
 GUID CBaseFilter2::interfaces[]=
 {
- IID_IUnknown,
- IID_IBaseFilter,
- {0x76c61a30, 0xebe1, 0x11cf, {0x89, 0xf9, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb}}, 
- {0xaae7e4e2, 0x6388, 0x11d1, {0x8d, 0x93, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2}}, 
- {0x02ef04dd, 0x7580, 0x11d1, {0xbe, 0xce, 0x00, 0xc0, 0x4f, 0xb6, 0xe9, 0x37}}, 
+    IID_IUnknown,
+    IID_IBaseFilter,
+    {0x76c61a30, 0xebe1, 0x11cf, {0x89, 0xf9, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb}},
+    {0xaae7e4e2, 0x6388, 0x11d1, {0x8d, 0x93, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2}},
+    {0x02ef04dd, 0x7580, 0x11d1, {0xbe, 0xce, 0x00, 0xc0, 0x4f, 0xb6, 0xe9, 0x37}},
 };
 IMPLEMENT_IUNKNOWN(CBaseFilter2)
 
@@ -48,20 +49,20 @@
 public:
     CEnumPins(IPin*, IPin* =0);
     ~CEnumPins(){delete vt;}
-    static long STDCALL Next ( 
+    static long STDCALL Next (
         IEnumPins * This,
         /* [in] */ unsigned long cMediaTypes,
         /* [size_is][out] */ IPin **ppMediaTypes,
         /* [out] */ unsigned long *pcFetched);
-    
-    static long STDCALL Skip ( 
+
+    static long STDCALL Skip (
         IEnumPins * This,
         /* [in] */ unsigned long cMediaTypes);
-    
-    static long STDCALL Reset ( 
+
+    static long STDCALL Reset (
         IEnumPins * This);
-    
-    static long STDCALL Clone ( 
+
+    static long STDCALL Clone (
         IEnumPins * This,
         /* [out] */ IEnumPins **ppEnum);
 
@@ -79,74 +80,79 @@
     vt->QueryInterface = QueryInterface;
     vt->AddRef = AddRef;
     vt->Release = Release;
-    vt->Next = Next; 
-    vt->Skip = Skip; 
+    vt->Next = Next;
+    vt->Skip = Skip;
     vt->Reset = Reset;
-    vt->Clone = Clone; 
+    vt->Clone = Clone;
 }
 
-long STDCALL CEnumPins::Next ( 
-    IEnumPins * This,
-    /* [in] */ unsigned long cMediaTypes,
-    /* [size_is][out] */ IPin **ppMediaTypes,
-    /* [out] */ unsigned long *pcFetched)
+long STDCALL CEnumPins::Next(IEnumPins * This,
+			     /* [in] */ unsigned long cMediaTypes,
+			     /* [size_is][out] */ IPin **ppMediaTypes,
+			     /* [out] */ unsigned long *pcFetched)
 {
-    IPin* pin1=((CEnumPins*)This)->pin1;
-    IPin* pin2=((CEnumPins*)This)->pin2;
     Debug printf("CEnumPins::Next() called\n");
-    if(!ppMediaTypes)return 0x80004003;
-    if(!pcFetched && (cMediaTypes!=1))return 0x80004003;
-    if(cMediaTypes<=0)return 0;
-    int& counter=((CEnumPins*)This)->counter;
-    if(((counter==2) && pin2) || ((counter==1) && !pin2))
+    if (!ppMediaTypes)
+	return E_INVALIDARG;
+    if (!pcFetched && (cMediaTypes!=1))
+	return E_INVALIDARG;
+    if (cMediaTypes<=0)
+	return 0;
+    int& lcounter=((CEnumPins*)This)->counter;
+
+    IPin* lpin1=((CEnumPins*)This)->pin1;
+    IPin* lpin2=((CEnumPins*)This)->pin2;
+    if (((lcounter == 2) && lpin2) || ((lcounter == 1) && !lpin2))
     {
-	if(pcFetched)*pcFetched=0;
+	if (pcFetched)
+	    *pcFetched=0;
 	return 1;
     }
-    
-    if(pcFetched)*pcFetched=1;
-    if(counter==0)
+
+    if (pcFetched)
+	*pcFetched=1;
+    if (lcounter==0)
     {
-	*ppMediaTypes=pin1;
-	pin1->vt->AddRef((IUnknown*)pin1);
+	*ppMediaTypes = lpin1;
+	lpin1->vt->AddRef((IUnknown*)lpin1);
     }
     else
     {
-	*ppMediaTypes=pin2;
-	pin2->vt->AddRef((IUnknown*)pin2);
+	*ppMediaTypes = lpin2;
+	lpin2->vt->AddRef((IUnknown*)lpin2);
     }
-    counter++;
-    if(cMediaTypes==1)return 0;
+    lcounter++;
+    if (cMediaTypes == 1)
+	return 0;
     return 1;
 }
 
-long STDCALL CEnumPins::Skip ( 
-    IEnumPins * This,
-    /* [in] */ unsigned long cMediaTypes)
+long STDCALL CEnumPins::Skip(IEnumPins * This,
+			     /* [in] */ unsigned long cMediaTypes)
 {
     Debug printf("CEnumPins::Skip() called\n");
     return E_NOTIMPL;
 }
 
-long STDCALL CEnumPins::Reset ( 
-    IEnumPins * This)
+long STDCALL CEnumPins::Reset(IEnumPins * This)
 {
     Debug printf("CEnumPins::Reset() called\n");
     ((CEnumPins*)This)->counter=0;
     return 0;
 }
 
-long STDCALL CEnumPins::Clone ( 
-    IEnumPins * This,
-    /* [out] */ IEnumPins **ppEnum)
+long STDCALL CEnumPins::Clone(IEnumPins * This,
+			      /* [out] */ IEnumPins **ppEnum)
 {
     Debug printf("CEnumPins::Clone() called\n");
     return E_NOTIMPL;
 }
- 
+
 CInputPin::CInputPin(CBaseFilter* p, const AM_MEDIA_TYPE& vh)
-     : refcount(1), type(vh), parent(p)
+     : type(vh)
 {
+    refcount = 1;
+    parent = p;
     vt=new IPin_vt;
     vt->QueryInterface = QueryInterface;
     vt->AddRef = AddRef;
@@ -168,7 +174,7 @@
     vt->NewSegment = NewSegment;
 }
 
-long STDCALL CInputPin::Connect ( 
+long STDCALL CInputPin::Connect (
     IPin * This,
     /* [in] */ IPin *pReceivePin,
     /* [in] */ AM_MEDIA_TYPE *pmt)
@@ -177,90 +183,74 @@
     return E_NOTIMPL;
 }
 
-long STDCALL CInputPin::ReceiveConnection ( 
-    IPin * This,
-    /* [in] */ IPin *pConnector,
-    /* [in] */ const AM_MEDIA_TYPE *pmt)
+long STDCALL CInputPin::ReceiveConnection(IPin * This,
+					  /* [in] */ IPin *pConnector,
+					  /* [in] */ const AM_MEDIA_TYPE *pmt)
 {
     Debug printf("CInputPin::ReceiveConnection() called\n");
     return E_NOTIMPL;
 }
-	    
-long STDCALL CInputPin::Disconnect ( 
-    IPin * This)
+
+long STDCALL CInputPin::Disconnect(IPin * This)
 {
     Debug printf("CInputPin::Disconnect() called\n");
     return E_NOTIMPL;
 }
 
-
-long STDCALL CInputPin::ConnectedTo ( 
-    IPin * This,
-    /* [out] */ IPin **pPin)
+long STDCALL CInputPin::ConnectedTo(IPin * This, /* [out] */ IPin **pPin)
 {
     Debug printf("CInputPin::ConnectedTo() called\n");
     return E_NOTIMPL;
 }
 
-
-long STDCALL CInputPin::ConnectionMediaType ( 
-    IPin * This,
-    /* [out] */ AM_MEDIA_TYPE *pmt)
+long STDCALL CInputPin::ConnectionMediaType(IPin * This,
+					    /* [out] */ AM_MEDIA_TYPE *pmt)
 {
     Debug printf("CInputPin::ConnectionMediaType() called\n");
-    if(!pmt)return 0x80004003;
+    if(!pmt)return E_INVALIDARG;
     *pmt=((CInputPin*)This)->type;
     if(pmt->cbFormat>0)
     {
 	pmt->pbFormat=(char *)CoTaskMemAlloc(pmt->cbFormat);
 	memcpy(pmt->pbFormat, ((CInputPin*)This)->type.pbFormat, pmt->cbFormat);
-    }	
+    }
     return 0;
 }
 
-long STDCALL CInputPin::QueryPinInfo ( 
-    IPin * This,
-    /* [out] */ PIN_INFO *pInfo)
+long STDCALL CInputPin::QueryPinInfo(IPin * This, /* [out] */ PIN_INFO *pInfo)
 {
     Debug printf("CInputPin::QueryPinInfo() called\n");
     pInfo->dir=PINDIR_OUTPUT;
-    CBaseFilter* parent=((CInputPin*)This)->parent;
-    pInfo->pFilter=parent;
-    parent->vt->AddRef((IUnknown*)parent);
+    CBaseFilter* lparent=((CInputPin*)This)->parent;
+    pInfo->pFilter = lparent;
+    lparent->vt->AddRef((IUnknown*)lparent);
     pInfo->achName[0]=0;
     return 0;
 }
 
-
-long STDCALL CInputPin::QueryDirection ( 
-    IPin * This,
-    /* [out] */ PIN_DIRECTION *pPinDir)
+long STDCALL CInputPin::QueryDirection(IPin * This,
+				       /* [out] */ PIN_DIRECTION *pPinDir)
 {
     *pPinDir=PINDIR_OUTPUT;
     Debug printf("CInputPin::QueryDirection() called\n");
     return 0;
 }
 
-
-long STDCALL CInputPin::QueryId ( 
-    IPin * This,
-    /* [out] */ unsigned short* *Id)
+long STDCALL CInputPin::QueryId(IPin * This, /* [out] */ unsigned short* *Id)
 {
     Debug printf("CInputPin::QueryId() called\n");
     return E_NOTIMPL;
 }
 
-
-long STDCALL CInputPin::QueryAccept ( 
-    IPin * This,
-    /* [in] */ const AM_MEDIA_TYPE *pmt)
+long STDCALL CInputPin::QueryAccept(IPin * This,
+				    /* [in] */ const AM_MEDIA_TYPE *pmt)
 {
     Debug printf("CInputPin::QueryAccept() called\n");
     return E_NOTIMPL;
 }
 
 
-long STDCALL CInputPin::EnumMediaTypes ( 
+long STDCALL CInputPin::EnumMediaTypes (
     IPin * This,
     /* [out] */ IEnumMediaTypes **ppEnum)
 {
@@ -269,56 +259,46 @@
 }
 
 
-long STDCALL CInputPin::QueryInternalConnections ( 
-    IPin * This,
-    /* [out] */ IPin **apPin,
-    /* [out][in] */ unsigned long *nPin)
+long STDCALL CInputPin::QueryInternalConnections(IPin * This,
+						 /* [out] */ IPin **apPin,
+						 /* [out][in] */ unsigned long *nPin)
 {
     Debug printf("CInputPin::QueryInternalConnections() called\n");
     return E_NOTIMPL;
 }
 
-long STDCALL CInputPin::EndOfStream ( 
-    IPin * This)
+long STDCALL CInputPin::EndOfStream (IPin * This)
 {
     Debug printf("CInputPin::EndOfStream() called\n");
     return E_NOTIMPL;
 }
-    
-    
-long STDCALL CInputPin::BeginFlush ( 
-IPin * This)
+
+
+long STDCALL CInputPin::BeginFlush(IPin * This)
 {
     Debug printf("CInputPin::BeginFlush() called\n");
     return E_NOTIMPL;
 }
 
 
-long STDCALL CInputPin::EndFlush ( 
-    IPin * This)
+long STDCALL CInputPin::EndFlush(IPin * This)
 {
     Debug printf("CInputPin::EndFlush() called\n");
     return E_NOTIMPL;
 }
 
-long STDCALL CInputPin::NewSegment ( 
-    IPin * This,
-    /* [in] */ REFERENCE_TIME tStart,
-    /* [in] */ REFERENCE_TIME tStop,
-    /* [in] */ double dRate)
+long STDCALL CInputPin::NewSegment(IPin * This,
+				   /* [in] */ REFERENCE_TIME tStart,
+				   /* [in] */ REFERENCE_TIME tStop,
+				   /* [in] */ double dRate)
 {
     Debug printf("CInputPin::NewSegment() called\n");
     return E_NOTIMPL;
 }
 
-
-
-
-
-
 CBaseFilter::CBaseFilter(const AM_MEDIA_TYPE& type, CBaseFilter2* parent)
-    : refcount(1)
 {
+    refcount = 1;
     pin=new CInputPin(this, type);
     unused_pin=new CRemotePin(this, parent->GetPin());
     vt=new IBaseFilter_vt;
@@ -329,7 +309,7 @@
     vt->Stop = Stop;
     vt->Pause = Pause;
     vt->Run = Run;
-    vt->GetState = GetState; 
+    vt->GetState = GetState;
     vt->SetSyncSource = SetSyncSource;
     vt->GetSyncSource = GetSyncSource;
     vt->EnumPins = EnumPins;
@@ -339,114 +319,104 @@
     vt->QueryVendorInfo = QueryVendorInfo;
 }
 
-long STDCALL CBaseFilter::GetClassID ( 
-        IBaseFilter * This,
-        /* [out] */ CLSID *pClassID)
+long STDCALL CBaseFilter::GetClassID(IBaseFilter * This,
+				      /* [out] */ CLSID *pClassID)
 {
     Debug printf("CBaseFilter::GetClassID() called\n");
     return E_NOTIMPL;
-}    
+}
 
-long STDCALL CBaseFilter::Stop ( 
-        IBaseFilter * This)
+long STDCALL CBaseFilter::Stop(IBaseFilter * This)
 {
     Debug printf("CBaseFilter::Stop() called\n");
     return E_NOTIMPL;
-}    
+}
 
-    
-long STDCALL CBaseFilter::Pause ( 
-        IBaseFilter * This)
+long STDCALL CBaseFilter::Pause(IBaseFilter * This)
 {
     Debug printf("CBaseFilter::Pause() called\n");
     return E_NOTIMPL;
-}    
-    
-long STDCALL CBaseFilter::Run ( 
-        IBaseFilter * This,
-        REFERENCE_TIME tStart)
+}
+
+long STDCALL CBaseFilter::Run(IBaseFilter * This,
+			      REFERENCE_TIME tStart)
 {
     Debug printf("CBaseFilter::Run() called\n");
     return E_NOTIMPL;
-}    
+}
 
-    
-long STDCALL CBaseFilter::GetState ( 
-        IBaseFilter * This,
-        /* [in] */ unsigned long dwMilliSecsTimeout,
-//        /* [out] */ FILTER_STATE *State)
-    	void* State)
+long STDCALL CBaseFilter::GetState(IBaseFilter * This,
+				   /* [in] */ unsigned long dwMilliSecsTimeout,
+				   // /* [out] */ FILTER_STATE *State)
+				   void* State)
 {
     Debug printf("CBaseFilter::GetState() called\n");
     return E_NOTIMPL;
-}    
+}
 
-    
-long STDCALL CBaseFilter::SetSyncSource ( 
-        IBaseFilter * This,
-        /* [in] */ IReferenceClock *pClock)
+long STDCALL CBaseFilter::SetSyncSource(IBaseFilter * This,
+					/* [in] */ IReferenceClock *pClock)
 {
     Debug printf("CBaseFilter::SetSyncSource() called\n");
     return E_NOTIMPL;
-}    
+}
 
-    
-long STDCALL CBaseFilter::GetSyncSource ( 
+long STDCALL CBaseFilter::GetSyncSource (
         IBaseFilter * This,
         /* [out] */ IReferenceClock **pClock)
 {
     Debug printf("CBaseFilter::GetSyncSource() called\n");
     return E_NOTIMPL;
-}    
+}
 
-    
-long STDCALL CBaseFilter::EnumPins ( 
+
+long STDCALL CBaseFilter::EnumPins (
         IBaseFilter * This,
         /* [out] */ IEnumPins **ppEnum)
 {
     Debug printf("CBaseFilter::EnumPins() called\n");
     *ppEnum=new CEnumPins(((CBaseFilter*)This)->pin, ((CBaseFilter*)This)->unused_pin);
     return 0;
-}    
+}
 
-    
-long STDCALL CBaseFilter::FindPin ( 
+
+long STDCALL CBaseFilter::FindPin (
         IBaseFilter * This,
         /* [string][in] */ const unsigned short* Id,
         /* [out] */ IPin **ppPin)
 {
     Debug printf("CBaseFilter::FindPin() called\n");
     return E_NOTIMPL;
-}    
+}
+
 
-    
-long STDCALL CBaseFilter::QueryFilterInfo ( 
+long STDCALL CBaseFilter::QueryFilterInfo (
         IBaseFilter * This,
 //        /* [out] */ FILTER_INFO *pInfo)
 	void* pInfo)
 {
     Debug printf("CBaseFilter::QueryFilterInfo() called\n");
     return E_NOTIMPL;
-}    
+}
+
 
-    
-long STDCALL CBaseFilter::JoinFilterGraph ( 
+long STDCALL CBaseFilter::JoinFilterGraph (
         IBaseFilter * This,
         /* [in] */ IFilterGraph *pGraph,
         /* [string][in] */ const unsigned short* pName)
 {
     Debug printf("CBaseFilter::JoinFilterGraph() called\n");
     return E_NOTIMPL;
-}    
+}
 
-    
-long STDCALL CBaseFilter::QueryVendorInfo ( 
+
+long STDCALL CBaseFilter::QueryVendorInfo (
         IBaseFilter * This,
         /* [string][out] */ unsigned short* *pVendorInfo)
 {
     Debug printf("CBaseFilter::QueryVendorInfo() called\n");
     return E_NOTIMPL;
-}    
+}
 
 
 CBaseFilter2::CBaseFilter2() : refcount(1)
@@ -461,7 +431,7 @@
     vt->Stop = Stop;
     vt->Pause = Pause;
     vt->Run = Run;
-    vt->GetState = GetState; 
+    vt->GetState = GetState;
     vt->SetSyncSource = SetSyncSource;
     vt->GetSyncSource = GetSyncSource;
     vt->EnumPins = EnumPins;
@@ -470,74 +440,40 @@
     vt->JoinFilterGraph = JoinFilterGraph;
     vt->QueryVendorInfo = QueryVendorInfo;
 }
-CRemotePin2::CRemotePin2(CBaseFilter2* p):parent(p),
-    refcount(1)
-{
-    vt=new IPin_vt;
-    memset(vt, 0, sizeof (IPin_vt));
-    vt->QueryInterface = QueryInterface;
-    vt->AddRef = AddRef;
-    vt->Release = Release;
-    vt->QueryPinInfo=QueryPinInfo;
-}
-CRemotePin::CRemotePin(CBaseFilter* pt, IPin* rpin): parent(pt), remote_pin(rpin),
-    refcount(1)
-{
-    vt=new IPin_vt;
-    memset(vt, 0, sizeof (IPin_vt));
-    vt->QueryInterface = QueryInterface;
-    vt->AddRef = AddRef;
-    vt->Release = Release;
-    vt->QueryDirection = QueryDirection;
-    vt->ConnectedTo = ConnectedTo;
-    vt->ConnectionMediaType = ConnectionMediaType;
-    vt->QueryPinInfo = QueryPinInfo;
-}
-
-
-
-
 
 
 
 
-
-
-
-
-long STDCALL CBaseFilter2::GetClassID ( 
+long STDCALL CBaseFilter2::GetClassID (
         IBaseFilter * This,
         /* [out] */ CLSID *pClassID)
 {
     Debug printf("CBaseFilter2::GetClassID() called\n");
     return E_NOTIMPL;
-}    
+}
 
-long STDCALL CBaseFilter2::Stop ( 
+long STDCALL CBaseFilter2::Stop (
         IBaseFilter * This)
 {
     Debug printf("CBaseFilter2::Stop() called\n");
     return E_NOTIMPL;
-}    
+}
 
-    
-long STDCALL CBaseFilter2::Pause ( 
-        IBaseFilter * This)
+
+long STDCALL CBaseFilter2::Pause (IBaseFilter * This)
 {
     Debug printf("CBaseFilter2::Pause() called\n");
     return E_NOTIMPL;
-}    
-    
-long STDCALL CBaseFilter2::Run ( 
-        IBaseFilter * This,
-        REFERENCE_TIME tStart)
+}
+
+long STDCALL CBaseFilter2::Run (IBaseFilter * This, REFERENCE_TIME tStart)
 {
     Debug printf("CBaseFilter2::Run() called\n");
     return E_NOTIMPL;
-}    
+}
+
 
-    
-long STDCALL CBaseFilter2::GetState ( 
+long STDCALL CBaseFilter2::GetState (
         IBaseFilter * This,
         /* [in] */ unsigned long dwMilliSecsTimeout,
 //        /* [out] */ FILTER_STATE *State)
@@ -545,123 +481,145 @@
 {
     Debug printf("CBaseFilter2::GetState() called\n");
     return E_NOTIMPL;
-}    
+}
+
 
-    
-long STDCALL CBaseFilter2::SetSyncSource ( 
+long STDCALL CBaseFilter2::SetSyncSource (
         IBaseFilter * This,
         /* [in] */ IReferenceClock *pClock)
 {
     Debug printf("CBaseFilter2::SetSyncSource() called\n");
     return E_NOTIMPL;
-}    
+}
 
-    
-long STDCALL CBaseFilter2::GetSyncSource ( 
+
+long STDCALL CBaseFilter2::GetSyncSource (
         IBaseFilter * This,
         /* [out] */ IReferenceClock **pClock)
 {
     Debug printf("CBaseFilter2::GetSyncSource() called\n");
     return E_NOTIMPL;
-}    
+}
+
 
-    
-long STDCALL CBaseFilter2::EnumPins ( 
+long STDCALL CBaseFilter2::EnumPins (
         IBaseFilter * This,
         /* [out] */ IEnumPins **ppEnum)
 {
     Debug printf("CBaseFilter2::EnumPins() called\n");
     *ppEnum=new CEnumPins(((CBaseFilter2*)This)->pin);
     return 0;
-}    
+}
+
 
-    
-long STDCALL CBaseFilter2::FindPin ( 
+long STDCALL CBaseFilter2::FindPin (
         IBaseFilter * This,
         /* [string][in] */ const unsigned short* Id,
         /* [out] */ IPin **ppPin)
 {
     Debug printf("CBaseFilter2::FindPin() called\n");
     return E_NOTIMPL;
-}    
+}
+
 
-    
-long STDCALL CBaseFilter2::QueryFilterInfo ( 
+long STDCALL CBaseFilter2::QueryFilterInfo (
         IBaseFilter * This,
 //        /* [out] */ FILTER_INFO *pInfo)
 	void* pInfo)
 {
     Debug printf("CBaseFilter2::QueryFilterInfo() called\n");
     return E_NOTIMPL;
-}    
+}
 
-    
-long STDCALL CBaseFilter2::JoinFilterGraph ( 
-        IBaseFilter * This,
-        /* [in] */ IFilterGraph *pGraph,
-        /* [string][in] */ const unsigned short* pName)
+
+long STDCALL CBaseFilter2::JoinFilterGraph(IBaseFilter * This,
+					   /* [in] */ IFilterGraph *pGraph,
+					   /* [string][in] */
+					   const unsigned short* pName)
 {
     Debug printf("CBaseFilter2::JoinFilterGraph() called\n");
     return E_NOTIMPL;
-}    
+}
 
-    
-long STDCALL CBaseFilter2::QueryVendorInfo ( 
-        IBaseFilter * This,
-        /* [string][out] */ unsigned short* *pVendorInfo)
+long STDCALL CBaseFilter2::QueryVendorInfo(IBaseFilter * This,
+					   /* [string][out] */
+					   unsigned short* *pVendorInfo)
 {
     Debug printf("CBaseFilter2::QueryVendorInfo() called\n");
     return E_NOTIMPL;
-}    
+}
 
-long STDCALL CRemotePin::ConnectionMediaType ( 
-    IPin * This,
-    /* [out] */ AM_MEDIA_TYPE *pmt)
+static long STDCALL CRemotePin_ConnectedTo(IPin * This, /* [out] */ IPin **pPin)
+{
+    Debug printf("CRemotePin::ConnectedTo called\n");
+    if (!pPin)
+	return E_INVALIDARG;
+    *pPin=((CRemotePin*)This)->remote_pin;
+    (*pPin)->vt->AddRef((IUnknown*)(*pPin));
+    return 0;
+}
+
+static long STDCALL CRemotePin_QueryDirection(IPin * This,
+					      /* [out] */ PIN_DIRECTION *pPinDir)
+{
+    Debug printf("CRemotePin::QueryDirection called\n");
+    if (!pPinDir)
+	return E_INVALIDARG;
+    *pPinDir=PINDIR_INPUT;
+    return 0;
+}
+
+static long STDCALL CRemotePin_ConnectionMediaType(IPin* This, /* [out] */ AM_MEDIA_TYPE* pmt)
 {
     Debug printf("CRemotePin::ConnectionMediaType() called\n");
     return E_NOTIMPL;
 }
 
-long STDCALL CRemotePin::QueryPinInfo ( 
-    IPin * This,
-    /* [out] */ PIN_INFO *pInfo)
+static long STDCALL CRemotePin_QueryPinInfo(IPin* This, /* [out] */ PIN_INFO* pInfo)
 {
     Debug printf("CRemotePin::QueryPinInfo() called\n");
     pInfo->dir=PINDIR_INPUT;
-    CBaseFilter* parent=((CRemotePin*)This)->parent;
-    pInfo->pFilter=parent;
-    parent->vt->AddRef((IUnknown*)parent);
+    CBaseFilter* lparent = ((CRemotePin*)This)->parent;
+    pInfo->pFilter = lparent;
+    lparent->vt->AddRef((IUnknown*)lparent);
     pInfo->achName[0]=0;
     return 0;
 }
-    long STDCALL CRemotePin2::QueryPinInfo ( 
-        IPin * This,
-        /* [out] */ PIN_INFO *pInfo)
-    {
-	Debug printf("CRemotePin2::QueryPinInfo called\n");
-	CBaseFilter2* parent=((CRemotePin2*)This)->parent;	
-	pInfo->pFilter=(IBaseFilter*)parent;
-	parent->vt->AddRef((IUnknown*)parent);
-	pInfo->dir=PINDIR_OUTPUT;
-	pInfo->achName[0]=0;
-	return 0;	
-    }
-    long STDCALL CRemotePin::ConnectedTo ( 
-        IPin * This,
-        /* [out] */ IPin **pPin)
-    {
-    	Debug printf("CRemotePin::ConnectedTo called\n");
-	if(!pPin)return 0x80004003;
-	*pPin=((CRemotePin*)This)->remote_pin;
-	(*pPin)->vt->AddRef((IUnknown*)(*pPin));
-	return 0;
-    }
-    long STDCALL CRemotePin::QueryDirection (
-        IPin * This,
-        /* [out] */ PIN_DIRECTION *pPinDir)
-    {
-	Debug printf("CRemotePin::QueryDirection called\n");
-	if(!pPinDir)return 0x80004003;
-	*pPinDir=PINDIR_INPUT;
-	return 0;
-    }
+
+
+static long STDCALL CRemotePin2_QueryPinInfo(IPin * This,
+				       /* [out] */ PIN_INFO *pInfo)
+{
+    Debug printf("CRemotePin2::QueryPinInfo called\n");
+    CBaseFilter2* lparent=((CRemotePin2*)This)->parent;
+    pInfo->pFilter=(IBaseFilter*)lparent;
+    lparent->vt->AddRef((IUnknown*)lparent);
+    pInfo->dir=PINDIR_OUTPUT;
+    pInfo->achName[0]=0;
+    return 0;
+}
+
+CRemotePin::CRemotePin(CBaseFilter* pt, IPin* rpin): parent(pt), remote_pin(rpin),
+    refcount(1)
+{
+    vt = new IPin_vt;
+    memset(vt, 0, sizeof(IPin_vt));
+    vt->QueryInterface = QueryInterface;
+    vt->AddRef = AddRef;
+    vt->Release = Release;
+    vt->QueryDirection = CRemotePin_QueryDirection;
+    vt->ConnectedTo = CRemotePin_ConnectedTo;
+    vt->ConnectionMediaType = CRemotePin_ConnectionMediaType;
+    vt->QueryPinInfo = CRemotePin_QueryPinInfo;
+}
+
+CRemotePin2::CRemotePin2(CBaseFilter2* p):parent(p),
+    refcount(1)
+{
+    vt = new IPin_vt;
+    memset(vt, 0, sizeof(IPin_vt));
+    vt->QueryInterface = QueryInterface;
+    vt->AddRef = AddRef;
+    vt->Release = Release;
+    vt->QueryPinInfo = CRemotePin2_QueryPinInfo;
+}

Index: inputpin.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/inputpin.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- inputpin.h	20 Mar 2001 00:05:42 -0000	1.1.1.1
+++ inputpin.h	16 Aug 2001 00:50:02 -0000	1.2
@@ -1,5 +1,6 @@
-#ifndef INPUTPIN_H
-#define INPUTPIN_H
+#ifndef DS_INPUTPIN_H
+#define DS_INPUTPIN_H
+
 #include "interfaces.h"
 #include "guids.h"
 #include "iunk.h"
@@ -17,61 +18,39 @@
     
     IPin* GetPin() {return pin;}
     IPin* GetUnusedPin() {return unused_pin;}
-//    static long STDCALL QueryInterface(IUnknown* This, GUID* iid, void** ppv);
-//    static long STDCALL AddRef(IUnknown* This);
-//    static long STDCALL Release(IUnknown* This);
 
-    static long STDCALL GetClassID ( 
-        IBaseFilter * This,
-        /* [out] */ CLSID *pClassID);
-    
-    static long STDCALL Stop ( 
-        IBaseFilter * This);
-    
-    static long STDCALL Pause ( 
-        IBaseFilter * This);
-    
-    static long STDCALL Run ( 
-        IBaseFilter * This,
-        REFERENCE_TIME tStart);
-    
-    static long STDCALL GetState ( 
-        IBaseFilter * This,
-        /* [in] */ unsigned long dwMilliSecsTimeout,
-//        /* [out] */ FILTER_STATE *State);
-    	void* State);
-    
-    static long STDCALL SetSyncSource ( 
-        IBaseFilter * This,
-        /* [in] */ IReferenceClock *pClock);
+    static long STDCALL GetClassID (IBaseFilter * This,
+				    /* [out] */ CLSID *pClassID);
     
-    static long STDCALL GetSyncSource ( 
-        IBaseFilter * This,
-        /* [out] */ IReferenceClock **pClock);
-    
-    static long STDCALL EnumPins ( 
-        IBaseFilter * This,
-        /* [out] */ IEnumPins **ppEnum);
-    
-    static long STDCALL FindPin ( 
-        IBaseFilter * This,
-        /* [string][in] */ const unsigned short* Id,
-        /* [out] */ IPin **ppPin);
-    
-    static long STDCALL QueryFilterInfo ( 
-        IBaseFilter * This,
-//        /* [out] */ FILTER_INFO *pInfo);
-	void* pInfo);
-    
-    static long STDCALL JoinFilterGraph ( 
-        IBaseFilter * This,
-        /* [in] */ IFilterGraph *pGraph,
-        /* [string][in] */ const unsigned short* pName);
-    
-    static long STDCALL QueryVendorInfo ( 
-        IBaseFilter * This,
-        /* [string][out] */ unsigned short* *pVendorInfo);
+    static long STDCALL Stop (IBaseFilter * This);
+    static long STDCALL Pause (IBaseFilter * This);
+    static long STDCALL Run (IBaseFilter * This, REFERENCE_TIME tStart);
+    static long STDCALL GetState (IBaseFilter * This,
+				  /* [in] */ unsigned long dwMilliSecsTimeout,
+				  // /* [out] */ FILTER_STATE *State);
+				  void* State);
+
+    static long STDCALL SetSyncSource (IBaseFilter * This,
+				       /* [in] */ IReferenceClock *pClock);
+    static long STDCALL GetSyncSource (IBaseFilter * This,
+				       /* [out] */ IReferenceClock **pClock);
+    static long STDCALL EnumPins (IBaseFilter * This,
+				  /* [out] */ IEnumPins **ppEnum);
+    static long STDCALL FindPin (IBaseFilter * This,
+				 /* [string][in] */ const unsigned short* Id,
+				 /* [out] */ IPin **ppPin);
+    static long STDCALL QueryFilterInfo (IBaseFilter * This,
+					 ///* [out] */ FILTER_INFO *pInfo);
+					 void* pInfo);
+    static long STDCALL JoinFilterGraph (IBaseFilter * This,
+					 /* [in] */ IFilterGraph *pGraph,
+					 /* [string][in] */
+					 const unsigned short* pName);
+    static long STDCALL QueryVendorInfo (IBaseFilter * This,
+					 /* [string][out] */
+					 unsigned short* *pVendorInfo);
 };
+
 class CInputPin: public IPin
 {
     AM_MEDIA_TYPE type;
@@ -214,52 +193,24 @@
         /* [string][out] */ unsigned short* *pVendorInfo);
 };
 
-class CRemotePin: public IPin
+
+struct CRemotePin: public IPin
 {
     CBaseFilter* parent;
     IPin* remote_pin;
     static GUID interfaces[];
     DECLARE_IUNKNOWN(CRemotePin)
-public:
     CRemotePin(CBaseFilter* pt, IPin* rpin);
     ~CRemotePin(){delete vt;}
-
-//    static long STDCALL QueryInterface(IUnknown* This, GUID* iid, void** ppv);
-//    static long STDCALL AddRef(IUnknown* This);
-//    static long STDCALL Release(IUnknown* This);
-    
-    static long STDCALL ConnectedTo ( 
-        IPin * This,
-        /* [out] */ IPin **pPin);
-
-    static long STDCALL QueryDirection (
-        IPin * This,
-        /* [out] */ PIN_DIRECTION *pPinDir);
-
-    static long STDCALL ConnectionMediaType ( 
-        IPin * This,
-        /* [out] */ AM_MEDIA_TYPE *pmt);
-    
-    static long STDCALL QueryPinInfo ( 
-        IPin * This,
-        /* [out] */ PIN_INFO *pInfo);
-    
 };
 
-
-class CRemotePin2: public IPin
+struct CRemotePin2: public IPin
 {
     CBaseFilter2* parent;
     static GUID interfaces[];
     DECLARE_IUNKNOWN(CRemotePin2)
-public:
     CRemotePin2(CBaseFilter2* parent);
     ~CRemotePin2(){delete vt;}
-    
-    static long STDCALL QueryPinInfo ( 
-        IPin * This,
-        /* [out] */ PIN_INFO *pInfo);
 };
 
-
-#endif
+#endif /* DS_INPUTPIN_H */

Index: interfaces.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/interfaces.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- interfaces.h	6 May 2001 21:43:45 -0000	1.3
+++ interfaces.h	16 Aug 2001 00:50:02 -0000	1.4
@@ -1,18 +1,19 @@
+#ifndef DS_INTERFACES_H
+#define DS_INTERFACES_H
+
 /*
 
-    Definition of important DirectShow interfaces.
-    Created using freely-available DirectX 8.0 SDK
-    ( http://msdn.microsoft.com )
+Definition of important DirectShow interfaces.
+Created using freely-available DirectX 8.0 SDK
+( http://msdn.microsoft.com )
 
 */
-#ifndef INTERFACES_H
-#define INTERFACES_H
 
-#include "guids.h"
-#include "default.h"
 #include <com.h>
+#include "guids.h"
+
 #ifndef STDCALL
-#define STDCALL __attribute__((__stdcall__))	
+#define STDCALL __attribute__((__stdcall__))
 #endif
 
 typedef GUID& REFIID;
@@ -30,6 +31,8 @@
 struct IMemInputPin;
 struct IMemAllocator;
 struct IMediaSample;
+struct IHidden;
+struct IHidden2;
 
 enum PIN_DIRECTION;
 
@@ -44,57 +47,33 @@
 
 struct IBaseFilter_vt: IUnknown_vt
 {
-    HRESULT STDCALL ( *GetClassID )( 
-        IBaseFilter * This,
-        /* [out] */ CLSID *pClassID);
-    
-    HRESULT STDCALL ( *Stop )( 
-        IBaseFilter * This);
-    
-    HRESULT STDCALL ( *Pause )( 
-        IBaseFilter * This);
-    
-    HRESULT STDCALL ( *Run )( 
-        IBaseFilter * This,
-        REFERENCE_TIME tStart);
-    
-    HRESULT STDCALL ( *GetState )( 
-        IBaseFilter * This,
-        /* [in] */ unsigned long dwMilliSecsTimeout,
-//        /* [out] */ FILTER_STATE *State);
-    	void* State);
-    
-    HRESULT STDCALL ( *SetSyncSource )( 
-        IBaseFilter * This,
-        /* [in] */ IReferenceClock *pClock);
-    
-    HRESULT STDCALL ( *GetSyncSource )( 
-        IBaseFilter * This,
-        /* [out] */ IReferenceClock **pClock);
-    
-    HRESULT STDCALL ( *EnumPins )( 
-        IBaseFilter * This,
-        /* [out] */ IEnumPins **ppEnum);
-    
-    HRESULT STDCALL ( *FindPin )( 
-        IBaseFilter * This,
-        /* [string][in] */ const unsigned short* Id,
-        /* [out] */ IPin **ppPin);
-    
-    HRESULT STDCALL ( *QueryFilterInfo )( 
-        IBaseFilter * This,
-//        /* [out] */ FILTER_INFO *pInfo);
-	void* pInfo);
-    
-    HRESULT STDCALL ( *JoinFilterGraph )( 
-        IBaseFilter * This,
-        /* [in] */ IFilterGraph *pGraph,
-        /* [string][in] */ const unsigned short* pName);
-    
-    HRESULT STDCALL ( *QueryVendorInfo )( 
-        IBaseFilter * This,
-        /* [string][out] */ unsigned short* *pVendorInfo);
-    
+    HRESULT STDCALL ( *GetClassID )(IBaseFilter * This,
+				    /* [out] */ CLSID *pClassID);
+    HRESULT STDCALL ( *Stop )(IBaseFilter * This);
+    HRESULT STDCALL ( *Pause )(IBaseFilter * This);
+    HRESULT STDCALL ( *Run )(IBaseFilter * This,
+			     REFERENCE_TIME tStart);
+    HRESULT STDCALL ( *GetState )(IBaseFilter * This,
+				  /* [in] */ unsigned long dwMilliSecsTimeout,
+				  ///* [out] */ FILTER_STATE *State);
+				  void* State);
+    HRESULT STDCALL ( *SetSyncSource )(IBaseFilter * This,
+				       /* [in] */ IReferenceClock *pClock);
+    HRESULT STDCALL ( *GetSyncSource )(IBaseFilter * This,
+				       /* [out] */ IReferenceClock **pClock);
+    HRESULT STDCALL ( *EnumPins )(IBaseFilter * This,
+				  /* [out] */ IEnumPins **ppEnum);
+    HRESULT STDCALL ( *FindPin )(IBaseFilter * This,
+				 /* [string][in] */ const unsigned short* Id,
+				 /* [out] */ IPin **ppPin);
+    HRESULT STDCALL ( *QueryFilterInfo )(IBaseFilter * This,
+					 // /* [out] */ FILTER_INFO *pInfo);
+					 void* pInfo);
+    HRESULT STDCALL ( *JoinFilterGraph )(IBaseFilter * This,
+					 /* [in] */ IFilterGraph *pGraph,
+					 /* [string][in] */ const unsigned short* pName);
+    HRESULT STDCALL ( *QueryVendorInfo )(IBaseFilter * This,
+					 /* [string][out] */ unsigned short* *pVendorInfo);
 };
 
 struct IBaseFilter
@@ -102,96 +81,56 @@
     struct IBaseFilter_vt *vt;
 };
 
+
 struct IEnumPins_vt: IUnknown_vt
 {
-    HRESULT STDCALL ( *Next )( 
-        IEnumPins * This,
-        /* [in] */ unsigned long cPins,
-        /* [size_is][out] */ IPin **ppPins,
-        /* [out] */ unsigned long *pcFetched);
-    
-    HRESULT STDCALL ( *Skip )( 
-        IEnumPins * This,
-        /* [in] */ unsigned long cPins);
-    
-    HRESULT STDCALL ( *Reset )( 
-        IEnumPins * This);
-    
-    HRESULT STDCALL ( *Clone )( 
-        IEnumPins * This,
-        /* [out] */ IEnumPins **ppEnum);
-        
+    HRESULT STDCALL ( *Next )(IEnumPins * This,
+			      /* [in] */ unsigned long cPins,
+			      /* [size_is][out] */ IPin **ppPins,
+			      /* [out] */ unsigned long *pcFetched);
+    HRESULT STDCALL ( *Skip )(IEnumPins * This,
+			      /* [in] */ unsigned long cPins);
+    HRESULT STDCALL ( *Reset )(IEnumPins * This);
+    HRESULT STDCALL ( *Clone )(IEnumPins * This,
+			       /* [out] */ IEnumPins **ppEnum);
 };
 
 struct IEnumPins
 {
-     struct IEnumPins_vt *vt;
+    struct IEnumPins_vt *vt;
 };
 
 
 struct IPin_vt: IUnknown_vt
 {
-        HRESULT STDCALL ( *Connect )( 
-            IPin * This,
-            /* [in] */ IPin *pReceivePin,
-            /* [in] */ /*const*/ AM_MEDIA_TYPE *pmt);
-        
-        HRESULT STDCALL ( *ReceiveConnection )( 
-            IPin * This,
-            /* [in] */ IPin *pConnector,
-            /* [in] */ const AM_MEDIA_TYPE *pmt);
-        
-        HRESULT STDCALL ( *Disconnect )( 
-            IPin * This);
-        
-        HRESULT STDCALL ( *ConnectedTo )( 
-            IPin * This,
-            /* [out] */ IPin **pPin);
-        
-        HRESULT STDCALL ( *ConnectionMediaType )( 
-            IPin * This,
-            /* [out] */ AM_MEDIA_TYPE *pmt);
-        
-        HRESULT STDCALL ( *QueryPinInfo )( 
-            IPin * This,
-            /* [out] */ PIN_INFO *pInfo);
-        
-        HRESULT STDCALL ( *QueryDirection )( 
-            IPin * This,
-            /* [out] */ PIN_DIRECTION *pPinDir);
-        
-        HRESULT STDCALL ( *QueryId )( 
-            IPin * This,
-            /* [out] */ unsigned short* *Id);
-        
-        HRESULT STDCALL ( *QueryAccept )( 
-            IPin * This,
-            /* [in] */ const AM_MEDIA_TYPE *pmt);
-        
-        HRESULT STDCALL ( *EnumMediaTypes )( 
-            IPin * This,
-            /* [out] */ IEnumMediaTypes **ppEnum);
-        
-        HRESULT STDCALL ( *QueryInternalConnections )( 
-            IPin * This,
-            /* [out] */ IPin **apPin,
-            /* [out][in] */ unsigned long *nPin);
-        
-        HRESULT STDCALL ( *EndOfStream )( 
-            IPin * This);
-        
-        HRESULT STDCALL ( *BeginFlush )( 
-            IPin * This);
-        
-        HRESULT STDCALL ( *EndFlush )( 
-            IPin * This);
-        
-        HRESULT STDCALL ( *NewSegment )( 
-            IPin * This,
-            /* [in] */ REFERENCE_TIME tStart,
-            /* [in] */ REFERENCE_TIME tStop,
-            /* [in] */ double dRate);
-        
+    HRESULT STDCALL ( *Connect )(IPin * This,
+				 /* [in] */ IPin *pReceivePin,
+				 /* [in] */ /*const*/ AM_MEDIA_TYPE *pmt);
+    HRESULT STDCALL ( *ReceiveConnection )(IPin * This,
+					   /* [in] */ IPin *pConnector,
+					   /* [in] */ const AM_MEDIA_TYPE *pmt);
+    HRESULT STDCALL ( *Disconnect )(IPin * This);
+    HRESULT STDCALL ( *ConnectedTo )(IPin * This, /* [out] */ IPin **pPin);
+    HRESULT STDCALL ( *ConnectionMediaType )(IPin * This,
+					     /* [out] */ AM_MEDIA_TYPE *pmt);
+    HRESULT STDCALL ( *QueryPinInfo )(IPin * This, /* [out] */ PIN_INFO *pInfo);
+    HRESULT STDCALL ( *QueryDirection )(IPin * This,
+					/* [out] */ PIN_DIRECTION *pPinDir);
+    HRESULT STDCALL ( *QueryId )(IPin * This, /* [out] */ unsigned short* *Id);
+    HRESULT STDCALL ( *QueryAccept )(IPin * This,
+				     /* [in] */ const AM_MEDIA_TYPE *pmt);
+    HRESULT STDCALL ( *EnumMediaTypes )(IPin * This,
+					/* [out] */ IEnumMediaTypes **ppEnum);
+    HRESULT STDCALL ( *QueryInternalConnections )(IPin * This,
+						  /* [out] */ IPin **apPin,
+						  /* [out][in] */ unsigned long *nPin);
+    HRESULT STDCALL ( *EndOfStream )(IPin * This);
+    HRESULT STDCALL ( *BeginFlush )(IPin * This);
+    HRESULT STDCALL ( *EndFlush )(IPin * This);
+    HRESULT STDCALL ( *NewSegment )(IPin * This,
+				    /* [in] */ REFERENCE_TIME tStart,
+				    /* [in] */ REFERENCE_TIME tStop,
+				    /* [in] */ double dRate);
 };
 
 struct IPin
@@ -199,24 +138,18 @@
     IPin_vt *vt;
 };
 
+
 struct IEnumMediaTypes_vt: IUnknown_vt
 {
-        HRESULT STDCALL ( *Next )( 
-            IEnumMediaTypes * This,
-            /* [in] */ unsigned long cMediaTypes,
-            /* [size_is][out] */ AM_MEDIA_TYPE **ppMediaTypes,
-            /* [out] */ unsigned long *pcFetched);
-        
-        HRESULT STDCALL ( *Skip )( 
-            IEnumMediaTypes * This,
-            /* [in] */ unsigned long cMediaTypes);
-        
-        HRESULT STDCALL ( *Reset )( 
-            IEnumMediaTypes * This);
-        
-        HRESULT STDCALL ( *Clone )( 
-            IEnumMediaTypes * This,
-            /* [out] */ IEnumMediaTypes **ppEnum);
+    HRESULT STDCALL ( *Next )(IEnumMediaTypes * This,
+			      /* [in] */ unsigned long cMediaTypes,
+			      /* [size_is][out] */ AM_MEDIA_TYPE **ppMediaTypes,
+			      /* [out] */ unsigned long *pcFetched);
+    HRESULT STDCALL ( *Skip )(IEnumMediaTypes * This,
+			      /* [in] */ unsigned long cMediaTypes);
+    HRESULT STDCALL ( *Reset )(IEnumMediaTypes * This);
+    HRESULT STDCALL ( *Clone )(IEnumMediaTypes * This,
+			       /* [out] */ IEnumMediaTypes **ppEnum);
 };
 
 struct IEnumMediaTypes
@@ -224,34 +157,23 @@
     IEnumMediaTypes_vt *vt;
 };
 
-    
+
 struct IMemInputPin_vt: IUnknown_vt
 {
-    HRESULT STDCALL ( *GetAllocator )( 
-        IMemInputPin * This,
-        /* [out] */ IMemAllocator **ppAllocator);
-    
-    HRESULT STDCALL ( *NotifyAllocator )( 
-        IMemInputPin * This,
-        /* [in] */ IMemAllocator *pAllocator,
-        /* [in] */ int bReadOnly);
-    
-    HRESULT STDCALL ( *GetAllocatorRequirements )( 
-            IMemInputPin * This,
-        /* [out] */ ALLOCATOR_PROPERTIES *pProps);
-    
-    HRESULT STDCALL ( *Receive )( 
-        IMemInputPin * This,
-        /* [in] */ IMediaSample *pSample);
-    
-    HRESULT STDCALL ( *ReceiveMultiple )( 
-        IMemInputPin * This,
-        /* [size_is][in] */ IMediaSample **pSamples,
-        /* [in] */ long nSamples,
-        /* [out] */ long *nSamplesProcessed);
-    
-    HRESULT STDCALL ( *ReceiveCanBlock )( 
-        IMemInputPin * This);
+    HRESULT STDCALL ( *GetAllocator )(IMemInputPin * This,
+				      /* [out] */ IMemAllocator **ppAllocator);
+    HRESULT STDCALL ( *NotifyAllocator )(IMemInputPin * This,
+					 /* [in] */ IMemAllocator *pAllocator,
+					 /* [in] */ int bReadOnly);
+    HRESULT STDCALL ( *GetAllocatorRequirements )(IMemInputPin * This,
+						  /* [out] */ ALLOCATOR_PROPERTIES *pProps);
+    HRESULT STDCALL ( *Receive )(IMemInputPin * This,
+				 /* [in] */ IMediaSample *pSample);
+    HRESULT STDCALL ( *ReceiveMultiple )(IMemInputPin * This,
+					 /* [size_is][in] */ IMediaSample **pSamples,
+					 /* [in] */ long nSamples,
+					 /* [out] */ long *nSamplesProcessed);
+    HRESULT STDCALL ( *ReceiveCanBlock )(IMemInputPin * This);
 };
 
 struct IMemInputPin
@@ -259,35 +181,23 @@
     IMemInputPin_vt *vt;
 };
 
-    
 
 struct IMemAllocator_vt: IUnknown_vt
 {
-    HRESULT STDCALL ( *SetProperties )( 
-        IMemAllocator * This,
-        /* [in] */ ALLOCATOR_PROPERTIES *pRequest,
-        /* [out] */ ALLOCATOR_PROPERTIES *pActual);
-    
-    HRESULT STDCALL ( *GetProperties )( 
-        IMemAllocator * This,
-        /* [out] */ ALLOCATOR_PROPERTIES *pProps);
-    
-    HRESULT STDCALL ( *Commit )( 
-        IMemAllocator * This);
-    
-    HRESULT STDCALL ( *Decommit )( 
-        IMemAllocator * This);
-    
-    HRESULT STDCALL ( *GetBuffer )( 
-        IMemAllocator * This,
-        /* [out] */ IMediaSample **ppBuffer,
-        /* [in] */ REFERENCE_TIME *pStartTime,
-        /* [in] */ REFERENCE_TIME *pEndTime,
-        /* [in] */ unsigned long dwFlags);
-    
-        HRESULT STDCALL ( *ReleaseBuffer )( 
-        IMemAllocator * This,
-        /* [in] */ IMediaSample *pBuffer);
+    HRESULT STDCALL ( *SetProperties )(IMemAllocator * This,
+				       /* [in] */ ALLOCATOR_PROPERTIES *pRequest,
+				       /* [out] */ ALLOCATOR_PROPERTIES *pActual);
+    HRESULT STDCALL ( *GetProperties )(IMemAllocator * This,
+				       /* [out] */ ALLOCATOR_PROPERTIES *pProps);
+    HRESULT STDCALL ( *Commit )(IMemAllocator * This);
+    HRESULT STDCALL ( *Decommit )(IMemAllocator * This);
+    HRESULT STDCALL ( *GetBuffer )(IMemAllocator * This,
+				   /* [out] */ IMediaSample **ppBuffer,
+				   /* [in] */ REFERENCE_TIME *pStartTime,
+				   /* [in] */ REFERENCE_TIME *pEndTime,
+				   /* [in] */ unsigned long dwFlags);
+    HRESULT STDCALL ( *ReleaseBuffer )(IMemAllocator * This,
+				       /* [in] */ IMediaSample *pBuffer);
 };
 
 struct IMemAllocator
@@ -295,99 +205,68 @@
     IMemAllocator_vt *vt;
 };
 
+
 struct IMediaSample_vt: IUnknown_vt
-{
-    HRESULT STDCALL ( *GetPointer )( 
-        IMediaSample * This,
-        /* [out] */ unsigned char **ppBuffer);
-    
-    long STDCALL ( *GetSize )( 
-        IMediaSample * This);
-    
-    HRESULT STDCALL ( *GetTime )( 
-        IMediaSample * This,
-        /* [out] */ REFERENCE_TIME *pTimeStart,
-        /* [out] */ REFERENCE_TIME *pTimeEnd);
-    
-    HRESULT STDCALL ( *SetTime )( 
-        IMediaSample * This,
-        /* [in] */ REFERENCE_TIME *pTimeStart,
-        /* [in] */ REFERENCE_TIME *pTimeEnd);
-    
-    HRESULT STDCALL ( *IsSyncPoint )( 
-        IMediaSample * This);
-    
-    HRESULT STDCALL ( *SetSyncPoint )( 
-        IMediaSample * This,
-        long bIsSyncPoint);
-    
-    HRESULT STDCALL ( *IsPreroll )( 
-        IMediaSample * This);
-    
-    HRESULT STDCALL ( *SetPreroll )( 
-        IMediaSample * This,
-        long bIsPreroll);
-    
-    long STDCALL ( *GetActualDataLength )( 
-        IMediaSample * This);
-    
-    HRESULT STDCALL ( *SetActualDataLength )( 
-        IMediaSample * This,
-        long __MIDL_0010);
-    
-    HRESULT STDCALL ( *GetMediaType )( 
-        IMediaSample * This,
-        AM_MEDIA_TYPE **ppMediaType);
-    
-    HRESULT STDCALL ( *SetMediaType )( 
-        IMediaSample * This,
-        AM_MEDIA_TYPE *pMediaType);
-    
-    HRESULT STDCALL ( *IsDiscontinuity )( 
-        IMediaSample * This);
-    
-    HRESULT STDCALL ( *SetDiscontinuity )( 
-        IMediaSample * This,
-        long bDiscontinuity);
-    
-    HRESULT STDCALL ( *GetMediaTime )( 
-        IMediaSample * This,
-        /* [out] */ long long *pTimeStart,
-        /* [out] */ long long *pTimeEnd);
-    
-    HRESULT STDCALL ( *SetMediaTime )( 
-        IMediaSample * This,
-        /* [in] */ long long *pTimeStart,
-        /* [in] */ long long *pTimeEnd);
-};
-
-struct IMediaSample
-{
-    struct IMediaSample_vt *vt;
-};
-
-struct IHidden;    
+{
+    HRESULT STDCALL ( *GetPointer )(IMediaSample * This,
+				    /* [out] */ unsigned char **ppBuffer);
+    long STDCALL ( *GetSize )(IMediaSample * This);
+    HRESULT STDCALL ( *GetTime )(IMediaSample * This,
+				 /* [out] */ REFERENCE_TIME *pTimeStart,
+				 /* [out] */ REFERENCE_TIME *pTimeEnd);
+    HRESULT STDCALL ( *SetTime )(IMediaSample * This,
+				 /* [in] */ REFERENCE_TIME *pTimeStart,
+				 /* [in] */ REFERENCE_TIME *pTimeEnd);
+    HRESULT STDCALL ( *IsSyncPoint )(IMediaSample * This);
+    HRESULT STDCALL ( *SetSyncPoint )(IMediaSample * This,
+				      long bIsSyncPoint);
+    HRESULT STDCALL ( *IsPreroll )(IMediaSample * This);
+    HRESULT STDCALL ( *SetPreroll )(IMediaSample * This,
+				    long bIsPreroll);
+    long STDCALL ( *GetActualDataLength )(IMediaSample * This);
+    HRESULT STDCALL ( *SetActualDataLength )(IMediaSample * This,
+					     long __MIDL_0010);
+    HRESULT STDCALL ( *GetMediaType )(IMediaSample * This,
+				      AM_MEDIA_TYPE **ppMediaType);
+    HRESULT STDCALL ( *SetMediaType )(IMediaSample * This,
+				      AM_MEDIA_TYPE *pMediaType);
+    HRESULT STDCALL ( *IsDiscontinuity )(IMediaSample * This);
+    HRESULT STDCALL ( *SetDiscontinuity )(IMediaSample * This,
+					  long bDiscontinuity);
+    HRESULT STDCALL ( *GetMediaTime )(IMediaSample * This,
+				      /* [out] */ long long *pTimeStart,
+				      /* [out] */ long long *pTimeEnd);
+    HRESULT STDCALL ( *SetMediaTime )(IMediaSample * This,
+				      /* [in] */ long long *pTimeStart,
+				      /* [in] */ long long *pTimeEnd);
+};
+
+struct IMediaSample
+{
+    struct IMediaSample_vt *vt;
+};
+
+
 struct IHidden_vt: IUnknown_vt
 {
-    HRESULT STDCALL ( *GetSmth )(IHidden * This,
 int* pv);
-    HRESULT STDCALL ( *SetSmth )(IHidden * This,
 int v1, int v2);
-    HRESULT STDCALL ( *GetSmth2 )(IHidden * This,
 int* pv);
-    HRESULT STDCALL ( *SetSmth2 )(IHidden * This,
 int v1, int v2);
-    HRESULT STDCALL ( *GetSmth3 )(IHidden * This,
 int* pv);
-    HRESULT STDCALL ( *SetSmth3 )(IHidden * This,
 int v1, int v2);
-    HRESULT STDCALL ( *GetSmth4 )(IHidden * This,
 int* pv);
-    HRESULT STDCALL ( *SetSmth4 )(IHidden * This,
 int v1, int v2);
-    HRESULT STDCALL ( *GetSmth5 )(IHidden * This,
 int* pv);
-    HRESULT STDCALL ( *SetSmth5 )(IHidden * This,
 int v1, int v2);
-    HRESULT STDCALL ( *GetSmth6 )(IHidden * This,
 int* pv);
-};
-    
+    HRESULT STDCALL ( *GetSmth )(IHidden * This, int* pv);
+    HRESULT STDCALL ( *SetSmth )(IHidden * This, int v1, int v2);
+    HRESULT STDCALL ( *GetSmth2 )(IHidden * This, int* pv);
+    HRESULT STDCALL ( *SetSmth2 )(IHidden * This, int v1, int v2);
+    HRESULT STDCALL ( *GetSmth3 )(IHidden * This, int* pv);
+    HRESULT STDCALL ( *SetSmth3 )(IHidden * This, int v1, int v2);
+    HRESULT STDCALL ( *GetSmth4 )(IHidden * This, int* pv);
+    HRESULT STDCALL ( *SetSmth4 )(IHidden * This, int v1, int v2);
+    HRESULT STDCALL ( *GetSmth5 )(IHidden * This, int* pv);
+    HRESULT STDCALL ( *SetSmth5 )(IHidden * This, int v1, int v2);
+    HRESULT STDCALL ( *GetSmth6 )(IHidden * This, int* pv);
+};
+
 struct IHidden
 {
     struct IHidden_vt *vt;
 };
 
-struct IHidden2;
 struct IHidden2_vt: IUnknown_vt
 {
     HRESULT STDCALL (*unk1) ();
@@ -399,8 +278,10 @@
     HRESULT STDCALL (*unk7) ();
     HRESULT STDCALL (*unk8) ();
 };
+
 struct IHidden2
 {
     struct IHidden2_vt *vt;
 };
-#endif
+
+#endif  /* DS_INTERFACES_H */

Index: iunk.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/iunk.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- iunk.h	20 Mar 2001 00:05:44 -0000	1.1.1.1
+++ iunk.h	16 Aug 2001 00:50:02 -0000	1.2
@@ -1,20 +1,22 @@
-#ifndef _iunk_h
-#define _iunk_h
+#ifndef DS_IUNK_H
+#define DS_IUNK_H
+
 #include "interfaces.h"
 #include "guids.h"
+
 #define DECLARE_IUNKNOWN(CLASSNAME) \
     int refcount; \
-    static long STDCALL QueryInterface (IUnknown * This, GUID* riid, void **ppvObject); \
+    static long STDCALL QueryInterface(IUnknown * This, GUID* riid, void **ppvObject); \
     static long STDCALL AddRef (IUnknown * This); \
     static long STDCALL Release (IUnknown * This); 
     
 #define IMPLEMENT_IUNKNOWN(CLASSNAME) 		\
-long STDCALL CLASSNAME ::QueryInterface (IUnknown * This, GUID* riid, void **ppvObject) \
+long STDCALL CLASSNAME ::QueryInterface(IUnknown * This, GUID* riid, void **ppvObject) \
 { \
     Debug printf(#CLASSNAME "::QueryInterface() called\n");\
-    if(!ppvObject)return 0x80004003; 		\
-    CLASSNAME * me=( CLASSNAME *)This; 		\
-    int i=0; 					\
+    if (!ppvObject) return 0x80004003; 		\
+    CLASSNAME * me = (CLASSNAME *)This;		\
+    unsigned int i = 0;				\
     for(const GUID* r=me->interfaces; i<sizeof(CLASSNAME ::interfaces)/sizeof(CLASSNAME ::interfaces[0]); r++, i++) \
 	if(!memcmp(r, riid, 16)) 		\
 	{ 					\
@@ -23,7 +25,7 @@
 	    return 0; 				\
 	} 					\
     Debug printf("Failed\n");			\
-    return 0x80004002; 				\
+    return E_NOINTERFACE;			\
 } 						\
 						\
 long STDCALL CLASSNAME ::AddRef ( 		\
@@ -44,4 +46,4 @@
     return 0; 					\
 }
 
-#endif
+#endif /* DS_IUNK_H */

Index: outputpin.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/outputpin.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- outputpin.cpp	9 Jun 2001 00:10:50 -0000	1.3
+++ outputpin.cpp	16 Aug 2001 00:50:02 -0000	1.4
@@ -1,13 +1,10 @@
-
-#include <cstdio>
-#include <cstring>
-//#include <string>
-
 #include "outputpin.h"
 #include "allocator.h"
 #include "iunk.h"
+#include <wine/winerror.h>
+#include <cstdio>
+#include <cstring>
 
-#define E_NOTIMPL 0x80004001
 /*
     An object beyond interface IEnumMediaTypes.
     Returned by COutputPin through call IPin::EnumMediaTypes().
@@ -17,164 +14,149 @@
 
 class CEnumMediaTypes: public IEnumMediaTypes
 {
+public:
     AM_MEDIA_TYPE type;
     static GUID interfaces[];
     DECLARE_IUNKNOWN(CEnumMediaTypes)
-public:
     CEnumMediaTypes(const AM_MEDIA_TYPE&);
-    ~CEnumMediaTypes(){delete vt;}
-    static HRESULT STDCALL Next ( 
-        IEnumMediaTypes * This,
-        /* [in] */ ULONG cMediaTypes,
-        /* [size_is][out] */ AM_MEDIA_TYPE **ppMediaTypes,
-        /* [out] */ ULONG *pcFetched);
-    
-    static HRESULT STDCALL Skip ( 
-        IEnumMediaTypes * This,
-        /* [in] */ ULONG cMediaTypes);
-    
-    static HRESULT STDCALL Reset ( 
-        IEnumMediaTypes * This);
-    
-    static HRESULT STDCALL Clone ( 
-        IEnumMediaTypes * This,
-        /* [out] */ IEnumMediaTypes **ppEnum);
-
+    ~CEnumMediaTypes() {delete vt;}
 };
+
 GUID CEnumMediaTypes::interfaces[]=
 {
     IID_IUnknown,
     IID_IEnumMediaTypes,
 };
+
+// IPin->IUnknown methods
 IMPLEMENT_IUNKNOWN(CEnumMediaTypes)
-CEnumMediaTypes::CEnumMediaTypes(const AM_MEDIA_TYPE& type)
-    :refcount(1)
-{
-    this->type=type;
-    vt=new IEnumMediaTypes_vt;
-    vt->QueryInterface = QueryInterface;
-    vt->AddRef = AddRef;
-    vt->Release = Release;
-    vt->Next = Next; 
-    vt->Skip = Skip; 
-    vt->Reset = Reset;
-    vt->Clone = Clone; 
-}
 
-HRESULT STDCALL CEnumMediaTypes::Next ( 
-    IEnumMediaTypes * This,
-    /* [in] */ ULONG cMediaTypes,
-    /* [size_is][out] */ AM_MEDIA_TYPE **ppMediaTypes,
-    /* [out] */ ULONG *pcFetched)
+
+static HRESULT STDCALL CEnumMediaTypes_Next(IEnumMediaTypes * This,
+					    /* [in] */ ULONG cMediaTypes,
+					    /* [size_is][out] */ AM_MEDIA_TYPE **ppMediaTypes,
+					    /* [out] */ ULONG *pcFetched)
 {
     AM_MEDIA_TYPE& type=((CEnumMediaTypes*)This)->type;
     Debug printf("CEnumMediaTypes::Next() called\n");
-    if(!ppMediaTypes)return 0x80004003;
-    if(!pcFetched && (cMediaTypes!=1))return 0x80004003;
-    if(cMediaTypes<=0)return 0;
-    
-    if(pcFetched)*pcFetched=1;
-    ppMediaTypes[0]=(AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
+    if (!ppMediaTypes)
+	return E_INVALIDARG;
+    if (!pcFetched && (cMediaTypes!=1))
+	return E_INVALIDARG;
+    if (cMediaTypes <= 0)
+	return 0;
+
+    if (pcFetched)
+	*pcFetched=1;
+    ppMediaTypes[0] = (AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
     memcpy(*ppMediaTypes, &type, sizeof(AM_MEDIA_TYPE));
-    if(ppMediaTypes[0]->pbFormat)
+    if (ppMediaTypes[0]->pbFormat)
     {
 	ppMediaTypes[0]->pbFormat=(char *)CoTaskMemAlloc(ppMediaTypes[0]->cbFormat);
 	memcpy(ppMediaTypes[0]->pbFormat, type.pbFormat, ppMediaTypes[0]->cbFormat);
     }
-    if(cMediaTypes==1)return 0;
+    if (cMediaTypes == 1)
+	return 0;
     return 1;
 }
-/*
-    I expect that these methods are unused.
-*/
-HRESULT STDCALL CEnumMediaTypes::Skip ( 
-    IEnumMediaTypes * This,
-    /* [in] */ ULONG cMediaTypes)
+
+/* I expect that these methods are unused. */
+static HRESULT STDCALL CEnumMediaTypes_Skip(IEnumMediaTypes * This,
+					    /* [in] */ ULONG cMediaTypes)
 {
     Debug printf("CEnumMediaTypes::Skip() called\n");
     return E_NOTIMPL;
 }
 
-HRESULT STDCALL CEnumMediaTypes::Reset ( 
-    IEnumMediaTypes * This)
+static HRESULT STDCALL CEnumMediaTypes_Reset(IEnumMediaTypes * This)
 {
     Debug printf("CEnumMediaTypes::Reset() called\n");
     return 0;
 }
 
-HRESULT STDCALL CEnumMediaTypes::Clone ( 
-    IEnumMediaTypes * This,
-    /* [out] */ IEnumMediaTypes **ppEnum)
+static HRESULT STDCALL CEnumMediaTypes_Clone(IEnumMediaTypes * This,
+				      /* [out] */ IEnumMediaTypes **ppEnum)
 {
     Debug printf("CEnumMediaTypes::Clone() called\n");
     return E_NOTIMPL;
 }
 
-/*
-    Implementation of output pin object.
-*/
 
-// Constructor
+CEnumMediaTypes::CEnumMediaTypes(const AM_MEDIA_TYPE& amtype)
+{
+    refcount = 1;
+    type = amtype;
 
-COutputPin::COutputPin(const AM_MEDIA_TYPE& vh) :refcount(1), type(vh), remote(0), frame_pointer(0), frame_size_pointer(0)
+    vt = new IEnumMediaTypes_vt;
+    vt->QueryInterface = QueryInterface;
+    vt->AddRef = AddRef;
+    vt->Release = Release;
+    vt->Next = CEnumMediaTypes_Next;
+    vt->Skip = CEnumMediaTypes_Skip;
+    vt->Reset = CEnumMediaTypes_Reset;
+    vt->Clone = CEnumMediaTypes_Clone;
+}
+
+
+static HRESULT STDCALL COutputPin_AddRef(IUnknown* This)
 {
-    IPin::vt = new IPin_vt;
-    IPin::vt->QueryInterface = QueryInterface;
-    IPin::vt->AddRef = AddRef;
-    IPin::vt->Release = Release;
-    IPin::vt->Connect = Connect;
-    IPin::vt->ReceiveConnection = ReceiveConnection;
-    IPin::vt->Disconnect=Disconnect;
-    IPin::vt->ConnectedTo = ConnectedTo;
-    IPin::vt->ConnectionMediaType = ConnectionMediaType;
-    IPin::vt->QueryPinInfo = QueryPinInfo;
-    IPin::vt->QueryDirection = QueryDirection;
-    IPin::vt->QueryId = QueryId;
-    IPin::vt->QueryAccept = QueryAccept;
-    IPin::vt->EnumMediaTypes = EnumMediaTypes;
-    IPin::vt->QueryInternalConnections = QueryInternalConnections;
-    IPin::vt->EndOfStream = EndOfStream;
-    IPin::vt->BeginFlush = BeginFlush;
-    IPin::vt->EndFlush = EndFlush;
-    IPin::vt->NewSegment = NewSegment;
-
-    IMemInputPin::vt=new IMemInputPin_vt;
-    IMemInputPin::vt->QueryInterface = M_QueryInterface;
-    IMemInputPin::vt->AddRef = M_AddRef;
-    IMemInputPin::vt->Release = M_Release;
-    IMemInputPin::vt->GetAllocator = GetAllocator;
-    IMemInputPin::vt->NotifyAllocator = NotifyAllocator;
-    IMemInputPin::vt->GetAllocatorRequirements = GetAllocatorRequirements;
-    IMemInputPin::vt->Receive = Receive;
-    IMemInputPin::vt->ReceiveMultiple = ReceiveMultiple;
-    IMemInputPin::vt->ReceiveCanBlock = ReceiveCanBlock;
-    
-    pAllocator = 0;
-    frame_pointer = 0;
+    Debug printf("COutputPin_AddRef(%p) called (%d)\n",
+		 This, ((COutputPin*)This)->refcount);
+    ((COutputPin*)This)->refcount++;
+    return 0;
 }
 
-COutputPin::~COutputPin()
+static HRESULT STDCALL COutputPin_Release(IUnknown* This)
 {
-    delete IPin::vt;
-    delete IMemInputPin::vt;
+    Debug printf("COutputPin_Release(%p) called (%d)\n",
+		 This, ((COutputPin*)This)->refcount);
+    if (--((COutputPin*)This)->refcount<=0)
+	delete (COutputPin*)This;
+
+    return 0;
 }
 
-// IPin->IUnknown methods
+static HRESULT STDCALL COutputPin_M_AddRef(IUnknown* This)
+{
+    COutputMemPin* p = (COutputMemPin*) This;
+    Debug printf("COutputPin_MAddRef(%p) called (%p,   %d)\n",
+		 p, p->parent, p->parent->refcount);
+    p->parent->refcount++;
+    return 0;
+}
 
-HRESULT STDCALL COutputPin::QueryInterface(IUnknown* This, GUID* iid, void** ppv)
+static HRESULT STDCALL COutputPin_M_Release(IUnknown* This)
 {
-    Debug printf("COutputPin::QueryInterface() called\n");
-    if(!ppv)return 0x80004003;
-    if(!memcmp(iid, &IID_IUnknown, 16))
+    COutputMemPin* p = (COutputMemPin*) This;
+    Debug printf("COutputPin_MRelease(%p) called (%p,   %d)\n",
+		 p, p->parent, p->parent->refcount);
+    if (--p->parent->refcount <= 0)
+	delete p->parent;
+    return 0;
+}
+
+/* Implementation of output pin object. */
+// Constructor
+
+
+static HRESULT STDCALL COutputPin_QueryInterface(IUnknown* This, GUID* iid, void** ppv)
+{
+    Debug printf("COutputPin_QueryInterface(%p) called\n", This);
+    if (!ppv)
+	return E_INVALIDARG;
+
+    COutputPin* p = (COutputPin*) This;
+
+    if (memcmp(iid, &IID_IUnknown, 16) == 0)
     {
-	*ppv=(void*)This;
-	This->vt->AddRef(This);
-	return 0;
+	*ppv = p;
+	p->vt->AddRef(This);
+        return 0;
     }
-    if(!memcmp(iid, &IID_IMemInputPin, 16))
+    if (memcmp(iid, &IID_IMemInputPin, 16) == 0)
     {
-	*ppv=(void*)(This+1);
-	This->vt->AddRef(This);
+	*ppv = p->mempin;
+	p->mempin->vt->AddRef((IUnknown*)*ppv);
 	return 0;
     }
 
@@ -185,32 +167,15 @@
 		 (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)
-{
-    Debug printf("COutputPin::AddRef() called\n");
-    ((COutputPin*)This)->refcount++;
-    return 0;
-}
-
-HRESULT STDCALL COutputPin::Release(IUnknown* This)
-{
-    Debug printf("COutputPin::Release() called\n");
-    if(--((COutputPin*)This)->refcount==0)
-	delete (COutputPin*)This;
-    return 0;
+    return E_NOINTERFACE;
 }
 
 // IPin methods
-
-HRESULT STDCALL COutputPin::Connect ( 
-    IPin * This,
-    /* [in] */ IPin *pReceivePin,
-    /* [in] */ /* const */ AM_MEDIA_TYPE *pmt)
+static HRESULT STDCALL COutputPin_Connect(IPin * This,
+				    /* [in] */ IPin *pReceivePin,
+				    /* [in] */ /* const */ AM_MEDIA_TYPE *pmt)
 {
-    Debug printf("COutputPin::Connect() called\n");
+    Debug printf("COutputPin_Connect() called\n");
 /*
     *pmt=((COutputPin*)This)->type;
     if(pmt->cbFormat>0)
@@ -219,176 +184,146 @@
 	memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat);
     }	
 */
-    return E_NOTIMPL;
+    //return E_NOTIMPL;
+    return 0;// XXXXXXXXXXXXX CHECKME XXXXXXXXXXXXXXX
     // if I put return 0; here, it crashes
 }
 
-HRESULT STDCALL COutputPin::ReceiveConnection ( 
-    IPin * This,
-    /* [in] */ IPin *pConnector,
-    /* [in] */ const AM_MEDIA_TYPE *pmt)
+static HRESULT STDCALL COutputPin_ReceiveConnection(IPin * This,
+						    /* [in] */ IPin *pConnector,
+						    /* [in] */ const AM_MEDIA_TYPE *pmt)
 {
-    Debug printf("COutputPin::ReceiveConnection() called\n");
+    Debug printf("COutputPin_ReceiveConnection() called\n");
     ((COutputPin*)This)->remote=pConnector;
     return 0;
 }
-	    
-HRESULT STDCALL COutputPin::Disconnect ( 
-    IPin * This)
+
+static HRESULT STDCALL COutputPin_Disconnect(IPin * This)
 {
-    Debug printf("COutputPin::Disconnect() called\n");
+    Debug printf("COutputPin_Disconnect() called\n");
     return 1;
 }
 
-
-HRESULT STDCALL COutputPin::ConnectedTo ( 
-    IPin * This,
-    /* [out] */ IPin **pPin)
+static HRESULT STDCALL COutputPin_ConnectedTo(IPin * This,
+					/* [out] */ IPin **pPin)
 {
-    Debug printf("COutputPin::ConnectedTo() called\n");
-    if(!pPin)return 0x80004003;
-    *pPin=((COutputPin*)This)->remote;
+    Debug printf("COutputPin_ConnectedTo() called\n");
+    if (!pPin)
+	return E_INVALIDARG;
+    *pPin = ((COutputPin*)This)->remote;
     return 0;
 }
 
-
-
-HRESULT STDCALL COutputPin::ConnectionMediaType ( 
-    IPin * This,
-    /* [out] */ AM_MEDIA_TYPE *pmt)
+static HRESULT STDCALL COutputPin_ConnectionMediaType(IPin * This,
+						      /* [out] */ AM_MEDIA_TYPE *pmt)
 {
     Debug printf("CInputPin::ConnectionMediaType() called\n");
-    if(!pmt)return 0x80004003;
-    *pmt=((COutputPin*)This)->type;
-    if(pmt->cbFormat>0)
+    if (!pmt)
+	return E_INVALIDARG;
+    *pmt = ((COutputPin*)This)->type;
+    if (pmt->cbFormat>0)
     {
 	pmt->pbFormat=(char *)CoTaskMemAlloc(pmt->cbFormat);
 	memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat);
-    }	
+    }
     return 0;
 }
 
-HRESULT STDCALL COutputPin::QueryPinInfo ( 
-    IPin * This,
-    /* [out] */ PIN_INFO *pInfo)
+static HRESULT STDCALL COutputPin_QueryPinInfo(IPin * This,
+					       /* [out] */ PIN_INFO *pInfo)
 {
-    Debug printf("COutputPin::QueryPinInfo() called\n");
+    Debug printf("COutputPin_QueryPinInfo() called\n");
     return E_NOTIMPL;
 }
 
-
-HRESULT STDCALL COutputPin::QueryDirection ( 
-    IPin * This,
-    /* [out] */ PIN_DIRECTION *pPinDir)
+static HRESULT STDCALL COutputPin_QueryDirection(IPin * This,
+					   /* [out] */ PIN_DIRECTION *pPinDir)
 {
-    Debug printf("COutputPin::QueryDirection() called\n");
-    if(!pPinDir)return -1;
-    *pPinDir=PINDIR_INPUT;
+    Debug printf("COutputPin_QueryDirection() called\n");
+    if (!pPinDir)
+	return E_INVALIDARG;
+    *pPinDir = PINDIR_INPUT;
     return 0;
 }
 
-
-HRESULT STDCALL COutputPin::QueryId ( 
-    IPin * This,
-    /* [out] */ LPWSTR *Id)
+static HRESULT STDCALL COutputPin_QueryId(IPin * This,
+					  /* [out] */ LPWSTR *Id)
 {
-    Debug printf("COutputPin::QueryId() called\n");
+    Debug printf("COutputPin_QueryId() called\n");
     return E_NOTIMPL;
 }
 
-HRESULT STDCALL COutputPin::QueryAccept ( 
-    IPin * This,
-    /* [in] */ const AM_MEDIA_TYPE *pmt)
+static HRESULT STDCALL COutputPin_QueryAccept(IPin * This,
+					      /* [in] */ const AM_MEDIA_TYPE *pmt)
 {
-    Debug printf("COutputPin::QueryAccept() called\n");
+    Debug printf("COutputPin_QueryAccept() called\n");
     return E_NOTIMPL;
 }
 
-
-HRESULT STDCALL COutputPin::EnumMediaTypes ( 
-    IPin * This,
-    /* [out] */ IEnumMediaTypes **ppEnum)
+static HRESULT STDCALL COutputPin_EnumMediaTypes(IPin * This,
+					   /* [out] */ IEnumMediaTypes **ppEnum)
 {
-    Debug printf("COutputPin::EnumMediaTypes() called\n");
-    if(!ppEnum)return 0x80004003;
+    Debug printf("COutputPin_EnumMediaTypes() called\n");
+    if (!ppEnum)
+	return E_INVALIDARG;
     *ppEnum=new CEnumMediaTypes(((COutputPin*)This)->type);
     return 0;
 }
 
-
-HRESULT STDCALL COutputPin::QueryInternalConnections ( 
-    IPin * This,
-    /* [out] */ IPin **apPin,
-    /* [out][in] */ ULONG *nPin)
+static HRESULT STDCALL COutputPin_QueryInternalConnections(IPin * This,
+						     /* [out] */ IPin **apPin,
+						     /* [out][in] */ ULONG *nPin)
 {
-    Debug printf("COutputPin::QueryInternalConnections() called\n");
+    Debug printf("COutputPin_QueryInternalConnections() called\n");
     return E_NOTIMPL;
 }
 
-HRESULT STDCALL COutputPin::EndOfStream ( 
-    IPin * This)
+static HRESULT STDCALL COutputPin_EndOfStream(IPin * This)
 {
-    Debug printf("COutputPin::EndOfStream() called\n");
+    Debug printf("COutputPin_EndOfStream() called\n");
     return E_NOTIMPL;
 }
-    
-    
-HRESULT STDCALL COutputPin::BeginFlush ( 
-IPin * This)
+
+static HRESULT STDCALL COutputPin_BeginFlush(IPin * This)
 {
-    Debug printf("COutputPin::BeginFlush() called\n");
+    Debug printf("COutputPin_BeginFlush() called\n");
     return E_NOTIMPL;
 }
 
-
-HRESULT STDCALL COutputPin::EndFlush ( 
-    IPin * This)
+static HRESULT STDCALL COutputPin_EndFlush(IPin * This)
 {
-    Debug printf("COutputPin::EndFlush() called\n");
+    Debug printf("COutputPin_EndFlush() called\n");
     return E_NOTIMPL;
 }
 
-HRESULT STDCALL COutputPin::NewSegment ( 
-    IPin * This,
-    /* [in] */ REFERENCE_TIME tStart,
-    /* [in] */ REFERENCE_TIME tStop,
-    /* [in] */ double dRate)
+static HRESULT STDCALL COutputPin_NewSegment(IPin * This,
+				       /* [in] */ REFERENCE_TIME tStart,
+				       /* [in] */ REFERENCE_TIME tStop,
+				       /* [in] */ double dRate)
 {
-    Debug printf("COutputPin::NewSegment(%ld,%ld,%f) called\n",tStart,tStop,dRate);
+    Debug printf("COutputPin_NewSegment(%ld,%ld,%f) called\n",
+		 tStart, tStop, dRate);
     return 0;
 }
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 // IMemInputPin->IUnknown methods
 
-HRESULT STDCALL COutputPin::M_QueryInterface(IUnknown* This, GUID* iid, void** ppv)
+static HRESULT STDCALL COutputPin_M_QueryInterface(IUnknown* This, GUID* iid, void** ppv)
 {
-    Debug printf("COutputPin::QueryInterface() called\n");
-    if(!ppv)return 0x80004003;
+    Debug printf("COutputPin_M_QueryInterface() called\n");
+    if (!ppv)
+	return E_INVALIDARG;
+
+    COutputPin* p = (COutputPin*)This;
     if(!memcmp(iid, &IID_IUnknown, 16))
     {
-	COutputPin* ptr=(COutputPin*)(This-1);
-	*ppv=(void*)ptr;
-	AddRef((IUnknown*)ptr);
+	*ppv=p;
+	p->vt->AddRef(This);
 	return 0;
     }
-/*    if(!memcmp(iid, &IID_IPin, 16))
+    /*if(!memcmp(iid, &IID_IPin, 16))
     {
 	COutputPin* ptr=(COutputPin*)(This-1);
 	*ppv=(void*)ptr;
@@ -397,81 +332,65 @@
     }*/
     if(!memcmp(iid, &IID_IMemInputPin, 16))
     {
-	*ppv=(void*)This;
-	This->vt->AddRef(This);
+	*ppv=p->mempin;
+	p->mempin->vt->AddRef(This);
 	return 0;
     }
     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::M_AddRef(IUnknown* This)
-{
-    Debug printf("COutputPin::AddRef() called\n");
-    ((COutputPin*)(This-1))->refcount++;
-    return 0;
-}
-HRESULT STDCALL COutputPin::M_Release(IUnknown* This)
-{
-    Debug printf("COutputPin::Release() called\n");
-    if(--((COutputPin*)(This-1))->refcount==0)
-	delete (COutputPin*)This;
-    return 0;
+		 "%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 E_NOINTERFACE;
 }
 
-
-
-
 // IMemInputPin methods
 
-HRESULT STDCALL COutputPin::GetAllocator( 
-        IMemInputPin * This,
-    /* [out] */ IMemAllocator **ppAllocator) 
+static HRESULT STDCALL COutputPin_GetAllocator(IMemInputPin * This,
+					 /* [out] */ IMemAllocator **ppAllocator)
 {
-    Debug printf("COutputPin::GetAllocator(%x,%x) called\n",This->vt,ppAllocator);
+    Debug printf("COutputPin_GetAllocator(%p, %p) called\n", This->vt, ppAllocator);
     *ppAllocator=new MemAllocator;
     return 0;
 }
     
-HRESULT STDCALL COutputPin::NotifyAllocator( 
-        IMemInputPin * This,
-    /* [in] */ IMemAllocator *pAllocator,
-    /* [in] */ int bReadOnly)
+static HRESULT STDCALL COutputPin_NotifyAllocator(IMemInputPin * This,
+						  /* [in] */ IMemAllocator *pAllocator,
+						  /* [in] */ int bReadOnly)
 {
-    Debug printf("COutputPin::NotifyAllocator() called\n");
-    COutputPin* pPin=(COutputPin*)This;
-    pPin->pAllocator=(MemAllocator*)pAllocator;
+    Debug printf("COutputPin_NotifyAllocator(%p, %p) called\n", This, pAllocator);
+    ((COutputMemPin*)This)->pAllocator = (MemAllocator*) pAllocator;
     return 0;
 }
 
-HRESULT STDCALL COutputPin::GetAllocatorRequirements( 
-        IMemInputPin * This,
-    /* [out] */ ALLOCATOR_PROPERTIES *pProps) 
+static HRESULT STDCALL COutputPin_GetAllocatorRequirements(IMemInputPin * This,
+							   /* [out] */ ALLOCATOR_PROPERTIES *pProps)
 {
-    Debug printf("COutputPin::GetAllocatorRequirements() called\n");
+    Debug printf("COutputPin_GetAllocatorRequirements() called\n");
     return E_NOTIMPL;
 }
 
-HRESULT STDCALL COutputPin::Receive( 
-        IMemInputPin * This,
-    /* [in] */ IMediaSample *pSample) 
+static HRESULT STDCALL COutputPin_Receive(IMemInputPin * This,
+				    /* [in] */ IMediaSample *pSample)
 {
-    Debug printf("COutputPin::Receive() called\n");
-    COutputPin& me=*(COutputPin*)This;
-    if(!pSample)return 0x80004003;
+    Debug printf("COutputPin_Receive(%p) called\n", This);
+    if (!pSample)
+	return E_INVALIDARG;
     char* pointer;
-    if(pSample->vt->GetPointer(pSample, (BYTE **)&pointer))
+    if (pSample->vt->GetPointer(pSample, (BYTE **)&pointer))
 	return -1;
-    int len=pSample->vt->GetActualDataLength(pSample);
-    if(len==0)len=pSample->vt->GetSize(pSample);//for iv50
+    int len = pSample->vt->GetActualDataLength(pSample);
+    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;
+
+    COutputMemPin* mp= (COutputMemPin*)This;
+    if (mp->frame_pointer)
+	*(mp->frame_pointer) = pointer;
+    if (mp->frame_size_pointer)
+	*(mp->frame_size_pointer) = len;
 /*
     FILE* file=fopen("./uncompr.bmp", "wb");
     char head[14]={0x42, 0x4D, 0x36, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00};
@@ -485,19 +404,64 @@
     return 0;
 }
 
-HRESULT STDCALL COutputPin::ReceiveMultiple( 
-        IMemInputPin * This,
-    /* [size_is][in] */ IMediaSample **pSamples,
-    /* [in] */ long nSamples,
-    /* [out] */ long *nSamplesProcessed)
-{
-    Debug printf("COutputPin::ReceiveMultiple() called\n");
+static HRESULT STDCALL COutputPin_ReceiveMultiple(IMemInputPin * This,
+					    /* [size_is][in] */ IMediaSample **pSamples,
+					    /* [in] */ long nSamples,
+					    /* [out] */ long *nSamplesProcessed)
+{
+    Debug printf("COutputPin_ReceiveMultiple() called (UNIMPLEMENTED)\n");
     return E_NOTIMPL;
 }
 
-HRESULT STDCALL COutputPin::ReceiveCanBlock(
-        IMemInputPin * This) 
-{
-    Debug printf("COutputPin::ReceiveCanBlock() called\n");
+static HRESULT STDCALL COutputPin_ReceiveCanBlock(IMemInputPin * This)
+{
+    Debug printf("COutputPin_ReceiveCanBlock() called (UNIMPLEMENTED)\n");
     return E_NOTIMPL;
+}
+
+COutputPin::COutputPin(const AM_MEDIA_TYPE& vh)
+    :refcount(1), type(vh), remote(0)
+{
+    vt = new IPin_vt;
+    vt->QueryInterface = COutputPin_QueryInterface;
+    vt->AddRef = COutputPin_AddRef;
+    vt->Release = COutputPin_Release;
+    vt->Connect = COutputPin_Connect;
+    vt->ReceiveConnection = COutputPin_ReceiveConnection;
+    vt->Disconnect = COutputPin_Disconnect;
+    vt->ConnectedTo = COutputPin_ConnectedTo;
+    vt->ConnectionMediaType = COutputPin_ConnectionMediaType;
+    vt->QueryPinInfo = COutputPin_QueryPinInfo;
+    vt->QueryDirection = COutputPin_QueryDirection;
+    vt->QueryId = COutputPin_QueryId;
+    vt->QueryAccept = COutputPin_QueryAccept;
+    vt->EnumMediaTypes = COutputPin_EnumMediaTypes;
+    vt->QueryInternalConnections = COutputPin_QueryInternalConnections;
+    vt->EndOfStream = COutputPin_EndOfStream;
+    vt->BeginFlush = COutputPin_BeginFlush;
+    vt->EndFlush = COutputPin_EndFlush;
+    vt->NewSegment = COutputPin_NewSegment;
+
+    mempin = new COutputMemPin;
+    mempin->vt = new IMemInputPin_vt;
+    mempin->vt->QueryInterface = COutputPin_M_QueryInterface;
+    mempin->vt->AddRef = COutputPin_M_AddRef;
+    mempin->vt->Release = COutputPin_M_Release;
+    mempin->vt->GetAllocator = COutputPin_GetAllocator;
+    mempin->vt->NotifyAllocator = COutputPin_NotifyAllocator;
+    mempin->vt->GetAllocatorRequirements = COutputPin_GetAllocatorRequirements;
+    mempin->vt->Receive = COutputPin_Receive;
+    mempin->vt->ReceiveMultiple = COutputPin_ReceiveMultiple;
+    mempin->vt->ReceiveCanBlock = COutputPin_ReceiveCanBlock;
+
+    mempin->frame_size_pointer = 0;
+    mempin->frame_pointer = 0;
+    mempin->pAllocator = 0;
+    mempin->parent = this;
+}
+
+COutputPin::~COutputPin()
+{
+    delete vt;
+    delete mempin->vt;
 }

Index: outputpin.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/outputpin.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- outputpin.h	6 May 2001 21:43:45 -0000	1.2
+++ outputpin.h	16 Aug 2001 00:50:02 -0000	1.3
@@ -1,124 +1,37 @@
-/*	"output pin" - the one that connects to output of filter.     */
+#ifndef DS_OUTPUTPIN_H
+#define DS_OUTPUTPIN_H
+
+/* "output pin" - the one that connects to output of filter. */
 
-#ifndef OUTPUTPIN_H
-#define OUTPUTPIN_H
 #include "interfaces.h"
 #include "guids.h"
-#include "default.h"
 #include "allocator.h"
-class COutputPin: public IPin, public IMemInputPin
+
+struct COutputPin;
+
+struct COutputMemPin : public IMemInputPin
 {
-    int refcount;
-    AM_MEDIA_TYPE type;
-    IPin* remote;
     char** frame_pointer;
     long* frame_size_pointer;
     MemAllocator* pAllocator;
-public:
+    COutputPin* parent;
+};
+
+struct COutputPin : public IPin
+{
+    COutputMemPin* mempin;
+    int refcount;
+    AM_MEDIA_TYPE type;
+    IPin* remote;
     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;}
-    static HRESULT STDCALL QueryInterface(IUnknown* This, GUID* iid, void** ppv);
-    static HRESULT STDCALL AddRef(IUnknown* This);
-    static HRESULT STDCALL Release(IUnknown* This);
-
-    static HRESULT STDCALL M_QueryInterface(IUnknown* This, GUID* iid, void** ppv);
-    static HRESULT STDCALL M_AddRef(IUnknown* This);
-    static HRESULT STDCALL M_Release(IUnknown* This);
-
-    static HRESULT STDCALL Connect ( 
-	IPin * This,
-        /* [in] */ IPin *pReceivePin,
-        /* [in] */ /*const */AM_MEDIA_TYPE *pmt);
-        
-    static HRESULT STDCALL ReceiveConnection ( 
-        IPin * This,
-        /* [in] */ IPin *pConnector,
-        /* [in] */ const AM_MEDIA_TYPE *pmt);
-    
-    static HRESULT STDCALL Disconnect ( 
-        IPin * This);
-    
-    static HRESULT STDCALL ConnectedTo ( 
-        IPin * This,
-        /* [out] */ IPin **pPin);
-    
-    static HRESULT STDCALL ConnectionMediaType ( 
-        IPin * This,
-        /* [out] */ AM_MEDIA_TYPE *pmt);
-    
-    static HRESULT STDCALL QueryPinInfo ( 
-        IPin * This,
-        /* [out] */ PIN_INFO *pInfo);
-    
-    static HRESULT STDCALL QueryDirection ( 
-        IPin * This,
-        /* [out] */ PIN_DIRECTION *pPinDir);
-    
-    static HRESULT STDCALL QueryId ( 
-        IPin * This,
-        /* [out] */ LPWSTR *Id);
-    
-    static HRESULT STDCALL QueryAccept ( 
-        IPin * This,
-        /* [in] */ const AM_MEDIA_TYPE *pmt);
-    
-    static HRESULT STDCALL EnumMediaTypes ( 
-        IPin * This,
-        /* [out] */ IEnumMediaTypes **ppEnum);
-    
-    static HRESULT STDCALL QueryInternalConnections ( 
-        IPin * This,
-        /* [out] */ IPin **apPin,
-        /* [out][in] */ ULONG *nPin);
-    
-    static HRESULT STDCALL EndOfStream ( 
-        IPin * This);
-    
-    static HRESULT STDCALL BeginFlush ( 
-        IPin * This);
-    
-    static HRESULT STDCALL EndFlush ( 
-        IPin * This);
-    
-    static HRESULT STDCALL NewSegment ( 
-        IPin * This,
-        /* [in] */ REFERENCE_TIME tStart,
-        /* [in] */ REFERENCE_TIME tStop,
-        /* [in] */ double dRate);
-	
-
-
-
-
-
-    static HRESULT STDCALL GetAllocator( 
-        IMemInputPin * This,
-        /* [out] */ IMemAllocator **ppAllocator) ;
-    
-    static HRESULT STDCALL NotifyAllocator( 
-        IMemInputPin * This,
-        /* [in] */ IMemAllocator *pAllocator,
-        /* [in] */ int bReadOnly) ;
-    
-    static HRESULT STDCALL GetAllocatorRequirements( 
-        IMemInputPin * This,
-        /* [out] */ ALLOCATOR_PROPERTIES *pProps) ;
-    
-    static HRESULT STDCALL Receive( 
-        IMemInputPin * This,
-        /* [in] */ IMediaSample *pSample) ;
-    
-    static HRESULT STDCALL ReceiveMultiple( 
-        IMemInputPin * This,
-        /* [size_is][in] */ IMediaSample **pSamples,
-        /* [in] */ long nSamples,
-        /* [out] */ long *nSamplesProcessed) ;
-    
-    static HRESULT STDCALL ReceiveCanBlock(
-            IMemInputPin * This) ;
+    void SetFramePointer(char** z) { mempin->frame_pointer = z; }
+    void SetPointer2(char* p) {
+	if (mempin->pAllocator)
+	    mempin->pAllocator->SetPointer(p);
+    }
+    void SetFrameSizePointer(long* z) { mempin->frame_size_pointer = z; }
+    void SetNewFormat(const AM_MEDIA_TYPE& a) { type = a; }
 };
-#endif
+
+#endif /* DS_OUTPUTPIN_H */

--- BitmapInfo.h DELETED ---

--- default.h DELETED ---

--- except.h DELETED ---

--- formats.h DELETED ---




More information about the MPlayer-cvslog mailing list