summaryrefslogtreecommitdiff
path: root/src/lib/video_content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-04-01 02:25:02 +0100
committerCarl Hetherington <cth@carlh.net>2013-04-01 02:25:02 +0100
commitb468ccabdb13fca86ae8a324239d83490ef5832e (patch)
tree816332e6d3437b3924c1fdf6ada7d61965136337 /src/lib/video_content.cc
parent640c53f0a5f178a894ff2718bf6d74e9e977eb80 (diff)
XML metadata and some other bits.
Diffstat (limited to 'src/lib/video_content.cc')
-rw-r--r--src/lib/video_content.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index 9fc5cf1a2..8a4414c18 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -1,3 +1,4 @@
+#include <libcxml/cxml.h>
#include "video_content.h"
#include "video_decoder.h"
@@ -5,7 +6,9 @@ int const VideoContentProperty::VIDEO_LENGTH = 0;
int const VideoContentProperty::VIDEO_SIZE = 1;
int const VideoContentProperty::VIDEO_FRAME_RATE = 2;
+using std::string;
using boost::shared_ptr;
+using boost::lexical_cast;
VideoContent::VideoContent (boost::filesystem::path f)
: Content (f)
@@ -14,6 +17,25 @@ VideoContent::VideoContent (boost::filesystem::path f)
}
+VideoContent::VideoContent (shared_ptr<const cxml::Node> node)
+ : Content (node)
+{
+ _video_length = node->number_child<ContentVideoFrame> ("VideoLength");
+ _video_size.width = node->number_child<int> ("VideoWidth");
+ _video_size.height = node->number_child<int> ("VideoHeight");
+ _video_frame_rate = node->number_child<float> ("VideoFrameRate");
+}
+
+void
+VideoContent::as_xml (xmlpp::Node* node) const
+{
+ boost::mutex::scoped_lock lm (_mutex);
+ node->add_child("VideoLength")->add_child_text (lexical_cast<string> (_video_length));
+ node->add_child("VideoWidth")->add_child_text (lexical_cast<string> (_video_size.width));
+ node->add_child("VideoHeight")->add_child_text (lexical_cast<string> (_video_size.height));
+ node->add_child("VideoFrameRate")->add_child_text (lexical_cast<string> (_video_frame_rate));
+}
+
void
VideoContent::take_from_video_decoder (shared_ptr<VideoDecoder> d)
{