Mercurial > mplayer.hg
annotate libmpcodecs/vd_dshow.c @ 19859:dae09276a46f
Wording improvements, document only one half of -mouse-movements flag option.
author | diego |
---|---|
date | Sat, 16 Sep 2006 22:14:36 +0000 |
parents | 1ba0aff3ed0a |
children | 0f1b5b68af32 |
rev | line source |
---|---|
4958 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
5003 | 3 #include <stdarg.h> |
4958 | 4 |
5 #include "config.h" | |
6 | |
7 #include "mp_msg.h" | |
8 #include "help_mp.h" | |
9 | |
10 #include "vd_internal.h" | |
11 | |
12 #include "loader/dshow/DS_VideoDecoder.h" | |
13 | |
14 static vd_info_t info = { | |
15 "DirectShow video codecs", | |
16 "dshow", | |
17 "A'rpi", | |
18 "based on http://avifile.sf.net", | |
19 "win32 codecs" | |
20 }; | |
21 | |
22 LIBVD_EXTERN(dshow) | |
23 | |
24 // to set/get/query special features/parameters | |
25 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
26 switch(cmd){ | |
27 case VDCTRL_QUERY_MAX_PP_LEVEL: | |
28 return 4; | |
29 case VDCTRL_SET_PP_LEVEL: | |
30 if(!sh->context) return CONTROL_ERROR; | |
31 DS_VideoDecoder_SetValue(sh->context,"Quality",*((int*)arg)); | |
32 return CONTROL_OK; | |
33 | |
5003 | 34 case VDCTRL_SET_EQUALIZER: { |
35 va_list ap; | |
36 int value; | |
37 va_start(ap, arg); | |
38 value=va_arg(ap, int); | |
39 va_end(ap); | |
6802 | 40 if(DS_VideoDecoder_SetValue(sh->context,arg,50+value/2)==0) |
5003 | 41 return CONTROL_OK; |
42 return CONTROL_FALSE; | |
43 } | |
44 | |
4958 | 45 } |
46 return CONTROL_UNKNOWN; | |
47 } | |
48 | |
49 // init driver | |
50 static int init(sh_video_t *sh){ | |
51 unsigned int out_fmt; | |
15344 | 52 |
53 /* Hack for VSSH codec: new dll can't decode old files | |
54 * In my samples old files have no extradata, so use that info | |
55 * to decide what dll should be used (here and in vd_vfw). | |
56 */ | |
57 if (!strcmp(sh->codec->dll, "vsshdsd.dll") && (sh->bih->biSize == 40)) | |
58 return 0; | |
59 | |
4958 | 60 if(!(sh->context=DS_VideoDecoder_Open(sh->codec->dll,&sh->codec->guid, sh->bih, 0, 0))){ |
61 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
|
62 mp_msg(MSGT_DECVIDEO,MSGL_HINT,MSGTR_DownloadCodecPackage); |
4958 | 63 return 0; |
64 } | |
5124 | 65 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0; |
4958 | 66 out_fmt=sh->codec->outfmt[sh->outfmtidx]; |
67 switch(out_fmt){ | |
68 case IMGFMT_YUY2: | |
69 case IMGFMT_UYVY: | |
70 DS_VideoDecoder_SetDestFmt(sh->context,16,out_fmt);break; // packed YUV | |
71 case IMGFMT_YV12: | |
72 case IMGFMT_I420: | |
73 case IMGFMT_IYUV: | |
74 DS_VideoDecoder_SetDestFmt(sh->context,12,out_fmt);break; // planar YUV | |
6525 | 75 case IMGFMT_YVU9: |
76 DS_VideoDecoder_SetDestFmt(sh->context,9,out_fmt);break; | |
4958 | 77 default: |
78 DS_VideoDecoder_SetDestFmt(sh->context,out_fmt&255,0); // RGB/BGR | |
79 } | |
5003 | 80 DS_SetAttr_DivX("Quality",divx_quality); |
4958 | 81 DS_VideoDecoder_StartInternal(sh->context); |
12763
f34a7cf4265a
Console message corrected and moved to help_mp-en.h.
diego
parents:
8504
diff
changeset
|
82 mp_msg(MSGT_DECVIDEO,MSGL_V,MSGTR_DShowInitOK); |
4958 | 83 return 1; |
84 } | |
85 | |
86 // uninit driver | |
87 static void uninit(sh_video_t *sh){ | |
88 DS_VideoDecoder_Destroy(sh->context); | |
89 } | |
90 | |
91 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); | |
92 | |
93 // decode a frame | |
94 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
95 mp_image_t* mpi; | |
96 if(len<=0) return NULL; // skipped frame | |
97 | |
98 if(flags&3){ | |
99 // framedrop: | |
100 DS_VideoDecoder_DecodeInternal(sh->context, data, len, 0, 0); | |
101 return NULL; | |
102 } | |
103 | |
104 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/, | |
105 sh->disp_w, sh->disp_h); | |
106 | |
107 if(!mpi){ // temporary! | |
18004
bcd805923554
Part2 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu with LOTS of modifications by me
reynaldo
parents:
15344
diff
changeset
|
108 mp_msg(MSGT_DECVIDEO,MSGL_WARN,MSGTR_MPCODECS_CouldntAllocateImageForCinepakCodec); |
4958 | 109 return NULL; |
110 } | |
111 | |
112 DS_VideoDecoder_DecodeInternal(sh->context, data, len, 0, mpi->planes[0]); | |
113 | |
114 return mpi; | |
115 } |