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