Fix a couple of audio crashes in the film viewer. Fix serialisation of SubRipContent.
authorCarl Hetherington <cth@carlh.net>
Tue, 25 Feb 2014 10:46:15 +0000 (10:46 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 25 Feb 2014 10:46:15 +0000 (10:46 +0000)
src/lib/ffmpeg_decoder.cc
src/lib/subrip_content.cc
src/lib/subrip_content.h
src/lib/subtitle_content.cc

index b7006a264627ed0f0d62c790a31fabd8f00f071e..4534de589693a21b7839009e9425325a821760c7 100644 (file)
@@ -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
index 73499a5f69c384a17bc5e2ed39787afd31882af3..9212add688c05b04ac7cba5ac3563211cd6a966c 100644 (file)
@@ -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
index 6138c047ec47d3a2ef8a691076c25e667ed55a42..3a8380cec56e1846060c3eacad2ecf4ea7dac1f8 100644 (file)
@@ -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;
 
index 8f88574e5e7ff53950c903b710c571fe1b151cce..4c6e601926d2ebf096450a443ee7560bda152fba 100644 (file)
@@ -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;