Mercurial > mplayer.hg
annotate dec_video.c @ 4408:291832d8d984
added constant-qscale encoding support with lavc, fixed slightly incorrect definition for the vme lavc option
author | rfelker |
---|---|
date | Tue, 29 Jan 2002 16:27:21 +0000 |
parents | 817530449706 |
children | 71d05615a378 |
rev | line source |
---|---|
4188 | 1 |
2 #define USE_MP_IMAGE | |
2775 | 3 |
4 #include "config.h" | |
1294 | 5 |
6 #include <stdio.h> | |
2775 | 7 #ifdef HAVE_MALLOC_H |
8 #include <malloc.h> | |
9 #endif | |
1294 | 10 #include <stdlib.h> |
1430 | 11 #include <unistd.h> |
1294 | 12 |
1567 | 13 #include "mp_msg.h" |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
14 #include "help_mp.h" |
1294 | 15 |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1309
diff
changeset
|
16 #include "linux/timer.h" |
1496 | 17 #include "linux/shmem.h" |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1309
diff
changeset
|
18 |
2563 | 19 extern int verbose; // defined in mplayer.c |
20 | |
1294 | 21 #include "stream.h" |
22 #include "demuxer.h" | |
1375
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1367
diff
changeset
|
23 #include "parse_es.h" |
1294 | 24 |
25 #include "codec-cfg.h" | |
26 | |
1422 | 27 #ifdef USE_LIBVO2 |
28 #include "libvo2/libvo2.h" | |
29 #else | |
1294 | 30 #include "libvo/video_out.h" |
1422 | 31 #endif |
1294 | 32 |
4188 | 33 #include "stheader.h" |
34 | |
2563 | 35 #include "dec_video.h" |
36 | |
37 // =================================================================== | |
38 | |
39 extern double video_time_usage; | |
40 extern double vout_time_usage; | |
4388 | 41 extern vo_vaa_t vo_vaa; |
2563 | 42 |
43 extern int frameratecode2framerate[16]; | |
44 | |
45 #include "dll_init.h" | |
46 | |
47 //#include <inttypes.h> | |
48 //#include "libvo/img_format.h" | |
49 | |
1294 | 50 #include "libmpeg2/mpeg2.h" |
51 #include "libmpeg2/mpeg2_internal.h" | |
52 | |
2184 | 53 #include "postproc/postprocess.h" |
54 | |
3144 | 55 #include "cpudetect.h" |
56 | |
1294 | 57 extern picture_t *picture; // exported from libmpeg2/decode.c |
58 | |
2563 | 59 int divx_quality=0; |
1294 | 60 |
61 #ifdef USE_DIRECTSHOW | |
3947
2eb8c8aacca7
using dshow headers from dshow/ instead of c++ version
arpi
parents:
3877
diff
changeset
|
62 #include "loader/dshow/DS_VideoDecoder.h" |
2eb8c8aacca7
using dshow headers from dshow/ instead of c++ version
arpi
parents:
3877
diff
changeset
|
63 static DS_VideoDecoder* ds_vdec=NULL; |
3062 | 64 #endif |
1294 | 65 |
66 #ifdef USE_LIBAVCODEC | |
2496 | 67 #ifdef USE_LIBAVCODEC_SO |
68 #include <libffmpeg/avcodec.h> | |
69 #else | |
1294 | 70 #include "libavcodec/avcodec.h" |
2496 | 71 #endif |
1927 | 72 static AVCodec *lavc_codec=NULL; |
73 static AVCodecContext lavc_context; | |
74 static AVPicture lavc_picture; | |
75 int avcodec_inited=0; | |
1294 | 76 #endif |
2228 | 77 #ifdef FF_POSTPROCESS |
78 unsigned int lavc_pp=0; | |
79 #endif | |
1294 | 80 |
1349 | 81 #ifndef NEW_DECORE |
1294 | 82 #include "opendivx/decore.h" |
1349 | 83 #else |
84 #include <decore.h> | |
85 #endif | |
1294 | 86 |
2378 | 87 #ifdef USE_XANIM |
88 #include "xacodec.h" | |
89 #endif | |
90 | |
2938
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
91 #ifdef USE_TV |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
92 #include "libmpdemux/tv.h" |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
93 extern int tv_param_on; |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
94 extern tvi_handle_t *tv_handler; |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
95 #endif |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
96 |
1948 | 97 void AVI_Decode_RLE8(char *image,char *delta,int tdsize, |
98 unsigned int *map,int imagex,int imagey,unsigned char x11_bytes_pixel); | |
99 | |
2827
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
100 void AVI_Decode_Video1_16( |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
101 char *encoded, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
102 int encoded_size, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
103 char *decoded, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
104 int width, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
105 int height, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
106 int bytes_per_pixel); |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
107 |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
108 void AVI_Decode_Video1_8( |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
109 char *encoded, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
110 int encoded_size, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
111 char *decoded, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
112 int width, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
113 int height, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
114 unsigned char *palette_map, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
115 int bytes_per_pixel); |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
116 |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
117 void Decode_Fli( |
3172 | 118 unsigned char *encoded, |
119 int encoded_size, | |
120 unsigned char *decoded, | |
121 int width, | |
122 int height, | |
123 int bytes_per_pixel); | |
124 | |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
125 void qt_decode_rle( |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
126 unsigned char *encoded, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
127 int encoded_size, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
128 unsigned char *decoded, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
129 int width, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
130 int height, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
131 int encoded_bpp, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
132 int bytes_per_pixel); |
3172 | 133 |
3804
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
134 void decode_nuv( |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
135 unsigned char *encoded, |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
136 int encoded_size, |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
137 unsigned char *decoded, |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
138 int width, |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
139 int height); |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
140 |
3969 | 141 void *decode_cinepak_init(void); |
142 | |
143 void decode_cinepak( | |
144 void *context, | |
145 unsigned char *buf, | |
146 int size, | |
147 unsigned char *frame, | |
148 int width, | |
149 int height, | |
150 int bit_per_pixel); | |
151 | |
152 void decode_cyuv( | |
153 unsigned char *buf, | |
154 int size, | |
155 unsigned char *frame, | |
156 int width, | |
157 int height, | |
158 int bit_per_pixel); | |
159 | |
4275
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
160 int qt_init_decode_smc(void); |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
161 |
4227 | 162 void qt_decode_smc( |
163 unsigned char *encoded, | |
164 int encoded_size, | |
165 unsigned char *decoded, | |
166 int width, | |
167 int height, | |
4275
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
168 unsigned char *palette_map, |
4227 | 169 int bytes_per_pixel); |
170 | |
4301
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
171 void decode_duck_tm1( |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
172 unsigned char *encoded, |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
173 int encoded_size, |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
174 unsigned char *decoded, |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
175 int width, |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
176 int height, |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
177 int bytes_per_pixel); |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
178 |
1294 | 179 //**************************************************************************// |
180 // The OpenDivX stuff: | |
181 //**************************************************************************// | |
182 | |
183 #ifndef NEW_DECORE | |
184 | |
185 static unsigned char *opendivx_src[3]; | |
186 static int opendivx_stride[3]; | |
187 | |
188 // callback, the opendivx decoder calls this for each frame: | |
189 void convert_linux(unsigned char *puc_y, int stride_y, | |
190 unsigned char *puc_u, unsigned char *puc_v, int stride_uv, | |
191 unsigned char *bmp, int width_y, int height_y){ | |
192 | |
193 // printf("convert_yuv called %dx%d stride: %d,%d\n",width_y,height_y,stride_y,stride_uv); | |
194 | |
195 opendivx_src[0]=puc_y; | |
196 opendivx_src[1]=puc_u; | |
197 opendivx_src[2]=puc_v; | |
198 | |
199 opendivx_stride[0]=stride_y; | |
200 opendivx_stride[1]=stride_uv; | |
201 opendivx_stride[2]=stride_uv; | |
202 } | |
203 #endif | |
204 | |
1429 | 205 int get_video_quality_max(sh_video_t *sh_video){ |
206 switch(sh_video->codec->driver){ | |
2087 | 207 #ifdef USE_WIN32DLL |
208 case VFM_VFW: | |
209 case VFM_VFWEX: | |
2184 | 210 return 9; // for Divx.dll (divx4) |
2087 | 211 #endif |
1429 | 212 #ifdef USE_DIRECTSHOW |
213 case VFM_DSHOW: | |
214 return 4; | |
215 #endif | |
216 #ifdef MPEG12_POSTPROC | |
217 case VFM_MPEG: | |
2184 | 218 return GET_PP_QUALITY_MAX; |
1429 | 219 #endif |
2228 | 220 #ifdef FF_POSTPROCESS |
221 case VFM_FFMPEG: | |
222 return GET_PP_QUALITY_MAX; | |
223 #endif | |
1429 | 224 case VFM_DIVX4: |
225 case VFM_ODIVX: | |
2184 | 226 #ifdef NEW_DECORE |
227 return 9; // for divx4linux | |
228 #else | |
229 return GET_PP_QUALITY_MAX; // for opendivx | |
230 #endif | |
1429 | 231 } |
232 return 0; | |
233 } | |
234 | |
235 void set_video_quality(sh_video_t *sh_video,int quality){ | |
236 switch(sh_video->codec->driver){ | |
2087 | 237 #ifdef USE_WIN32DLL |
238 case VFM_VFW: | |
239 case VFM_VFWEX: | |
240 vfw_set_postproc(sh_video,10*quality); | |
241 break; | |
242 #endif | |
1429 | 243 #ifdef USE_DIRECTSHOW |
244 case VFM_DSHOW: { | |
245 if(quality<0 || quality>4) quality=4; | |
3062 | 246 DS_VideoDecoder_SetValue(ds_vdec,"Quality",quality); |
1429 | 247 } |
248 break; | |
249 #endif | |
250 #ifdef MPEG12_POSTPROC | |
251 case VFM_MPEG: { | |
2184 | 252 if(quality<0 || quality>GET_PP_QUALITY_MAX) quality=GET_PP_QUALITY_MAX; |
253 picture->pp_options=getPpModeForQuality(quality); | |
1429 | 254 } |
255 break; | |
256 #endif | |
2228 | 257 #ifdef FF_POSTPROCESS |
258 case VFM_FFMPEG: | |
259 if(quality<0 || quality>GET_PP_QUALITY_MAX) quality=GET_PP_QUALITY_MAX; | |
260 lavc_pp=getPpModeForQuality(quality); | |
261 break; | |
262 #endif | |
1429 | 263 case VFM_DIVX4: |
264 case VFM_ODIVX: { | |
265 DEC_SET dec_set; | |
2184 | 266 #ifdef NEW_DECORE |
267 if(quality<0 || quality>9) quality=9; | |
268 dec_set.postproc_level=quality*10; | |
269 #else | |
270 if(quality<0 || quality>GET_PP_QUALITY_MAX) quality=GET_PP_QUALITY_MAX; | |
271 dec_set.postproc_level=getPpModeForQuality(quality); | |
272 #endif | |
1429 | 273 decore(0x123,DEC_OPT_SETPP,&dec_set,NULL); |
274 } | |
275 break; | |
276 } | |
277 } | |
278 | |
4395 | 279 int set_video_colors(sh_video_t *sh_video,char *item,int value) |
280 { | |
281 if(vo_vaa.get_video_eq) | |
4388 | 282 { |
4395 | 283 vidix_video_eq_t veq; |
284 if(vo_vaa.get_video_eq(&veq) == 0) | |
4388 | 285 { |
4395 | 286 int v_hw_equ_cap = veq.cap; |
287 if(v_hw_equ_cap != 0) | |
288 { | |
289 if(vo_vaa.set_video_eq) | |
290 { | |
291 vidix_video_eq_t veq; | |
292 veq.flags = VEQ_FLG_ITU_R_BT_601; /* Fixme please !!! */ | |
293 if(strcmp(item,"Brightness") == 0) | |
294 { | |
295 if(!(v_hw_equ_cap & VEQ_CAP_BRIGHTNESS)) goto try_sw_control; | |
296 veq.brightness = value*10; | |
297 veq.cap = VEQ_CAP_BRIGHTNESS; | |
298 } | |
299 else | |
300 if(strcmp(item,"Contrast") == 0) | |
301 { | |
302 if(!(v_hw_equ_cap & VEQ_CAP_CONTRAST)) goto try_sw_control; | |
303 veq.contrast = value*10; | |
304 veq.cap = VEQ_CAP_CONTRAST; | |
305 } | |
306 else | |
307 if(strcmp(item,"Saturation") == 0) | |
308 { | |
309 if(!(v_hw_equ_cap & VEQ_CAP_SATURATION)) goto try_sw_control; | |
310 veq.saturation = value*10; | |
311 veq.cap = VEQ_CAP_SATURATION; | |
312 } | |
313 else | |
314 if(strcmp(item,"Hue") == 0) | |
315 { | |
316 if(!(v_hw_equ_cap & VEQ_CAP_HUE)) goto try_sw_control; | |
317 veq.hue = value*10; | |
318 veq.cap = VEQ_CAP_HUE; | |
319 } | |
320 else goto try_sw_control;; | |
321 vo_vaa.set_video_eq(&veq); | |
322 } | |
323 return 1; | |
324 } | |
4388 | 325 } |
326 } | |
4395 | 327 try_sw_control: |
1431 | 328 #ifdef USE_DIRECTSHOW |
2295 | 329 if(sh_video->codec->driver==VFM_DSHOW){ |
3062 | 330 DS_VideoDecoder_SetValue(ds_vdec,item,value); |
1429 | 331 return 1; |
332 } | |
1431 | 333 #endif |
2938
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
334 |
2295 | 335 #ifdef NEW_DECORE |
336 #ifdef DECORE_VERSION | |
337 #if DECORE_VERSION >= 20011010 | |
338 if(sh_video->codec->driver==VFM_DIVX4){ | |
339 int option; | |
340 if(!strcmp(item,"Brightness")) option=DEC_GAMMA_BRIGHTNESS; | |
341 else if(!strcmp(item, "Contrast")) option=DEC_GAMMA_CONTRAST; | |
342 else if(!strcmp(item,"Saturation")) option=DEC_GAMMA_SATURATION; | |
343 else return 0; | |
344 value = (value * 256) / 100 - 128; | |
345 decore(0x123, DEC_OPT_GAMMA, (void *)option, (void *) value); | |
346 return 1; | |
347 } | |
348 #endif | |
349 #endif | |
350 #endif | |
2938
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
351 |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
352 #ifdef USE_TV |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
353 |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
354 if (tv_param_on == 1) |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
355 { |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
356 if (!strcmp(item, "Brightness")) |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
357 { |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
358 tv_set_color_options(tv_handler, TV_COLOR_BRIGHTNESS, value); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
359 return(1); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
360 } |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
361 if (!strcmp(item, "Hue")) |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
362 { |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
363 tv_set_color_options(tv_handler, TV_COLOR_HUE, value); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
364 return(1); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
365 } |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
366 if (!strcmp(item, "Saturation")) |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
367 { |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
368 tv_set_color_options(tv_handler, TV_COLOR_SATURATION, value); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
369 return(1); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
370 } |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
371 if (!strcmp(item, "Contrast")) |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
372 { |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
373 tv_set_color_options(tv_handler, TV_COLOR_CONTRAST, value); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
374 return(1); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
375 } |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
376 } |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
377 #endif |
1429 | 378 return 0; |
379 } | |
1294 | 380 |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
381 void uninit_video(sh_video_t *sh_video){ |
1654 | 382 if(!sh_video->inited) return; |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
383 mp_msg(MSGT_DECVIDEO,MSGL_V,"uninit video: %d \n",sh_video->codec->driver); |
1654 | 384 switch(sh_video->codec->driver){ |
1666 | 385 #ifdef USE_LIBAVCODEC |
1654 | 386 case VFM_FFMPEG: |
387 if (avcodec_close(&lavc_context) < 0) | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
388 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec); |
1654 | 389 break; |
1666 | 390 #endif |
1669 | 391 #ifdef USE_DIRECTSHOW |
1664 | 392 case VFM_DSHOW: // Win32/DirectShow |
3062 | 393 if(ds_vdec){ DS_VideoDecoder_Destroy(ds_vdec); ds_vdec=NULL; } |
1664 | 394 break; |
1666 | 395 #endif |
1654 | 396 case VFM_MPEG: |
397 mpeg2_free_image_buffers (picture); | |
398 break; | |
2563 | 399 #ifdef USE_XANIM |
400 case VFM_XANIM: | |
401 xacodec_exit(); | |
402 break; | |
403 #endif | |
4156
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
3969
diff
changeset
|
404 case VFM_DIVX4: |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
3969
diff
changeset
|
405 case VFM_ODIVX: |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
3969
diff
changeset
|
406 decore(0x123,DEC_OPT_RELEASE,NULL,NULL); |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
3969
diff
changeset
|
407 break; |
1654 | 408 } |
409 if(sh_video->our_out_buffer){ | |
410 free(sh_video->our_out_buffer); | |
411 sh_video->our_out_buffer=NULL; | |
412 } | |
413 sh_video->inited=0; | |
414 } | |
415 | |
1294 | 416 int init_video(sh_video_t *sh_video){ |
417 unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx]; | |
418 | |
1454
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
419 sh_video->our_out_buffer=NULL; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
420 |
4188 | 421 sh_video->image=new_mp_image(sh_video->disp_w,sh_video->disp_h); |
422 mp_image_setfmt(sh_video->image,out_fmt); | |
423 | |
1294 | 424 switch(sh_video->codec->driver){ |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
425 case VFM_CINEPAK: { |
4188 | 426 #ifdef USE_MP_IMAGE |
427 sh_video->image->type=MP_IMGTYPE_STATIC; | |
428 #else | |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
429 int bpp=((out_fmt&255)+7)/8; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
430 sh_video->our_out_buffer = |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
431 (char*)memalign(64, sh_video->disp_w*sh_video->disp_h*bpp); |
4188 | 432 #endif |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
433 sh_video->context = decode_cinepak_init(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
434 break; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
435 } |
2659 | 436 case VFM_XANIM: { |
2378 | 437 #ifdef USE_XANIM |
2827
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
438 int ret=xacodec_init_video(sh_video,out_fmt); |
2378 | 439 if(!ret) return 0; |
2659 | 440 #else |
2660 | 441 // mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_NoXAnimSupport); |
442 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "MPlayer was compiled WIHTOUT XAnim support!\n"); | |
2659 | 443 return 0; |
444 #endif | |
2378 | 445 break; |
446 } | |
1517
0e9c29538a86
Use USE_WIN32DLL define instead of ARCH_X86 to decide whether or not to compile
jkeil
parents:
1496
diff
changeset
|
447 #ifdef USE_WIN32DLL |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
448 case VFM_VFW: { |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
449 if(!init_vfw_video_codec(sh_video,0)) { |
1294 | 450 return 0; |
451 } | |
1567 | 452 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32 video codec init OK!\n"); |
1294 | 453 break; |
454 } | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
455 case VFM_VFWEX: { |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
456 if(!init_vfw_video_codec(sh_video,1)) { |
1297 | 457 return 0; |
458 } | |
1567 | 459 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32Ex video codec init OK!\n"); |
1297 | 460 break; |
461 } | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
462 case VFM_DSHOW: { // Win32/DirectShow |
1294 | 463 #ifndef USE_DIRECTSHOW |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
464 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_NoDShowSupport); |
1294 | 465 return 0; |
466 #else | |
1547
4b0046db8e64
alloc frame buffer for directshow codec - requires for avifile sync
arpi
parents:
1517
diff
changeset
|
467 int bpp; |
3448 | 468 if(!(ds_vdec=DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0, 0))){ |
1294 | 469 // if(DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0, NULL)){ |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
470 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh_video->codec->dll); |
1567 | 471 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Maybe you forget to upgrade your win32 codecs?? It's time to download the new\n"); |
472 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"package from: ftp://mplayerhq.hu/MPlayer/releases/w32codec.zip !\n"); | |
473 // mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Or you should disable DShow support: make distclean;make -f Makefile.No-DS\n"); | |
1294 | 474 return 0; |
475 } | |
4188 | 476 |
477 #ifdef USE_MP_IMAGE | |
478 sh_video->image->type=MP_IMGTYPE_STATIC; | |
479 bpp=sh_video->image->bpp; | |
480 if(sh_video->image->flags&MP_IMGFLAG_YUV){ | |
481 DS_VideoDecoder_SetDestFmt(ds_vdec,bpp,out_fmt); // YUV | |
482 } else { | |
483 DS_VideoDecoder_SetDestFmt(ds_vdec,out_fmt&255,0); // RGB/BGR | |
484 } | |
485 #else | |
1294 | 486 switch(out_fmt){ |
487 case IMGFMT_YUY2: | |
488 case IMGFMT_UYVY: | |
1547
4b0046db8e64
alloc frame buffer for directshow codec - requires for avifile sync
arpi
parents:
1517
diff
changeset
|
489 bpp=16; |
3062 | 490 DS_VideoDecoder_SetDestFmt(ds_vdec,16,out_fmt);break; // packed YUV |
1294 | 491 case IMGFMT_YV12: |
492 case IMGFMT_I420: | |
493 case IMGFMT_IYUV: | |
1547
4b0046db8e64
alloc frame buffer for directshow codec - requires for avifile sync
arpi
parents:
1517
diff
changeset
|
494 bpp=12; |
3062 | 495 DS_VideoDecoder_SetDestFmt(ds_vdec,12,out_fmt);break; // planar YUV |
1294 | 496 default: |
1547
4b0046db8e64
alloc frame buffer for directshow codec - requires for avifile sync
arpi
parents:
1517
diff
changeset
|
497 bpp=((out_fmt&255)+7)&(~7); |
3062 | 498 DS_VideoDecoder_SetDestFmt(ds_vdec,out_fmt&255,0); // RGB/BGR |
1294 | 499 } |
500 | |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
501 sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*bpp/8); // FIXME!!! |
4188 | 502 #endif |
1547
4b0046db8e64
alloc frame buffer for directshow codec - requires for avifile sync
arpi
parents:
1517
diff
changeset
|
503 |
3062 | 504 DS_SetAttr_DivX("Quality",divx_quality); |
1294 | 505 |
3062 | 506 DS_VideoDecoder_StartInternal(ds_vdec); |
1294 | 507 // printf("DivX setting result = %d\n", DS_SetAttr_DivX("Quality",divx_quality) ); |
508 // printf("DivX setting result = %d\n", DS_SetValue_DivX("Brightness",60) ); | |
509 | |
1567 | 510 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DShow video codec init OK!\n"); |
1294 | 511 break; |
512 #endif | |
513 } | |
1517
0e9c29538a86
Use USE_WIN32DLL define instead of ARCH_X86 to decide whether or not to compile
jkeil
parents:
1496
diff
changeset
|
514 #else /* !USE_WIN32DLL */ |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
515 case VFM_VFW: |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
516 case VFM_DSHOW: |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
517 case VFM_VFWEX: |
2006 | 518 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_NoWfvSupport); |
1309
598e3047ce13
Add some preliminary support for non-x86 architectures to mplayer
jkeil
parents:
1297
diff
changeset
|
519 return 0; |
1517
0e9c29538a86
Use USE_WIN32DLL define instead of ARCH_X86 to decide whether or not to compile
jkeil
parents:
1496
diff
changeset
|
520 #endif /* !USE_WIN32DLL */ |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
521 case VFM_ODIVX: { // OpenDivX |
1567 | 522 mp_msg(MSGT_DECVIDEO,MSGL_V,"OpenDivX video codec\n"); |
1294 | 523 { DEC_PARAM dec_param; |
524 DEC_SET dec_set; | |
1349 | 525 memset(&dec_param,0,sizeof(dec_param)); |
1294 | 526 #ifdef NEW_DECORE |
527 dec_param.output_format=DEC_USER; | |
528 #else | |
529 dec_param.color_depth = 32; | |
530 #endif | |
531 dec_param.x_dim = sh_video->bih->biWidth; | |
532 dec_param.y_dim = sh_video->bih->biHeight; | |
533 decore(0x123, DEC_OPT_INIT, &dec_param, NULL); | |
534 dec_set.postproc_level = divx_quality; | |
535 decore(0x123, DEC_OPT_SETPP, &dec_set, NULL); | |
1349 | 536 } |
1567 | 537 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: OpenDivX video codec init OK!\n"); |
1349 | 538 break; |
539 } | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
540 case VFM_DIVX4: { // DivX4Linux |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
541 #ifndef NEW_DECORE |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
542 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_NoDivx4Support); |
1631 | 543 return 0; |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
544 #else |
1567 | 545 mp_msg(MSGT_DECVIDEO,MSGL_V,"DivX4Linux video codec\n"); |
1349 | 546 { DEC_PARAM dec_param; |
547 DEC_SET dec_set; | |
548 int bits=16; | |
549 memset(&dec_param,0,sizeof(dec_param)); | |
550 switch(out_fmt){ | |
551 case IMGFMT_YV12: dec_param.output_format=DEC_YV12;bits=12;break; | |
552 case IMGFMT_YUY2: dec_param.output_format=DEC_YUY2;break; | |
553 case IMGFMT_UYVY: dec_param.output_format=DEC_UYVY;break; | |
554 case IMGFMT_I420: dec_param.output_format=DEC_420;bits=12;break; | |
555 case IMGFMT_BGR15: dec_param.output_format=DEC_RGB555_INV;break; | |
556 case IMGFMT_BGR16: dec_param.output_format=DEC_RGB565_INV;break; | |
557 case IMGFMT_BGR24: dec_param.output_format=DEC_RGB24_INV;bits=24;break; | |
558 case IMGFMT_BGR32: dec_param.output_format=DEC_RGB32_INV;bits=32;break; | |
559 default: | |
1567 | 560 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Unsupported out_fmt: 0x%X\n",out_fmt); |
1349 | 561 return 0; |
562 } | |
563 dec_param.x_dim = sh_video->bih->biWidth; | |
564 dec_param.y_dim = sh_video->bih->biHeight; | |
565 decore(0x123, DEC_OPT_INIT, &dec_param, NULL); | |
566 dec_set.postproc_level = divx_quality; | |
567 decore(0x123, DEC_OPT_SETPP, &dec_set, NULL); | |
4188 | 568 #ifdef USE_MP_IMAGE |
569 sh_video->image->type=MP_IMGTYPE_STATIC; | |
570 #else | |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
571 sh_video->our_out_buffer = (char*)memalign(64,((bits*dec_param.x_dim+7)/8)*dec_param.y_dim); |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
572 // sh_video->our_out_buffer = shmem_alloc(dec_param.x_dim*dec_param.y_dim*5); |
4188 | 573 #endif |
1294 | 574 } |
1567 | 575 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: OpenDivX video codec init OK!\n"); |
1294 | 576 break; |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
577 #endif |
1294 | 578 } |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
579 case VFM_FFMPEG: { // FFmpeg's libavcodec |
1294 | 580 #ifndef USE_LIBAVCODEC |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
581 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_NoLAVCsupport); |
1631 | 582 return 0; |
1294 | 583 #else |
1567 | 584 mp_msg(MSGT_DECVIDEO,MSGL_V,"FFmpeg's libavcodec video codec\n"); |
1654 | 585 if(!avcodec_inited){ |
586 avcodec_init(); | |
587 avcodec_register_all(); | |
588 avcodec_inited=1; | |
589 } | |
1294 | 590 lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh_video->codec->dll); |
591 if(!lavc_codec){ | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
592 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh_video->codec->dll); |
1631 | 593 return 0; |
1294 | 594 } |
595 memset(&lavc_context, 0, sizeof(lavc_context)); | |
1462 | 596 // sh_video->disp_h/=2; // !! |
1294 | 597 lavc_context.width=sh_video->disp_w; |
598 lavc_context.height=sh_video->disp_h; | |
1567 | 599 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",lavc_context.width,lavc_context.height); |
3877 | 600 if (sh_video->format == mmioFOURCC('R', 'V', '1', '3')) |
601 lavc_context.sub_id = 3; | |
1294 | 602 /* open it */ |
603 if (avcodec_open(&lavc_context, lavc_codec) < 0) { | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
604 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec); |
1631 | 605 return 0; |
1294 | 606 } |
2228 | 607 #ifdef FF_POSTPROCESS |
608 lavc_pp=divx_quality; | |
609 #endif | |
1567 | 610 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: libavcodec init OK!\n"); |
1294 | 611 break; |
612 #endif | |
613 } | |
614 | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
615 case VFM_MPEG: { |
1294 | 616 // init libmpeg2: |
2567 | 617 mpeg2_init(); |
1294 | 618 #ifdef MPEG12_POSTPROC |
619 picture->pp_options=divx_quality; | |
620 #else | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
621 if(divx_quality) mp_msg(MSGT_DECVIDEO,MSGL_HINT,MSGTR_MpegPPhint); |
1294 | 622 #endif |
2567 | 623 // send seq header to the decoder: |
624 mpeg2_decode_data(NULL,videobuffer,videobuffer+videobuf_len,0); | |
1294 | 625 mpeg2_allocate_image_buffers (picture); |
626 break; | |
627 } | |
1488 | 628 case VFM_RAW: { |
3397
39abf443aac4
vfm_raw hack: set outfmt if format != 0x0 (for tv input)
alex
parents:
3303
diff
changeset
|
629 if (sh_video->format != 0x0) |
39abf443aac4
vfm_raw hack: set outfmt if format != 0x0 (for tv input)
alex
parents:
3303
diff
changeset
|
630 /* set out_fmt */ |
39abf443aac4
vfm_raw hack: set outfmt if format != 0x0 (for tv input)
alex
parents:
3303
diff
changeset
|
631 sh_video->codec->outfmt[sh_video->outfmtidx] = sh_video->format; |
1488 | 632 break; |
633 } | |
1948 | 634 case VFM_RLE: { |
635 int bpp=((out_fmt&255)+7)/8; // RGB only | |
4188 | 636 #ifdef USE_MP_IMAGE |
637 sh_video->image->type=MP_IMGTYPE_STATIC; | |
638 #else | |
639 sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*bpp); // FIXME!!! | |
640 #endif | |
1949 | 641 if(bpp==2){ // 15 or 16 bpp ==> palette conversion! |
642 unsigned int* pal=(unsigned int*)(((char*)sh_video->bih)+40); | |
3303 | 643 int cols=(sh_video->bih->biSize-40)/4; |
644 //int cols=1<<(sh_video->bih->biBitCount); | |
1949 | 645 int i; |
646 if(cols>256) cols=256; | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
647 mp_msg(MSGT_DECVIDEO,MSGL_V,"RLE: converting palette for %d colors.\n",cols); |
1949 | 648 for(i=0;i<cols;i++){ |
649 unsigned int c=pal[i]; | |
650 unsigned int b=c&255; | |
651 unsigned int g=(c>>8)&255; | |
652 unsigned int r=(c>>16)&255; | |
653 if((out_fmt&255)==15) | |
654 pal[i]=((r>>3)<<10)|((g>>3)<<5)|((b>>3)); | |
655 else | |
656 pal[i]=((r>>3)<<11)|((g>>2)<<5)|((b>>3)); | |
657 } | |
658 } | |
1948 | 659 break; |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
660 case VFM_MSVIDC: |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
661 case VFM_FLI: |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
662 case VFM_QTRLE: |
4301
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
663 case VFM_DUCKTM1: |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
664 { |
4188 | 665 #ifdef USE_MP_IMAGE |
666 sh_video->image->type=MP_IMGTYPE_STATIC; | |
667 #else | |
2827
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
668 int bpp=((out_fmt&255)+7)/8; // RGB only |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
669 sh_video->our_out_buffer = |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
670 (char*)memalign(64, sh_video->disp_w*sh_video->disp_h*bpp); // FIXME!!! |
4188 | 671 #endif |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
672 if ((sh_video->codec->driver == VFM_QTRLE) && (sh_video->bih->biBitCount != 24)) |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
673 printf ( |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
674 " *** FYI: This Quicktime file is using %d-bit RLE Animation\n" \ |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
675 " encoding, which is not yet supported by MPlayer. But if you upload\n" \ |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
676 " this Quicktime file to the MPlayer FTP, the team could look at it.\n", |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
677 sh_video->bih->biBitCount); |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
678 |
3804
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
679 break; |
3172 | 680 } |
4275
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
681 case VFM_QTSMC: |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
682 { |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
683 if (qt_init_decode_smc() != 0) |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
684 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "SMC decoder could not allocate enough memory"); |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
685 #ifdef USE_MP_IMAGE |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
686 sh_video->image->type=MP_IMGTYPE_STATIC; |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
687 #else |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
688 int bpp=((out_fmt&255)+7)/8; // RGB only |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
689 sh_video->our_out_buffer = |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
690 (char*)memalign(64, sh_video->disp_w*sh_video->disp_h*bpp); // FIXME!!! |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
691 #endif |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
692 break; |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
693 } |
3804
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
694 case VFM_NUV: |
4188 | 695 #ifdef USE_MP_IMAGE |
696 sh_video->image->type=MP_IMGTYPE_STATIC; | |
697 #else | |
3804
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
698 sh_video->our_out_buffer = (char *)memalign(64, sh_video->disp_w*sh_video->disp_h*3/2); |
4188 | 699 #endif |
3172 | 700 break; |
3969 | 701 case VFM_CYUV: { |
4188 | 702 // int bpp=((out_fmt&255)+7)/8; |
703 #ifdef USE_MP_IMAGE | |
704 sh_video->image->type=MP_IMGTYPE_STATIC; | |
705 #else | |
3969 | 706 sh_video->our_out_buffer = |
707 (char*)memalign(64, sh_video->disp_w*sh_video->disp_h*3); | |
4188 | 708 #endif |
3969 | 709 break; |
710 } | |
1948 | 711 } |
1294 | 712 } |
1654 | 713 sh_video->inited=1; |
1294 | 714 return 1; |
715 } | |
716 | |
1422 | 717 #ifdef USE_LIBVO2 |
718 int decode_video(vo2_handle_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame){ | |
719 #else | |
1294 | 720 int decode_video(vo_functions_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame){ |
1422 | 721 #endif |
4188 | 722 |
723 mp_image_t *mpi=sh_video->image; | |
724 unsigned int out_fmt=mpi->imgfmt; //sh_video->codec->outfmt[sh_video->outfmtidx]; | |
725 int planar=(mpi->flags&MP_IMGFLAG_PLANAR)!=0; //(out_fmt==IMGFMT_YV12||out_fmt==IMGFMT_IYUV||out_fmt==IMGFMT_I420); | |
1294 | 726 int blit_frame=0; |
727 | |
4188 | 728 //uint8_t* planes_[3]; |
729 //uint8_t** planes=planes_; | |
730 //int stride_[3]; | |
731 //int* stride=stride_; | |
1360 | 732 |
733 unsigned int t=GetTimer(); | |
734 unsigned int t2; | |
735 | |
4188 | 736 #ifdef USE_MP_IMAGE |
737 if(mpi->type!=MP_IMGTYPE_EXPORT) | |
738 if( !(mpi->flags&MP_IMGFLAG_ALLOCATED) && !(mpi->flags&MP_IMGFLAG_DIRECT) ){ | |
739 // allocate image buffer: | |
740 sh_video->our_out_buffer = (char *)memalign(64, mpi->width*mpi->height*mpi->bpp/8); | |
741 if((mpi->flags|MP_IMGFLAG_PLANAR) && (mpi->flags|MP_IMGFLAG_YUV)){ | |
742 // planar YUV | |
743 mpi->stride[0]=mpi->width; | |
744 mpi->stride[1]=mpi->stride[2]=mpi->width/2; | |
745 mpi->planes[0]=sh_video->our_out_buffer; | |
746 mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height; | |
747 mpi->planes[2]=mpi->planes[1]+mpi->stride[0]*mpi->height/4; | |
748 } else { | |
749 // packed YUV / RGB | |
750 mpi->stride[0]=mpi->width*mpi->bpp; | |
751 mpi->planes[0]=sh_video->our_out_buffer; | |
752 } | |
753 mpi->flags|=MP_IMGFLAG_ALLOCATED; | |
754 mp_msg(MSGT_DECVIDEO,MSGL_INFO,"mp_image: allocated %d bytes for %dx%dx%d [0x%X] image\n", | |
755 mpi->width*mpi->height*mpi->bpp/8, mpi->width, mpi->height, mpi->bpp, mpi->imgfmt); | |
756 } | |
757 #endif | |
758 | |
2794 | 759 //printf("decode_frame(start: %p, size: %d, w: %d, h: %d)\n", |
760 // start, in_size, sh_video->disp_w, sh_video->disp_h); | |
761 | |
1294 | 762 //-------------------- Decode a frame: ----------------------- |
763 switch(sh_video->codec->driver){ | |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
764 case VFM_CINEPAK: |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
765 decode_cinepak(sh_video->context, start, in_size, sh_video->our_out_buffer, |
3646 | 766 sh_video->disp_w, sh_video->disp_h, (out_fmt==IMGFMT_YUY2)?16:(out_fmt&255)); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
767 blit_frame = 3; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
768 break; |
2378 | 769 #ifdef USE_XANIM |
770 case VFM_XANIM: { | |
2384 | 771 xacodec_image_t* image=xacodec_decode_frame(start,in_size,drop_frame?1:0); |
772 if(image){ | |
773 blit_frame=2; | |
4188 | 774 //planes=image->planes; |
775 //stride=image->stride; | |
776 mpi->planes[0]=image->planes[0]; | |
777 mpi->planes[1]=image->planes[1]; | |
778 mpi->planes[2]=image->planes[2]; | |
779 mpi->stride[0]=image->stride[0]; | |
780 mpi->stride[1]=image->stride[1]; | |
781 mpi->stride[2]=image->stride[2]; | |
2384 | 782 } |
2378 | 783 break; |
784 } | |
785 #endif | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
786 case VFM_ODIVX: { |
1294 | 787 // OpenDivX |
788 DEC_FRAME dec_frame; | |
789 #ifdef NEW_DECORE | |
790 DEC_PICTURE dec_pic; | |
791 #endif | |
792 // let's decode | |
793 dec_frame.length = in_size; | |
794 dec_frame.bitstream = start; | |
1349 | 795 dec_frame.render_flag = drop_frame?0:1; |
796 | |
1294 | 797 #ifdef NEW_DECORE |
798 dec_frame.bmp=&dec_pic; | |
799 dec_pic.y=dec_pic.u=dec_pic.v=NULL; | |
1349 | 800 decore(0x123, (sh_video->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME, &dec_frame, NULL); |
801 #else | |
1360 | 802 opendivx_src[0]=NULL; |
1349 | 803 decore(0x123, 0, &dec_frame, NULL); |
1294 | 804 #endif |
1360 | 805 |
806 if(!drop_frame) | |
1294 | 807 |
1349 | 808 // let's display |
1294 | 809 #ifdef NEW_DECORE |
810 if(dec_pic.y){ | |
4188 | 811 mpi->planes[0]=dec_pic.y; |
812 mpi->planes[1]=dec_pic.u; | |
813 mpi->planes[2]=dec_pic.v; | |
814 mpi->stride[0]=dec_pic.stride_y; | |
815 mpi->stride[1]=mpi->stride[2]=dec_pic.stride_uv; | |
1360 | 816 blit_frame=2; |
1294 | 817 } |
818 #else | |
819 if(opendivx_src[0]){ | |
4188 | 820 // planes=opendivx_src; |
821 // stride=opendivx_stride; | |
822 mpi->planes[0]=opendivx_src[0]; | |
823 mpi->planes[1]=opendivx_src[1]; | |
824 mpi->planes[2]=opendivx_src[2]; | |
825 mpi->stride[0]=opendivx_stride[0]; | |
826 mpi->stride[1]=opendivx_stride[1]; | |
827 mpi->stride[2]=opendivx_stride[2]; | |
1360 | 828 blit_frame=2; |
1294 | 829 } |
830 #endif | |
831 | |
832 break; | |
833 } | |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
834 #ifdef NEW_DECORE |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
835 case VFM_DIVX4: { |
1349 | 836 // DivX4Linux |
837 DEC_FRAME dec_frame; | |
838 // let's decode | |
839 dec_frame.length = in_size; | |
840 dec_frame.bitstream = start; | |
841 dec_frame.render_flag = drop_frame?0:1; | |
842 dec_frame.bmp=sh_video->our_out_buffer; | |
843 dec_frame.stride=sh_video->disp_w; | |
844 // printf("Decoding DivX4 frame\n"); | |
845 decore(0x123, (sh_video->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME, &dec_frame, NULL); | |
1360 | 846 if(!drop_frame) blit_frame=3; |
1349 | 847 break; |
848 } | |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
849 #endif |
1294 | 850 #ifdef USE_DIRECTSHOW |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
851 case VFM_DSHOW: { // W32/DirectShow |
3062 | 852 if(drop_frame<2) |
853 DS_VideoDecoder_DecodeInternal(ds_vdec, start, in_size, 0, drop_frame ? 0 : sh_video->our_out_buffer); | |
1362
11673118f37f
Fix segfault in DShow video decoder. Using directshow, the
jkeil
parents:
1360
diff
changeset
|
854 if(!drop_frame && sh_video->our_out_buffer) blit_frame=3; |
1294 | 855 break; |
856 } | |
857 #endif | |
858 #ifdef USE_LIBAVCODEC | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
859 case VFM_FFMPEG: { // libavcodec |
1294 | 860 int got_picture=0; |
1567 | 861 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"Calling ffmpeg...\n"); |
1294 | 862 if(drop_frame<2 && in_size>0){ |
863 int ret = avcodec_decode_video(&lavc_context, &lavc_picture, | |
864 &got_picture, start, in_size); | |
1489 | 865 if(verbose>1){ |
1462 | 866 unsigned char *x="???"; |
867 switch(lavc_context.pix_fmt){ | |
868 case PIX_FMT_YUV420P: x="YUV420P";break; | |
869 case PIX_FMT_YUV422: x="YUV422";break; | |
870 case PIX_FMT_RGB24: x="RGB24";break; | |
871 case PIX_FMT_BGR24: x="BGR24";break; | |
1465 | 872 #ifdef PIX_FMT_YUV422P |
1462 | 873 case PIX_FMT_YUV422P: x="YUV422P";break; |
874 case PIX_FMT_YUV444P: x="YUV444P";break; | |
1465 | 875 #endif |
1462 | 876 } |
1567 | 877 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"DONE -> got_picture=%d format=0x%X (%s) \n",got_picture, |
1462 | 878 lavc_context.pix_fmt,x); |
879 } | |
1567 | 880 if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n"); |
1360 | 881 if(!drop_frame && got_picture){ |
1454
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
882 // if(!drop_frame){ |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
883 if(planar){ |
2228 | 884 #ifdef FF_POSTPROCESS |
3745 | 885 #ifdef MBC |
2228 | 886 if(lavc_pp){ |
887 // postprocess | |
2291 | 888 int w=(sh_video->disp_w+15)&(~15); |
889 int h=(sh_video->disp_h+15)&(~15); | |
890 int xoff=0; //(w-sh_video->disp_w)/2; | |
891 int yoff=0; //(h-sh_video->disp_h)/2; | |
892 if(!sh_video->our_out_buffer){ | |
893 sh_video->our_out_buffer = (char*)memalign(64,w*h*3/2); | |
894 memset(sh_video->our_out_buffer,0,w*h*3/2); | |
895 } | |
4188 | 896 mpi->stride[0]=w; |
897 mpi->stride[1]=mpi->stride[2]=w/2; | |
898 mpi->planes[0]=sh_video->our_out_buffer+mpi->stride[0]*yoff+xoff; | |
899 mpi->planes[2]=sh_video->our_out_buffer+w*h+mpi->stride[2]*(yoff>>1)+(xoff>>1); | |
900 mpi->planes[1]=mpi->planes[2]+w*h/4; | |
2228 | 901 postprocess(lavc_picture.data,lavc_picture.linesize[0], |
4188 | 902 mpi->planes,mpi->stride[0], |
2228 | 903 sh_video->disp_w,sh_video->disp_h, |
904 &quant_store[0][0],MBC+1,lavc_pp); | |
905 } else | |
906 #endif | |
3745 | 907 #endif |
2228 | 908 { |
4188 | 909 //planes=lavc_picture.data; |
910 //stride=lavc_picture.linesize; | |
911 mpi->planes[0]=lavc_picture.data[0]; | |
912 mpi->planes[1]=lavc_picture.data[1]; | |
913 mpi->planes[2]=lavc_picture.data[2]; | |
914 mpi->stride[0]=lavc_picture.linesize[0]; | |
915 mpi->stride[1]=lavc_picture.linesize[1]; | |
916 mpi->stride[2]=lavc_picture.linesize[2]; | |
917 | |
2228 | 918 //stride[1]=stride[2]=0; |
919 //stride[0]/=2; | |
920 } | |
921 blit_frame=2; | |
1454
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
922 } else { |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
923 int y; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
924 // temporary hack - FIXME |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
925 if(!sh_video->our_out_buffer) |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
926 sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*2); |
1454
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
927 for(y=0;y<sh_video->disp_h;y++){ |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
928 unsigned char *s0=lavc_picture.data[0]+lavc_picture.linesize[0]*y; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
929 unsigned char *s1=lavc_picture.data[1]+lavc_picture.linesize[1]*y; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
930 unsigned char *s2=lavc_picture.data[2]+lavc_picture.linesize[2]*y; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
931 unsigned char *d=sh_video->our_out_buffer+y*2*sh_video->disp_w; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
932 int x; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
933 for(x=0;x<sh_video->disp_w/2;x++){ |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
934 d[4*x+0]=s0[2*x+0]; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
935 d[4*x+1]=s1[x]; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
936 d[4*x+2]=s0[2*x+1]; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
937 d[4*x+3]=s2[x]; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
938 } |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
939 } |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
940 blit_frame=3; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
941 } |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
942 |
1360 | 943 } |
1294 | 944 } |
945 break; | |
946 } | |
947 #endif | |
1517
0e9c29538a86
Use USE_WIN32DLL define instead of ARCH_X86 to decide whether or not to compile
jkeil
parents:
1496
diff
changeset
|
948 #ifdef USE_WIN32DLL |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
949 case VFM_VFWEX: |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
950 case VFM_VFW: |
1309
598e3047ce13
Add some preliminary support for non-x86 architectures to mplayer
jkeil
parents:
1297
diff
changeset
|
951 { |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
952 int ret; |
1360 | 953 if(!in_size) break; |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
954 if((ret=vfw_decode_video(sh_video,start,in_size,drop_frame,(sh_video->codec->driver==VFM_VFWEX) ))){ |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
955 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error decompressing frame, err=%d\n",ret); |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
956 break; |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
957 } |
1360 | 958 if(!drop_frame) blit_frame=3; |
1294 | 959 break; |
960 } | |
1309
598e3047ce13
Add some preliminary support for non-x86 architectures to mplayer
jkeil
parents:
1297
diff
changeset
|
961 #endif |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
962 case VFM_MPEG: |
1873 | 963 if(out_fmt==IMGFMT_MPEGPES){ |
964 // hardware decoding: | |
965 static vo_mpegpes_t packet; | |
966 mpeg2_decode_data(video_out, start, start+in_size,3); // parse headers | |
967 packet.data=start; | |
968 packet.size=in_size-4; | |
969 packet.timestamp=sh_video->timer*90000.0; | |
970 packet.id=0x1E0; //+sh_video->ds->id; | |
4188 | 971 mpi->planes[0]=(uint8_t*)(&packet); |
1873 | 972 blit_frame=2; |
973 } else { | |
974 // software decoding: | |
2019
7de4eceac32f
mpeg2-interlaced patch by Ivan Kalvatchev <iive@yahoo.com>
arpi
parents:
2006
diff
changeset
|
975 if( |
7de4eceac32f
mpeg2-interlaced patch by Ivan Kalvatchev <iive@yahoo.com>
arpi
parents:
2006
diff
changeset
|
976 mpeg2_decode_data(video_out, start, start+in_size,drop_frame) > 0 // decode |
7de4eceac32f
mpeg2-interlaced patch by Ivan Kalvatchev <iive@yahoo.com>
arpi
parents:
2006
diff
changeset
|
977 && (!drop_frame) |
7de4eceac32f
mpeg2-interlaced patch by Ivan Kalvatchev <iive@yahoo.com>
arpi
parents:
2006
diff
changeset
|
978 ) blit_frame=1; |
1873 | 979 } |
1294 | 980 break; |
1488 | 981 case VFM_RAW: |
2794 | 982 // planes[0]=start; |
983 // blit_frame=2; | |
984 sh_video->our_out_buffer = start; | |
985 blit_frame=3; | |
1488 | 986 break; |
1948 | 987 case VFM_RLE: |
988 //void AVI_Decode_RLE8(char *image,char *delta,int tdsize, | |
989 // unsigned int *map,int imagex,int imagey,unsigned char x11_bytes_pixel); | |
990 AVI_Decode_RLE8(sh_video->our_out_buffer,start,in_size, | |
991 (int*)(((char*)sh_video->bih)+40), | |
992 sh_video->disp_w,sh_video->disp_h,((out_fmt&255)+7)/8); | |
993 blit_frame=3; | |
994 break; | |
2827
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
995 case VFM_MSVIDC: |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
996 if (sh_video->bih->biBitCount == 16) |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
997 AVI_Decode_Video1_16( |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
998 start, in_size, sh_video->our_out_buffer, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
999 sh_video->disp_w, sh_video->disp_h, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1000 ((out_fmt&255)+7)/8); |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1001 else |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1002 AVI_Decode_Video1_8( |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1003 start, in_size, sh_video->our_out_buffer, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1004 sh_video->disp_w, sh_video->disp_h, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1005 (char *)sh_video->bih+40, ((out_fmt&255)+7)/8); |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1006 blit_frame = 3; |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1007 break; |
3172 | 1008 case VFM_FLI: |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1009 Decode_Fli( |
3172 | 1010 start, in_size, sh_video->our_out_buffer, |
1011 sh_video->disp_w, sh_video->disp_h, | |
1012 ((out_fmt&255)+7)/8); | |
1013 blit_frame = 3; | |
1014 break; | |
3804
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
1015 case VFM_NUV: |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
1016 decode_nuv( |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
1017 start, in_size, sh_video->our_out_buffer, |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
1018 sh_video->disp_w, sh_video->disp_h); |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
1019 blit_frame = 3; |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
1020 break; |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1021 case VFM_QTRLE: |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1022 qt_decode_rle( |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1023 start, in_size, sh_video->our_out_buffer, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1024 sh_video->disp_w, sh_video->disp_h, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1025 sh_video->bih->biBitCount, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1026 ((out_fmt&255)+7)/8); |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1027 blit_frame = 3; |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1028 break; |
4227 | 1029 case VFM_QTSMC: |
1030 qt_decode_smc( | |
1031 start, in_size, sh_video->our_out_buffer, | |
1032 sh_video->disp_w, sh_video->disp_h, | |
4275
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
1033 (unsigned char *)sh_video->bih+40, |
4227 | 1034 ((out_fmt&255)+7)/8); |
1035 blit_frame = 3; | |
1036 break; | |
4301
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
1037 case VFM_DUCKTM1: |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
1038 decode_duck_tm1( |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
1039 start, in_size, sh_video->our_out_buffer, |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
1040 sh_video->disp_w, sh_video->disp_h, |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
1041 ((out_fmt&255)+7)/8); |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
1042 blit_frame = 3; |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
1043 break; |
3969 | 1044 case VFM_CYUV: |
1045 decode_cyuv(start, in_size, sh_video->our_out_buffer, | |
1046 sh_video->disp_w, sh_video->disp_h, (out_fmt==IMGFMT_YUY2)?16:(out_fmt&255)); | |
1047 blit_frame = 3; | |
1048 break; | |
1294 | 1049 } // switch |
1050 //------------------------ frame decoded. -------------------- | |
1051 | |
3160 | 1052 #ifdef ARCH_X86 |
1367 | 1053 // some codecs is broken, and doesn't restore MMX state :( |
1054 // it happens usually with broken/damaged files. | |
3144 | 1055 if(gCpuCaps.has3DNow){ |
1056 __asm __volatile ("femms\n\t":::"memory"); | |
1057 } | |
1058 else if(gCpuCaps.hasMMX){ | |
1059 __asm __volatile ("emms\n\t":::"memory"); | |
1060 } | |
3160 | 1061 #endif |
1367 | 1062 |
1360 | 1063 t2=GetTimer();t=t2-t;video_time_usage+=t*0.000001f; |
1064 | |
1065 switch(blit_frame){ | |
1066 case 3: | |
1067 if(planar){ | |
4188 | 1068 mpi->stride[0]=sh_video->disp_w; |
1069 mpi->stride[1]=mpi->stride[2]=sh_video->disp_w/2; | |
1070 mpi->planes[0]=sh_video->our_out_buffer; | |
1071 mpi->planes[2]=mpi->planes[0]+sh_video->disp_w*sh_video->disp_h; | |
1072 mpi->planes[1]=mpi->planes[2]+sh_video->disp_w*sh_video->disp_h/4; | |
2716 | 1073 } else { |
4188 | 1074 mpi->planes[0]=sh_video->our_out_buffer; |
1075 mpi->stride[0]=sh_video->disp_w*mpi->bpp; | |
2716 | 1076 if(sh_video->bih && sh_video->bih->biSize==1064) |
4188 | 1077 mpi->planes[1]=&sh_video->bih[1]; // pointer to palette |
2716 | 1078 else |
4188 | 1079 mpi->planes[1]=NULL; |
2716 | 1080 } |
3073 | 1081 //#define VFM_RAW_POSTPROC |
1082 #ifdef VFM_RAW_POSTPROC | |
1083 if (sh_video->codec->driver == VFM_RAW) | |
1084 { | |
1085 mp_dbg(MSGT_DECVIDEO, MSGL_V, "Postprocessing raw %s!\n", | |
1086 vo_format_name(out_fmt)); | |
1087 switch(out_fmt) | |
1088 { | |
1089 case IMGFMT_YV12: | |
1090 postprocess(planes, stride[0], planes, stride[0], | |
1091 sh_video->disp_w, sh_video->disp_h, planes[0], | |
1092 0, /*0x20000*/divx_quality); | |
1093 break; | |
1094 // case IMGFMT_UYVY: | |
1095 // uyvytoyv12(start, planes[0], planes[1], planes[2], | |
1096 // sh_video->disp_w, sh_video->disp_h, stride[0], stride[1], | |
1097 // sh_video->disp_w*2); | |
1098 // postprocess(planes, stride[0], planes, stride[0], | |
1099 // sh_video->disp_w, sh_video->disp_h, planes[0], | |
1100 // 0, /*0x20000*/divx_quality); | |
1101 // break; | |
1102 default: | |
1103 mp_dbg(MSGT_DECVIDEO, MSGL_DBG2, "Unsuitable outformat (%s) for raw pp!\n", | |
1104 vo_format_name(out_fmt)); | |
1105 } | |
1106 } | |
1107 #endif | |
1360 | 1108 case 2: |
1422 | 1109 #ifdef USE_LIBVO2 |
1110 if(planar) | |
1111 vo2_draw_slice(video_out,planes,stride,sh_video->disp_w,sh_video->disp_h,0,0); | |
1112 else | |
1113 vo2_draw_frame(video_out,planes[0],sh_video->disp_w,sh_video->disp_w,sh_video->disp_h); | |
1114 #else | |
1360 | 1115 if(planar) |
4188 | 1116 video_out->draw_slice(mpi->planes,mpi->stride,sh_video->disp_w,sh_video->disp_h,0,0); |
1360 | 1117 else |
4188 | 1118 video_out->draw_frame(mpi->planes); |
1422 | 1119 #endif |
1360 | 1120 t2=GetTimer()-t2;vout_time_usage+=t2*0.000001f; |
1121 blit_frame=1; | |
1122 break; | |
1123 } | |
1124 | |
1294 | 1125 return blit_frame; |
1126 } | |
1375
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1367
diff
changeset
|
1127 |
2827
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1128 |