Mercurial > mplayer.hg
annotate dec_video.c @ 4455:e23ce822b5de
YVYU support (untested yet)
author | nick |
---|---|
date | Fri, 01 Feb 2002 08:53:08 +0000 |
parents | 71d05615a378 |
children | 49dcbd03436d |
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 | |
4453 | 416 int init_video(sh_video_t *sh_video,int *pitches) |
417 { | |
1294 | 418 unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx]; |
4453 | 419 pitches[0] = pitches[1] =pitches[2] = 0; /* fake unknown */ |
1294 | 420 |
1454
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
421 sh_video->our_out_buffer=NULL; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
422 |
4188 | 423 sh_video->image=new_mp_image(sh_video->disp_w,sh_video->disp_h); |
424 mp_image_setfmt(sh_video->image,out_fmt); | |
425 | |
1294 | 426 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
|
427 case VFM_CINEPAK: { |
4188 | 428 #ifdef USE_MP_IMAGE |
429 sh_video->image->type=MP_IMGTYPE_STATIC; | |
430 #else | |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
431 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
|
432 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
|
433 (char*)memalign(64, sh_video->disp_w*sh_video->disp_h*bpp); |
4188 | 434 #endif |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
435 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
|
436 break; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
437 } |
2659 | 438 case VFM_XANIM: { |
2378 | 439 #ifdef USE_XANIM |
2827
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
440 int ret=xacodec_init_video(sh_video,out_fmt); |
2378 | 441 if(!ret) return 0; |
2659 | 442 #else |
2660 | 443 // mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_NoXAnimSupport); |
444 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "MPlayer was compiled WIHTOUT XAnim support!\n"); | |
2659 | 445 return 0; |
446 #endif | |
2378 | 447 break; |
448 } | |
1517
0e9c29538a86
Use USE_WIN32DLL define instead of ARCH_X86 to decide whether or not to compile
jkeil
parents:
1496
diff
changeset
|
449 #ifdef USE_WIN32DLL |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
450 case VFM_VFW: { |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
451 if(!init_vfw_video_codec(sh_video,0)) { |
1294 | 452 return 0; |
453 } | |
1567 | 454 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32 video codec init OK!\n"); |
1294 | 455 break; |
456 } | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
457 case VFM_VFWEX: { |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
458 if(!init_vfw_video_codec(sh_video,1)) { |
1297 | 459 return 0; |
460 } | |
1567 | 461 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32Ex video codec init OK!\n"); |
1297 | 462 break; |
463 } | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
464 case VFM_DSHOW: { // Win32/DirectShow |
1294 | 465 #ifndef USE_DIRECTSHOW |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
466 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_NoDShowSupport); |
1294 | 467 return 0; |
468 #else | |
1547
4b0046db8e64
alloc frame buffer for directshow codec - requires for avifile sync
arpi
parents:
1517
diff
changeset
|
469 int bpp; |
3448 | 470 if(!(ds_vdec=DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0, 0))){ |
1294 | 471 // 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
|
472 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh_video->codec->dll); |
1567 | 473 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Maybe you forget to upgrade your win32 codecs?? It's time to download the new\n"); |
474 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"package from: ftp://mplayerhq.hu/MPlayer/releases/w32codec.zip !\n"); | |
475 // mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Or you should disable DShow support: make distclean;make -f Makefile.No-DS\n"); | |
1294 | 476 return 0; |
477 } | |
4188 | 478 |
479 #ifdef USE_MP_IMAGE | |
480 sh_video->image->type=MP_IMGTYPE_STATIC; | |
481 bpp=sh_video->image->bpp; | |
482 if(sh_video->image->flags&MP_IMGFLAG_YUV){ | |
483 DS_VideoDecoder_SetDestFmt(ds_vdec,bpp,out_fmt); // YUV | |
484 } else { | |
485 DS_VideoDecoder_SetDestFmt(ds_vdec,out_fmt&255,0); // RGB/BGR | |
486 } | |
487 #else | |
1294 | 488 switch(out_fmt){ |
489 case IMGFMT_YUY2: | |
490 case IMGFMT_UYVY: | |
1547
4b0046db8e64
alloc frame buffer for directshow codec - requires for avifile sync
arpi
parents:
1517
diff
changeset
|
491 bpp=16; |
3062 | 492 DS_VideoDecoder_SetDestFmt(ds_vdec,16,out_fmt);break; // packed YUV |
1294 | 493 case IMGFMT_YV12: |
494 case IMGFMT_I420: | |
495 case IMGFMT_IYUV: | |
1547
4b0046db8e64
alloc frame buffer for directshow codec - requires for avifile sync
arpi
parents:
1517
diff
changeset
|
496 bpp=12; |
3062 | 497 DS_VideoDecoder_SetDestFmt(ds_vdec,12,out_fmt);break; // planar YUV |
1294 | 498 default: |
1547
4b0046db8e64
alloc frame buffer for directshow codec - requires for avifile sync
arpi
parents:
1517
diff
changeset
|
499 bpp=((out_fmt&255)+7)&(~7); |
3062 | 500 DS_VideoDecoder_SetDestFmt(ds_vdec,out_fmt&255,0); // RGB/BGR |
1294 | 501 } |
502 | |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
503 sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*bpp/8); // FIXME!!! |
4188 | 504 #endif |
1547
4b0046db8e64
alloc frame buffer for directshow codec - requires for avifile sync
arpi
parents:
1517
diff
changeset
|
505 |
3062 | 506 DS_SetAttr_DivX("Quality",divx_quality); |
1294 | 507 |
3062 | 508 DS_VideoDecoder_StartInternal(ds_vdec); |
1294 | 509 // printf("DivX setting result = %d\n", DS_SetAttr_DivX("Quality",divx_quality) ); |
510 // printf("DivX setting result = %d\n", DS_SetValue_DivX("Brightness",60) ); | |
511 | |
1567 | 512 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DShow video codec init OK!\n"); |
1294 | 513 break; |
514 #endif | |
515 } | |
1517
0e9c29538a86
Use USE_WIN32DLL define instead of ARCH_X86 to decide whether or not to compile
jkeil
parents:
1496
diff
changeset
|
516 #else /* !USE_WIN32DLL */ |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
517 case VFM_VFW: |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
518 case VFM_DSHOW: |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
519 case VFM_VFWEX: |
2006 | 520 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
|
521 return 0; |
1517
0e9c29538a86
Use USE_WIN32DLL define instead of ARCH_X86 to decide whether or not to compile
jkeil
parents:
1496
diff
changeset
|
522 #endif /* !USE_WIN32DLL */ |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
523 case VFM_ODIVX: { // OpenDivX |
1567 | 524 mp_msg(MSGT_DECVIDEO,MSGL_V,"OpenDivX video codec\n"); |
1294 | 525 { DEC_PARAM dec_param; |
526 DEC_SET dec_set; | |
1349 | 527 memset(&dec_param,0,sizeof(dec_param)); |
1294 | 528 #ifdef NEW_DECORE |
529 dec_param.output_format=DEC_USER; | |
530 #else | |
531 dec_param.color_depth = 32; | |
532 #endif | |
533 dec_param.x_dim = sh_video->bih->biWidth; | |
534 dec_param.y_dim = sh_video->bih->biHeight; | |
535 decore(0x123, DEC_OPT_INIT, &dec_param, NULL); | |
536 dec_set.postproc_level = divx_quality; | |
537 decore(0x123, DEC_OPT_SETPP, &dec_set, NULL); | |
1349 | 538 } |
1567 | 539 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: OpenDivX video codec init OK!\n"); |
1349 | 540 break; |
541 } | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
542 case VFM_DIVX4: { // DivX4Linux |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
543 #ifndef NEW_DECORE |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
544 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_NoDivx4Support); |
1631 | 545 return 0; |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
546 #else |
1567 | 547 mp_msg(MSGT_DECVIDEO,MSGL_V,"DivX4Linux video codec\n"); |
1349 | 548 { DEC_PARAM dec_param; |
549 DEC_SET dec_set; | |
550 int bits=16; | |
551 memset(&dec_param,0,sizeof(dec_param)); | |
552 switch(out_fmt){ | |
553 case IMGFMT_YV12: dec_param.output_format=DEC_YV12;bits=12;break; | |
554 case IMGFMT_YUY2: dec_param.output_format=DEC_YUY2;break; | |
555 case IMGFMT_UYVY: dec_param.output_format=DEC_UYVY;break; | |
556 case IMGFMT_I420: dec_param.output_format=DEC_420;bits=12;break; | |
557 case IMGFMT_BGR15: dec_param.output_format=DEC_RGB555_INV;break; | |
558 case IMGFMT_BGR16: dec_param.output_format=DEC_RGB565_INV;break; | |
559 case IMGFMT_BGR24: dec_param.output_format=DEC_RGB24_INV;bits=24;break; | |
560 case IMGFMT_BGR32: dec_param.output_format=DEC_RGB32_INV;bits=32;break; | |
561 default: | |
1567 | 562 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Unsupported out_fmt: 0x%X\n",out_fmt); |
1349 | 563 return 0; |
564 } | |
565 dec_param.x_dim = sh_video->bih->biWidth; | |
566 dec_param.y_dim = sh_video->bih->biHeight; | |
567 decore(0x123, DEC_OPT_INIT, &dec_param, NULL); | |
568 dec_set.postproc_level = divx_quality; | |
569 decore(0x123, DEC_OPT_SETPP, &dec_set, NULL); | |
4188 | 570 #ifdef USE_MP_IMAGE |
571 sh_video->image->type=MP_IMGTYPE_STATIC; | |
572 #else | |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
573 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
|
574 // sh_video->our_out_buffer = shmem_alloc(dec_param.x_dim*dec_param.y_dim*5); |
4188 | 575 #endif |
1294 | 576 } |
1567 | 577 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: OpenDivX video codec init OK!\n"); |
1294 | 578 break; |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
579 #endif |
1294 | 580 } |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
581 case VFM_FFMPEG: { // FFmpeg's libavcodec |
1294 | 582 #ifndef USE_LIBAVCODEC |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
583 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_NoLAVCsupport); |
1631 | 584 return 0; |
1294 | 585 #else |
4453 | 586 /* Just because we know that */ |
587 pitches[0] = 16; | |
588 pitches[1] = pitches[2] = 8; | |
1567 | 589 mp_msg(MSGT_DECVIDEO,MSGL_V,"FFmpeg's libavcodec video codec\n"); |
1654 | 590 if(!avcodec_inited){ |
591 avcodec_init(); | |
592 avcodec_register_all(); | |
593 avcodec_inited=1; | |
594 } | |
1294 | 595 lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh_video->codec->dll); |
596 if(!lavc_codec){ | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
597 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh_video->codec->dll); |
1631 | 598 return 0; |
1294 | 599 } |
600 memset(&lavc_context, 0, sizeof(lavc_context)); | |
1462 | 601 // sh_video->disp_h/=2; // !! |
1294 | 602 lavc_context.width=sh_video->disp_w; |
603 lavc_context.height=sh_video->disp_h; | |
1567 | 604 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",lavc_context.width,lavc_context.height); |
3877 | 605 if (sh_video->format == mmioFOURCC('R', 'V', '1', '3')) |
606 lavc_context.sub_id = 3; | |
1294 | 607 /* open it */ |
608 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
|
609 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec); |
1631 | 610 return 0; |
1294 | 611 } |
2228 | 612 #ifdef FF_POSTPROCESS |
613 lavc_pp=divx_quality; | |
614 #endif | |
1567 | 615 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: libavcodec init OK!\n"); |
1294 | 616 break; |
617 #endif | |
618 } | |
619 | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
620 case VFM_MPEG: { |
1294 | 621 // init libmpeg2: |
2567 | 622 mpeg2_init(); |
1294 | 623 #ifdef MPEG12_POSTPROC |
624 picture->pp_options=divx_quality; | |
625 #else | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
626 if(divx_quality) mp_msg(MSGT_DECVIDEO,MSGL_HINT,MSGTR_MpegPPhint); |
1294 | 627 #endif |
4453 | 628 /* Just because we know that */ |
629 pitches[0] = 16; | |
630 pitches[1] = pitches[2] = 8; | |
2567 | 631 // send seq header to the decoder: |
632 mpeg2_decode_data(NULL,videobuffer,videobuffer+videobuf_len,0); | |
1294 | 633 mpeg2_allocate_image_buffers (picture); |
634 break; | |
635 } | |
1488 | 636 case VFM_RAW: { |
3397
39abf443aac4
vfm_raw hack: set outfmt if format != 0x0 (for tv input)
alex
parents:
3303
diff
changeset
|
637 if (sh_video->format != 0x0) |
39abf443aac4
vfm_raw hack: set outfmt if format != 0x0 (for tv input)
alex
parents:
3303
diff
changeset
|
638 /* set out_fmt */ |
39abf443aac4
vfm_raw hack: set outfmt if format != 0x0 (for tv input)
alex
parents:
3303
diff
changeset
|
639 sh_video->codec->outfmt[sh_video->outfmtidx] = sh_video->format; |
1488 | 640 break; |
641 } | |
1948 | 642 case VFM_RLE: { |
643 int bpp=((out_fmt&255)+7)/8; // RGB only | |
4188 | 644 #ifdef USE_MP_IMAGE |
645 sh_video->image->type=MP_IMGTYPE_STATIC; | |
646 #else | |
647 sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*bpp); // FIXME!!! | |
648 #endif | |
1949 | 649 if(bpp==2){ // 15 or 16 bpp ==> palette conversion! |
650 unsigned int* pal=(unsigned int*)(((char*)sh_video->bih)+40); | |
3303 | 651 int cols=(sh_video->bih->biSize-40)/4; |
652 //int cols=1<<(sh_video->bih->biBitCount); | |
1949 | 653 int i; |
654 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
|
655 mp_msg(MSGT_DECVIDEO,MSGL_V,"RLE: converting palette for %d colors.\n",cols); |
1949 | 656 for(i=0;i<cols;i++){ |
657 unsigned int c=pal[i]; | |
658 unsigned int b=c&255; | |
659 unsigned int g=(c>>8)&255; | |
660 unsigned int r=(c>>16)&255; | |
661 if((out_fmt&255)==15) | |
662 pal[i]=((r>>3)<<10)|((g>>3)<<5)|((b>>3)); | |
663 else | |
664 pal[i]=((r>>3)<<11)|((g>>2)<<5)|((b>>3)); | |
665 } | |
666 } | |
1948 | 667 break; |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
668 case VFM_MSVIDC: |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
669 case VFM_FLI: |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
670 case VFM_QTRLE: |
4301
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
671 case VFM_DUCKTM1: |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
672 { |
4188 | 673 #ifdef USE_MP_IMAGE |
674 sh_video->image->type=MP_IMGTYPE_STATIC; | |
675 #else | |
2827
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
676 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
|
677 sh_video->our_out_buffer = |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
678 (char*)memalign(64, sh_video->disp_w*sh_video->disp_h*bpp); // FIXME!!! |
4188 | 679 #endif |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
680 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
|
681 printf ( |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
682 " *** 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
|
683 " 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
|
684 " 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
|
685 sh_video->bih->biBitCount); |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
686 |
3804
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
687 break; |
3172 | 688 } |
4275
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
689 case VFM_QTSMC: |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
690 { |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
691 if (qt_init_decode_smc() != 0) |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
692 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
|
693 #ifdef USE_MP_IMAGE |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
694 sh_video->image->type=MP_IMGTYPE_STATIC; |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
695 #else |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
696 int bpp=((out_fmt&255)+7)/8; // RGB only |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
697 sh_video->our_out_buffer = |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
698 (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
|
699 #endif |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
700 break; |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
701 } |
3804
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
702 case VFM_NUV: |
4188 | 703 #ifdef USE_MP_IMAGE |
704 sh_video->image->type=MP_IMGTYPE_STATIC; | |
705 #else | |
3804
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
706 sh_video->our_out_buffer = (char *)memalign(64, sh_video->disp_w*sh_video->disp_h*3/2); |
4188 | 707 #endif |
3172 | 708 break; |
3969 | 709 case VFM_CYUV: { |
4188 | 710 // int bpp=((out_fmt&255)+7)/8; |
711 #ifdef USE_MP_IMAGE | |
712 sh_video->image->type=MP_IMGTYPE_STATIC; | |
713 #else | |
3969 | 714 sh_video->our_out_buffer = |
715 (char*)memalign(64, sh_video->disp_w*sh_video->disp_h*3); | |
4188 | 716 #endif |
3969 | 717 break; |
718 } | |
1948 | 719 } |
1294 | 720 } |
1654 | 721 sh_video->inited=1; |
1294 | 722 return 1; |
723 } | |
724 | |
1422 | 725 #ifdef USE_LIBVO2 |
726 int decode_video(vo2_handle_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame){ | |
727 #else | |
1294 | 728 int decode_video(vo_functions_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame){ |
1422 | 729 #endif |
4188 | 730 |
731 mp_image_t *mpi=sh_video->image; | |
732 unsigned int out_fmt=mpi->imgfmt; //sh_video->codec->outfmt[sh_video->outfmtidx]; | |
733 int planar=(mpi->flags&MP_IMGFLAG_PLANAR)!=0; //(out_fmt==IMGFMT_YV12||out_fmt==IMGFMT_IYUV||out_fmt==IMGFMT_I420); | |
1294 | 734 int blit_frame=0; |
735 | |
4188 | 736 //uint8_t* planes_[3]; |
737 //uint8_t** planes=planes_; | |
738 //int stride_[3]; | |
739 //int* stride=stride_; | |
1360 | 740 |
741 unsigned int t=GetTimer(); | |
742 unsigned int t2; | |
743 | |
4188 | 744 #ifdef USE_MP_IMAGE |
745 if(mpi->type!=MP_IMGTYPE_EXPORT) | |
746 if( !(mpi->flags&MP_IMGFLAG_ALLOCATED) && !(mpi->flags&MP_IMGFLAG_DIRECT) ){ | |
747 // allocate image buffer: | |
748 sh_video->our_out_buffer = (char *)memalign(64, mpi->width*mpi->height*mpi->bpp/8); | |
749 if((mpi->flags|MP_IMGFLAG_PLANAR) && (mpi->flags|MP_IMGFLAG_YUV)){ | |
750 // planar YUV | |
751 mpi->stride[0]=mpi->width; | |
752 mpi->stride[1]=mpi->stride[2]=mpi->width/2; | |
753 mpi->planes[0]=sh_video->our_out_buffer; | |
754 mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height; | |
755 mpi->planes[2]=mpi->planes[1]+mpi->stride[0]*mpi->height/4; | |
756 } else { | |
757 // packed YUV / RGB | |
758 mpi->stride[0]=mpi->width*mpi->bpp; | |
759 mpi->planes[0]=sh_video->our_out_buffer; | |
760 } | |
761 mpi->flags|=MP_IMGFLAG_ALLOCATED; | |
762 mp_msg(MSGT_DECVIDEO,MSGL_INFO,"mp_image: allocated %d bytes for %dx%dx%d [0x%X] image\n", | |
763 mpi->width*mpi->height*mpi->bpp/8, mpi->width, mpi->height, mpi->bpp, mpi->imgfmt); | |
764 } | |
765 #endif | |
766 | |
2794 | 767 //printf("decode_frame(start: %p, size: %d, w: %d, h: %d)\n", |
768 // start, in_size, sh_video->disp_w, sh_video->disp_h); | |
769 | |
1294 | 770 //-------------------- Decode a frame: ----------------------- |
771 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
|
772 case VFM_CINEPAK: |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
773 decode_cinepak(sh_video->context, start, in_size, sh_video->our_out_buffer, |
3646 | 774 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
|
775 blit_frame = 3; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
776 break; |
2378 | 777 #ifdef USE_XANIM |
778 case VFM_XANIM: { | |
2384 | 779 xacodec_image_t* image=xacodec_decode_frame(start,in_size,drop_frame?1:0); |
780 if(image){ | |
781 blit_frame=2; | |
4188 | 782 //planes=image->planes; |
783 //stride=image->stride; | |
784 mpi->planes[0]=image->planes[0]; | |
785 mpi->planes[1]=image->planes[1]; | |
786 mpi->planes[2]=image->planes[2]; | |
787 mpi->stride[0]=image->stride[0]; | |
788 mpi->stride[1]=image->stride[1]; | |
789 mpi->stride[2]=image->stride[2]; | |
2384 | 790 } |
2378 | 791 break; |
792 } | |
793 #endif | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
794 case VFM_ODIVX: { |
1294 | 795 // OpenDivX |
796 DEC_FRAME dec_frame; | |
797 #ifdef NEW_DECORE | |
798 DEC_PICTURE dec_pic; | |
799 #endif | |
800 // let's decode | |
801 dec_frame.length = in_size; | |
802 dec_frame.bitstream = start; | |
1349 | 803 dec_frame.render_flag = drop_frame?0:1; |
804 | |
1294 | 805 #ifdef NEW_DECORE |
806 dec_frame.bmp=&dec_pic; | |
807 dec_pic.y=dec_pic.u=dec_pic.v=NULL; | |
1349 | 808 decore(0x123, (sh_video->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME, &dec_frame, NULL); |
809 #else | |
1360 | 810 opendivx_src[0]=NULL; |
1349 | 811 decore(0x123, 0, &dec_frame, NULL); |
1294 | 812 #endif |
1360 | 813 |
814 if(!drop_frame) | |
1294 | 815 |
1349 | 816 // let's display |
1294 | 817 #ifdef NEW_DECORE |
818 if(dec_pic.y){ | |
4188 | 819 mpi->planes[0]=dec_pic.y; |
820 mpi->planes[1]=dec_pic.u; | |
821 mpi->planes[2]=dec_pic.v; | |
822 mpi->stride[0]=dec_pic.stride_y; | |
823 mpi->stride[1]=mpi->stride[2]=dec_pic.stride_uv; | |
1360 | 824 blit_frame=2; |
1294 | 825 } |
826 #else | |
827 if(opendivx_src[0]){ | |
4188 | 828 // planes=opendivx_src; |
829 // stride=opendivx_stride; | |
830 mpi->planes[0]=opendivx_src[0]; | |
831 mpi->planes[1]=opendivx_src[1]; | |
832 mpi->planes[2]=opendivx_src[2]; | |
833 mpi->stride[0]=opendivx_stride[0]; | |
834 mpi->stride[1]=opendivx_stride[1]; | |
835 mpi->stride[2]=opendivx_stride[2]; | |
1360 | 836 blit_frame=2; |
1294 | 837 } |
838 #endif | |
839 | |
840 break; | |
841 } | |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
842 #ifdef NEW_DECORE |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
843 case VFM_DIVX4: { |
1349 | 844 // DivX4Linux |
845 DEC_FRAME dec_frame; | |
846 // let's decode | |
847 dec_frame.length = in_size; | |
848 dec_frame.bitstream = start; | |
849 dec_frame.render_flag = drop_frame?0:1; | |
850 dec_frame.bmp=sh_video->our_out_buffer; | |
851 dec_frame.stride=sh_video->disp_w; | |
852 // printf("Decoding DivX4 frame\n"); | |
853 decore(0x123, (sh_video->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME, &dec_frame, NULL); | |
1360 | 854 if(!drop_frame) blit_frame=3; |
1349 | 855 break; |
856 } | |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
857 #endif |
1294 | 858 #ifdef USE_DIRECTSHOW |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
859 case VFM_DSHOW: { // W32/DirectShow |
3062 | 860 if(drop_frame<2) |
861 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
|
862 if(!drop_frame && sh_video->our_out_buffer) blit_frame=3; |
1294 | 863 break; |
864 } | |
865 #endif | |
866 #ifdef USE_LIBAVCODEC | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
867 case VFM_FFMPEG: { // libavcodec |
1294 | 868 int got_picture=0; |
1567 | 869 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"Calling ffmpeg...\n"); |
1294 | 870 if(drop_frame<2 && in_size>0){ |
871 int ret = avcodec_decode_video(&lavc_context, &lavc_picture, | |
872 &got_picture, start, in_size); | |
1489 | 873 if(verbose>1){ |
1462 | 874 unsigned char *x="???"; |
875 switch(lavc_context.pix_fmt){ | |
876 case PIX_FMT_YUV420P: x="YUV420P";break; | |
877 case PIX_FMT_YUV422: x="YUV422";break; | |
878 case PIX_FMT_RGB24: x="RGB24";break; | |
879 case PIX_FMT_BGR24: x="BGR24";break; | |
1465 | 880 #ifdef PIX_FMT_YUV422P |
1462 | 881 case PIX_FMT_YUV422P: x="YUV422P";break; |
882 case PIX_FMT_YUV444P: x="YUV444P";break; | |
1465 | 883 #endif |
1462 | 884 } |
1567 | 885 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"DONE -> got_picture=%d format=0x%X (%s) \n",got_picture, |
1462 | 886 lavc_context.pix_fmt,x); |
887 } | |
1567 | 888 if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n"); |
1360 | 889 if(!drop_frame && got_picture){ |
1454
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
890 // if(!drop_frame){ |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
891 if(planar){ |
2228 | 892 #ifdef FF_POSTPROCESS |
3745 | 893 #ifdef MBC |
2228 | 894 if(lavc_pp){ |
895 // postprocess | |
2291 | 896 int w=(sh_video->disp_w+15)&(~15); |
897 int h=(sh_video->disp_h+15)&(~15); | |
898 int xoff=0; //(w-sh_video->disp_w)/2; | |
899 int yoff=0; //(h-sh_video->disp_h)/2; | |
900 if(!sh_video->our_out_buffer){ | |
901 sh_video->our_out_buffer = (char*)memalign(64,w*h*3/2); | |
902 memset(sh_video->our_out_buffer,0,w*h*3/2); | |
903 } | |
4188 | 904 mpi->stride[0]=w; |
905 mpi->stride[1]=mpi->stride[2]=w/2; | |
906 mpi->planes[0]=sh_video->our_out_buffer+mpi->stride[0]*yoff+xoff; | |
907 mpi->planes[2]=sh_video->our_out_buffer+w*h+mpi->stride[2]*(yoff>>1)+(xoff>>1); | |
908 mpi->planes[1]=mpi->planes[2]+w*h/4; | |
2228 | 909 postprocess(lavc_picture.data,lavc_picture.linesize[0], |
4188 | 910 mpi->planes,mpi->stride[0], |
2228 | 911 sh_video->disp_w,sh_video->disp_h, |
912 &quant_store[0][0],MBC+1,lavc_pp); | |
913 } else | |
914 #endif | |
3745 | 915 #endif |
2228 | 916 { |
4188 | 917 //planes=lavc_picture.data; |
918 //stride=lavc_picture.linesize; | |
919 mpi->planes[0]=lavc_picture.data[0]; | |
920 mpi->planes[1]=lavc_picture.data[1]; | |
921 mpi->planes[2]=lavc_picture.data[2]; | |
922 mpi->stride[0]=lavc_picture.linesize[0]; | |
923 mpi->stride[1]=lavc_picture.linesize[1]; | |
924 mpi->stride[2]=lavc_picture.linesize[2]; | |
925 | |
2228 | 926 //stride[1]=stride[2]=0; |
927 //stride[0]/=2; | |
928 } | |
929 blit_frame=2; | |
1454
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
930 } else { |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
931 int y; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
932 // temporary hack - FIXME |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
933 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
|
934 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
|
935 for(y=0;y<sh_video->disp_h;y++){ |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
936 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
|
937 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
|
938 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
|
939 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
|
940 int x; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
941 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
|
942 d[4*x+0]=s0[2*x+0]; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
943 d[4*x+1]=s1[x]; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
944 d[4*x+2]=s0[2*x+1]; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
945 d[4*x+3]=s2[x]; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
946 } |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
947 } |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
948 blit_frame=3; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
949 } |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
950 |
1360 | 951 } |
1294 | 952 } |
953 break; | |
954 } | |
955 #endif | |
1517
0e9c29538a86
Use USE_WIN32DLL define instead of ARCH_X86 to decide whether or not to compile
jkeil
parents:
1496
diff
changeset
|
956 #ifdef USE_WIN32DLL |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
957 case VFM_VFWEX: |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
958 case VFM_VFW: |
1309
598e3047ce13
Add some preliminary support for non-x86 architectures to mplayer
jkeil
parents:
1297
diff
changeset
|
959 { |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
960 int ret; |
1360 | 961 if(!in_size) break; |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
962 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
|
963 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
|
964 break; |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
965 } |
1360 | 966 if(!drop_frame) blit_frame=3; |
1294 | 967 break; |
968 } | |
1309
598e3047ce13
Add some preliminary support for non-x86 architectures to mplayer
jkeil
parents:
1297
diff
changeset
|
969 #endif |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
970 case VFM_MPEG: |
1873 | 971 if(out_fmt==IMGFMT_MPEGPES){ |
972 // hardware decoding: | |
973 static vo_mpegpes_t packet; | |
974 mpeg2_decode_data(video_out, start, start+in_size,3); // parse headers | |
975 packet.data=start; | |
976 packet.size=in_size-4; | |
977 packet.timestamp=sh_video->timer*90000.0; | |
978 packet.id=0x1E0; //+sh_video->ds->id; | |
4188 | 979 mpi->planes[0]=(uint8_t*)(&packet); |
1873 | 980 blit_frame=2; |
981 } else { | |
982 // software decoding: | |
2019
7de4eceac32f
mpeg2-interlaced patch by Ivan Kalvatchev <iive@yahoo.com>
arpi
parents:
2006
diff
changeset
|
983 if( |
7de4eceac32f
mpeg2-interlaced patch by Ivan Kalvatchev <iive@yahoo.com>
arpi
parents:
2006
diff
changeset
|
984 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
|
985 && (!drop_frame) |
7de4eceac32f
mpeg2-interlaced patch by Ivan Kalvatchev <iive@yahoo.com>
arpi
parents:
2006
diff
changeset
|
986 ) blit_frame=1; |
1873 | 987 } |
1294 | 988 break; |
1488 | 989 case VFM_RAW: |
2794 | 990 // planes[0]=start; |
991 // blit_frame=2; | |
992 sh_video->our_out_buffer = start; | |
993 blit_frame=3; | |
1488 | 994 break; |
1948 | 995 case VFM_RLE: |
996 //void AVI_Decode_RLE8(char *image,char *delta,int tdsize, | |
997 // unsigned int *map,int imagex,int imagey,unsigned char x11_bytes_pixel); | |
998 AVI_Decode_RLE8(sh_video->our_out_buffer,start,in_size, | |
999 (int*)(((char*)sh_video->bih)+40), | |
1000 sh_video->disp_w,sh_video->disp_h,((out_fmt&255)+7)/8); | |
1001 blit_frame=3; | |
1002 break; | |
2827
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1003 case VFM_MSVIDC: |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1004 if (sh_video->bih->biBitCount == 16) |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1005 AVI_Decode_Video1_16( |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1006 start, in_size, sh_video->our_out_buffer, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1007 sh_video->disp_w, sh_video->disp_h, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1008 ((out_fmt&255)+7)/8); |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1009 else |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1010 AVI_Decode_Video1_8( |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1011 start, in_size, sh_video->our_out_buffer, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1012 sh_video->disp_w, sh_video->disp_h, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1013 (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
|
1014 blit_frame = 3; |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1015 break; |
3172 | 1016 case VFM_FLI: |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1017 Decode_Fli( |
3172 | 1018 start, in_size, sh_video->our_out_buffer, |
1019 sh_video->disp_w, sh_video->disp_h, | |
1020 ((out_fmt&255)+7)/8); | |
1021 blit_frame = 3; | |
1022 break; | |
3804
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
1023 case VFM_NUV: |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
1024 decode_nuv( |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
1025 start, in_size, sh_video->our_out_buffer, |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
1026 sh_video->disp_w, sh_video->disp_h); |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
1027 blit_frame = 3; |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
1028 break; |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1029 case VFM_QTRLE: |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1030 qt_decode_rle( |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1031 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
|
1032 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
|
1033 sh_video->bih->biBitCount, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1034 ((out_fmt&255)+7)/8); |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1035 blit_frame = 3; |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
1036 break; |
4227 | 1037 case VFM_QTSMC: |
1038 qt_decode_smc( | |
1039 start, in_size, sh_video->our_out_buffer, | |
1040 sh_video->disp_w, sh_video->disp_h, | |
4275
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
1041 (unsigned char *)sh_video->bih+40, |
4227 | 1042 ((out_fmt&255)+7)/8); |
1043 blit_frame = 3; | |
1044 break; | |
4301
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
1045 case VFM_DUCKTM1: |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
1046 decode_duck_tm1( |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
1047 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
|
1048 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
|
1049 ((out_fmt&255)+7)/8); |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
1050 blit_frame = 3; |
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4275
diff
changeset
|
1051 break; |
3969 | 1052 case VFM_CYUV: |
1053 decode_cyuv(start, in_size, sh_video->our_out_buffer, | |
1054 sh_video->disp_w, sh_video->disp_h, (out_fmt==IMGFMT_YUY2)?16:(out_fmt&255)); | |
1055 blit_frame = 3; | |
1056 break; | |
1294 | 1057 } // switch |
1058 //------------------------ frame decoded. -------------------- | |
1059 | |
3160 | 1060 #ifdef ARCH_X86 |
1367 | 1061 // some codecs is broken, and doesn't restore MMX state :( |
1062 // it happens usually with broken/damaged files. | |
3144 | 1063 if(gCpuCaps.has3DNow){ |
1064 __asm __volatile ("femms\n\t":::"memory"); | |
1065 } | |
1066 else if(gCpuCaps.hasMMX){ | |
1067 __asm __volatile ("emms\n\t":::"memory"); | |
1068 } | |
3160 | 1069 #endif |
1367 | 1070 |
1360 | 1071 t2=GetTimer();t=t2-t;video_time_usage+=t*0.000001f; |
1072 | |
1073 switch(blit_frame){ | |
1074 case 3: | |
1075 if(planar){ | |
4188 | 1076 mpi->stride[0]=sh_video->disp_w; |
1077 mpi->stride[1]=mpi->stride[2]=sh_video->disp_w/2; | |
1078 mpi->planes[0]=sh_video->our_out_buffer; | |
1079 mpi->planes[2]=mpi->planes[0]+sh_video->disp_w*sh_video->disp_h; | |
1080 mpi->planes[1]=mpi->planes[2]+sh_video->disp_w*sh_video->disp_h/4; | |
2716 | 1081 } else { |
4188 | 1082 mpi->planes[0]=sh_video->our_out_buffer; |
1083 mpi->stride[0]=sh_video->disp_w*mpi->bpp; | |
2716 | 1084 if(sh_video->bih && sh_video->bih->biSize==1064) |
4188 | 1085 mpi->planes[1]=&sh_video->bih[1]; // pointer to palette |
2716 | 1086 else |
4188 | 1087 mpi->planes[1]=NULL; |
2716 | 1088 } |
3073 | 1089 //#define VFM_RAW_POSTPROC |
1090 #ifdef VFM_RAW_POSTPROC | |
1091 if (sh_video->codec->driver == VFM_RAW) | |
1092 { | |
1093 mp_dbg(MSGT_DECVIDEO, MSGL_V, "Postprocessing raw %s!\n", | |
1094 vo_format_name(out_fmt)); | |
1095 switch(out_fmt) | |
1096 { | |
1097 case IMGFMT_YV12: | |
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 // case IMGFMT_UYVY: | |
1103 // uyvytoyv12(start, planes[0], planes[1], planes[2], | |
1104 // sh_video->disp_w, sh_video->disp_h, stride[0], stride[1], | |
1105 // sh_video->disp_w*2); | |
1106 // postprocess(planes, stride[0], planes, stride[0], | |
1107 // sh_video->disp_w, sh_video->disp_h, planes[0], | |
1108 // 0, /*0x20000*/divx_quality); | |
1109 // break; | |
1110 default: | |
1111 mp_dbg(MSGT_DECVIDEO, MSGL_DBG2, "Unsuitable outformat (%s) for raw pp!\n", | |
1112 vo_format_name(out_fmt)); | |
1113 } | |
1114 } | |
1115 #endif | |
1360 | 1116 case 2: |
1422 | 1117 #ifdef USE_LIBVO2 |
1118 if(planar) | |
1119 vo2_draw_slice(video_out,planes,stride,sh_video->disp_w,sh_video->disp_h,0,0); | |
1120 else | |
1121 vo2_draw_frame(video_out,planes[0],sh_video->disp_w,sh_video->disp_w,sh_video->disp_h); | |
1122 #else | |
1360 | 1123 if(planar) |
4188 | 1124 video_out->draw_slice(mpi->planes,mpi->stride,sh_video->disp_w,sh_video->disp_h,0,0); |
1360 | 1125 else |
4188 | 1126 video_out->draw_frame(mpi->planes); |
1422 | 1127 #endif |
1360 | 1128 t2=GetTimer()-t2;vout_time_usage+=t2*0.000001f; |
1129 blit_frame=1; | |
1130 break; | |
1131 } | |
1132 | |
1294 | 1133 return blit_frame; |
1134 } | |
1375
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1367
diff
changeset
|
1135 |
2827
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1136 |