Mercurial > mplayer.hg
comparison libmpcodecs/vf_ass.c @ 32391:b4c3659d16b1
Use a dynamic list for the sources of EOSD elements.
author | cigaes |
---|---|
date | Sun, 10 Oct 2010 09:27:11 +0000 |
parents | 0dd2b27940b5 |
children | d80bbc5868de |
comparison
equal
deleted
inserted
replaced
32390:b33aed46ecda | 32391:b4c3659d16b1 |
---|---|
35 #include "vd.h" | 35 #include "vd.h" |
36 #include "vf.h" | 36 #include "vf.h" |
37 | 37 |
38 #include "libvo/fastmemcpy.h" | 38 #include "libvo/fastmemcpy.h" |
39 #include "libvo/sub.h" | 39 #include "libvo/sub.h" |
40 #include "libvo/video_out.h" | |
41 #include "m_option.h" | 40 #include "m_option.h" |
42 #include "m_struct.h" | 41 #include "m_struct.h" |
43 | 42 |
44 #include "ass_mp.h" | 43 #include "ass_mp.h" |
45 #include "eosd.h" | 44 #include "eosd.h" |
69 | 68 |
70 static int config(struct vf_instance *vf, | 69 static int config(struct vf_instance *vf, |
71 int width, int height, int d_width, int d_height, | 70 int width, int height, int d_width, int d_height, |
72 unsigned int flags, unsigned int outfmt) | 71 unsigned int flags, unsigned int outfmt) |
73 { | 72 { |
74 mp_eosd_res_t res = { 0 }; | 73 struct mp_eosd_settings res = {0}; |
75 | 74 |
76 if (outfmt == IMGFMT_IF09) | 75 if (outfmt == IMGFMT_IF09) |
77 return 0; | 76 return 0; |
78 | 77 |
79 vf->priv->outh = height + ass_top_margin + ass_bottom_margin; | 78 vf->priv->outh = height + ass_top_margin + ass_bottom_margin; |
92 res.h = vf->priv->outh; | 91 res.h = vf->priv->outh; |
93 res.srcw = width; | 92 res.srcw = width; |
94 res.srch = height; | 93 res.srch = height; |
95 res.mt = ass_top_margin; | 94 res.mt = ass_top_margin; |
96 res.mb = ass_bottom_margin; | 95 res.mb = ass_bottom_margin; |
97 eosd_configure(&res, 0); | 96 eosd_configure(&res); |
98 | 97 |
99 return vf_next_config(vf, vf->priv->outw, vf->priv->outh, d_width, | 98 return vf_next_config(vf, vf->priv->outw, vf->priv->outh, d_width, |
100 d_height, flags, outfmt); | 99 d_height, flags, outfmt); |
101 } | 100 } |
102 | 101 |
332 dstu += vf->priv->outw; | 331 dstu += vf->priv->outw; |
333 dstv += vf->priv->outw; | 332 dstv += vf->priv->outw; |
334 } | 333 } |
335 } | 334 } |
336 | 335 |
337 static int render_frame(struct vf_instance *vf, mp_image_t *mpi, | 336 static void render_frame(struct vf_instance *vf, mp_image_t *mpi, |
338 const ASS_Image *img) | 337 struct mp_eosd_image_list *images) |
339 { | 338 { |
340 if (img) { | 339 struct mp_eosd_image *img; |
340 img = eosd_image_first(images); | |
341 if (!img) | |
342 return; | |
341 memset(vf->priv->dirty_rows, 0, vf->priv->outh); // reset dirty rows | 343 memset(vf->priv->dirty_rows, 0, vf->priv->outh); // reset dirty rows |
342 while (img) { | 344 while (img) { |
343 copy_from_image(vf, img->dst_y, img->dst_y + img->h); | 345 copy_from_image(vf, img->dst_y, img->dst_y + img->h); |
344 my_draw_bitmap(vf, img->bitmap, img->w, img->h, img->stride, | 346 my_draw_bitmap(vf, img->bitmap, img->w, img->h, img->stride, |
345 img->dst_x, img->dst_y, img->color); | 347 img->dst_x, img->dst_y, img->color); |
346 img = img->next; | 348 img = eosd_image_next(images); |
347 } | 349 } |
348 copy_to_image(vf); | 350 copy_to_image(vf); |
349 } | |
350 return 0; | |
351 } | 351 } |
352 | 352 |
353 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) | 353 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) |
354 { | 354 { |
355 ASS_Image *images = eosd_render_frame(pts, NULL); | 355 struct mp_eosd_image_list images; |
356 eosd_render_frame(pts, &images); | |
356 prepare_image(vf, mpi); | 357 prepare_image(vf, mpi); |
357 if (images) | 358 render_frame(vf, mpi, &images); |
358 render_frame(vf, mpi, images); | |
359 | |
360 return vf_next_put_image(vf, vf->dmpi, pts); | 359 return vf_next_put_image(vf, vf->dmpi, pts); |
361 } | 360 } |
362 | 361 |
363 static int query_format(struct vf_instance *vf, unsigned int fmt) | 362 static int query_format(struct vf_instance *vf, unsigned int fmt) |
364 { | 363 { |