annotate loader/dshow/test.c @ 15837:dbc964f2f00a

Synced with 1023
author jheryan
date Tue, 28 Jun 2005 12:05:37 +0000
parents 385a68be7494
children 3bf0d70b4c7f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
169
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
1 #include <stdio.h>
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
2 #include <stdlib.h>
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
3
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
4 #include "formats.h"
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
5 #include "com.h"
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
6
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
7 #include "DS_VideoDec.h"
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
8
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
9 int main(int argc,char* argv[]){
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
10 FILE *f;
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
11 BITMAPINFOHEADER bih;
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
12 int len;
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
13 char *src;
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
14 char *dst=0;
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
15 GUID CLSID_DivxDecompressorCF={0x82CCd3E0, 0xF71A, 0x11D0,
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
16 { 0x9f, 0xe5, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}};
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
17
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
18 f=fopen("test.divx","rb");
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
19
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
20 fread(&bih,sizeof(BITMAPINFOHEADER),1,f);
170
a4d3c83eeb52 small cosmetic to avoid gcc warnings
arpi_esp
parents: 169
diff changeset
21 printf("frame dim: %d x %d \n",(int)bih.biWidth,(int)bih.biHeight);
169
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
22
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
23 src=(char*)malloc(512000);
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
24 len=fread(src,1,512000,f);
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
25 printf("frame len = %d\n",len);
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
26
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
27 DS_VideoDecoder_Open("divx_c32.ax", &CLSID_DivxDecompressorCF, &bih, 0, &dst);
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
28
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
29 // DS_VideoDecoder_SetDestFmt(16,fccYUY2);
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
30 DS_VideoDecoder_SetDestFmt(24,0);
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
31
184
385a68be7494 fixed Quality setting
arpi_esp
parents: 170
diff changeset
32 printf("DivX setting result = %d\n", DS_SetAttr_DivX("Quality",4) );
385a68be7494 fixed Quality setting
arpi_esp
parents: 170
diff changeset
33
169
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
34 DS_VideoDecoder_Start();
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
35
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
36 printf("DivX setting result = %d\n", DS_SetValue_DivX("Brightness",60) );
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
37
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
38 DS_VideoDecoder_DecodeFrame(src, len, 1, 1);
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
39
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
40 #if 0
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
41 f2=fopen("test.yuy2","wb");
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
42 fwrite(dst,bih.biWidth*bih.biHeight*2,1,f2);
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
43 fclose(f2);
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
44 #endif
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
45
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
46 { unsigned char raw_head[32];
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
47 FILE *f=fopen("test.raw","wb");
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
48
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
49 strcpy((char*)raw_head,"mhwanh");
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
50 raw_head[7]=4;
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
51 raw_head[8]=bih.biWidth>>8;
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
52 raw_head[9]=bih.biWidth&0xFF;
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
53 raw_head[10]=bih.biHeight>>8;
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
54 raw_head[11]=bih.biHeight&0xFF;
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
55 raw_head[12]=raw_head[13]=0; // 24bit
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
56 raw_head[14]=1;raw_head[15]=0x2C;
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
57 raw_head[16]=1;raw_head[17]=0x2C;
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
58 memset(raw_head+18,0,32-18);
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
59 fwrite(raw_head,32,1,f);
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
60
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
61 fwrite(dst,bih.biWidth*bih.biHeight*3,1,f);
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
62 fclose(f);
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
63 }
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
64
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
65
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
66 return 0;
550ebe869cec Added C-C++ interface in DS_VideoDec.h
arpi_esp
parents:
diff changeset
67 }