10 #include "stream/stream.h"
11 #include "libmpdemux/demuxer.h"
12 #include "libmpdemux/stheader.h"
14 #include "stream/stream.h"
15 #include "libmpdemux/muxer.h"
17 #include "img_format.h"
22 //===========================================================================//
27 #define mux_v (vf->priv->mux)
29 static int set_format(struct vf_instance_s
*vf
, unsigned int fmt
) {
30 mux_v
->bih
->biCompression
= fmt
;
32 mux_v
->bih
->biPlanes
= 1;
33 if (IMGFMT_IS_RGB(fmt
)) {
34 if (IMGFMT_RGB_DEPTH(fmt
) < 8 && !(fmt
&128))
35 mux_v
->bih
->biBitCount
= IMGFMT_RGB_DEPTH(fmt
);
37 mux_v
->bih
->biBitCount
= (IMGFMT_RGB_DEPTH(fmt
)+7)&(~7);
40 if (IMGFMT_IS_BGR(fmt
)) {
41 if (IMGFMT_BGR_DEPTH(fmt
) < 8 && !(fmt
&128))
42 mux_v
->bih
->biBitCount
= IMGFMT_BGR_DEPTH(fmt
);
44 mux_v
->bih
->biBitCount
= (IMGFMT_BGR_DEPTH(fmt
)+7)&(~7);
52 mux_v
->bih
->biPlanes
= 3;
53 mux_v
->bih
->biBitCount
= 12;
56 mux_v
->bih
->biPlanes
= 3;
57 mux_v
->bih
->biBitCount
= 24;
60 mux_v
->bih
->biPlanes
= 3;
61 mux_v
->bih
->biBitCount
= 16;
64 mux_v
->bih
->biPlanes
= 4;
66 mux_v
->bih
->biBitCount
= 9;
70 mux_v
->bih
->biBitCount
= 16;
73 mux_v
->bih
->biBitCount
= 8;
76 mp_msg(MSGT_MENCODER
, MSGL_INFO
, MSGTR_MPCODECS_OutputWithFourccNotSupported
, fmt
);
77 mux_v
->bih
->biCompression
= 0;
84 static int config(struct vf_instance_s
*vf
,
85 int width
, int height
, int d_width
, int d_height
,
86 unsigned int flags
, unsigned int outfmt
)
89 mux_v
->bih
->biWidth
= width
;
90 mux_v
->bih
->biHeight
= height
;
91 mux_v
->aspect
= (float)d_width
/d_height
;
92 ret
= set_format(vf
, outfmt
);
95 mux_v
->bih
->biSizeImage
= mux_v
->bih
->biWidth
*mux_v
->bih
->biHeight
*mux_v
->bih
->biBitCount
/8;
99 static int control(struct vf_instance_s
*vf
, int request
, void *data
) {
100 return CONTROL_UNKNOWN
;
103 static int query_format(struct vf_instance_s
*vf
, unsigned int fmt
) {
104 if (IMGFMT_IS_RGB(fmt
) || IMGFMT_IS_BGR(fmt
))
105 return VFCAP_CSP_SUPPORTED
| VFCAP_CSP_SUPPORTED_BY_HW
;
118 return VFCAP_CSP_SUPPORTED
| VFCAP_CSP_SUPPORTED_BY_HW
;
124 static int put_image(struct vf_instance_s
*vf
, mp_image_t
*mpi
, double pts
) {
125 mux_v
->buffer
= mpi
->planes
[0];
126 muxer_write_chunk(mux_v
, mpi
->width
*mpi
->height
*mux_v
->bih
->biBitCount
/8, 0x10, pts
, pts
);
130 //===========================================================================//
132 static int vf_open(vf_instance_t
*vf
, char* args
){
134 vf
->default_caps
= VFCAP_CONSTANT
;
135 vf
->control
= control
;
136 vf
->query_format
= query_format
;
137 vf
->put_image
= put_image
;
138 vf
->default_caps
= 0;
139 vf
->priv
= malloc(sizeof(struct vf_priv_s
));
140 memset(vf
->priv
, 0, sizeof(struct vf_priv_s
));
141 vf
->priv
->mux
= (muxer_stream_t
*)args
;
143 mux_v
->bih
= calloc(1, sizeof(BITMAPINFOHEADER
));
144 mux_v
->bih
->biSize
= sizeof(BITMAPINFOHEADER
);
145 mux_v
->bih
->biWidth
= 0;
146 mux_v
->bih
->biHeight
= 0;
151 vf_info_t ve_info_raw
= {
159 //===========================================================================//