⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 outputpin.c

📁 linux下的MPEG1
💻 C
📖 第 1 页 / 共 2 页
字号:
static HRESULT STDCALL COutputPin_BeginFlush(IPin * This){    return output_unimplemented("COutputPin_BeginFlush", This);}static HRESULT STDCALL COutputPin_EndFlush(IPin * This){    return output_unimplemented("COutputPin_EndFlush", This);}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);    return 0;}// IMemInputPin->IUnknown methodsstatic HRESULT STDCALL COutputPin_M_QueryInterface(IUnknown* This, const GUID* iid, void** ppv){    COutputPin* p = (COutputPin*)This;    Debug printf("COutputPin_M_QueryInterface(%p) called\n", This);    if (!ppv)	return E_INVALIDARG;    if(!memcmp(iid, &IID_IUnknown, 16))    {	*ppv = p;	p->vt->AddRef(This);	return 0;    }    /*if(!memcmp(iid, &IID_IPin, 16))    {	COutputPin* ptr=(COutputPin*)(This-1);	*ppv=(void*)ptr;	AddRef((IUnknown*)ptr);	return 0;    }*/    if(!memcmp(iid, &IID_IMemInputPin, 16))    {	*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 E_NOINTERFACE;}// IMemInputPin methodsstatic HRESULT STDCALL COutputPin_GetAllocator(IMemInputPin* This,					 /* [out] */ IMemAllocator** ppAllocator){    Debug printf("COutputPin_GetAllocator(%p, %p) called\n", This->vt, ppAllocator);    *ppAllocator = (IMemAllocator*) MemAllocatorCreate();    return 0;}static HRESULT STDCALL COutputPin_NotifyAllocator(IMemInputPin* This,						  /* [in] */ IMemAllocator* pAllocator,						  /* [in] */ int bReadOnly){    Debug printf("COutputPin_NotifyAllocator(%p, %p) called\n", This, pAllocator);    ((COutputMemPin*)This)->pAllocator = (MemAllocator*) pAllocator;    return 0;}static HRESULT STDCALL COutputPin_GetAllocatorRequirements(IMemInputPin* This,							   /* [out] */ ALLOCATOR_PROPERTIES* pProps){    return output_unimplemented("COutputPin_GetAllocatorRequirements", This);}static HRESULT STDCALL COutputPin_Receive(IMemInputPin* This,					  /* [in] */ IMediaSample* pSample){    COutputMemPin* mp = (COutputMemPin*)This;    char* pointer;    int len;    Debug printf("COutputPin_Receive(%p) called\n", This);    if (!pSample)	return E_INVALIDARG;    if (pSample->vt->GetPointer(pSample, (BYTE**) &pointer))	return -1;    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 (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};    *(int*)(&head[2])=len+0x36;    fwrite(head, 14, 1, file);    fwrite(&((VIDEOINFOHEADER*)me.type.pbFormat)->bmiHeader, sizeof(BITMAPINFOHEADER), 1, file);    fwrite(pointer, len, 1, file);    fclose(file);*///    pSample->vt->Release((IUnknown*)pSample);    return 0;}static HRESULT STDCALL COutputPin_ReceiveMultiple(IMemInputPin * This,					    /* [size_is][in] */ IMediaSample **pSamples,					    /* [in] */ long nSamples,					    /* [out] */ long *nSamplesProcessed){    return output_unimplemented("COutputPin_ReceiveMultiple", This);}static HRESULT STDCALL COutputPin_ReceiveCanBlock(IMemInputPin * This){    return output_unimplemented("COutputPin_ReceiveCanBlock", This);}static void COutputPin_SetFramePointer(COutputPin* This, char** z){    This->mempin->frame_pointer = z;}static void COutputPin_SetPointer2(COutputPin* This, char* p){    if (This->mempin->pAllocator)        // fixme	This->mempin->pAllocator->SetPointer(This->mempin->pAllocator, p);}static void COutputPin_SetFrameSizePointer(COutputPin* This, long* z){    This->mempin->frame_size_pointer = z;}static void COutputPin_SetNewFormat(COutputPin* This, const AM_MEDIA_TYPE* amt){    This->type = *amt;}static void COutputPin_Destroy(COutputPin* This){    if (This->mempin) {	if (This->mempin->vt)	    free(This->mempin->vt);	free(This->mempin);    }    if (This->vt)	free(This->vt);    free(This);}static HRESULT STDCALL COutputPin_AddRef(IUnknown* This){    Debug printf("COutputPin_AddRef(%p) called (%d)\n", This, ((COutputPin*)This)->refcount);    ((COutputPin*)This)->refcount++;    return 0;}static HRESULT STDCALL COutputPin_Release(IUnknown* This){    Debug printf("COutputPin_Release(%p) called (%d)\n", This, ((COutputPin*)This)->refcount);    if (--((COutputPin*)This)->refcount <= 0)	COutputPin_Destroy((COutputPin*)This);    return 0;}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;}static HRESULT STDCALL COutputPin_M_Release(IUnknown* This){    COutputMemPin* p = (COutputMemPin*) This;    Debug printf("COutputPin_MRelease(%p) called (%p,   %d)\n",		 p, p->parent, p->parent->refcount);    if (--p->parent->refcount <= 0)	COutputPin_Destroy(p->parent);    return 0;}COutputPin* COutputPinCreate(const AM_MEDIA_TYPE* amt){    COutputPin* This = (COutputPin*) malloc(sizeof(COutputPin));    IMemInputPin_vt* ivt;    if (!This)        return NULL;    This->vt = (IPin_vt*) malloc(sizeof(IPin_vt));    This->mempin = (COutputMemPin*) malloc(sizeof(COutputMemPin));    ivt = (IMemInputPin_vt*) malloc(sizeof(IMemInputPin_vt));    if (!This->vt || !This->mempin || !ivt)    {        COutputPin_Destroy(This);        free(ivt);	return NULL;    }    This->mempin->vt = ivt;    This->refcount = 1;    This->remote = 0;    This->type = *amt;    This->vt->QueryInterface = COutputPin_QueryInterface;    This->vt->AddRef = COutputPin_AddRef;    This->vt->Release = COutputPin_Release;    This->vt->Connect = COutputPin_Connect;    This->vt->ReceiveConnection = COutputPin_ReceiveConnection;    This->vt->Disconnect = COutputPin_Disconnect;    This->vt->ConnectedTo = COutputPin_ConnectedTo;    This->vt->ConnectionMediaType = COutputPin_ConnectionMediaType;    This->vt->QueryPinInfo = COutputPin_QueryPinInfo;    This->vt->QueryDirection = COutputPin_QueryDirection;    This->vt->QueryId = COutputPin_QueryId;    This->vt->QueryAccept = COutputPin_QueryAccept;    This->vt->EnumMediaTypes = COutputPin_EnumMediaTypes;    This->vt->QueryInternalConnections = COutputPin_QueryInternalConnections;    This->vt->EndOfStream = COutputPin_EndOfStream;    This->vt->BeginFlush = COutputPin_BeginFlush;    This->vt->EndFlush = COutputPin_EndFlush;    This->vt->NewSegment = COutputPin_NewSegment;    This->mempin->vt->QueryInterface = COutputPin_M_QueryInterface;    This->mempin->vt->AddRef = COutputPin_M_AddRef;    This->mempin->vt->Release = COutputPin_M_Release;    This->mempin->vt->GetAllocator = COutputPin_GetAllocator;    This->mempin->vt->NotifyAllocator = COutputPin_NotifyAllocator;    This->mempin->vt->GetAllocatorRequirements = COutputPin_GetAllocatorRequirements;    This->mempin->vt->Receive = COutputPin_Receive;    This->mempin->vt->ReceiveMultiple = COutputPin_ReceiveMultiple;    This->mempin->vt->ReceiveCanBlock = COutputPin_ReceiveCanBlock;    This->mempin->frame_size_pointer = 0;    This->mempin->frame_pointer = 0;    This->mempin->pAllocator = 0;    This->mempin->refcount = 1;    This->mempin->parent = This;    This->SetPointer2 = COutputPin_SetPointer2;    This->SetFramePointer = COutputPin_SetFramePointer;    This->SetFrameSizePointer = COutputPin_SetFrameSizePointer;    This->SetNewFormat = COutputPin_SetNewFormat;    return This;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -