annotate libmpcodecs/ve_rawyuv.c @ 11928:7d603ceb4ac1

new filter: vf_noformat. like vf_format, but in reverse. this time I committed the filter, too. :)
author joey
date Fri, 06 Feb 2004 20:44:09 +0000
parents 6ea42c885d60
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11581
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
1 #include <stdio.h>
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
2 #include <stdlib.h>
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
3 #include <string.h>
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
4
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
5 #include "../config.h"
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
6 #include "../mp_msg.h"
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
7
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
8 #include "codec-cfg.h"
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
9 #include "stream.h"
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
10 #include "demuxer.h"
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
11 #include "stheader.h"
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
12
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
13 #include "muxer.h"
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
14
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
15 #include "img_format.h"
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
16 #include "mp_image.h"
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
17 #include "vf.h"
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
18
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
19 //===========================================================================//
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
20
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
21 struct vf_priv_s {
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
22 muxer_stream_t* mux;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
23 };
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
24 #define mux_v (vf->priv->mux)
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
25
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
26 static int config(struct vf_instance_s *vf,
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
27 int width, int height, int d_width, int d_height,
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
28 unsigned int flags, unsigned int outfmt)
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
29 {
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
30 mux_v->bih->biWidth = width;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
31 mux_v->bih->biHeight = height;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
32 mux_v->bih->biSizeImage = mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8);
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
33 return 1;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
34 }
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
35
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
36 static int control(struct vf_instance_s *vf, int request, void *data) {
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
37 return CONTROL_UNKNOWN;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
38 }
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
39
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
40 static int query_format(struct vf_instance_s *vf, unsigned int fmt) {
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
41 if (fmt==IMGFMT_I420) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
42 return 0;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
43 }
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
44
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
45 static int put_image(struct vf_instance_s *vf, mp_image_t *mpi) {
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
46 mux_v->buffer = mpi->planes[0];
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
47 muxer_write_chunk(mux_v, mpi->width*mpi->height*3/2, 0x10);
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
48 return 1;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
49 }
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
50
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
51 //===========================================================================//
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
52
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
53 static int vf_open(vf_instance_t *vf, char* args){
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
54 vf->config = config;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
55 vf->control = control;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
56 vf->query_format = query_format;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
57 vf->put_image = put_image;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
58 vf->priv = malloc(sizeof(struct vf_priv_s));
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
59 memset(vf->priv, 0, sizeof(struct vf_priv_s));
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
60 vf->priv->mux = (muxer_stream_t*)args;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
61
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
62 mux_v->bih = malloc(sizeof(BITMAPINFOHEADER));
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
63 mux_v->bih->biSize = sizeof(BITMAPINFOHEADER);
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
64 mux_v->bih->biWidth = 0;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
65 mux_v->bih->biHeight = 0;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
66 mux_v->bih->biCompression = mmioFOURCC('I', '4', '2', '0');
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
67 mux_v->bih->biPlanes = 3;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
68 mux_v->bih->biBitCount = 12;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
69
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
70 return 1;
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
71 }
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
72
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
73 vf_info_t ve_info_rawyuv = {
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
74 "rawyuv encoder",
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
75 "rawyuv",
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
76 "tuukkat@ee.oulu.fi",
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
77 "Based on rawrgb",
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
78 vf_open
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
79 };
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
80
6ea42c885d60 RAWYUV output in MEncoder. Patch by Tuukka Toivonen <tuukkat@ee.oulu.fi>
alex
parents:
diff changeset
81 //===========================================================================//