convert some printfs to mp_msg
[mplayer/glamo.git] / loader / dshow / test.c
blob0b3a521f4779482faf0baf594e8021c57916c323
1 #include <stdio.h>
2 #include <stdlib.h>
4 #include "formats.h"
5 #include "com.h"
7 #include "DS_VideoDec.h"
9 int main(int argc,char* argv[]){
10 FILE *f;
11 BITMAPINFOHEADER bih;
12 int len;
13 char *src;
14 char *dst=0;
15 GUID CLSID_DivxDecompressorCF={0x82CCd3E0, 0xF71A, 0x11D0,
16 { 0x9f, 0xe5, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}};
18 f=fopen("test.divx","rb");
20 fread(&bih,sizeof(BITMAPINFOHEADER),1,f);
21 printf("frame dim: %d x %d \n",(int)bih.biWidth,(int)bih.biHeight);
23 src=(char*)malloc(512000);
24 len=fread(src,1,512000,f);
25 printf("frame len = %d\n",len);
27 DS_VideoDecoder_Open("divx_c32.ax", &CLSID_DivxDecompressorCF, &bih, 0, &dst);
29 // DS_VideoDecoder_SetDestFmt(16,fccYUY2);
30 DS_VideoDecoder_SetDestFmt(24,0);
32 printf("DivX setting result = %d\n", DS_SetAttr_DivX("Quality",4) );
34 DS_VideoDecoder_Start();
36 printf("DivX setting result = %d\n", DS_SetValue_DivX("Brightness",60) );
38 DS_VideoDecoder_DecodeFrame(src, len, 1, 1);
40 #if 0
41 f2=fopen("test.yuy2","wb");
42 fwrite(dst,bih.biWidth*bih.biHeight*2,1,f2);
43 fclose(f2);
44 #endif
46 { unsigned char raw_head[32];
47 FILE *f=fopen("test.raw","wb");
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);
61 fwrite(dst,bih.biWidth*bih.biHeight*3,1,f);
62 fclose(f);
66 return 0;