Mercurial > mplayer.hg
annotate libmpcodecs/ve_raw.c @ 30046:844755b5d7b6
Do not autogenerate vidix/pci_names.h.
Its contents is always the same, so there is no point in generating it.
author | diego |
---|---|
date | Sun, 20 Dec 2009 17:49:07 +0000 |
parents | 0f1b5b68af32 |
children | bbb6ebec87a0 |
rev | line source |
---|---|
11966 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 #include <string.h> | |
4 | |
17012 | 5 #include "config.h" |
6 #include "mp_msg.h" | |
18004
bcd805923554
Part2 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu with LOTS of modifications by me
reynaldo
parents:
17906
diff
changeset
|
7 #include "help_mp.h" |
11966 | 8 |
9 #include "codec-cfg.h" | |
22600
3c2b4a866c6a
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
10 #include "stream/stream.h" |
22601
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
11 #include "libmpdemux/demuxer.h" |
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
12 #include "libmpdemux/stheader.h" |
11966 | 13 |
22600
3c2b4a866c6a
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
14 #include "stream/stream.h" |
22601
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
15 #include "libmpdemux/muxer.h" |
11966 | 16 |
17 #include "img_format.h" | |
18 #include "mp_image.h" | |
19 #include "vf.h" | |
20 | |
21 | |
22 //===========================================================================// | |
23 | |
24 struct vf_priv_s { | |
25 muxer_stream_t* mux; | |
26 }; | |
27 #define mux_v (vf->priv->mux) | |
28 | |
29 static int set_format(struct vf_instance_s *vf, unsigned int fmt) { | |
27366
067da68b5b16
change ve_raw.c:set_format to not overwrite biCompression if force_fourcc is set.
compn
parents:
22958
diff
changeset
|
30 if (!force_fourcc) |
27367 | 31 mux_v->bih->biCompression = fmt; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27367
diff
changeset
|
32 |
11966 | 33 mux_v->bih->biPlanes = 1; |
34 if (IMGFMT_IS_RGB(fmt)) { | |
35 if (IMGFMT_RGB_DEPTH(fmt) < 8 && !(fmt&128)) | |
36 mux_v->bih->biBitCount = IMGFMT_RGB_DEPTH(fmt); | |
37 else | |
38 mux_v->bih->biBitCount = (IMGFMT_RGB_DEPTH(fmt)+7)&(~7); | |
39 return 1; | |
40 } | |
41 if (IMGFMT_IS_BGR(fmt)) { | |
42 if (IMGFMT_BGR_DEPTH(fmt) < 8 && !(fmt&128)) | |
43 mux_v->bih->biBitCount = IMGFMT_BGR_DEPTH(fmt); | |
44 else | |
45 mux_v->bih->biBitCount = (IMGFMT_BGR_DEPTH(fmt)+7)&(~7); | |
46 return 1; | |
47 } | |
48 switch (fmt) { | |
49 case IMGFMT_I420: | |
50 case IMGFMT_IYUV: | |
51 case IMGFMT_YV12: | |
52 case IMGFMT_411P: | |
53 mux_v->bih->biPlanes = 3; | |
54 mux_v->bih->biBitCount = 12; | |
55 break; | |
56 case IMGFMT_444P: | |
57 mux_v->bih->biPlanes = 3; | |
58 mux_v->bih->biBitCount = 24; | |
59 break; | |
60 case IMGFMT_422P: | |
61 mux_v->bih->biPlanes = 3; | |
62 mux_v->bih->biBitCount = 16; | |
63 break; | |
64 case IMGFMT_IF09: | |
65 mux_v->bih->biPlanes = 4; | |
66 case IMGFMT_YVU9: | |
67 mux_v->bih->biBitCount = 9; | |
68 break; | |
69 case IMGFMT_UYVY: | |
70 case IMGFMT_YUY2: | |
71 mux_v->bih->biBitCount = 16; | |
72 break; | |
22958 | 73 case IMGFMT_Y8: |
74 mux_v->bih->biBitCount = 8; | |
75 break; | |
11966 | 76 default: |
18004
bcd805923554
Part2 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu with LOTS of modifications by me
reynaldo
parents:
17906
diff
changeset
|
77 mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_MPCODECS_OutputWithFourccNotSupported, fmt); |
11966 | 78 mux_v->bih->biCompression = 0; |
79 return 0; | |
80 } | |
81 return 1; | |
82 } | |
83 | |
84 | |
85 static int config(struct vf_instance_s *vf, | |
86 int width, int height, int d_width, int d_height, | |
87 unsigned int flags, unsigned int outfmt) | |
88 { | |
89 int ret; | |
90 mux_v->bih->biWidth = width; | |
91 mux_v->bih->biHeight = height; | |
12061 | 92 mux_v->aspect = (float)d_width/d_height; |
11966 | 93 ret = set_format(vf, outfmt); |
94 if (!ret) return 0; | |
95 | |
96 mux_v->bih->biSizeImage = mux_v->bih->biWidth*mux_v->bih->biHeight*mux_v->bih->biBitCount/8; | |
97 return 1; | |
98 } | |
99 | |
100 static int control(struct vf_instance_s *vf, int request, void *data) { | |
101 return CONTROL_UNKNOWN; | |
102 } | |
103 | |
104 static int query_format(struct vf_instance_s *vf, unsigned int fmt) { | |
105 if (IMGFMT_IS_RGB(fmt) || IMGFMT_IS_BGR(fmt)) | |
106 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; | |
107 switch (fmt) { | |
108 case IMGFMT_I420: | |
109 case IMGFMT_IYUV: | |
110 case IMGFMT_YV12: | |
111 case IMGFMT_411P: | |
112 case IMGFMT_444P: | |
113 case IMGFMT_422P: | |
114 case IMGFMT_UYVY: | |
115 case IMGFMT_YUY2: | |
116 case IMGFMT_YVU9: | |
117 case IMGFMT_IF09: | |
22958 | 118 case IMGFMT_Y8: |
11966 | 119 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; |
120 } | |
121 | |
122 return 0; | |
123 } | |
124 | |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17487
diff
changeset
|
125 static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts) { |
11966 | 126 mux_v->buffer = mpi->planes[0]; |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17487
diff
changeset
|
127 muxer_write_chunk(mux_v, mpi->width*mpi->height*mux_v->bih->biBitCount/8, 0x10, pts, pts); |
11966 | 128 return 1; |
129 } | |
130 | |
131 //===========================================================================// | |
132 | |
133 static int vf_open(vf_instance_t *vf, char* args){ | |
134 vf->config = config; | |
14878 | 135 vf->default_caps = VFCAP_CONSTANT; |
11966 | 136 vf->control = control; |
137 vf->query_format = query_format; | |
138 vf->put_image = put_image; | |
14303 | 139 vf->default_caps = 0; |
11966 | 140 vf->priv = malloc(sizeof(struct vf_priv_s)); |
141 memset(vf->priv, 0, sizeof(struct vf_priv_s)); | |
142 vf->priv->mux = (muxer_stream_t*)args; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27367
diff
changeset
|
143 |
14549
acf3241be19b
Initialized BITMAPINFOHEADER to 0 to avoid problems, esp. windows has problems
reimar
parents:
14303
diff
changeset
|
144 mux_v->bih = calloc(1, sizeof(BITMAPINFOHEADER)); |
11966 | 145 mux_v->bih->biSize = sizeof(BITMAPINFOHEADER); |
146 mux_v->bih->biWidth = 0; | |
147 mux_v->bih->biHeight = 0; | |
148 | |
149 return 1; | |
150 } | |
151 | |
152 vf_info_t ve_info_raw = { | |
153 "raw encoder", | |
154 "raw", | |
155 "jwe21@cam.ac.uk", | |
156 "Based on rawrgb", | |
157 vf_open | |
158 }; | |
159 | |
160 //===========================================================================// |