From: Carl Hetherington Date: Tue, 25 Feb 2014 10:46:15 +0000 (+0000) Subject: Fix a couple of audio crashes in the film viewer. Fix serialisation of SubRipContent. X-Git-Tag: v2.0.48~910 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=0412f1a2b29f380cb4ca35787fc7174d6948072c;hp=a983bc3abceadae75c7fa070ae394a69e6d8bd5b;p=dcpomatic.git Fix a couple of audio crashes in the film viewer. Fix serialisation of SubRipContent. --- 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 film, boost::filesystem::path path) : Content (film, path) @@ -37,6 +39,7 @@ SubRipContent::SubRipContent (shared_ptr film, boost::filesystem::pa SubRipContent::SubRipContent (shared_ptr film, shared_ptr node, int version) : Content (film, node) , SubtitleContent (film, node, version) + , _length (node->number_child ("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 (_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;