comparison libass/ass_library.c @ 20477:de4a66d99f41

Libass interface reworked: - ass_instance_t renamed to ass_renderer_t - ass_library_t introduced - use of mplayer-specific global variables limited to ass_mp.c
author eugeni
date Sat, 28 Oct 2006 15:07:18 +0000
parents
children 2edba6772316
comparison
equal deleted inserted replaced
20476:1fd76553550d 20477:de4a66d99f41
1 // -*- c-basic-offset: 8; indent-tabs-mode: t -*-
2 // vim:ts=8:sw=8:noet:ai:
3 /*
4 Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include <inttypes.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25
26 #include "ass.h"
27 #include "ass_library.h"
28
29
30 ass_library_t* ass_library_init(void)
31 {
32 return calloc(1, sizeof(ass_library_t));
33 }
34
35 void ass_library_done(ass_library_t* priv)
36 {
37 if (priv) free(priv);
38 }
39
40 void ass_set_fonts_dir(ass_library_t* priv, const char* fonts_dir)
41 {
42 if (priv->fonts_dir)
43 free(priv->fonts_dir);
44
45 priv->fonts_dir = fonts_dir ? strdup(fonts_dir) : 0;
46 }
47
48 void ass_set_extract_fonts(ass_library_t* priv, int extract)
49 {
50 priv->extract_fonts = !!extract;
51 }
52
53 void ass_set_style_overrides(ass_library_t* priv, char** list)
54 {
55 char** p;
56 char** q;
57 int cnt;
58
59 if (priv->style_overrides) {
60 for (p = priv->style_overrides; *p; ++p)
61 free(*p);
62 free(priv->style_overrides);
63 }
64
65 if (!list) return;
66
67 for (p = list, cnt = 0; *p; ++p, ++cnt) {}
68
69 priv->style_overrides = malloc(cnt * sizeof(char*));
70 for (p = list, q = priv->style_overrides; *p; ++p, ++q)
71 *q = strdup(*p);
72 }