annotate libass/ass_utils.c @ 24861:a974b051e8cc

Comment out unused variable, fixes the warning: dvb_tune.c:43: warning: 'dvb_secdev' defined but not used
author diego
date Tue, 30 Oct 2007 08:44:15 +0000
parents ca7c2ec2c66b
children e8289d9a4fec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20008
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
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: 19405
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: 19405
diff changeset
3 /*
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
4 Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
5
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
6 This program is free software; you can redistribute it and/or modify
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
7 it under the terms of the GNU General Public License as published by
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
8 the Free Software Foundation; either version 2 of the License, or
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
9 (at your option) any later version.
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
10
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
11 This program is distributed in the hope that it will be useful,
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
14 GNU General Public License for more details.
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
15
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
16 You should have received a copy of the GNU General Public License
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
17 along with this program; if not, write to the Free Software
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
19 */
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19405
diff changeset
20
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
21 #include "config.h"
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
22
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
23 #include <stdlib.h>
19405
0797e1b4a4be Replace stdint.h with inttypes.h.
eugeni
parents: 19003
diff changeset
24 #include <inttypes.h>
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
25
21026
d138463e820b Collect all includes of mplayer headers in libass in a single file (mputils.h).
eugeni
parents: 20629
diff changeset
26 #include "mputils.h"
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
27 #include "ass_utils.h"
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
28
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
29 int mystrtoi(char** p, int base, int* res)
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
30 {
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
31 char* start = *p;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
32 *res = strtol(*p, p, base);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
33 if (*p != start) return 1;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
34 else return 0;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
35 }
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
36
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
37 int mystrtou32(char** p, int base, uint32_t* res)
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
38 {
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
39 char* start = *p;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
40 *res = strtoll(*p, p, base);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
41 if (*p != start) return 1;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
42 else return 0;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
43 }
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
44
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
45 int mystrtod(char** p, double* res)
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
46 {
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
47 char* start = *p;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
48 *res = strtod(*p, p);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
49 if (*p != start) return 1;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
50 else return 0;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
51 }
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
52
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
53 int strtocolor(char** q, uint32_t* res)
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
54 {
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
55 uint32_t color = 0;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
56 int result;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
57 char* p = *q;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
58
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
59 if (*p == '&') ++p;
20629
e8885ec63928 Introduce MSGT_ASS, use it for all libass messages.
eugeni
parents: 20503
diff changeset
60 else mp_msg(MSGT_ASS, MSGL_DBG2, "suspicious color format: \"%s\"\n", p);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
61
19003
9dc06456af0f Support some recently discovered color formats.
eugeni
parents: 18937
diff changeset
62 if (*p == 'H' || *p == 'h') {
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
63 ++p;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
64 result = mystrtou32(&p, 16, &color);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
65 } else {
19003
9dc06456af0f Support some recently discovered color formats.
eugeni
parents: 18937
diff changeset
66 result = mystrtou32(&p, 0, &color);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
67 }
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
68
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
69 {
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
70 unsigned char* tmp = (unsigned char*)(&color);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
71 unsigned char b;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
72 b = tmp[0]; tmp[0] = tmp[3]; tmp[3] = b;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
73 b = tmp[1]; tmp[1] = tmp[2]; tmp[2] = b;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
74 }
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
75 if (*p == '&') ++p;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
76 *q = p;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
77
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
78 *res = color;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
79 return result;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
80 }
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
81