annotate libmpcodecs/ve_vfw.c @ 6041:4090fefb7922

skin-en.html --> skin-pl.html
author nell
date Fri, 10 May 2002 11:37:35 +0000
parents 1972c3475d93
children 6aa4fc282fc7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5550
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
1 #include <stdio.h>
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
2 #include <stdlib.h>
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
3 #include <string.h>
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
4
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
5 #include "../config.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
6 #ifdef USE_WIN32DLL
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
7
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
8 #include "../mp_msg.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
9
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
10 #include "codec-cfg.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
11 #include "stream.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
12 #include "demuxer.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
13 #include "stheader.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
14
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
15 #include "aviwrite.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
16
5607
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5565
diff changeset
17 #include "img_format.h"
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5565
diff changeset
18 #include "mp_image.h"
5550
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
19 #include "vf.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
20
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
21 //===========================================================================//
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
22
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
23 #include "dll_init.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
24
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
25 struct vf_priv_s {
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
26 aviwrite_stream_t* mux;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
27 BITMAPINFOHEADER* bih;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
28 };
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
29
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
30 #define mux_v (vf->priv->mux)
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
31 #define vfw_bih (vf->priv->bih)
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
32
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
33 static int config(struct vf_instance_s* vf,
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
34 int width, int height, int d_width, int d_height,
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
35 unsigned int flags, unsigned int outfmt){
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
36
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
37 vfw_bih->biWidth=width;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
38 vfw_bih->biHeight=height;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
39 vfw_bih->biSizeImage=width*height*((vfw_bih->biBitCount+7)/8);
5551
73978162b6a1 soem fixes
arpi
parents: 5550
diff changeset
40
73978162b6a1 soem fixes
arpi
parents: 5550
diff changeset
41 if(!vfw_start_encoder(vfw_bih, mux_v->bih)) return 0;
73978162b6a1 soem fixes
arpi
parents: 5550
diff changeset
42
73978162b6a1 soem fixes
arpi
parents: 5550
diff changeset
43 // mux_v->bih->biWidth=width;
73978162b6a1 soem fixes
arpi
parents: 5550
diff changeset
44 // mux_v->bih->biHeight=height;
73978162b6a1 soem fixes
arpi
parents: 5550
diff changeset
45 // mux_v->bih->biSizeImage=width*height*((mux_v->bih->biBitCount+7)/8);
5550
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
46
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
47 return 1;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
48 }
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
49
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
50 static int control(struct vf_instance_s* vf, int request, void* data){
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
51
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
52 return CONTROL_UNKNOWN;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
53 }
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
54
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
55 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
56 if(fmt==IMGFMT_BGR24) return 3 | VFCAP_FLIPPED;
5550
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
57 return 0;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
58 }
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
59
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
60 static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
61 long flags=0;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
62 int ret;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
63 // flip_upside_down(vo_image_ptr,vo_image_ptr,3*vo_w,vo_h); // dirty hack
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
64 ret=vfw_encode_frame(mux_v->bih, mux_v->buffer, vfw_bih, mpi->planes[0], &flags, 10000);
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
65 mencoder_write_chunk(mux_v,mux_v->bih->biSizeImage,flags);
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
66 }
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
67
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
68 //===========================================================================//
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
69
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
70 static int vf_open(vf_instance_t *vf, char* args){
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
71 vf->config=config;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
72 vf->control=control;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
73 vf->query_format=query_format;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
74 vf->put_image=put_image;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
75 vf->priv=malloc(sizeof(struct vf_priv_s));
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
76 memset(vf->priv,0,sizeof(struct vf_priv_s));
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
77 vf->priv->mux=args;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
78
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
79 vfw_bih=malloc(sizeof(BITMAPINFOHEADER));
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
80 vfw_bih->biSize=sizeof(BITMAPINFOHEADER);
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
81 vfw_bih->biWidth=0; // FIXME ?
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
82 vfw_bih->biHeight=0;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
83 vfw_bih->biPlanes=1;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
84 vfw_bih->biBitCount=24;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
85 vfw_bih->biCompression=0;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
86 // vfw_bih->biSizeImage=vo_w*vo_h*((vfw_bih->biBitCount+7)/8);
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
87 // mux_v->bih=vfw_open_encoder("divxc32.dll",vfw_bih,mmioFOURCC('D', 'I', 'V', '3'));
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
88 mux_v->bih=vfw_open_encoder("AvidAVICodec.dll",vfw_bih, 0);
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
89 if(!mux_v->bih) return 0;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
90
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
91 return 1;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
92 }
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
93
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
94 vf_info_t ve_info_vfw = {
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
95 "Win32/VfW encoders",
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
96 "vfw",
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
97 "A'rpi",
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
98 "for internal use by mencoder",
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
99 vf_open
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
100 };
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
101
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
102 //===========================================================================//
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
103 #endif