annotate codecs.c @ 180:afa2c05cfe43

terrible fatal bug fixed
author arpi_esp
date Wed, 21 Mar 2001 03:20:17 +0000
parents d43c7e6412f0
children a8552ad553e0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 //#define ANGELPOTION
175
d43c7e6412f0 added DirectShow support
arpi_esp
parents: 129
diff changeset
2 //#define USE_DIRECTSHOW
d43c7e6412f0 added DirectShow support
arpi_esp
parents: 129
diff changeset
3
d43c7e6412f0 added DirectShow support
arpi_esp
parents: 129
diff changeset
4 static GUID CLSID_DivxDecompressorCF={0x82CCd3E0, 0xF71A, 0x11D0,
d43c7e6412f0 added DirectShow support
arpi_esp
parents: 129
diff changeset
5 { 0x9f, 0xe5, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}};
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 char* get_vids_codec_name(){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 // unsigned long fccHandler=avi_header.video.fccHandler;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 unsigned long fccHandler=avi_header.bih.biCompression;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 avi_header.yuv_supported=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 avi_header.yuv_hack_needed=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 avi_header.flipped=0;
175
d43c7e6412f0 added DirectShow support
arpi_esp
parents: 129
diff changeset
13 avi_header.vids_guid=NULL;
d43c7e6412f0 added DirectShow support
arpi_esp
parents: 129
diff changeset
14
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 switch(fccHandler){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 case mmioFOURCC('M', 'P', 'G', '4'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 case mmioFOURCC('m', 'p', 'g', '4'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 case mmioFOURCC('M', 'P', '4', '2'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 case mmioFOURCC('m', 'p', '4', '2'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 // case mmioFOURCC('M', 'P', '4', '3'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 // case mmioFOURCC('m', 'p', '4', '3'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 printf("Video in Microsoft MPEG-4 format\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 avi_header.yuv_supported=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 avi_header.yuv_hack_needed=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 #ifdef ANGELPOTION
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 return "APmpg4v1.dll";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 return "mpg4c32.dll";
125
4e42d41dad68 DIV5+DIV6 support
arpi_esp
parents: 124
diff changeset
29
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 case mmioFOURCC('M', 'P', '4', '3'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 case mmioFOURCC('m', 'p', '4', '3'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 printf("Video in MPEG-4 v3 (really DivX) format\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 avi_header.bih.biCompression=mmioFOURCC('d', 'i', 'v', '3'); // hack
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 avi_header.yuv_supported=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 avi_header.yuv_hack_needed=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 #ifdef ANGELPOTION
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 return "APmpg4v1.dll";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 return "divxc32.dll";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 case mmioFOURCC('D', 'I', 'V', 'X'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 case mmioFOURCC('d', 'i', 'v', 'x'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 return "DivX.dll";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44
125
4e42d41dad68 DIV5+DIV6 support
arpi_esp
parents: 124
diff changeset
45 case mmioFOURCC('D', 'I', 'V', '5'):
4e42d41dad68 DIV5+DIV6 support
arpi_esp
parents: 124
diff changeset
46 case mmioFOURCC('d', 'i', 'v', '5'):
4e42d41dad68 DIV5+DIV6 support
arpi_esp
parents: 124
diff changeset
47 case mmioFOURCC('D', 'I', 'V', '6'):
4e42d41dad68 DIV5+DIV6 support
arpi_esp
parents: 124
diff changeset
48 case mmioFOURCC('d', 'i', 'v', '6'):
4e42d41dad68 DIV5+DIV6 support
arpi_esp
parents: 124
diff changeset
49 avi_header.bih.biCompression-=0x02000000; // div5->div3, div6->div4
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 case mmioFOURCC('D', 'I', 'V', '3'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 case mmioFOURCC('d', 'i', 'v', '3'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 case mmioFOURCC('D', 'I', 'V', '4'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 case mmioFOURCC('d', 'i', 'v', '4'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 case mmioFOURCC('M', 'P', '4', '1'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 case mmioFOURCC('m', 'p', '4', '1'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 printf("Video in DivX ;-) format\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 avi_header.yuv_supported=1;
175
d43c7e6412f0 added DirectShow support
arpi_esp
parents: 129
diff changeset
58 #ifdef USE_DIRECTSHOW
d43c7e6412f0 added DirectShow support
arpi_esp
parents: 129
diff changeset
59 avi_header.vids_guid=&CLSID_DivxDecompressorCF;
d43c7e6412f0 added DirectShow support
arpi_esp
parents: 129
diff changeset
60 return "divx_c32.ax";
d43c7e6412f0 added DirectShow support
arpi_esp
parents: 129
diff changeset
61 #else
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 avi_header.yuv_hack_needed=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 #ifdef ANGELPOTION
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 return "APmpg4v1.dll";
175
d43c7e6412f0 added DirectShow support
arpi_esp
parents: 129
diff changeset
65 #else
d43c7e6412f0 added DirectShow support
arpi_esp
parents: 129
diff changeset
66 return "divxc32.dll";
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 #endif
175
d43c7e6412f0 added DirectShow support
arpi_esp
parents: 129
diff changeset
68 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 case mmioFOURCC('I', 'V', '5', '0'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 case mmioFOURCC('i', 'v', '5', '0'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 printf("Video in Indeo Video 5 format\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 avi_header.yuv_supported=1; // YUV pic is upside-down :(
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 return "ir50_32.dll";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 case mmioFOURCC('I', 'V', '4', '1'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 case mmioFOURCC('i', 'v', '4', '1'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 printf("Video in Indeo Video 4.1 format\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 avi_header.flipped=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 avi_header.no_32bpp_support=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 return "ir41_32.dll";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 case mmioFOURCC('I', 'V', '3', '2'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 case mmioFOURCC('i', 'v', '3', '2'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 printf("Video in Indeo Video 3.2 format\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 avi_header.flipped=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 avi_header.no_32bpp_support=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 return "ir32_32.dll";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 case mmioFOURCC('c', 'v', 'i', 'd'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 printf("Video in Cinepak format\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 avi_header.yuv_supported=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 return "iccvid.dll";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94
124
2df337e28820 CRAM codec support added
arpi_esp
parents: 1
diff changeset
95 case mmioFOURCC('c', 'r', 'a', 'm'):
2df337e28820 CRAM codec support added
arpi_esp
parents: 1
diff changeset
96 case mmioFOURCC('C', 'R', 'A', 'M'):
2df337e28820 CRAM codec support added
arpi_esp
parents: 1
diff changeset
97 printf("Video in CRAM format\n");
2df337e28820 CRAM codec support added
arpi_esp
parents: 1
diff changeset
98 avi_header.no_32bpp_support=1;
2df337e28820 CRAM codec support added
arpi_esp
parents: 1
diff changeset
99 //avi_header.yuv_supported=1;
2df337e28820 CRAM codec support added
arpi_esp
parents: 1
diff changeset
100 return "msvidc32.dll";
2df337e28820 CRAM codec support added
arpi_esp
parents: 1
diff changeset
101
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 //*** Only 16bit .DLL available (can't load under linux) ***
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 // case mmioFOURCC('V', 'C', 'R', '1'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 // printf("Video in ATI VCR1 format\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 // return "ativcr1.dll";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 case mmioFOURCC('V', 'C', 'R', '2'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 printf("Video in ATI VCR2 format\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 avi_header.yuv_supported=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 return "ativcr2.dll";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 case mmioFOURCC('A', 'S', 'V', '1'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 printf("Asus ASV-1 format\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 // avi_header.yuv_supported=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115 return "asusasvd.dll";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 case mmioFOURCC('A', 'S', 'V', '2'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 printf("Asus ASV-2 format\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 // avi_header.yuv_supported=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 avi_header.flipped=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121 // avi_header.bih.biCompression=mmioFOURCC('A', 'S', 'V', '1');
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 // return "asusasvd.dll";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 return "asusasv2.dll";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
124
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125 case mmioFOURCC('I', '2', '6', '3'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126 case mmioFOURCC('i', '2', '6', '3'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 printf("Video in I263 format\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128 return "i263_32.drv";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
130 case mmioFOURCC('M', 'J', 'P', 'G'):
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 printf("Video in MJPEG format\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 avi_header.yuv_supported=1;
129
02d5e36e81de MJPEG support added
arpi_esp
parents: 125
diff changeset
133 // return "M3JPEG32.dll";
02d5e36e81de MJPEG support added
arpi_esp
parents: 125
diff changeset
134 return "mcmjpg32.dll";
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
135 // return "m3jpeg32.dll";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136 // return "libavi_mjpeg.so";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138 printf("UNKNOWN video codec: %.4s (0x%0X)\n",&fccHandler,fccHandler);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139 printf("If you know this video format and codec, you can edit codecs.c in the source!\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140 printf("Please contact the author, send this movie to be supported by future version.\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 return NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 char* get_auds_codec_name(){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145 int id=((WAVEFORMATEX*)avi_header.wf_ext)->wFormatTag;
175
d43c7e6412f0 added DirectShow support
arpi_esp
parents: 129
diff changeset
146 avi_header.auds_guid=NULL;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 switch (id){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148 case 0x161://DivX audio
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 // ((WAVEFORMATEX*)avi_header.wf_ext)->wFormatTag=0x160; //hack
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
150 case 0x160://DivX audio
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
151 avi_header.audio_seekable=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152 return "divxa32.acm"; // tested, OK.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 case 0x2://MS ADPCM
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154 avi_header.audio_seekable=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155 return "msadp32.acm"; // tested, OK.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156 case 0x55://MPEG l3
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157 avi_header.audio_seekable=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158 return "l3codeca.acm"; // tested, OK. faster than mp3lib on intel
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 case 0x11://IMA ADPCM
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160 return "imaadp32.acm"; // segfault :(
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161 case 0x31://MS GSM
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
162 case 0x32://MS GSM
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163 return "msgsm32.acm"; // segfault :( - not req. has internal now!
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164 case 0x75://VoxWare
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165 return "voxmsdec.ax"; // directshow, not yet supported just a try
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166 // case 0x06://???
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 // return "lhacm.acm";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168 // return "msg711.acm";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169 // return "tssoft32.acm";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171 printf("UNKNOWN audio codec: 0x%0X\n",id);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172 printf("If you know this audio format and codec, you can edit codecs.c in the source!\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 printf("Please contact the author, send this movie to be supported by future version.\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174 return NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176