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