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

📄 ds_videodecoder.c

📁 coreavc for linux in unix_linux
💻 C
📖 第 1 页 / 共 3 页
字号:
	memcpy(&(this->m_sVhdr2->bmiHeader), &this->iv.m_decoder, sizeof(this->iv.m_decoder));	this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);	if (this->m_sVhdr2->bmiHeader.biCompression == 3)    	    this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER2) + 12;	else    	    this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER2);	return -1;    }    memcpy( &this->iv.m_decoder, &this->iv.m_obh, sizeof(this->iv.m_obh));//    m_obh=temp;//    if(csp)//	m_obh.biBitCount=BitmapInfo::BitCount(csp);    this->iv.m_bh->biBitCount = bits;    //DS_VideoDecoder_Restart(this);    if (this->iv.m_State == START)    {	DS_VideoDecoder_StopInternal(this);        this->iv.m_State = STOP;        stopped = true;    }    this->m_pDS_Filter->m_pInputPin->vt->Disconnect(this->m_pDS_Filter->m_pInputPin);    this->m_pDS_Filter->m_pOutputPin->vt->Disconnect(this->m_pDS_Filter->m_pOutputPin);    this->m_pDS_Filter->m_pOurOutput->SetNewFormat(this->m_pDS_Filter->m_pOurOutput,&this->m_sDestType);    result = this->m_pDS_Filter->m_pInputPin->vt->ReceiveConnection(this->m_pDS_Filter->m_pInputPin,							      this->m_pDS_Filter->m_pOurInput,							      &this->m_sOurType);    if (result)    {	printf("Error reconnecting input pin 0x%x\n", (int)result);	return -1;    }    if(this->m_pDS_Filter->m_pAll)        this->m_pDS_Filter->m_pAll->vt->Release((IUnknown *)this->m_pDS_Filter->m_pAll);    this->m_pDS_Filter->m_pAll=(IMemAllocator *)MemAllocatorCreate();    if (!this->m_pDS_Filter->m_pAll)    {        printf("Call to MemAllocatorCreate failed\n");        return -1;    }    //Seting allocator property according to our media type    props.cBuffers=1;    props.cbBuffer=this->m_sDestType.lSampleSize;    props.cbAlign=1;    props.cbPrefix=0;    this->m_pDS_Filter->m_pAll->vt->SetProperties(this->m_pDS_Filter->m_pAll, &props, &props1);    //Notify remote pin about choosed allocator    this->m_pDS_Filter->m_pImp->vt->NotifyAllocator(this->m_pDS_Filter->m_pImp, this->m_pDS_Filter->m_pAll, 0);    result = this->m_pDS_Filter->m_pOutputPin->vt->ReceiveConnection(this->m_pDS_Filter->m_pOutputPin,							       (IPin *)this->m_pDS_Filter->m_pOurOutput,							       &this->m_sDestType);    if (result)    {	printf("Error reconnecting output pin 0x%x\n", (int)result);	return -1;    }    if (stopped)    {	DS_VideoDecoder_StartInternal(this);        this->iv.m_State = START;     }    return 0;}int DS_VideoDecoder_SetDirection(DS_VideoDecoder *this, int d){    this->iv.m_obh.biHeight = (d) ? this->iv.m_bh->biHeight : -this->iv.m_bh->biHeight;    this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;    return 0;}int DS_VideoDecoder_GetValue(DS_VideoDecoder *this, const char* name, int* value){/*    if (m_bIsDivX4)    {	IDivxFilterInterface* pIDivx;	if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_IDivxFilterInterface, (void**)&pIDivx))	{	    Debug printf("No such interface\n");	    return -1;	}	if (strcmp(name, "Postprocessing") == 0)	{	    pIDivx->vt->get_PPLevel(pIDivx, &value);	    value /= 10;	}	else if (strcmp(name, "Brightness") == 0)	    pIDivx->vt->get_Brightness(pIDivx, &value);	else if (strcmp(name, "Contrast") == 0)	    pIDivx->vt->get_Contrast(pIDivx, &value);	else if (strcmp(name, "Saturation") == 0)	    pIDivx->vt->get_Saturation(pIDivx, &value);	else if (strcmp(name, "MaxAuto") == 0)	    value = m_iMaxAuto;	pIDivx->vt->Release((IUnknown*)pIDivx);	return 0;    }    else 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, "Quality") == 0)	{#warning NOT SURE	    int r = hidden->vt->GetSmth2(hidden, &value);	    if (value >= 10)		value -= 10;	    return 0;	}	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, "MaxAuto") == 0)	{	    value = m_iMaxAuto;            return 0;	}    }    else if (strcmp((const char*)record.dll, "ir50_32.dll") == 0)    {	IHidden2* hidden = 0;	if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_Iv50Hidden, (void**)&hidden))	{	    Debug printf("No such interface\n");	    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;}int DS_VideoDecoder_SetValue(DS_VideoDecoder *this, const char* name, int value){    if (this->m_bIsDivX4) {	IDivxFilterInterface* pIDivx=NULL;//	printf("DS_SetValue for DIVX4, name=%s  value=%d\n",name,value);	if (this->m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)this->m_pDS_Filter->m_pFilter, &IID_IDivxFilterInterface, (void *)&pIDivx))	{	    printf("No such interface\n");	    return -1;	}	if (strcasecmp(name, "Postprocessing") == 0)	    pIDivx->vt->put_PPLevel(pIDivx, value * 10);	else if (strcasecmp(name, "Brightness") == 0)	    pIDivx->vt->put_Brightness(pIDivx, value);	else if (strcasecmp(name, "Contrast") == 0)	    pIDivx->vt->put_Contrast(pIDivx, value);	else if (strcasecmp(name, "Saturation") == 0)	    pIDivx->vt->put_Saturation(pIDivx, value);	else if (strcasecmp(name, "MaxAuto") == 0)            this->m_iMaxAuto = value;	pIDivx->vt->Release((IUnknown*)pIDivx);	//printf("Set %s  %d\n", name, value);	return 0;    }    if (this->m_bIsDivX) {	IHidden* hidden;	if (this->iv.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    	hidden = (IHidden*)((int)this->m_pDS_Filter->m_pFilter + 0xb8);	//printf("DS_SetValue for DIVX, name=%s  value=%d\n",name,value);	if (strcasecmp(name, "Quality") == 0)	{            this->m_iLastQuality = value;	    return hidden->vt->SetSmth(hidden, value, 0);	}	if (strcasecmp(name, "Brightness") == 0)	    return hidden->vt->SetSmth2(hidden, value, 0);	if (strcasecmp(name, "Contrast") == 0)	    return hidden->vt->SetSmth3(hidden, value, 0);	if (strcasecmp(name, "Saturation") == 0)	    return hidden->vt->SetSmth4(hidden, value, 0);	if (strcasecmp(name, "Hue") == 0)	    return hidden->vt->SetSmth5(hidden, value, 0);	if (strcasecmp(name, "MaxAuto") == 0)	{            this->m_iMaxAuto = value;	}        return 0;    }#if 0        if (strcmp((const char*)record.dll, "ir50_32.dll") == 0)    {	IHidden2* hidden = 0;	if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_Iv50Hidden, (void**)&hidden))	{	    Debug printf("No such interface\n");	    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;    }#endif//    printf("DS_SetValue for ????, name=%s  value=%d\n",name,value);    return 0;}/*vim: vi* sux.*/int DS_SetAttr_DivX(char* attribute, int value){    int result, status, newkey;        if(strcasecmp(attribute, "Quality")==0){	    char* keyname="SOFTWARE\\Microsoft\\Scrunch";    	    result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0,	   		&newkey, &status);            if(result!=0)	    {	        printf("VideoDecoder::SetExtAttr: registry failure\n");	        return -1;	    }    	    result=RegSetValueExA(newkey, "Current Post Process Mode", 0, REG_DWORD, &value, 4);            if(result!=0)	    {	        printf("VideoDecoder::SetExtAttr: error writing value\n");	        return -1;	    }    	    value=-1;	    result=RegSetValueExA(newkey, "Force Post Process Mode", 0, REG_DWORD, &value, 4);            if(result!=0)	    {		printf("VideoDecoder::SetExtAttr: error writing value\n");	    	return -1;	    }       	    RegCloseKey(newkey);   	    return 0;	}   	        if(	(strcasecmp(attribute, "Saturation")==0) ||	(strcasecmp(attribute, "Hue")==0) ||	(strcasecmp(attribute, "Contrast")==0) ||	(strcasecmp(attribute, "Brightness")==0)	)        {	    char* keyname="SOFTWARE\\Microsoft\\Scrunch\\Video";    	    result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0,	   		&newkey, &status);            if(result!=0)	    {	        printf("VideoDecoder::SetExtAttr: registry failure\n");	        return -1;	    }    	    result=RegSetValueExA(newkey, attribute, 0, REG_DWORD, &value, 4);            if(result!=0)	    {	        printf("VideoDecoder::SetExtAttr: error writing value\n");	        return -1;	    }       	    RegCloseKey(newkey);   	    return 0;	}   	        printf("Unknown attribute!\n");        return -200;}

⌨️ 快捷键说明

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