diff --git a/AUTHORS b/AUTHORS index 6cf584a1f2..dca683bf50 100644 --- a/AUTHORS +++ b/AUTHORS @@ -22,6 +22,7 @@ Chun-da Chen Daniel CantarĂ­n Dolby Laboratories <*@dolby.com> Evgeny Zajcev +Eyevinn Technology AB <*@eyevinn.se> Google Inc. <*@google.com> Ivi.ru LLC <*@ivi.ru> Leandro Moreira diff --git a/CONTRIBUTORS b/CONTRIBUTORS index b11338f611..108ed4d850 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -39,6 +39,7 @@ Joey Parrish Kongqun Yang Leandro Moreira Leo Law +Marcus Spangenberg Ole Andre Birkedal Piotr Srebrny Qingquan Wang diff --git a/packager/media/formats/ttml/ttml_generator.cc b/packager/media/formats/ttml/ttml_generator.cc index 883691f670..193810fba8 100644 --- a/packager/media/formats/ttml/ttml_generator.cc +++ b/packager/media/formats/ttml/ttml_generator.cc @@ -29,7 +29,7 @@ std::string ToTtmlTime(int64_t time, int32_t timescale) { remaining /= 60; const int hr = remaining; - return base::StringPrintf("%02d:%02d:%02d.%02d", hr, min, sec, ms); + return base::StringPrintf("%02d:%02d:%02d.%03d", hr, min, sec, ms); } std::string ToTtmlSize(const TextNumber& x, const TextNumber& y) { diff --git a/packager/media/formats/ttml/ttml_generator_unittest.cc b/packager/media/formats/ttml/ttml_generator_unittest.cc index 8ae644c8c8..8a3915e8ca 100644 --- a/packager/media/formats/ttml/ttml_generator_unittest.cc +++ b/packager/media/formats/ttml/ttml_generator_unittest.cc @@ -67,8 +67,8 @@ TEST_F(TtmlMuxerTest, WithOneSegmentAndWithOneSample) { " \n" " \n" "
\n" - "

payload

\n" + "

payload

\n" "
\n" " \n" "\n"; @@ -86,8 +86,8 @@ TEST_F(TtmlMuxerTest, MultipleFragmentsWithNewlines) { " \n" " \n" "
\n" - "

foo bar
baz

\n" + "

foo bar
baz

\n" "
\n" " \n" "\n"; @@ -109,8 +109,8 @@ TEST_F(TtmlMuxerTest, HandlesStyles) { " \n" " \n" "
\n" - "

\n" + "

\n" " foo\n" " bar\n" " baz\n" @@ -141,8 +141,8 @@ TEST_F(TtmlMuxerTest, HandlesRegions) { " \n" " \n" "

\n" - "

bar

\n" + "

bar

\n" "
\n" " \n" "\n"; @@ -169,8 +169,8 @@ TEST_F(TtmlMuxerTest, HandlesLanguage) { " \n" " \n" "
\n" - "

bar

\n" + "

bar

\n" "
\n" " \n" "\n"; @@ -192,8 +192,8 @@ TEST_F(TtmlMuxerTest, HandlesPosition) { "
\n" " \n" - "

bar

\n" + "

bar

\n" "
\n" " \n" "\n"; @@ -216,8 +216,8 @@ TEST_F(TtmlMuxerTest, HandlesOtherSettings) { " \n" " \n" "
\n" - "

bar

\n" "
\n" " \n" @@ -240,8 +240,8 @@ TEST_F(TtmlMuxerTest, HandlesCueId) { " \n" " \n" "
\n" - "

bar

\n" + "

bar

\n" "
\n" " \n" "\n"; @@ -265,8 +265,8 @@ TEST_F(TtmlMuxerTest, EscapesSpecialChars) { " \n" " \n" "
\n" - "

<tag>\"foo&bar\"

\n" "
\n" " \n" @@ -290,8 +290,8 @@ TEST_F(TtmlMuxerTest, HandlesReset) { " \n" " \n" "
\n" - "

foo

\n" + "

foo

\n" "
\n" " \n" "\n"; @@ -302,8 +302,8 @@ TEST_F(TtmlMuxerTest, HandlesReset) { " \n" " \n" "
\n" - "

bar

\n" + "

bar

\n" "
\n" " \n" "\n"; @@ -339,8 +339,8 @@ TEST_F(TtmlMuxerTest, HandlesImage) { " \n" " \n" "
\n" - "

\n" + "

\n" "

\n" " \n" "\n"; @@ -352,6 +352,27 @@ TEST_F(TtmlMuxerTest, HandlesImage) { ParseSingleCue(kExpectedOutput, properties); } +TEST_F(TtmlMuxerTest, FormatsTimeWithFixedNumberOfDigits) { + const char* kExpectedOutput = + "\n" + "\n" + " \n" + " \n" + "
\n" + "

payload

\n" + "
\n" + " \n" + "
\n"; + + TestProperties properties; + properties.body.body = "payload"; + properties.start = 0; + properties.end = 1; + ParseSingleCue(kExpectedOutput, properties); +} + } // namespace ttml } // namespace media } // namespace shaka