annotate libmpcodecs/ve_rawrgb.c @ 7283:5fa6eb7b0f1a

- add fuckin locale fix from Dietrich Clau <dc2@clauss.dyndns.org> (Yeah. Nice round:)
author pontscho
date Thu, 05 Sep 2002 15:22:45 +0000
parents 1e47c2e7aa8e
children a894e99c1e51
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 #include "../mp_msg.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
7
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
8 #include "codec-cfg.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
9 #include "stream.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
10 #include "demuxer.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
11 #include "stheader.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
12
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
13 #include "aviwrite.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
14
5607
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5565
diff changeset
15 #include "img_format.h"
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5565
diff changeset
16 #include "mp_image.h"
5550
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
17 #include "vf.h"
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
18
7127
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 5895
diff changeset
19 extern void mencoder_write_chunk(aviwrite_stream_t *s,int len,unsigned int flags);
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 5895
diff changeset
20
5550
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
21 //===========================================================================//
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
22
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
23 struct vf_priv_s {
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
24 aviwrite_stream_t* mux;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
25 };
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
26 #define mux_v (vf->priv->mux)
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
27
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
28 static int config(struct vf_instance_s* vf,
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
29 int width, int height, int d_width, int d_height,
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
30 unsigned int flags, unsigned int outfmt){
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
31
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
32 mux_v->bih->biWidth=width;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
33 mux_v->bih->biHeight=height;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
34 mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8);
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
35
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
36 return 1;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
37 }
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
38
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
39 static int control(struct vf_instance_s* vf, int request, void* data){
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
40
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
41 return CONTROL_UNKNOWN;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
42 }
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
43
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
44 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
5895
e69d0434d92b Uncompressed avi files are stored upside down.
ksorim
parents: 5607
diff changeset
45 if(fmt==IMGFMT_BGR24) return 3 | VFCAP_FLIPPED;
5550
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
46 return 0;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
47 }
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
48
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
49 static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
50 mux_v->buffer=mpi->planes[0];
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
51 mencoder_write_chunk(mux_v, mpi->width*mpi->height*3, 0x10);
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
52 }
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
53
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
54 //===========================================================================//
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
55
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
56 static int vf_open(vf_instance_t *vf, char* args){
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
57 vf->config=config;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
58 vf->control=control;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
59 vf->query_format=query_format;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
60 vf->put_image=put_image;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
61 vf->priv=malloc(sizeof(struct vf_priv_s));
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
62 memset(vf->priv,0,sizeof(struct vf_priv_s));
7127
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 5895
diff changeset
63 vf->priv->mux=(aviwrite_stream_t*)args;
5550
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
64
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
65 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER));
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
66 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER);
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
67 mux_v->bih->biWidth=0;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
68 mux_v->bih->biHeight=0;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
69 mux_v->bih->biCompression=0;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
70 mux_v->bih->biPlanes=1;
5551
73978162b6a1 soem fixes
arpi
parents: 5550
diff changeset
71 mux_v->bih->biBitCount=24;
5550
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
72
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
73 return 1;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
74 }
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
75
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
76 vf_info_t ve_info_rawrgb = {
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
77 "rawrgb encoder",
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
78 "rawrgb",
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
79 "A'rpi",
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
80 "for internal use by mencoder",
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
81 vf_open
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
82 };
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
83
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
84 //===========================================================================//