Mercurial > mplayer.hg
comparison dec_video.c @ 3442:62b452b7ddf9
changed for updated DShow wrapper api
author | arpi |
---|---|
date | Mon, 10 Dec 2001 20:11:31 +0000 |
parents | 39abf443aac4 |
children | 837bc55b5913 |
comparison
equal
deleted
inserted
replaced
3441:9fec5bdfe06b | 3442:62b452b7ddf9 |
---|---|
55 extern picture_t *picture; // exported from libmpeg2/decode.c | 55 extern picture_t *picture; // exported from libmpeg2/decode.c |
56 | 56 |
57 int divx_quality=0; | 57 int divx_quality=0; |
58 | 58 |
59 #ifdef USE_DIRECTSHOW | 59 #ifdef USE_DIRECTSHOW |
60 static void* ds_vdec=NULL; | |
60 #ifdef NEW_DSHOW | 61 #ifdef NEW_DSHOW |
61 //#include "loader/dshow/DS_VideoDecoder.h" | 62 //#include "loader/dshow/DS_VideoDecoder.h" |
62 //static DS_VideoDecoder* ds_vdec=NULL; | 63 //static DS_VideoDecoder* ds_vdec=NULL; |
63 typedef struct _CodecInfo | 64 typedef struct _CodecInfo |
64 { | 65 { |
65 char* dll; | 66 char* dll; |
66 GUID* guid; | 67 GUID* guid; |
67 }CodecInfo; | 68 }CodecInfo; |
68 static void* ds_vdec=NULL; | |
69 #else | 69 #else |
70 #include "loader/DirectShow/DS_VideoDec.h" | 70 #include "loader/DirectShow/DS_VideoDec.h" |
71 #endif | 71 #endif |
72 #endif | 72 #endif |
73 | 73 |
197 break; | 197 break; |
198 #endif | 198 #endif |
199 #ifdef USE_DIRECTSHOW | 199 #ifdef USE_DIRECTSHOW |
200 case VFM_DSHOW: { | 200 case VFM_DSHOW: { |
201 if(quality<0 || quality>4) quality=4; | 201 if(quality<0 || quality>4) quality=4; |
202 #ifdef NEW_DSHOW | |
203 DS_VideoDecoder_SetValue(ds_vdec,"Quality",quality); | 202 DS_VideoDecoder_SetValue(ds_vdec,"Quality",quality); |
204 #else | |
205 DS_SetValue_DivX("Quality",quality); | |
206 #endif | |
207 } | 203 } |
208 break; | 204 break; |
209 #endif | 205 #endif |
210 #ifdef MPEG12_POSTPROC | 206 #ifdef MPEG12_POSTPROC |
211 case VFM_MPEG: { | 207 case VFM_MPEG: { |
237 } | 233 } |
238 | 234 |
239 int set_video_colors(sh_video_t *sh_video,char *item,int value){ | 235 int set_video_colors(sh_video_t *sh_video,char *item,int value){ |
240 #ifdef USE_DIRECTSHOW | 236 #ifdef USE_DIRECTSHOW |
241 if(sh_video->codec->driver==VFM_DSHOW){ | 237 if(sh_video->codec->driver==VFM_DSHOW){ |
242 #ifdef NEW_DSHOW | |
243 DS_VideoDecoder_SetValue(ds_vdec,item,value); | 238 DS_VideoDecoder_SetValue(ds_vdec,item,value); |
244 #else | |
245 DS_SetValue_DivX(item,value); | |
246 #endif | |
247 return 1; | 239 return 1; |
248 } | 240 } |
249 #endif | 241 #endif |
250 | 242 |
251 #ifdef NEW_DECORE | 243 #ifdef NEW_DECORE |
304 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec); | 296 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec); |
305 break; | 297 break; |
306 #endif | 298 #endif |
307 #ifdef USE_DIRECTSHOW | 299 #ifdef USE_DIRECTSHOW |
308 case VFM_DSHOW: // Win32/DirectShow | 300 case VFM_DSHOW: // Win32/DirectShow |
309 #ifdef NEW_DSHOW | |
310 if(ds_vdec){ DS_VideoDecoder_Destroy(ds_vdec); ds_vdec=NULL; } | 301 if(ds_vdec){ DS_VideoDecoder_Destroy(ds_vdec); ds_vdec=NULL; } |
311 #else | |
312 DS_VideoDecoder_Close(); | |
313 #endif | |
314 break; | 302 break; |
315 #endif | 303 #endif |
316 case VFM_MPEG: | 304 case VFM_MPEG: |
317 mpeg2_free_image_buffers (picture); | 305 mpeg2_free_image_buffers (picture); |
318 break; | 306 break; |
371 CodecInfo ci; | 359 CodecInfo ci; |
372 ci.dll=sh_video->codec->dll; | 360 ci.dll=sh_video->codec->dll; |
373 ci.guid=&sh_video->codec->guid; | 361 ci.guid=&sh_video->codec->guid; |
374 if(!(ds_vdec=DS_VideoDecoder_Create(&ci,sh_video->bih, 0, 0))){ | 362 if(!(ds_vdec=DS_VideoDecoder_Create(&ci,sh_video->bih, 0, 0))){ |
375 #else | 363 #else |
376 if(DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0, &sh_video->our_out_buffer)){ | 364 if(!(ds_vdec=DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0))){ |
377 #endif | 365 #endif |
378 // if(DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0, NULL)){ | 366 // if(DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0, NULL)){ |
379 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh_video->codec->dll); | 367 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh_video->codec->dll); |
380 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Maybe you forget to upgrade your win32 codecs?? It's time to download the new\n"); | 368 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Maybe you forget to upgrade your win32 codecs?? It's time to download the new\n"); |
381 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"package from: ftp://mplayerhq.hu/MPlayer/releases/w32codec.zip !\n"); | 369 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"package from: ftp://mplayerhq.hu/MPlayer/releases/w32codec.zip !\n"); |
385 | 373 |
386 switch(out_fmt){ | 374 switch(out_fmt){ |
387 case IMGFMT_YUY2: | 375 case IMGFMT_YUY2: |
388 case IMGFMT_UYVY: | 376 case IMGFMT_UYVY: |
389 bpp=16; | 377 bpp=16; |
390 #ifdef NEW_DSHOW | |
391 DS_VideoDecoder_SetDestFmt(ds_vdec,16,out_fmt);break; // packed YUV | 378 DS_VideoDecoder_SetDestFmt(ds_vdec,16,out_fmt);break; // packed YUV |
392 #else | |
393 DS_VideoDecoder_SetDestFmt(16,out_fmt);break; // packed YUV | |
394 #endif | |
395 case IMGFMT_YV12: | 379 case IMGFMT_YV12: |
396 case IMGFMT_I420: | 380 case IMGFMT_I420: |
397 case IMGFMT_IYUV: | 381 case IMGFMT_IYUV: |
398 bpp=12; | 382 bpp=12; |
399 #ifdef NEW_DSHOW | |
400 DS_VideoDecoder_SetDestFmt(ds_vdec,12,out_fmt);break; // planar YUV | 383 DS_VideoDecoder_SetDestFmt(ds_vdec,12,out_fmt);break; // planar YUV |
401 #else | |
402 DS_VideoDecoder_SetDestFmt(12,out_fmt);break; // planar YUV | |
403 #endif | |
404 default: | 384 default: |
405 bpp=((out_fmt&255)+7)&(~7); | 385 bpp=((out_fmt&255)+7)&(~7); |
406 #ifdef NEW_DSHOW | |
407 DS_VideoDecoder_SetDestFmt(ds_vdec,out_fmt&255,0); // RGB/BGR | 386 DS_VideoDecoder_SetDestFmt(ds_vdec,out_fmt&255,0); // RGB/BGR |
408 #else | |
409 DS_VideoDecoder_SetDestFmt(out_fmt&255,0); // RGB/BGR | |
410 #endif | |
411 } | 387 } |
412 | 388 |
413 sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*bpp/8); // FIXME!!! | 389 sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*bpp/8); // FIXME!!! |
414 | 390 |
415 DS_SetAttr_DivX("Quality",divx_quality); | 391 DS_SetAttr_DivX("Quality",divx_quality); |
416 | 392 |
417 #ifdef NEW_DSHOW | |
418 DS_VideoDecoder_StartInternal(ds_vdec); | 393 DS_VideoDecoder_StartInternal(ds_vdec); |
419 #else | |
420 DS_VideoDecoder_Start(); | |
421 #endif | |
422 // printf("DivX setting result = %d\n", DS_SetAttr_DivX("Quality",divx_quality) ); | 394 // printf("DivX setting result = %d\n", DS_SetAttr_DivX("Quality",divx_quality) ); |
423 // printf("DivX setting result = %d\n", DS_SetValue_DivX("Brightness",60) ); | 395 // printf("DivX setting result = %d\n", DS_SetValue_DivX("Brightness",60) ); |
424 | 396 |
425 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DShow video codec init OK!\n"); | 397 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DShow video codec init OK!\n"); |
426 break; | 398 break; |
671 } | 643 } |
672 #endif | 644 #endif |
673 #ifdef USE_DIRECTSHOW | 645 #ifdef USE_DIRECTSHOW |
674 case VFM_DSHOW: { // W32/DirectShow | 646 case VFM_DSHOW: { // W32/DirectShow |
675 if(drop_frame<2) | 647 if(drop_frame<2) |
676 #ifdef NEW_DSHOW | |
677 DS_VideoDecoder_DecodeInternal(ds_vdec, start, in_size, 0, drop_frame ? 0 : sh_video->our_out_buffer); | 648 DS_VideoDecoder_DecodeInternal(ds_vdec, start, in_size, 0, drop_frame ? 0 : sh_video->our_out_buffer); |
678 #else | |
679 DS_VideoDecoder_DecodeFrame(start, in_size, 0, !drop_frame); | |
680 #endif | |
681 if(!drop_frame && sh_video->our_out_buffer) blit_frame=3; | 649 if(!drop_frame && sh_video->our_out_buffer) blit_frame=3; |
682 break; | 650 break; |
683 } | 651 } |
684 #endif | 652 #endif |
685 #ifdef USE_LIBAVCODEC | 653 #ifdef USE_LIBAVCODEC |