annotate eosd.c @ 32344:0e036289e7ef

Replace forward declarations of resync_{audio|video}_stream by proper #includes.
author diego
date Sun, 03 Oct 2010 15:28:49 +0000
parents ef21cbba62ee
children b4c3659d16b1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31928
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
1 /*
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
2 * Extended On Screen Display
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
3 * Copyright (C) 2010 Nicolas George
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
4 *
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
5 * This file is part of MPlayer.
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
6 *
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
7 * MPlayer is free software; you can redistribute it and/or modify
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
10 * (at your option) any later version.
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
11 *
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
12 * MPlayer is distributed in the hope that it will be useful,
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
15 * GNU General Public License for more details.
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
16 *
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License along
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
18 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
20 */
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
21
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
22 #include "mpcommon.h"
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
23 #include "libmpcodecs/vf.h"
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
24 #include "libvo/video_out.h"
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
25 #include "libvo/sub.h"
32209
ef21cbba62ee Move libass/ass_mp.[ch] ---> ass_mp.[ch].
diego
parents: 31936
diff changeset
26 #include "ass_mp.h"
31928
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
27 #include "eosd.h"
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
28
31934
30b03b5dbb3d Add #ifdefs to fix build with ASS disabled.
cigaes
parents: 31928
diff changeset
29 #ifdef CONFIG_ASS
31928
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
30 static ASS_Renderer *ass_renderer;
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
31 int prev_visibility;
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
32
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
33 void eosd_ass_init(ASS_Library *ass_library)
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
34 {
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
35 ass_renderer = ass_renderer_init(ass_library);
31936
76e3148cacce Cosmetic: reformat a if...return.
cigaes
parents: 31934
diff changeset
36 if (!ass_renderer)
76e3148cacce Cosmetic: reformat a if...return.
cigaes
parents: 31934
diff changeset
37 return;
31928
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
38 ass_configure_fonts(ass_renderer);
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
39 }
31934
30b03b5dbb3d Add #ifdefs to fix build with ASS disabled.
cigaes
parents: 31928
diff changeset
40 #endif
31928
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
41
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
42 void eosd_init(vf_instance_t *vf)
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
43 {
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
44 vf->control(vf, VFCTRL_INIT_EOSD, NULL);
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
45 }
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
46
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
47 void eosd_configure(mp_eosd_res_t *res, int hinting)
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
48 {
31934
30b03b5dbb3d Add #ifdefs to fix build with ASS disabled.
cigaes
parents: 31928
diff changeset
49 #ifdef CONFIG_ASS
31928
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
50 double dar = (double) (res->w - res->ml - res->mr) / (res->h - res->mt - res->mb);
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
51 if (ass_renderer) {
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
52 ass_configure(ass_renderer, res->w, res->h, hinting);
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
53 ass_set_margins(ass_renderer, res->mt, res->mb, res->ml, res->mr);
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
54 ass_set_aspect_ratio(ass_renderer, dar, (double)res->srcw/res->srch);
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
55 }
31934
30b03b5dbb3d Add #ifdefs to fix build with ASS disabled.
cigaes
parents: 31928
diff changeset
56 #endif
31928
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
57 }
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
58
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
59 ASS_Image *eosd_render_frame(double ts, int *changed)
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
60 {
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
61 ASS_Image *r = NULL;
31934
30b03b5dbb3d Add #ifdefs to fix build with ASS disabled.
cigaes
parents: 31928
diff changeset
62 #ifdef CONFIG_ASS
31928
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
63 if (sub_visibility && ass_renderer && ass_track && ts != MP_NOPTS_VALUE) {
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
64 r = ass_mp_render_frame(ass_renderer, ass_track, (ts+sub_delay) * 1000 + .5, changed);
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
65 if (!prev_visibility && changed)
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
66 *changed = 2;
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
67 }
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
68 prev_visibility = sub_visibility;
31934
30b03b5dbb3d Add #ifdefs to fix build with ASS disabled.
cigaes
parents: 31928
diff changeset
69 #endif
31928
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
70 return r;
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
71 }
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
72
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
73 void eosd_uninit(void)
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
74 {
31934
30b03b5dbb3d Add #ifdefs to fix build with ASS disabled.
cigaes
parents: 31928
diff changeset
75 #ifdef CONFIG_ASS
31928
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
76 if (ass_renderer)
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
77 ass_renderer_done(ass_renderer);
31934
30b03b5dbb3d Add #ifdefs to fix build with ASS disabled.
cigaes
parents: 31928
diff changeset
78 #endif
31928
47c6a74eba0f Forgot to svn add those two files.
cigaes
parents:
diff changeset
79 }