From 0cdcee1926293663877a31fdb9654986ac8f1120 Mon Sep 17 00:00:00 2001 From: arpi_esp Date: Tue, 20 Mar 2001 21:12:37 +0000 Subject: fixed DivX Quality setting (using registry) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@174 b3059339-0415-0410-9bf9-f77b7e298cf2 --- loader/dshow/DS_VideoDec.c | 74 +++++++++++++++++++++++++++++++++++++++++----- loader/dshow/DS_VideoDec.h | 1 + 2 files changed, 67 insertions(+), 8 deletions(-) (limited to 'loader') diff --git a/loader/dshow/DS_VideoDec.c b/loader/dshow/DS_VideoDec.c index 299f7ceae4..5831eef029 100644 --- a/loader/dshow/DS_VideoDec.c +++ b/loader/dshow/DS_VideoDec.c @@ -28,6 +28,9 @@ #include #include +#include +#include + #include "guids.h" #include "interfaces.h" #include "DS_Filter.h" @@ -39,6 +42,7 @@ #include "DS_VideoDec.h" + using namespace std; extern "C" char* def_path; @@ -213,29 +217,29 @@ extern "C" int DS_VideoDecoder_DecodeFrame(char* src, int size, int is_keyframe, m_bh.biSizeImage=size; IMediaSample* sample=0; - printf("GetBuffer... (m_pAll=%X) ",dsf->m_pAll);fflush(stdout); + //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"); + //printf("OK!\n"); if(!sample) { Debug cerr<<"ERROR: null sample"<vt->GetPointer(sample, (BYTE **)&ptr); - printf("OK!\n"); + //printf("OK!\n"); memcpy(ptr, src, size); - printf("memcpy OK!\n"); + //printf("memcpy OK!\n"); sample->vt->SetActualDataLength(sample, size); - printf("SetActualDataLength OK!\n"); + //printf("SetActualDataLength OK!\n"); sample->vt->SetSyncPoint(sample, is_keyframe); - printf("SetSyncPoint OK!\n"); + //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) - Debug printf("Error putting data into input pin %x\n", result); + printf("Error putting data into input pin %x\n", result); sample->vt->Release((IUnknown*)sample); @@ -382,4 +386,58 @@ extern "C" int DS_SetValue_DivX(char* name, int value){ return -200; } +extern "C" int DS_SetAttr_DivX(char* attribute, int value){ + int result, status, newkey, count; + if(strcmp(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( + (strcmp(attribute, "Saturation")==0) || + (strcmp(attribute, "Hue")==0) || + (strcmp(attribute, "Contrast")==0) || + (strcmp(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; +} diff --git a/loader/dshow/DS_VideoDec.h b/loader/dshow/DS_VideoDec.h index c46d34155a..d3c9415c54 100644 --- a/loader/dshow/DS_VideoDec.h +++ b/loader/dshow/DS_VideoDec.h @@ -25,6 +25,7 @@ int DS_VideoDecoder_DecodeFrame(char* src, int size, int is_keyframe, int render int DS_VideoDecoder_SetDestFmt(int bits, int csp); int DS_SetValue_DivX(char* name, int value); +int DS_SetAttr_DivX(char* attribute, int value); #ifdef __cplusplus } /* extern "C" */ -- cgit v1.2.3