[MPlayer-cvslog] r32009 - in trunk: eosd.c eosd.h
cigaes
subversion at mplayerhq.hu
Mon Aug 23 21:22:03 CEST 2010
Author: cigaes
Date: Mon Aug 23 21:22:03 2010
New Revision: 32009
Log:
Forgot to svn add those two files.
Added:
trunk/eosd.c
trunk/eosd.h
Added: trunk/eosd.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/eosd.c Mon Aug 23 21:22:03 2010 (r32009)
@@ -0,0 +1,70 @@
+/*
+ * Extended On Screen Display
+ * Copyright (C) 2010 Nicolas George
+ *
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "mpcommon.h"
+#include "libmpcodecs/vf.h"
+#include "libvo/video_out.h"
+#include "libvo/sub.h"
+#include "libass/ass_mp.h"
+#include "eosd.h"
+
+static ASS_Renderer *ass_renderer;
+int prev_visibility;
+
+void eosd_ass_init(ASS_Library *ass_library)
+{
+ ass_renderer = ass_renderer_init(ass_library);
+ if (!ass_renderer) return;
+ ass_configure_fonts(ass_renderer);
+}
+
+void eosd_init(vf_instance_t *vf)
+{
+ vf->control(vf, VFCTRL_INIT_EOSD, NULL);
+}
+
+void eosd_configure(mp_eosd_res_t *res, int hinting)
+{
+ double dar = (double) (res->w - res->ml - res->mr) / (res->h - res->mt - res->mb);
+ if (ass_renderer) {
+ ass_configure(ass_renderer, res->w, res->h, hinting);
+ ass_set_margins(ass_renderer, res->mt, res->mb, res->ml, res->mr);
+ ass_set_aspect_ratio(ass_renderer, dar, (double)res->srcw/res->srch);
+ }
+}
+
+ASS_Image *eosd_render_frame(double ts, int *changed)
+{
+ ASS_Image *r = NULL;
+ if (sub_visibility && ass_renderer && ass_track && ts != MP_NOPTS_VALUE) {
+ r = ass_mp_render_frame(ass_renderer, ass_track, (ts+sub_delay) * 1000 + .5, changed);
+ if (!prev_visibility && changed)
+ *changed = 2;
+ }
+ prev_visibility = sub_visibility;
+ return r;
+}
+
+void eosd_uninit(void)
+{
+ if (ass_renderer)
+ ass_renderer_done(ass_renderer);
+}
Added: trunk/eosd.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/eosd.h Mon Aug 23 21:22:03 2010 (r32009)
@@ -0,0 +1,33 @@
+/*
+ * Extended On Screen Display
+ * Copyright (C) 2010 Nicolas George
+ *
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPLAYER_EOSD_H
+#define MPLAYER_EOSD_H
+
+void eosd_init(vf_instance_t *);
+
+void eosd_configure(mp_eosd_res_t *, int);
+ASS_Image *eosd_render_frame(double, int *);
+void eosd_uninit(void);
+
+void eosd_ass_init(ASS_Library *);
+
+#endif /* MPLAYER_EOSD_H */
More information about the MPlayer-cvslog
mailing list