*/
#include "ffmpeg_subtitle_stream.h"
+#include "raw_convert.h"
+#include <libxml++/libxml++.h>
+#include <boost/foreach.hpp>
+
+using std::string;
/** Construct a SubtitleStream from a value returned from to_string().
* @param t String returned from to_string().
FFmpegSubtitleStream::FFmpegSubtitleStream (cxml::ConstNodePtr node)
: FFmpegStream (node)
{
-
+ BOOST_FOREACH (cxml::NodePtr i, node->node_children ("Period")) {
+ periods.push_back (
+ ContentTimePeriod (
+ ContentTime (node->number_child<ContentTime::Type> ("From")),
+ ContentTime (node->number_child<ContentTime::Type> ("To"))
+ )
+ );
+ }
}
void
FFmpegSubtitleStream::as_xml (xmlpp::Node* root) const
{
FFmpegStream::as_xml (root);
+
+ BOOST_FOREACH (ContentTimePeriod const & i, periods) {
+ xmlpp::Node* node = root->add_child ("Period");
+ node->add_child("From")->add_child_text (raw_convert<string> (i.from.get ()));
+ node->add_child("To")->add_child_text (raw_convert<string> (i.to.get ()));
+ }
}