annotate libmpcodecs/ve_rawrgb.c @ 6604:62ce54563e56

Hopefully the end of the RealPlayer codecs saga.. Explained where to put things and which configure options to use in case something goes wrong.
author diego
date Sat, 29 Jun 2002 16:27:48 +0000
parents e69d0434d92b
children 1e47c2e7aa8e
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
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
19 //===========================================================================//
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
20
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
21 struct vf_priv_s {
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
22 aviwrite_stream_t* mux;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
23 };
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
24 #define mux_v (vf->priv->mux)
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
25
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
26 static int config(struct vf_instance_s* vf,
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
27 int width, int height, int d_width, int d_height,
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
28 unsigned int flags, unsigned int outfmt){
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
29
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
30 mux_v->bih->biWidth=width;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
31 mux_v->bih->biHeight=height;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
32 mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8);
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
33
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
34 return 1;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
35 }
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
36
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
37 static int control(struct vf_instance_s* vf, int request, void* data){
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
38
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
39 return CONTROL_UNKNOWN;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
40 }
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
41
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
42 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
43 if(fmt==IMGFMT_BGR24) return 3 | VFCAP_FLIPPED;
5550
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
44 return 0;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
45 }
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
46
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
47 static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
48 mux_v->buffer=mpi->planes[0];
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
49 mencoder_write_chunk(mux_v, mpi->width*mpi->height*3, 0x10);
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
50 }
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
51
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
52 //===========================================================================//
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
53
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
54 static int vf_open(vf_instance_t *vf, char* args){
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
55 vf->config=config;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
56 vf->control=control;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
57 vf->query_format=query_format;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
58 vf->put_image=put_image;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
59 vf->priv=malloc(sizeof(struct vf_priv_s));
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
60 memset(vf->priv,0,sizeof(struct vf_priv_s));
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
61 vf->priv->mux=args;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
62
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
63 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER));
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
64 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER);
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
65 mux_v->bih->biWidth=0;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
66 mux_v->bih->biHeight=0;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
67 mux_v->bih->biCompression=0;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
68 mux_v->bih->biPlanes=1;
5551
73978162b6a1 soem fixes
arpi
parents: 5550
diff changeset
69 mux_v->bih->biBitCount=24;
5550
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
70
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
71 return 1;
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
72 }
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
73
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
74 vf_info_t ve_info_rawrgb = {
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
75 "rawrgb encoder",
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
76 "rawrgb",
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
77 "A'rpi",
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
78 "for internal use by mencoder",
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
79 vf_open
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
80 };
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
81
7d1dfb59c6c0 encoders
arpi
parents:
diff changeset
82 //===========================================================================//