Mercurial > mplayer.hg
annotate libmpcodecs/vd_dmo.c @ 16399:97007b8b0720
Synced with 1.1076 - patch by Paul TT <paultt - at - hackerjournal - dot - it> with some improvement ;)
author | danny |
---|---|
date | Mon, 05 Sep 2005 11:18:09 +0000 |
parents | f34a7cf4265a |
children | bcd805923554 |
rev | line source |
---|---|
8295 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 #include <stdarg.h> | |
4 | |
5 #include "config.h" | |
6 #ifdef USE_DIRECTSHOW | |
7 | |
8 #include "mp_msg.h" | |
9 #include "help_mp.h" | |
10 | |
11 #include "vd_internal.h" | |
12 | |
13 #include "loader/dmo/DMO_VideoDecoder.h" | |
14 | |
15 static vd_info_t info = { | |
16 "DMO video codecs", | |
17 "dmo", | |
18 "A'rpi", | |
19 "based on http://avifile.sf.net", | |
20 "win32 codecs" | |
21 }; | |
22 | |
23 LIBVD_EXTERN(dmo) | |
24 | |
25 // to set/get/query special features/parameters | |
26 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
27 return CONTROL_UNKNOWN; | |
28 } | |
29 | |
30 // init driver | |
31 static int init(sh_video_t *sh){ | |
32 unsigned int out_fmt; | |
33 if(!(sh->context=DMO_VideoDecoder_Open(sh->codec->dll,&sh->codec->guid, sh->bih, 0, 0))){ | |
34 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh->codec->dll); | |
12763
f34a7cf4265a
Console message corrected and moved to help_mp-en.h.
diego
parents:
8504
diff
changeset
|
35 mp_msg(MSGT_DECVIDEO,MSGL_HINT,MSGTR_DownloadCodecPackage); |
8295 | 36 return 0; |
37 } | |
38 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0; | |
39 out_fmt=sh->codec->outfmt[sh->outfmtidx]; | |
40 switch(out_fmt){ | |
41 case IMGFMT_YUY2: | |
42 case IMGFMT_UYVY: | |
43 DMO_VideoDecoder_SetDestFmt(sh->context,16,out_fmt);break; // packed YUV | |
44 case IMGFMT_YV12: | |
45 case IMGFMT_I420: | |
46 case IMGFMT_IYUV: | |
47 DMO_VideoDecoder_SetDestFmt(sh->context,12,out_fmt);break; // planar YUV | |
48 case IMGFMT_YVU9: | |
49 DMO_VideoDecoder_SetDestFmt(sh->context,9,out_fmt);break; | |
50 default: | |
51 DMO_VideoDecoder_SetDestFmt(sh->context,out_fmt&255,0); // RGB/BGR | |
52 } | |
53 DMO_VideoDecoder_StartInternal(sh->context); | |
12763
f34a7cf4265a
Console message corrected and moved to help_mp-en.h.
diego
parents:
8504
diff
changeset
|
54 mp_msg(MSGT_DECVIDEO,MSGL_V,MSGTR_DMOInitOK); |
8295 | 55 return 1; |
56 } | |
57 | |
58 // uninit driver | |
59 static void uninit(sh_video_t *sh){ | |
60 DMO_VideoDecoder_Destroy(sh->context); | |
61 } | |
62 | |
63 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); | |
64 | |
65 // decode a frame | |
66 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
67 mp_image_t* mpi; | |
68 if(len<=0) return NULL; // skipped frame | |
69 | |
70 if(flags&3){ | |
71 // framedrop: | |
72 DMO_VideoDecoder_DecodeInternal(sh->context, data, len, 0, 0); | |
73 return NULL; | |
74 } | |
75 | |
76 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/, | |
77 sh->disp_w, sh->disp_h); | |
78 | |
79 if(!mpi){ // temporary! | |
80 printf("couldn't allocate image for cinepak codec\n"); | |
81 return NULL; | |
82 } | |
83 | |
84 DMO_VideoDecoder_DecodeInternal(sh->context, data, len, 1, mpi->planes[0]); | |
85 | |
86 return mpi; | |
87 } | |
88 | |
89 #endif |