22 #include "WebvttSubtecDevParser.hpp"
23 #include "WebVttSubtecParser.hpp"
24 #include "TtmlSubtecParser.hpp"
29 template<
typename T,
typename ...Args>
30 std::unique_ptr<T> subtec_make_unique(Args&& ...args)
32 return std::unique_ptr<T>(
new T(std::forward<Args>(args)...));
43 AAMPLOG_INFO(
"createSubtitleParser: mimeType %s\n", mimeType.c_str());
45 if (!mimeType.compare(
"text/vtt"))
46 type = eSUB_TYPE_WEBVTT;
47 else if (!mimeType.compare(
"application/ttml+xml") ||
48 !mimeType.compare(
"application/mp4"))
49 type = eSUB_TYPE_TTML;
51 return createSubtitleParser(mLogObj, aamp, type);
56 AAMPLOG_INFO(
"createSubtitleParser: mimeType: %d\n", mimeType);
57 std::unique_ptr<SubtitleParser> empty;
62 case eSUB_TYPE_WEBVTT:
67 return subtec_make_unique<WebVTTSubtecParser>(mLogObj, aamp, mimeType);
69 return subtec_make_unique<WebVTTSubtecDevParser>(mLogObj, aamp, mimeType);
71 return subtec_make_unique<WebVTTParser>(mLogObj, aamp, mimeType);
73 return subtec_make_unique<TtmlSubtecParser>(mLogObj, aamp, mimeType);
75 AAMPLOG_WARN(
"Unknown subtitle parser type %d, returning empty", mimeType);
78 }
catch (
const std::runtime_error &e) {
79 AAMPLOG_WARN(
"%s", e.what());
80 AAMPLOG_WARN(
" Failed on SubtitleParser construction - returning empty");