summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-02-25 10:46:15 +0000
committerCarl Hetherington <cth@carlh.net>2014-02-25 10:46:15 +0000
commit0412f1a2b29f380cb4ca35787fc7174d6948072c (patch)
treea0f74429e57e868614da7e01a43cf9a4e73cf9e4 /src/lib
parenta983bc3abceadae75c7fa070ae394a69e6d8bd5b (diff)
Fix a couple of audio crashes in the film viewer. Fix serialisation of SubRipContent.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ffmpeg_decoder.cc7
-rw-r--r--src/lib/subrip_content.cc8
-rw-r--r--src/lib/subrip_content.h2
-rw-r--r--src/lib/subtitle_content.cc1
4 files changed, 13 insertions, 5 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index b7006a264..4534de589 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -136,9 +136,8 @@ FFmpegDecoder::flush ()
if (_ffmpeg_content->audio_stream() && _decode_audio) {
decode_audio_packet ();
+ AudioDecoder::flush ();
}
-
- AudioDecoder::flush ();
}
bool
@@ -391,7 +390,9 @@ void
FFmpegDecoder::seek (ContentTime time, bool accurate)
{
Decoder::seek (time, accurate);
- AudioDecoder::seek (time, accurate);
+ if (_decode_audio) {
+ AudioDecoder::seek (time, accurate);
+ }
/* If we are doing an accurate seek, our initial shot will be 200ms (200 being
a number plucked from the air) earlier than we want to end up. The loop below
diff --git a/src/lib/subrip_content.cc b/src/lib/subrip_content.cc
index 73499a5f6..9212add68 100644
--- a/src/lib/subrip_content.cc
+++ b/src/lib/subrip_content.cc
@@ -25,7 +25,9 @@
using std::stringstream;
using std::string;
+using std::cout;
using boost::shared_ptr;
+using boost::lexical_cast;
SubRipContent::SubRipContent (shared_ptr<const Film> film, boost::filesystem::path path)
: Content (film, path)
@@ -37,6 +39,7 @@ SubRipContent::SubRipContent (shared_ptr<const Film> film, boost::filesystem::pa
SubRipContent::SubRipContent (shared_ptr<const Film> film, shared_ptr<const cxml::Node> node, int version)
: Content (film, node)
, SubtitleContent (film, node, version)
+ , _length (node->number_child<DCPTime> ("Length"))
{
}
@@ -69,11 +72,14 @@ SubRipContent::information () const
}
void
-SubRipContent::as_xml (xmlpp::Node* node)
+SubRipContent::as_xml (xmlpp::Node* node) const
{
+ LocaleGuard lg;
+
node->add_child("Type")->add_child_text ("SubRip");
Content::as_xml (node);
SubtitleContent::as_xml (node);
+ node->add_child("Length")->add_child_text (lexical_cast<string> (_length));
}
DCPTime
diff --git a/src/lib/subrip_content.h b/src/lib/subrip_content.h
index 6138c047e..3a8380cec 100644
--- a/src/lib/subrip_content.h
+++ b/src/lib/subrip_content.h
@@ -33,7 +33,7 @@ public:
std::string summary () const;
std::string technical_summary () const;
std::string information () const;
- void as_xml (xmlpp::Node *);
+ void as_xml (xmlpp::Node *) const;
DCPTime full_length () const;
std::string identifier () const;
diff --git a/src/lib/subtitle_content.cc b/src/lib/subtitle_content.cc
index 8f88574e5..4c6e60192 100644
--- a/src/lib/subtitle_content.cc
+++ b/src/lib/subtitle_content.cc
@@ -26,6 +26,7 @@
using std::string;
using std::vector;
+using std::cout;
using boost::shared_ptr;
using boost::lexical_cast;
using boost::dynamic_pointer_cast;