changeset 173:fb67a2aa61fe

fixed DivX Quality setting (using registry)
author arpi_esp
date Tue, 20 Mar 2001 21:12:37 +0000
parents 82a9977f7e04
children 3b8373ce57ca
files loader/dshow/DS_VideoDec.c loader/dshow/DS_VideoDec.h
diffstat 2 files changed, 67 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/loader/dshow/DS_VideoDec.c	Tue Mar 20 21:11:45 2001 +0000
+++ b/loader/dshow/DS_VideoDec.c	Tue Mar 20 21:12:37 2001 +0000
@@ -28,6 +28,9 @@
 #include <sys/types.h>
 #include <sys/mman.h>
 
+#include <registry.h>
+#include <wine/winreg.h>
+
 #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 @@
         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"<<endl;
 	    return -1;
 	}
         char* ptr;
-        printf("GetPtr...");fflush(stdout);
+        //printf("GetPtr...");fflush(stdout);
 	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 @@
         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;
+}
+
--- a/loader/dshow/DS_VideoDec.h	Tue Mar 20 21:11:45 2001 +0000
+++ b/loader/dshow/DS_VideoDec.h	Tue Mar 20 21:12:37 2001 +0000
@@ -25,6 +25,7 @@
 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" */