comparison libmpcodecs/ve_rawyuv.c @ 11581:6ea42c885d60

RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
author alex
date Mon, 08 Dec 2003 12:44:11 +0000
parents
children
comparison
equal deleted inserted replaced
11580:90953d955165 11581:6ea42c885d60
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 "muxer.h"
14
15 #include "img_format.h"
16 #include "mp_image.h"
17 #include "vf.h"
18
19 //===========================================================================//
20
21 struct vf_priv_s {
22 muxer_stream_t* mux;
23 };
24 #define mux_v (vf->priv->mux)
25
26 static int config(struct vf_instance_s *vf,
27 int width, int height, int d_width, int d_height,
28 unsigned int flags, unsigned int outfmt)
29 {
30 mux_v->bih->biWidth = width;
31 mux_v->bih->biHeight = height;
32 mux_v->bih->biSizeImage = mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8);
33 return 1;
34 }
35
36 static int control(struct vf_instance_s *vf, int request, void *data) {
37 return CONTROL_UNKNOWN;
38 }
39
40 static int query_format(struct vf_instance_s *vf, unsigned int fmt) {
41 if (fmt==IMGFMT_I420) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
42 return 0;
43 }
44
45 static int put_image(struct vf_instance_s *vf, mp_image_t *mpi) {
46 mux_v->buffer = mpi->planes[0];
47 muxer_write_chunk(mux_v, mpi->width*mpi->height*3/2, 0x10);
48 return 1;
49 }
50
51 //===========================================================================//
52
53 static int vf_open(vf_instance_t *vf, char* args){
54 vf->config = config;
55 vf->control = control;
56 vf->query_format = query_format;
57 vf->put_image = put_image;
58 vf->priv = malloc(sizeof(struct vf_priv_s));
59 memset(vf->priv, 0, sizeof(struct vf_priv_s));
60 vf->priv->mux = (muxer_stream_t*)args;
61
62 mux_v->bih = malloc(sizeof(BITMAPINFOHEADER));
63 mux_v->bih->biSize = sizeof(BITMAPINFOHEADER);
64 mux_v->bih->biWidth = 0;
65 mux_v->bih->biHeight = 0;
66 mux_v->bih->biCompression = mmioFOURCC('I', '4', '2', '0');
67 mux_v->bih->biPlanes = 3;
68 mux_v->bih->biBitCount = 12;
69
70 return 1;
71 }
72
73 vf_info_t ve_info_rawyuv = {
74 "rawyuv encoder",
75 "rawyuv",
76 "tuukkat@ee.oulu.fi",
77 "Based on rawrgb",
78 vf_open
79 };
80
81 //===========================================================================//