Mercurial > mplayer.hg
annotate libmpcodecs/ve_vfw.c @ 7202:b414c2e34b2e
removed buggy fd<0 check for disallowing dumpstream/cache
author | arpi |
---|---|
date | Sat, 31 Aug 2002 15:44:41 +0000 |
parents | 1e47c2e7aa8e |
children | 1e84415320d8 |
rev | line source |
---|---|
5550 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 #include <string.h> | |
4 | |
5 #include "../config.h" | |
6 #ifdef USE_WIN32DLL | |
7 | |
8 #include "../mp_msg.h" | |
9 | |
10 #include "codec-cfg.h" | |
11 #include "stream.h" | |
12 #include "demuxer.h" | |
13 #include "stheader.h" | |
14 | |
15 #include "aviwrite.h" | |
16 | |
5607 | 17 #include "img_format.h" |
18 #include "mp_image.h" | |
5550 | 19 #include "vf.h" |
20 | |
7127 | 21 extern void mencoder_write_chunk(aviwrite_stream_t *s,int len,unsigned int flags); |
22 | |
5550 | 23 //===========================================================================// |
24 | |
25 #include "dll_init.h" | |
26 | |
6083 | 27 static char *vfw_param_codec = NULL; |
28 | |
29 #include "cfgparser.h" | |
30 | |
31 struct config vfwopts_conf[]={ | |
32 {"codec", &vfw_param_codec, CONF_TYPE_STRING, 0, 0, 0, NULL}, | |
33 {NULL, NULL, 0, 0, 0, 0, NULL} | |
34 }; | |
35 | |
5550 | 36 struct vf_priv_s { |
37 aviwrite_stream_t* mux; | |
38 BITMAPINFOHEADER* bih; | |
39 }; | |
40 | |
41 #define mux_v (vf->priv->mux) | |
42 #define vfw_bih (vf->priv->bih) | |
43 | |
44 static int config(struct vf_instance_s* vf, | |
45 int width, int height, int d_width, int d_height, | |
46 unsigned int flags, unsigned int outfmt){ | |
47 | |
48 vfw_bih->biWidth=width; | |
49 vfw_bih->biHeight=height; | |
50 vfw_bih->biSizeImage=width*height*((vfw_bih->biBitCount+7)/8); | |
5551 | 51 |
52 if(!vfw_start_encoder(vfw_bih, mux_v->bih)) return 0; | |
53 | |
54 // mux_v->bih->biWidth=width; | |
55 // mux_v->bih->biHeight=height; | |
56 // mux_v->bih->biSizeImage=width*height*((mux_v->bih->biBitCount+7)/8); | |
5550 | 57 |
58 return 1; | |
59 } | |
60 | |
61 static int control(struct vf_instance_s* vf, int request, void* data){ | |
62 | |
63 return CONTROL_UNKNOWN; | |
64 } | |
65 | |
66 static int query_format(struct vf_instance_s* vf, unsigned int fmt){ | |
5565
0b301fec999a
capabilities support -> automatic insertion of scale, expand, pp
arpi
parents:
5551
diff
changeset
|
67 if(fmt==IMGFMT_BGR24) return 3 | VFCAP_FLIPPED; |
5550 | 68 return 0; |
69 } | |
70 | |
71 static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){ | |
72 long flags=0; | |
73 int ret; | |
74 // flip_upside_down(vo_image_ptr,vo_image_ptr,3*vo_w,vo_h); // dirty hack | |
75 ret=vfw_encode_frame(mux_v->bih, mux_v->buffer, vfw_bih, mpi->planes[0], &flags, 10000); | |
76 mencoder_write_chunk(mux_v,mux_v->bih->biSizeImage,flags); | |
77 } | |
78 | |
79 //===========================================================================// | |
80 | |
81 static int vf_open(vf_instance_t *vf, char* args){ | |
82 vf->config=config; | |
83 vf->control=control; | |
84 vf->query_format=query_format; | |
85 vf->put_image=put_image; | |
86 vf->priv=malloc(sizeof(struct vf_priv_s)); | |
87 memset(vf->priv,0,sizeof(struct vf_priv_s)); | |
7127 | 88 vf->priv->mux=(aviwrite_stream_t*)args; |
5550 | 89 |
90 vfw_bih=malloc(sizeof(BITMAPINFOHEADER)); | |
91 vfw_bih->biSize=sizeof(BITMAPINFOHEADER); | |
92 vfw_bih->biWidth=0; // FIXME ? | |
93 vfw_bih->biHeight=0; | |
94 vfw_bih->biPlanes=1; | |
95 vfw_bih->biBitCount=24; | |
96 vfw_bih->biCompression=0; | |
97 // vfw_bih->biSizeImage=vo_w*vo_h*((vfw_bih->biBitCount+7)/8); | |
6083 | 98 |
99 if (!vfw_param_codec) | |
100 { | |
101 printf("No VfW codec specified! It's required!\n"); | |
102 return 0; | |
103 } | |
5550 | 104 // mux_v->bih=vfw_open_encoder("divxc32.dll",vfw_bih,mmioFOURCC('D', 'I', 'V', '3')); |
6083 | 105 // mux_v->bih=vfw_open_encoder("AvidAVICodec.dll",vfw_bih, 0); |
106 mux_v->bih = vfw_open_encoder(vfw_param_codec, vfw_bih, 0); | |
5550 | 107 if(!mux_v->bih) return 0; |
108 | |
109 return 1; | |
110 } | |
111 | |
112 vf_info_t ve_info_vfw = { | |
113 "Win32/VfW encoders", | |
114 "vfw", | |
115 "A'rpi", | |
116 "for internal use by mencoder", | |
117 vf_open | |
118 }; | |
119 | |
120 //===========================================================================// | |
121 #endif |