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