1 /*
2 * Copyright (c) 2013 Matthew Heaney
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg 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 GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 /**
22 * @file
23 * WebVTT subtitle muxer
24 * @see https://www.w3.org/TR/webvtt1/
25 */
26
30
32 {
34 sec = millisec / 1000;
35 millisec -= 1000 * sec;
40
41 if (hour > 0)
43
44 avio_printf(pb,
"%02"PRId64
":%02"PRId64
".%03"PRId64
"",
min, sec, millisec);
45 }
46
48 {
51
53
55
56 return 0;
57 }
58
60 {
62 size_t id_size, settings_size;
63 int id_size_int, settings_size_int;
64 uint8_t *
id, *settings;
65
67
69 &id_size);
70
71 if (id_size > INT_MAX)
73
74 id_size_int = id_size;
75 if (id && id_size_int > 0)
77
81
83 &settings_size);
84
85 if (settings_size > INT_MAX)
87
88 settings_size_int = settings_size;
89 if (settings && settings_size_int > 0)
90 avio_printf(pb,
" %.*s", settings_size_int, settings);
91
93
96
97 return 0;
98 }
99
103 .p.extensions = "vtt",
104 .p.mime_type = "text/vtt",
113 };