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