Mercurial > mplayer.hg
annotate libmpcodecs/vd_dshow.c @ 9709:1b1e33d1688a
Fix rawvideo and -audiofile
Use the new config header
Add a cache for the stream used by -audiofile
author | albeu |
---|---|
date | Thu, 27 Mar 2003 20:38:14 +0000 |
parents | 321763255480 |
children | f34a7cf4265a |
rev | line source |
---|---|
4958 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
5003 | 3 #include <stdarg.h> |
4958 | 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/dshow/DS_VideoDecoder.h" | |
14 | |
15 static vd_info_t info = { | |
16 "DirectShow video codecs", | |
17 "dshow", | |
18 "A'rpi", | |
19 "based on http://avifile.sf.net", | |
20 "win32 codecs" | |
21 }; | |
22 | |
23 LIBVD_EXTERN(dshow) | |
24 | |
25 // to set/get/query special features/parameters | |
26 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
27 switch(cmd){ | |
28 case VDCTRL_QUERY_MAX_PP_LEVEL: | |
29 return 4; | |
30 case VDCTRL_SET_PP_LEVEL: | |
31 if(!sh->context) return CONTROL_ERROR; | |
32 DS_VideoDecoder_SetValue(sh->context,"Quality",*((int*)arg)); | |
33 return CONTROL_OK; | |
34 | |
5003 | 35 case VDCTRL_SET_EQUALIZER: { |
36 va_list ap; | |
37 int value; | |
38 va_start(ap, arg); | |
39 value=va_arg(ap, int); | |
40 va_end(ap); | |
6802 | 41 if(DS_VideoDecoder_SetValue(sh->context,arg,50+value/2)==0) |
5003 | 42 return CONTROL_OK; |
43 return CONTROL_FALSE; | |
44 } | |
45 | |
4958 | 46 } |
47 return CONTROL_UNKNOWN; | |
48 } | |
49 | |
50 // init driver | |
51 static int init(sh_video_t *sh){ | |
52 unsigned int out_fmt; | |
53 if(!(sh->context=DS_VideoDecoder_Open(sh->codec->dll,&sh->codec->guid, sh->bih, 0, 0))){ | |
54 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh->codec->dll); | |
55 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Maybe you forget to upgrade your win32 codecs?? It's time to download the new\n"); | |
8504
321763255480
corrected w32codec address (noticed by Peter Nelson on mplayer-users)
alex
parents:
7180
diff
changeset
|
56 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"package from: ftp://mplayerhq.hu/MPlayer/releases/w32codec.tar.bz2!\n"); |
4958 | 57 return 0; |
58 } | |
5124 | 59 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0; |
4958 | 60 out_fmt=sh->codec->outfmt[sh->outfmtidx]; |
61 switch(out_fmt){ | |
62 case IMGFMT_YUY2: | |
63 case IMGFMT_UYVY: | |
64 DS_VideoDecoder_SetDestFmt(sh->context,16,out_fmt);break; // packed YUV | |
65 case IMGFMT_YV12: | |
66 case IMGFMT_I420: | |
67 case IMGFMT_IYUV: | |
68 DS_VideoDecoder_SetDestFmt(sh->context,12,out_fmt);break; // planar YUV | |
6525 | 69 case IMGFMT_YVU9: |
70 DS_VideoDecoder_SetDestFmt(sh->context,9,out_fmt);break; | |
4958 | 71 default: |
72 DS_VideoDecoder_SetDestFmt(sh->context,out_fmt&255,0); // RGB/BGR | |
73 } | |
5003 | 74 DS_SetAttr_DivX("Quality",divx_quality); |
4958 | 75 DS_VideoDecoder_StartInternal(sh->context); |
76 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DShow video codec init OK!\n"); | |
77 return 1; | |
78 } | |
79 | |
80 // uninit driver | |
81 static void uninit(sh_video_t *sh){ | |
82 DS_VideoDecoder_Destroy(sh->context); | |
83 } | |
84 | |
85 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); | |
86 | |
87 // decode a frame | |
88 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
89 mp_image_t* mpi; | |
90 if(len<=0) return NULL; // skipped frame | |
91 | |
92 if(flags&3){ | |
93 // framedrop: | |
94 DS_VideoDecoder_DecodeInternal(sh->context, data, len, 0, 0); | |
95 return NULL; | |
96 } | |
97 | |
98 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/, | |
99 sh->disp_w, sh->disp_h); | |
100 | |
101 if(!mpi){ // temporary! | |
102 printf("couldn't allocate image for cinepak codec\n"); | |
103 return NULL; | |
104 } | |
105 | |
106 DS_VideoDecoder_DecodeInternal(sh->context, data, len, 0, mpi->planes[0]); | |
107 | |
108 return mpi; | |
109 } | |
110 | |
111 #endif |