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