1 /*
2 * SubRip subtitle muxer
3 * Copyright (c) 2012 Nicolas George <nicolas.george@normalesup.org>
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
28 /* TODO: add options for:
29 - character encoding;
30 - LF / CRLF;
31 - byte order mark.
32 */
33
37
39 {
41
45 "Unsupported subtitles codec: %s\n",
48 }
51 return 0;
52 }
53
55 {
57
60 int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
61 const uint8_t *p;
62
64 if (p &&
size == 16) {
69 }
70
73 "Insufficient timestamps in event number %d.\n", srt->
index);
74 return 0;
75 }
77 avio_printf(avf->
pb,
"%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d",
79 (
int)(
s / 3600000), (
int)(
s / 60000) % 60,
80 (
int)(
s / 1000) % 60, (
int)(
s % 1000),
81 (int)(e / 3600000), (int)(e / 60000) % 60,
82 (int)(e / 1000) % 60, (int)(e % 1000));
83 if (p)
85 x1, x2, y1, y2);
87
91 return 0;
92 }
93
97 .p.mime_type = "application/x-subrip",
98 .p.extensions = "srt",
107 };