Mercurial > mplayer.hg
annotate libmpcodecs/ve_vfw.c @ 6729:62b33bad8fca
Added DVB to the HTML docs.
Parts of this may be outdated, somebody please review.
author | diego |
---|---|
date | Sat, 13 Jul 2002 17:54:04 +0000 |
parents | 6aa4fc282fc7 |
children | 1e47c2e7aa8e |
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 | |
21 //===========================================================================// | |
22 | |
23 #include "dll_init.h" | |
24 | |
6083 | 25 static char *vfw_param_codec = NULL; |
26 | |
27 #include "cfgparser.h" | |
28 | |
29 struct config vfwopts_conf[]={ | |
30 {"codec", &vfw_param_codec, CONF_TYPE_STRING, 0, 0, 0, NULL}, | |
31 {NULL, NULL, 0, 0, 0, 0, NULL} | |
32 }; | |
33 | |
5550 | 34 struct vf_priv_s { |
35 aviwrite_stream_t* mux; | |
36 BITMAPINFOHEADER* bih; | |
37 }; | |
38 | |
39 #define mux_v (vf->priv->mux) | |
40 #define vfw_bih (vf->priv->bih) | |
41 | |
42 static int config(struct vf_instance_s* vf, | |
43 int width, int height, int d_width, int d_height, | |
44 unsigned int flags, unsigned int outfmt){ | |
45 | |
46 vfw_bih->biWidth=width; | |
47 vfw_bih->biHeight=height; | |
48 vfw_bih->biSizeImage=width*height*((vfw_bih->biBitCount+7)/8); | |
5551 | 49 |
50 if(!vfw_start_encoder(vfw_bih, mux_v->bih)) return 0; | |
51 | |
52 // mux_v->bih->biWidth=width; | |
53 // mux_v->bih->biHeight=height; | |
54 // mux_v->bih->biSizeImage=width*height*((mux_v->bih->biBitCount+7)/8); | |
5550 | 55 |
56 return 1; | |
57 } | |
58 | |
59 static int control(struct vf_instance_s* vf, int request, void* data){ | |
60 | |
61 return CONTROL_UNKNOWN; | |
62 } | |
63 | |
64 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
|
65 if(fmt==IMGFMT_BGR24) return 3 | VFCAP_FLIPPED; |
5550 | 66 return 0; |
67 } | |
68 | |
69 static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){ | |
70 long flags=0; | |
71 int ret; | |
72 // flip_upside_down(vo_image_ptr,vo_image_ptr,3*vo_w,vo_h); // dirty hack | |
73 ret=vfw_encode_frame(mux_v->bih, mux_v->buffer, vfw_bih, mpi->planes[0], &flags, 10000); | |
74 mencoder_write_chunk(mux_v,mux_v->bih->biSizeImage,flags); | |
75 } | |
76 | |
77 //===========================================================================// | |
78 | |
79 static int vf_open(vf_instance_t *vf, char* args){ | |
80 vf->config=config; | |
81 vf->control=control; | |
82 vf->query_format=query_format; | |
83 vf->put_image=put_image; | |
84 vf->priv=malloc(sizeof(struct vf_priv_s)); | |
85 memset(vf->priv,0,sizeof(struct vf_priv_s)); | |
86 vf->priv->mux=args; | |
87 | |
88 vfw_bih=malloc(sizeof(BITMAPINFOHEADER)); | |
89 vfw_bih->biSize=sizeof(BITMAPINFOHEADER); | |
90 vfw_bih->biWidth=0; // FIXME ? | |
91 vfw_bih->biHeight=0; | |
92 vfw_bih->biPlanes=1; | |
93 vfw_bih->biBitCount=24; | |
94 vfw_bih->biCompression=0; | |
95 // vfw_bih->biSizeImage=vo_w*vo_h*((vfw_bih->biBitCount+7)/8); | |
6083 | 96 |
97 if (!vfw_param_codec) | |
98 { | |
99 printf("No VfW codec specified! It's required!\n"); | |
100 return 0; | |
101 } | |
5550 | 102 // mux_v->bih=vfw_open_encoder("divxc32.dll",vfw_bih,mmioFOURCC('D', 'I', 'V', '3')); |
6083 | 103 // mux_v->bih=vfw_open_encoder("AvidAVICodec.dll",vfw_bih, 0); |
104 mux_v->bih = vfw_open_encoder(vfw_param_codec, vfw_bih, 0); | |
5550 | 105 if(!mux_v->bih) return 0; |
106 | |
107 return 1; | |
108 } | |
109 | |
110 vf_info_t ve_info_vfw = { | |
111 "Win32/VfW encoders", | |
112 "vfw", | |
113 "A'rpi", | |
114 "for internal use by mencoder", | |
115 vf_open | |
116 }; | |
117 | |
118 //===========================================================================// | |
119 #endif |