Mercurial > mplayer.hg
comparison libmpcodecs/ve_vfw.c @ 5550:7d1dfb59c6c0
encoders
author | arpi |
---|---|
date | Wed, 10 Apr 2002 23:23:36 +0000 |
parents | |
children | 73978162b6a1 |
comparison
equal
deleted
inserted
replaced
5549:7bed3fb6a3be | 5550:7d1dfb59c6c0 |
---|---|
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 | |
17 #include "../libvo/img_format.h" | |
18 #include "../mp_image.h" | |
19 #include "vf.h" | |
20 | |
21 //===========================================================================// | |
22 | |
23 #include "dll_init.h" | |
24 | |
25 struct vf_priv_s { | |
26 aviwrite_stream_t* mux; | |
27 BITMAPINFOHEADER* bih; | |
28 }; | |
29 | |
30 #define mux_v (vf->priv->mux) | |
31 #define vfw_bih (vf->priv->bih) | |
32 | |
33 static int config(struct vf_instance_s* vf, | |
34 int width, int height, int d_width, int d_height, | |
35 unsigned int flags, unsigned int outfmt){ | |
36 | |
37 vfw_bih->biWidth=width; | |
38 vfw_bih->biHeight=height; | |
39 vfw_bih->biSizeImage=width*height*((vfw_bih->biBitCount+7)/8); | |
40 mux_v->bih->biWidth=width; | |
41 mux_v->bih->biHeight=height; | |
42 mux_v->bih->biSizeImage=width*height*((mux_v->bih->biBitCount+7)/8); | |
43 | |
44 return 1; | |
45 } | |
46 | |
47 static int control(struct vf_instance_s* vf, int request, void* data){ | |
48 | |
49 return CONTROL_UNKNOWN; | |
50 } | |
51 | |
52 static int query_format(struct vf_instance_s* vf, unsigned int fmt){ | |
53 if(fmt==IMGFMT_BGR24) return 1; | |
54 return 0; | |
55 } | |
56 | |
57 static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){ | |
58 long flags=0; | |
59 int ret; | |
60 // flip_upside_down(vo_image_ptr,vo_image_ptr,3*vo_w,vo_h); // dirty hack | |
61 ret=vfw_encode_frame(mux_v->bih, mux_v->buffer, vfw_bih, mpi->planes[0], &flags, 10000); | |
62 mencoder_write_chunk(mux_v,mux_v->bih->biSizeImage,flags); | |
63 } | |
64 | |
65 //===========================================================================// | |
66 | |
67 static int vf_open(vf_instance_t *vf, char* args){ | |
68 vf->config=config; | |
69 vf->control=control; | |
70 vf->query_format=query_format; | |
71 vf->put_image=put_image; | |
72 vf->priv=malloc(sizeof(struct vf_priv_s)); | |
73 memset(vf->priv,0,sizeof(struct vf_priv_s)); | |
74 vf->priv->mux=args; | |
75 | |
76 vfw_bih=malloc(sizeof(BITMAPINFOHEADER)); | |
77 vfw_bih->biSize=sizeof(BITMAPINFOHEADER); | |
78 vfw_bih->biWidth=0; // FIXME ? | |
79 vfw_bih->biHeight=0; | |
80 vfw_bih->biPlanes=1; | |
81 vfw_bih->biBitCount=24; | |
82 vfw_bih->biCompression=0; | |
83 // vfw_bih->biSizeImage=vo_w*vo_h*((vfw_bih->biBitCount+7)/8); | |
84 // mux_v->bih=vfw_open_encoder("divxc32.dll",vfw_bih,mmioFOURCC('D', 'I', 'V', '3')); | |
85 mux_v->bih=vfw_open_encoder("AvidAVICodec.dll",vfw_bih, 0); | |
86 if(!mux_v->bih) return 0; | |
87 | |
88 return 1; | |
89 } | |
90 | |
91 vf_info_t ve_info_vfw = { | |
92 "Win32/VfW encoders", | |
93 "vfw", | |
94 "A'rpi", | |
95 "for internal use by mencoder", | |
96 vf_open | |
97 }; | |
98 | |
99 //===========================================================================// | |
100 #endif |