Mercurial > mplayer.hg
annotate libmpcodecs/vf_ass.c @ 31938:93c67b51b171
Print a warning, but allow to encode to a non-supported frame rate with
libxvid.
Patch by Carl Eric Codere, cecodere yahoo ca
author | cehoyos |
---|---|
date | Thu, 26 Aug 2010 18:44:14 +0000 |
parents | 6e0b5a97e00f |
children | 06519a2a9c77 |
rev | line source |
---|---|
20008
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19563
diff
changeset
|
1 // -*- c-basic-offset: 8; indent-tabs-mode: t -*- |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19563
diff
changeset
|
2 // vim:ts=8:sw=8:noet:ai: |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19563
diff
changeset
|
3 /* |
26727 | 4 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com> |
5 * | |
6 * This file is part of MPlayer. | |
7 * | |
8 * MPlayer is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * MPlayer is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License along | |
19 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
21 */ | |
20008
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19563
diff
changeset
|
22 |
18937 | 23 #include "config.h" |
24 | |
25 #include <stdio.h> | |
26 #include <stdlib.h> | |
27 #include <string.h> | |
24545
9e5126679d44
Replace stdint.h #include by functionally equivalent inttypes.h.
diego
parents:
23134
diff
changeset
|
28 #include <inttypes.h> |
18937 | 29 #include <assert.h> |
30 | |
31 #include "config.h" | |
32 #include "mp_msg.h" | |
33 #include "help_mp.h" | |
31489 | 34 #include "mpcommon.h" |
18937 | 35 #include "img_format.h" |
36 #include "mp_image.h" | |
30653
3d23e24c5c60
Declare externally used variables from vd.c as extern in vd.h.
diego
parents:
30642
diff
changeset
|
37 #include "vd.h" |
18937 | 38 #include "vf.h" |
39 | |
40 #include "libvo/fastmemcpy.h" | |
31488
4b738166e825
Add libvo/sub.h #include instead of declaring sub_visibility extern.
diego
parents:
31238
diff
changeset
|
41 #include "libvo/sub.h" |
31927 | 42 #include "libvo/video_out.h" |
18937 | 43 #include "m_option.h" |
44 #include "m_struct.h" | |
45 | |
46 #include "libass/ass_mp.h" | |
31927 | 47 #include "eosd.h" |
18937 | 48 |
49 #define _r(c) ((c)>>24) | |
50 #define _g(c) (((c)>>16)&0xFF) | |
51 #define _b(c) (((c)>>8)&0xFF) | |
52 #define _a(c) ((c)&0xFF) | |
53 #define rgba2y(c) ( (( 263*_r(c) + 516*_g(c) + 100*_b(c)) >> 10) + 16 ) | |
54 #define rgba2u(c) ( ((-152*_r(c) - 298*_g(c) + 450*_b(c)) >> 10) + 128 ) | |
55 #define rgba2v(c) ( (( 450*_r(c) - 376*_g(c) - 73*_b(c)) >> 10) + 128 ) | |
56 | |
57 | |
24969
c2b7ba444ade
begin moving const filter data to .text/.rodata sections
rfelker
parents:
24545
diff
changeset
|
58 static const struct vf_priv_s { |
18937 | 59 int outh, outw; |
60 | |
61 unsigned int outfmt; | |
62 | |
63 // 1 = auto-added filter: insert only if chain does not support EOSD already | |
64 // 0 = insert always | |
65 int auto_insert; | |
66 | |
67 unsigned char* planes[3]; | |
68 unsigned char* dirty_rows; | |
24969
c2b7ba444ade
begin moving const filter data to .text/.rodata sections
rfelker
parents:
24545
diff
changeset
|
69 } vf_priv_dflt; |
18937 | 70 |
71 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
72 static int config(struct vf_instance *vf, |
18937 | 73 int width, int height, int d_width, int d_height, |
74 unsigned int flags, unsigned int outfmt) | |
75 { | |
31927 | 76 mp_eosd_res_t res = {0}; |
77 | |
18937 | 78 if (outfmt == IMGFMT_IF09) return 0; |
79 | |
80 vf->priv->outh = height + ass_top_margin + ass_bottom_margin; | |
81 vf->priv->outw = width; | |
82 | |
83 if(!opt_screen_size_x && !opt_screen_size_y){ | |
84 d_width = d_width * vf->priv->outw / width; | |
85 d_height = d_height * vf->priv->outh / height; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26727
diff
changeset
|
86 } |
18937 | 87 |
19065
26ed3fcd5cd4
drops casts from void * on malloc/calloc, leftover on libmpcodecs
reynaldo
parents:
18937
diff
changeset
|
88 vf->priv->planes[1] = malloc(vf->priv->outw * vf->priv->outh); |
26ed3fcd5cd4
drops casts from void * on malloc/calloc, leftover on libmpcodecs
reynaldo
parents:
18937
diff
changeset
|
89 vf->priv->planes[2] = malloc(vf->priv->outw * vf->priv->outh); |
26ed3fcd5cd4
drops casts from void * on malloc/calloc, leftover on libmpcodecs
reynaldo
parents:
18937
diff
changeset
|
90 vf->priv->dirty_rows = malloc(vf->priv->outh); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26727
diff
changeset
|
91 |
31927 | 92 res.w = vf->priv->outw; |
93 res.h = vf->priv->outh; | |
94 res.srcw = width; | |
95 res.srch = height; | |
96 res.mt = ass_top_margin; | |
97 res.mb = ass_bottom_margin; | |
98 eosd_configure(&res, 0); | |
18937 | 99 |
100 return vf_next_config(vf, vf->priv->outw, vf->priv->outh, d_width, d_height, flags, outfmt); | |
101 } | |
102 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
103 static void get_image(struct vf_instance *vf, mp_image_t *mpi) |
18937 | 104 { |
105 if(mpi->type == MP_IMGTYPE_IPB) return; | |
106 if(mpi->flags & MP_IMGFLAG_PRESERVE) return; | |
107 if(mpi->imgfmt != vf->priv->outfmt) return; // colorspace differ | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26727
diff
changeset
|
108 |
18937 | 109 // width never changes, always try full DR |
110 mpi->priv = vf->dmpi = vf_get_image(vf->next, mpi->imgfmt, | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26727
diff
changeset
|
111 mpi->type, mpi->flags | MP_IMGFLAG_READABLE, |
18937 | 112 vf->priv->outw, |
113 vf->priv->outh); | |
114 | |
115 if((vf->dmpi->flags & MP_IMGFLAG_DRAW_CALLBACK) && | |
116 !(vf->dmpi->flags & MP_IMGFLAG_DIRECT)){ | |
20629
e8885ec63928
Introduce MSGT_ASS, use it for all libass messages.
eugeni
parents:
20477
diff
changeset
|
117 mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_MPCODECS_FullDRNotPossible); |
18937 | 118 return; |
119 } | |
120 | |
121 // set up mpi as a cropped-down image of dmpi: | |
122 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
123 mpi->planes[0]=vf->dmpi->planes[0] + ass_top_margin * vf->dmpi->stride[0]; | |
124 mpi->planes[1]=vf->dmpi->planes[1] + (ass_top_margin >> mpi->chroma_y_shift) * vf->dmpi->stride[1]; | |
125 mpi->planes[2]=vf->dmpi->planes[2] + (ass_top_margin >> mpi->chroma_y_shift) * vf->dmpi->stride[2]; | |
126 mpi->stride[1]=vf->dmpi->stride[1]; | |
127 mpi->stride[2]=vf->dmpi->stride[2]; | |
128 } else { | |
129 mpi->planes[0]=vf->dmpi->planes[0] + ass_top_margin * vf->dmpi->stride[0]; | |
130 } | |
131 mpi->stride[0]=vf->dmpi->stride[0]; | |
132 mpi->width=vf->dmpi->width; | |
133 mpi->flags|=MP_IMGFLAG_DIRECT; | |
134 mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; | |
135 // vf->dmpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; | |
136 } | |
137 | |
138 static void blank(mp_image_t *mpi, int y1, int y2) | |
139 { | |
140 int color[3] = {16, 128, 128}; // black (YUV) | |
141 int y; | |
142 unsigned char* dst; | |
143 int chroma_rows = (y2 - y1) >> mpi->chroma_y_shift; | |
144 | |
145 dst = mpi->planes[0] + y1 * mpi->stride[0]; | |
146 for (y = 0; y < y2 - y1; ++y) { | |
147 memset(dst, color[0], mpi->w); | |
148 dst += mpi->stride[0]; | |
149 } | |
150 dst = mpi->planes[1] + (y1 >> mpi->chroma_y_shift) * mpi->stride[1]; | |
151 for (y = 0; y < chroma_rows ; ++y) { | |
152 memset(dst, color[1], mpi->chroma_width); | |
153 dst += mpi->stride[1]; | |
154 } | |
155 dst = mpi->planes[2] + (y1 >> mpi->chroma_y_shift) * mpi->stride[2]; | |
156 for (y = 0; y < chroma_rows ; ++y) { | |
157 memset(dst, color[2], mpi->chroma_width); | |
158 dst += mpi->stride[2]; | |
159 } | |
160 } | |
161 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
162 static int prepare_image(struct vf_instance *vf, mp_image_t *mpi) |
18937 | 163 { |
164 if(mpi->flags&MP_IMGFLAG_DIRECT || mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){ | |
165 vf->dmpi = mpi->priv; | |
20629
e8885ec63928
Introduce MSGT_ASS, use it for all libass messages.
eugeni
parents:
20477
diff
changeset
|
166 if (!vf->dmpi) { mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_MPCODECS_FunWhydowegetNULL); return 0; } |
18937 | 167 mpi->priv = NULL; |
168 // we've used DR, so we're ready... | |
169 if (ass_top_margin) | |
170 blank(vf->dmpi, 0, ass_top_margin); | |
171 if (ass_bottom_margin) | |
172 blank(vf->dmpi, vf->priv->outh - ass_bottom_margin, vf->priv->outh); | |
173 if(!(mpi->flags&MP_IMGFLAG_PLANAR)) | |
174 vf->dmpi->planes[1] = mpi->planes[1]; // passthrough rgb8 palette | |
175 return 0; | |
176 } | |
177 | |
178 // hope we'll get DR buffer: | |
179 vf->dmpi = vf_get_image(vf->next, vf->priv->outfmt, | |
20656
839c48c35ce8
ass renderer absolutely needs readable target mpi.
reimar
parents:
20629
diff
changeset
|
180 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_READABLE, |
18937 | 181 vf->priv->outw, vf->priv->outh); |
182 | |
183 // copy mpi->dmpi... | |
184 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
185 memcpy_pic(vf->dmpi->planes[0] + ass_top_margin * vf->dmpi->stride[0], | |
186 mpi->planes[0], mpi->w, mpi->h, | |
187 vf->dmpi->stride[0], mpi->stride[0]); | |
188 memcpy_pic(vf->dmpi->planes[1] + (ass_top_margin >> mpi->chroma_y_shift) * vf->dmpi->stride[1], | |
189 mpi->planes[1], mpi->w >> mpi->chroma_x_shift, mpi->h >> mpi->chroma_y_shift, | |
190 vf->dmpi->stride[1], mpi->stride[1]); | |
191 memcpy_pic(vf->dmpi->planes[2] + (ass_top_margin >> mpi->chroma_y_shift) * vf->dmpi->stride[2], | |
192 mpi->planes[2], mpi->w >> mpi->chroma_x_shift, mpi->h >> mpi->chroma_y_shift, | |
193 vf->dmpi->stride[2], mpi->stride[2]); | |
194 } else { | |
195 memcpy_pic(vf->dmpi->planes[0] + ass_top_margin * vf->dmpi->stride[0], | |
196 mpi->planes[0], mpi->w*(vf->dmpi->bpp/8), mpi->h, | |
197 vf->dmpi->stride[0], mpi->stride[0]); | |
198 vf->dmpi->planes[1] = mpi->planes[1]; // passthrough rgb8 palette | |
199 } | |
200 if (ass_top_margin) | |
201 blank(vf->dmpi, 0, ass_top_margin); | |
202 if (ass_bottom_margin) | |
203 blank(vf->dmpi, vf->priv->outh - ass_bottom_margin, vf->priv->outh); | |
204 return 0; | |
205 } | |
206 | |
207 /** | |
208 * \brief Copy specified rows from render_context.dmpi to render_context.planes, upsampling to 4:4:4 | |
209 */ | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
210 static void copy_from_image(struct vf_instance *vf, int first_row, int last_row) |
18937 | 211 { |
212 int pl; | |
213 int i, j, k; | |
214 unsigned char val; | |
215 int chroma_rows; | |
216 | |
217 first_row -= (first_row % 2); | |
218 last_row += (last_row % 2); | |
219 chroma_rows = (last_row - first_row) / 2; | |
220 | |
29383
e9cab9f6ed62
Make sure clip coordinates are inside the screen area.
eugeni
parents:
29263
diff
changeset
|
221 assert(first_row >= 0); |
e9cab9f6ed62
Make sure clip coordinates are inside the screen area.
eugeni
parents:
29263
diff
changeset
|
222 assert(first_row <= last_row); |
29406
e1c1e13cb646
Fix stupid, off-by-one, mistakes in assert() expressions.
eugeni
parents:
29383
diff
changeset
|
223 assert(last_row <= vf->priv->outh); |
29383
e9cab9f6ed62
Make sure clip coordinates are inside the screen area.
eugeni
parents:
29263
diff
changeset
|
224 |
18937 | 225 for (pl = 1; pl < 3; ++pl) { |
21154 | 226 int dst_stride = vf->priv->outw; |
18937 | 227 int src_stride = vf->dmpi->stride[pl]; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26727
diff
changeset
|
228 |
18937 | 229 unsigned char* src = vf->dmpi->planes[pl] + (first_row/2) * src_stride; |
230 unsigned char* dst = vf->priv->planes[pl] + first_row * dst_stride; | |
231 unsigned char* dst_next = dst + dst_stride; | |
232 for(i = 0; i < chroma_rows; ++i) | |
233 { | |
234 if ((vf->priv->dirty_rows[first_row + i*2] == 0) || | |
235 (vf->priv->dirty_rows[first_row + i*2 + 1] == 0)) { | |
236 for (j = 0, k = 0; j < vf->dmpi->chroma_width; ++j, k+=2) { | |
237 val = *(src + j); | |
238 *(dst + k) = val; | |
239 *(dst + k + 1) = val; | |
240 *(dst_next + k) = val; | |
241 *(dst_next + k + 1) = val; | |
242 } | |
243 } | |
244 src += src_stride; | |
245 dst = dst_next + dst_stride; | |
246 dst_next = dst + dst_stride; | |
247 } | |
248 } | |
249 for (i = first_row; i < last_row; ++i) | |
250 vf->priv->dirty_rows[i] = 1; | |
251 } | |
252 | |
253 /** | |
254 * \brief Copy all previously copied rows back to render_context.dmpi | |
255 */ | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
256 static void copy_to_image(struct vf_instance *vf) |
18937 | 257 { |
258 int pl; | |
259 int i, j, k; | |
260 for (pl = 1; pl < 3; ++pl) { | |
261 int dst_stride = vf->dmpi->stride[pl]; | |
21154 | 262 int src_stride = vf->priv->outw; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26727
diff
changeset
|
263 |
18937 | 264 unsigned char* dst = vf->dmpi->planes[pl]; |
265 unsigned char* src = vf->priv->planes[pl]; | |
266 unsigned char* src_next = vf->priv->planes[pl] + src_stride; | |
267 for(i = 0; i < vf->dmpi->chroma_height; ++i) | |
268 { | |
269 if ((vf->priv->dirty_rows[i*2] == 1)) { | |
270 assert(vf->priv->dirty_rows[i*2 + 1] == 1); | |
271 for (j = 0, k = 0; j < vf->dmpi->chroma_width; ++j, k+=2) { | |
272 unsigned val = 0; | |
273 val += *(src + k); | |
274 val += *(src + k + 1); | |
275 val += *(src_next + k); | |
276 val += *(src_next + k + 1); | |
277 *(dst + j) = val >> 2; | |
278 } | |
279 } | |
280 dst += dst_stride; | |
281 src = src_next + src_stride; | |
282 src_next = src + src_stride; | |
283 } | |
284 } | |
285 } | |
286 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
287 static void my_draw_bitmap(struct vf_instance *vf, unsigned char* bitmap, int bitmap_w, int bitmap_h, int stride, int dst_x, int dst_y, unsigned color) |
18937 | 288 { |
289 unsigned char y = rgba2y(color); | |
290 unsigned char u = rgba2u(color); | |
291 unsigned char v = rgba2v(color); | |
292 unsigned char opacity = 255 - _a(color); | |
20012 | 293 unsigned char *src, *dsty, *dstu, *dstv; |
18937 | 294 int i, j; |
295 mp_image_t* dmpi = vf->dmpi; | |
296 | |
297 src = bitmap; | |
20012 | 298 dsty = dmpi->planes[0] + dst_x + dst_y * dmpi->stride[0]; |
21154 | 299 dstu = vf->priv->planes[1] + dst_x + dst_y * vf->priv->outw; |
300 dstv = vf->priv->planes[2] + dst_x + dst_y * vf->priv->outw; | |
18937 | 301 for (i = 0; i < bitmap_h; ++i) { |
302 for (j = 0; j < bitmap_w; ++j) { | |
20012 | 303 unsigned k = ((unsigned)src[j]) * opacity / 255; |
304 dsty[j] = (k*y + (255-k)*dsty[j]) / 255; | |
305 dstu[j] = (k*u + (255-k)*dstu[j]) / 255; | |
306 dstv[j] = (k*v + (255-k)*dstv[j]) / 255; | |
18937 | 307 } |
20012 | 308 src += stride; |
309 dsty += dmpi->stride[0]; | |
21154 | 310 dstu += vf->priv->outw; |
311 dstv += vf->priv->outw; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26727
diff
changeset
|
312 } |
18937 | 313 } |
314 | |
31792
55dacfca4a43
Rename libass types to match upstream libass >= 0.9.7
greg
parents:
31688
diff
changeset
|
315 static int render_frame(struct vf_instance *vf, mp_image_t *mpi, const ASS_Image* img) |
18937 | 316 { |
317 if (img) { | |
318 memset(vf->priv->dirty_rows, 0, vf->priv->outh); // reset dirty rows | |
319 while (img) { | |
320 copy_from_image(vf, img->dst_y, img->dst_y + img->h); | |
321 my_draw_bitmap(vf, img->bitmap, img->w, img->h, img->stride, | |
322 img->dst_x, img->dst_y, img->color); | |
323 img = img->next; | |
324 } | |
325 copy_to_image(vf); | |
326 } | |
327 return 0; | |
328 } | |
329 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
330 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) |
18937 | 331 { |
31927 | 332 ASS_Image* images = eosd_render_frame(pts, NULL); |
18937 | 333 prepare_image(vf, mpi); |
334 if (images) render_frame(vf, mpi, images); | |
335 | |
336 return vf_next_put_image(vf, vf->dmpi, pts); | |
337 } | |
338 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
339 static int query_format(struct vf_instance *vf, unsigned int fmt) |
18937 | 340 { |
341 switch(fmt){ | |
342 case IMGFMT_YV12: | |
343 case IMGFMT_I420: | |
344 case IMGFMT_IYUV: | |
345 return vf_next_query_format(vf, vf->priv->outfmt); | |
346 } | |
347 return 0; | |
348 } | |
349 | |
350 static int control(vf_instance_t *vf, int request, void *data) | |
351 { | |
19521 | 352 switch (request) { |
353 case VFCTRL_INIT_EOSD: | |
20706
6ae01628975f
Initialize fontconfig in VFCTRL_INIT_EOSD handler.
eugeni
parents:
20656
diff
changeset
|
354 return CONTROL_TRUE; |
19521 | 355 case VFCTRL_DRAW_EOSD: |
31927 | 356 return CONTROL_TRUE; |
18937 | 357 } |
358 return vf_next_control(vf, request, data); | |
359 } | |
360 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
361 static void uninit(struct vf_instance *vf) |
18937 | 362 { |
363 if (vf->priv->planes[1]) | |
364 free(vf->priv->planes[1]); | |
365 if (vf->priv->planes[2]) | |
366 free(vf->priv->planes[2]); | |
367 if (vf->priv->dirty_rows) | |
368 free(vf->priv->dirty_rows); | |
369 } | |
370 | |
24969
c2b7ba444ade
begin moving const filter data to .text/.rodata sections
rfelker
parents:
24545
diff
changeset
|
371 static const unsigned int fmt_list[]={ |
18937 | 372 IMGFMT_YV12, |
373 IMGFMT_I420, | |
374 IMGFMT_IYUV, | |
375 0 | |
376 }; | |
377 | |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30633
diff
changeset
|
378 static int vf_open(vf_instance_t *vf, char *args) |
18937 | 379 { |
380 int flags; | |
381 vf->priv->outfmt = vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12); | |
382 if (vf->priv->outfmt) | |
383 flags = vf_next_query_format(vf, vf->priv->outfmt); | |
384 if (!vf->priv->outfmt || (vf->priv->auto_insert && flags&VFCAP_EOSD)) | |
385 { | |
386 uninit(vf); | |
387 return 0; | |
388 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26727
diff
changeset
|
389 |
18937 | 390 if (vf->priv->auto_insert) |
20629
e8885ec63928
Introduce MSGT_ASS, use it for all libass messages.
eugeni
parents:
20477
diff
changeset
|
391 mp_msg(MSGT_ASS, MSGL_INFO, "[ass] auto-open\n"); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26727
diff
changeset
|
392 |
18937 | 393 vf->config = config; |
394 vf->query_format = query_format; | |
395 vf->uninit = uninit; | |
396 vf->control = control; | |
397 vf->get_image = get_image; | |
398 vf->put_image = put_image; | |
399 vf->default_caps=VFCAP_EOSD; | |
400 return 1; | |
401 } | |
402 | |
403 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f) | |
24969
c2b7ba444ade
begin moving const filter data to .text/.rodata sections
rfelker
parents:
24545
diff
changeset
|
404 static const m_option_t vf_opts_fields[] = { |
18937 | 405 {"auto", ST_OFF(auto_insert), CONF_TYPE_FLAG, 0 , 0, 1, NULL}, |
406 { NULL, NULL, 0, 0, 0, 0, NULL } | |
407 }; | |
408 | |
24969
c2b7ba444ade
begin moving const filter data to .text/.rodata sections
rfelker
parents:
24545
diff
changeset
|
409 static const m_struct_t vf_opts = { |
18937 | 410 "ass", |
411 sizeof(struct vf_priv_s), | |
412 &vf_priv_dflt, | |
413 vf_opts_fields | |
414 }; | |
415 | |
24969
c2b7ba444ade
begin moving const filter data to .text/.rodata sections
rfelker
parents:
24545
diff
changeset
|
416 const vf_info_t vf_info_ass = { |
18937 | 417 "Render ASS/SSA subtitles", |
418 "ass", | |
419 "Evgeniy Stepanov", | |
420 "", | |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30633
diff
changeset
|
421 vf_open, |
18937 | 422 &vf_opts |
423 }; |