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
|
8585
|
13 #include "muxer.h"
|
5550
|
14
|
5607
|
15 #include "img_format.h"
|
|
16 #include "mp_image.h"
|
5550
|
17 #include "vf.h"
|
|
18
|
8585
|
19 extern void mencoder_write_chunk(muxer_stream_t *s,int len,unsigned int flags);
|
7127
|
20
|
5550
|
21 //===========================================================================//
|
|
22
|
|
23 struct vf_priv_s {
|
8585
|
24 muxer_stream_t* mux;
|
5550
|
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
|
7368
|
49 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
|
5550
|
50 mux_v->buffer=mpi->planes[0];
|
|
51 mencoder_write_chunk(mux_v, mpi->width*mpi->height*3, 0x10);
|
7368
|
52 return 1;
|
5550
|
53 }
|
|
54
|
|
55 //===========================================================================//
|
|
56
|
|
57 static int vf_open(vf_instance_t *vf, char* args){
|
|
58 vf->config=config;
|
|
59 vf->control=control;
|
|
60 vf->query_format=query_format;
|
|
61 vf->put_image=put_image;
|
|
62 vf->priv=malloc(sizeof(struct vf_priv_s));
|
|
63 memset(vf->priv,0,sizeof(struct vf_priv_s));
|
8585
|
64 vf->priv->mux=(muxer_stream_t*)args;
|
5550
|
65
|
|
66 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER));
|
|
67 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER);
|
|
68 mux_v->bih->biWidth=0;
|
|
69 mux_v->bih->biHeight=0;
|
|
70 mux_v->bih->biCompression=0;
|
|
71 mux_v->bih->biPlanes=1;
|
5551
|
72 mux_v->bih->biBitCount=24;
|
5550
|
73
|
|
74 return 1;
|
|
75 }
|
|
76
|
|
77 vf_info_t ve_info_rawrgb = {
|
|
78 "rawrgb encoder",
|
|
79 "rawrgb",
|
|
80 "A'rpi",
|
|
81 "for internal use by mencoder",
|
|
82 vf_open
|
|
83 };
|
|
84
|
|
85 //===========================================================================//
|