1 /*
2 * Copyright (c) 2014 Eejya Singh
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 * STL subtitles format demuxer
24 * @see https://documentation.apple.com/en/dvdstudiopro/usermanual/index.html#chapter=19%26section=13%26tasks=true
25 */
26
33
37
39 {
41 const unsigned char *ptr = p->
buf;
42
44 ptr += 3; /* skip UTF-8 BOM */
45
46 while (*ptr == '\r' || *ptr == '\n' || *ptr == '$' || !strncmp(ptr, "//" , 2))
48
49 if (sscanf(ptr,
"%*d:%*d:%*d:%*d , %*d:%*d:%*d:%*d , %c", &
c) == 1)
51
52 return 0;
53 }
54
56 {
57 int hh1, mm1, ss1, ms1;
58 int hh2, mm2, ss2, ms2;
60
61 if (sscanf(*buf, "%2d:%2d:%2d:%2d , %2d:%2d:%2d:%2d , %n",
62 &hh1, &mm1, &ss1, &ms1,
63 &hh2, &mm2, &ss2, &ms2, &
len) >= 8 &&
len > 0) {
64 int64_t start = (hh1*3600LL + mm1*60LL + ss1) * 100LL + ms1;
65 int64_t end = (hh2*3600LL + mm2*60LL + ss2) * 100LL + ms2;
68 return start;
69 }
71 }
72
74 {
77
78 if (!st)
83
91
93 break;
94
97
101 if (!sub)
104 sub->
pts = pts_start;
106 }
107 }
109 return 0;
110 }
111
115 .p.extensions = "stl",
123 };