comparison loader/dshow/test.c @ 169:550ebe869cec

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