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 http://dev.w3.org/html5/webvtt/
25 */
26
29
31 {
32 int64_t sec,
min, hour;
33 sec = millisec / 1000;
34 millisec -= 1000 * sec;
39
40 if (hour > 0)
42
43 avio_printf(pb,
"%02"PRId64
":%02"PRId64
".%03"PRId64
"",
min, sec, millisec);
44 }
45
47 {
51
55 }
56
58
60
61 return 0;
62 }
63
65 {
67 size_t id_size, settings_size;
68 int id_size_int, settings_size_int;
69 uint8_t *
id, *settings;
70
72
74 &id_size);
75
76 if (id_size > INT_MAX)
78
79 id_size_int = id_size;
80 if (id && id_size_int > 0)
82
86
88 &settings_size);
89
90 if (settings_size > INT_MAX)
92
93 settings_size_int = settings_size;
94 if (settings && settings_size_int > 0)
95 avio_printf(pb,
" %.*s", settings_size_int, settings);
96
98
101
102 return 0;
103 }
104
108 .extensions = "vtt",
109 .mime_type = "text/vtt",
114 };