Mercurial > mplayer.hg
annotate libmpcodecs/ve_raw.c @ 32476:af9ef007bec6
Add the -force-key-frames option.
author | cigaes |
---|---|
date | Fri, 29 Oct 2010 13:50:05 +0000 |
parents | c08363dc5320 |
children | 059cc86b02dc |
rev | line source |
---|---|
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
1 /* |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
2 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
3 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
7 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
8 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
12 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
13 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
17 */ |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
18 |
11966 | 19 #include <stdio.h> |
20 #include <stdlib.h> | |
21 #include <string.h> | |
22 | |
17012 | 23 #include "config.h" |
24 #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
|
25 #include "help_mp.h" |
11966 | 26 |
27 #include "codec-cfg.h" | |
22600
3c2b4a866c6a
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
28 #include "stream/stream.h" |
22601
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
29 #include "libmpdemux/demuxer.h" |
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
30 #include "libmpdemux/stheader.h" |
11966 | 31 |
22600
3c2b4a866c6a
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
32 #include "stream/stream.h" |
22601
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
33 #include "libmpdemux/muxer.h" |
11966 | 34 |
35 #include "img_format.h" | |
36 #include "mp_image.h" | |
37 #include "vf.h" | |
38 | |
39 | |
40 //===========================================================================// | |
41 | |
42 struct vf_priv_s { | |
43 muxer_stream_t* mux; | |
44 }; | |
45 #define mux_v (vf->priv->mux) | |
46 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30421
diff
changeset
|
47 static int set_format(struct vf_instance *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
|
48 if (!force_fourcc) |
27367 | 49 mux_v->bih->biCompression = fmt; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27367
diff
changeset
|
50 |
11966 | 51 mux_v->bih->biPlanes = 1; |
52 if (IMGFMT_IS_RGB(fmt)) { | |
53 if (IMGFMT_RGB_DEPTH(fmt) < 8 && !(fmt&128)) | |
54 mux_v->bih->biBitCount = IMGFMT_RGB_DEPTH(fmt); | |
55 else | |
56 mux_v->bih->biBitCount = (IMGFMT_RGB_DEPTH(fmt)+7)&(~7); | |
57 return 1; | |
58 } | |
59 if (IMGFMT_IS_BGR(fmt)) { | |
60 if (IMGFMT_BGR_DEPTH(fmt) < 8 && !(fmt&128)) | |
61 mux_v->bih->biBitCount = IMGFMT_BGR_DEPTH(fmt); | |
62 else | |
63 mux_v->bih->biBitCount = (IMGFMT_BGR_DEPTH(fmt)+7)&(~7); | |
64 return 1; | |
65 } | |
66 switch (fmt) { | |
67 case IMGFMT_I420: | |
68 case IMGFMT_IYUV: | |
69 case IMGFMT_YV12: | |
70 case IMGFMT_411P: | |
71 mux_v->bih->biPlanes = 3; | |
72 mux_v->bih->biBitCount = 12; | |
73 break; | |
74 case IMGFMT_444P: | |
75 mux_v->bih->biPlanes = 3; | |
76 mux_v->bih->biBitCount = 24; | |
77 break; | |
78 case IMGFMT_422P: | |
79 mux_v->bih->biPlanes = 3; | |
80 mux_v->bih->biBitCount = 16; | |
81 break; | |
82 case IMGFMT_IF09: | |
83 mux_v->bih->biPlanes = 4; | |
84 case IMGFMT_YVU9: | |
85 mux_v->bih->biBitCount = 9; | |
86 break; | |
87 case IMGFMT_UYVY: | |
88 case IMGFMT_YUY2: | |
89 mux_v->bih->biBitCount = 16; | |
90 break; | |
22958 | 91 case IMGFMT_Y8: |
92 mux_v->bih->biBitCount = 8; | |
93 break; | |
11966 | 94 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
|
95 mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_MPCODECS_OutputWithFourccNotSupported, fmt); |
11966 | 96 mux_v->bih->biCompression = 0; |
97 return 0; | |
98 } | |
99 return 1; | |
100 } | |
101 | |
102 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30421
diff
changeset
|
103 static int config(struct vf_instance *vf, |
11966 | 104 int width, int height, int d_width, int d_height, |
105 unsigned int flags, unsigned int outfmt) | |
106 { | |
107 int ret; | |
108 mux_v->bih->biWidth = width; | |
109 mux_v->bih->biHeight = height; | |
12061 | 110 mux_v->aspect = (float)d_width/d_height; |
11966 | 111 ret = set_format(vf, outfmt); |
112 if (!ret) return 0; | |
113 | |
114 mux_v->bih->biSizeImage = mux_v->bih->biWidth*mux_v->bih->biHeight*mux_v->bih->biBitCount/8; | |
115 return 1; | |
116 } | |
117 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30421
diff
changeset
|
118 static int control(struct vf_instance *vf, int request, void *data) { |
11966 | 119 return CONTROL_UNKNOWN; |
120 } | |
121 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30421
diff
changeset
|
122 static int query_format(struct vf_instance *vf, unsigned int fmt) { |
11966 | 123 if (IMGFMT_IS_RGB(fmt) || IMGFMT_IS_BGR(fmt)) |
124 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; | |
125 switch (fmt) { | |
126 case IMGFMT_I420: | |
127 case IMGFMT_IYUV: | |
128 case IMGFMT_YV12: | |
129 case IMGFMT_411P: | |
130 case IMGFMT_444P: | |
131 case IMGFMT_422P: | |
132 case IMGFMT_UYVY: | |
133 case IMGFMT_YUY2: | |
134 case IMGFMT_YVU9: | |
135 case IMGFMT_IF09: | |
22958 | 136 case IMGFMT_Y8: |
11966 | 137 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; |
138 } | |
139 | |
140 return 0; | |
141 } | |
142 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30421
diff
changeset
|
143 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { |
11966 | 144 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
|
145 muxer_write_chunk(mux_v, mpi->width*mpi->height*mux_v->bih->biBitCount/8, 0x10, pts, pts); |
11966 | 146 return 1; |
147 } | |
148 | |
149 //===========================================================================// | |
150 | |
151 static int vf_open(vf_instance_t *vf, char* args){ | |
152 vf->config = config; | |
14878 | 153 vf->default_caps = VFCAP_CONSTANT; |
11966 | 154 vf->control = control; |
155 vf->query_format = query_format; | |
156 vf->put_image = put_image; | |
14303 | 157 vf->default_caps = 0; |
11966 | 158 vf->priv = malloc(sizeof(struct vf_priv_s)); |
159 memset(vf->priv, 0, sizeof(struct vf_priv_s)); | |
160 vf->priv->mux = (muxer_stream_t*)args; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27367
diff
changeset
|
161 |
32105 | 162 mux_v->bih = calloc(1, sizeof(*mux_v->bih)); |
163 mux_v->bih->biSize = sizeof(*mux_v->bih); | |
11966 | 164 mux_v->bih->biWidth = 0; |
165 mux_v->bih->biHeight = 0; | |
166 | |
167 return 1; | |
168 } | |
169 | |
32033 | 170 const vf_info_t ve_info_raw = { |
11966 | 171 "raw encoder", |
172 "raw", | |
173 "jwe21@cam.ac.uk", | |
174 "Based on rawrgb", | |
175 vf_open | |
176 }; | |
177 | |
178 //===========================================================================// |