+void create_marks_from_comments(
+ const spl::shared_ptr<core::scene::scene_producer>& scene,
+ const core::video_format_desc& format_desc,
+ const boost::property_tree::wptree& comment_track)
+{
+ auto keylist = comment_track.get_child_optional(L"keyList");
+
+ if (!keylist)
+ return;
+
+ for (auto& key : *keylist)
+ {
+ auto time = get_rational(key.second.get_child(L"time"));
+ auto frame = get_frame_number(format_desc, time);
+ auto text = key.second.get<std::wstring>(L"animKey.Vl ");
+ std::vector<std::wstring> marks;
+ boost::split(marks, text, boost::is_any_of(","));
+
+ for (auto& mark : marks)
+ {
+ boost::trim_if(mark, [](wchar_t c) { return isspace(c) || c == 0; });
+
+ std::vector<std::wstring> args;
+ boost::split(args, mark, boost::is_any_of(" \t"), boost::algorithm::token_compress_on);
+
+ scene->add_mark(frame, core::scene::get_mark_action(args.at(0)), args.size() == 1 ? L"" : args.at(1));
+ }
+ }
+}
+
+void create_marks(
+ const spl::shared_ptr<core::scene::scene_producer>& scene,
+ const core::video_format_desc& format_desc,
+ const boost::property_tree::wptree& global_timeline)
+{
+ auto time = get_rational(global_timeline.get_child(L"duration"));
+ auto remove_at_frame = get_frame_number(format_desc, time);
+
+ scene->add_mark(remove_at_frame, core::scene::mark_action::remove, L"");
+
+ auto tracklist = global_timeline.get_child_optional(L"globalTrackList");
+
+ if (!tracklist)
+ return;
+
+ for (auto& track : *tracklist)
+ {
+ auto track_id = track.second.get<std::wstring>(L"stdTrackID");
+
+ if (track_id == L"globalCommentTrack")
+ create_marks_from_comments(scene, format_desc, track.second);
+ }
+}
+