Fix Playlist::has_audio().
authorCarl Hetherington <cth@carlh.net>
Sun, 14 Apr 2013 13:24:07 +0000 (14:24 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 14 Apr 2013 13:24:07 +0000 (14:24 +0100)
src/lib/playlist.cc

index 7fe4fb2a5496c00cb83562eb606f426461a0b011..f04bbe0cb13b608d1a07d3d297ec1cbc90987849 100644 (file)
@@ -182,8 +182,18 @@ Playlist::video_length () const
 bool
 Playlist::has_audio () const
 {
-       /* XXX */
-       return true;
+       if (!_sndfile.empty ()) {
+               return true;
+       }
+
+       for (list<shared_ptr<const VideoContent> >::const_iterator i = _video.begin(); i != _video.end(); ++i) {
+               shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (*i);
+               if (fc && fc->audio_stream ()) {
+                       return true;
+               }
+       }
+       
+       return false;
 }
 
 void