5550
|
1 #include <stdio.h>
|
|
2 #include <stdlib.h>
|
|
3 #include <string.h>
|
|
4
|
|
5 #include "../config.h"
|
|
6 #include "../mp_msg.h"
|
|
7
|
|
8 #include "codec-cfg.h"
|
|
9 #include "stream.h"
|
|
10 #include "demuxer.h"
|
|
11 #include "stheader.h"
|
|
12
|
|
13 #include "aviwrite.h"
|
|
14
|
5607
|
15 #include "img_format.h"
|
|
16 #include "mp_image.h"
|
5550
|
17 #include "vf.h"
|
|
18
|
7127
|
19 extern void mencoder_write_chunk(aviwrite_stream_t *s,int len,unsigned int flags);
|
|
20
|
5550
|
21 //===========================================================================//
|
|
22
|
|
23 struct vf_priv_s {
|
|
24 aviwrite_stream_t* mux;
|
|
25 };
|
|
26 #define mux_v (vf->priv->mux)
|
|
27
|
|
28 static int config(struct vf_instance_s* vf,
|
|
29 int width, int height, int d_width, int d_height,
|
|
30 unsigned int flags, unsigned int outfmt){
|
|
31
|
|
32 mux_v->bih->biWidth=width;
|
|
33 mux_v->bih->biHeight=height;
|
|
34 mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8);
|
|
35
|
|
36 return 1;
|
|
37 }
|
|
38
|
|
39 static int control(struct vf_instance_s* vf, int request, void* data){
|
|
40
|
|
41 return CONTROL_UNKNOWN;
|
|
42 }
|
|
43
|
|
44 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
|
5895
|
45 if(fmt==IMGFMT_BGR24) return 3 | VFCAP_FLIPPED;
|
5550
|
46 return 0;
|
|
47 }
|
|
48
|
|
49 static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){
|
|
50 mux_v->buffer=mpi->planes[0];
|
|
51 mencoder_write_chunk(mux_v, mpi->width*mpi->height*3, 0x10);
|
|
52 }
|
|
53
|
|
54 //===========================================================================//
|
|
55
|
|
56 static int vf_open(vf_instance_t *vf, char* args){
|
|
57 vf->config=config;
|
|
58 vf->control=control;
|
|
59 vf->query_format=query_format;
|
|
60 vf->put_image=put_image;
|
|
61 vf->priv=malloc(sizeof(struct vf_priv_s));
|
|
62 memset(vf->priv,0,sizeof(struct vf_priv_s));
|
7127
|
63 vf->priv->mux=(aviwrite_stream_t*)args;
|
5550
|
64
|
|
65 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER));
|
|
66 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER);
|
|
67 mux_v->bih->biWidth=0;
|
|
68 mux_v->bih->biHeight=0;
|
|
69 mux_v->bih->biCompression=0;
|
|
70 mux_v->bih->biPlanes=1;
|
5551
|
71 mux_v->bih->biBitCount=24;
|
5550
|
72
|
|
73 return 1;
|
|
74 }
|
|
75
|
|
76 vf_info_t ve_info_rawrgb = {
|
|
77 "rawrgb encoder",
|
|
78 "rawrgb",
|
|
79 "A'rpi",
|
|
80 "for internal use by mencoder",
|
|
81 vf_open
|
|
82 };
|
|
83
|
|
84 //===========================================================================//
|