1 /*
2 * Metadata demuxer
3 * Copyright (c) 2010 Anton Khirnov
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
27
29 {
32 return 0;
33 }
34
36 {
37 do {
39 int i = 0;
40
42 if (c == '\\') {
43 if (i < size - 1)
46 } else if (c == '\n')
47 break;
48
49 if (i < size - 1)
51 }
52 buf[i] = 0;
53 }
while (!
url_feof(s) && (buf[0] ==
';' || buf[0] ==
'#' || buf[0] == 0));
54 }
55
57 {
61
63
64 if (sscanf(line,
"TIMEBASE=%d/%d", &tb.
num, &tb.
den))
66 if (!sscanf(line, "START=%"SCNd64, &start)) {
70 } else
72
73 if (!sscanf(line, "END=%"SCNd64, &end)) {
76 }
77
79 }
80
82 {
85
86 if (!ret)
87 return NULL;
88
89 while (p2 < buf + size) {
90 if (*p2 == '\\')
91 p2++;
92 *p1++ = *p2++;
93 }
94 *p1 = 0;
96 }
97
99 {
101
102 /* find first not escaped '=' */
103 while (1) {
104 if (*p == '=')
105 break;
106 else if (*p == '\\')
107 p++;
108
109 if (*p++)
110 continue;
111
112 return 0;
113 }
114
115 if (!(key =
unescape(line, p - line)))
117 if (!(value =
unescape(p + 1, strlen(p + 1)))) {
120 }
121
123 return 0;
124 }
125
127 {
130
133
136
137 if (!st)
139
142
146
147 if (!ch)
149
151 } else
153 }
154
160
161 return 0;
162 }
163
165 {
167 }
168
170 .
name =
"ffmetadata",
175 };