Remove unused Film::content_paths_valid; fix ImageDecoder to throw an OpenFileError...
authorCarl Hetherington <cth@carlh.net>
Sat, 28 Dec 2013 15:00:38 +0000 (15:00 +0000)
committerCarl Hetherington <cth@carlh.net>
Sat, 28 Dec 2013 15:00:38 +0000 (15:00 +0000)
ChangeLog
src/lib/content.cc
src/lib/content.h
src/lib/film.cc
src/lib/film.h
src/lib/image_decoder.cc
src/lib/playlist.cc
src/lib/playlist.h
src/wx/content_menu.cc
src/wx/film_editor.cc

index 7feabc198f4db34f172bbb9c175ffeeeaf04bafb..c80ad2e6342806b13609daee421b9b6153f7667c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-12-28  Carl Hetherington  <cth@carlh.net>
+
+       * Fix failure to load films with missing still image content (#300).
+
 2013-12-27  Carl Hetherington  <cth@carlh.net>
 
        * Fix non-update of video information on changing DCP resolution (#299).
index f09012765a7cbe7616d1e2ae40a870981b74604a..d835a5b0573fd263c6e46f0be4073d830bccde06 100644 (file)
@@ -232,7 +232,7 @@ Content::identifier () const
 }
 
 bool
-Content::path_valid () const
+Content::paths_valid () const
 {
        for (vector<boost::filesystem::path>::const_iterator i = _paths.begin(); i != _paths.end(); ++i) {
                if (!boost::filesystem::exists (*i)) {
index 9cf6d866ab04906b3288188792c66f9403b8592e..4ee7c267f354c5cf65da2f1c948f3b8d93b79424 100644 (file)
@@ -84,7 +84,7 @@ public:
                return _paths[i];
        }
        
-       bool path_valid () const;
+       bool paths_valid () const;
 
        /** @return MD5 digest of the content's file(s) */
        std::string digest () const {
index 5946d5bec8ce3db40f8c53d06259ae521f8dd170..1bf35cc5fffde98ced3c2a2598c0a41926f129c4 100644 (file)
@@ -860,12 +860,6 @@ Film::best_video_frame_rate () const
        return _playlist->best_dcp_frame_rate ();
 }
 
-bool
-Film::content_paths_valid () const
-{
-       return _playlist->content_paths_valid ();
-}
-
 void
 Film::playlist_content_changed (boost::weak_ptr<Content> c, int p)
 {
index 4b07f84a928503befb9fd231ab2f4a0a8efd97e9..e318f772492fc83777b5169170ff822779c88c08 100644 (file)
@@ -114,7 +114,6 @@ public:
        Time length () const;
        bool has_subtitles () const;
        OutputVideoFrame best_video_frame_rate () const;
-       bool content_paths_valid () const;
 
        libdcp::KDM
        make_kdm (
index fb6053ae5226188d91f31809133df65aec47d011..a7999c02a86b5270b09dd50fd118c00280ef5761 100644 (file)
@@ -52,7 +52,14 @@ ImageDecoder::pass ()
                return;
        }
 
-       Magick::Image* magick_image = new Magick::Image (_image_content->path (_image_content->still() ? 0 : _video_position).string ());
+       Magick::Image* magick_image = 0;
+       boost::filesystem::path const path = _image_content->path (_image_content->still() ? 0 : _video_position);
+       try {
+               magick_image = new Magick::Image (path.string ());
+       } catch (...) {
+               throw OpenFileError (path);
+       }
+       
        libdcp::Size size (magick_image->columns(), magick_image->rows());
 
        _image.reset (new Image (PIX_FMT_RGB24, size, true));
index 37b2902189f2b32d61a94a57bbc0baa36c7f0a28..daa82cb94a56e305dc3420424f15e2d7a4f1cf41 100644 (file)
@@ -389,15 +389,3 @@ Playlist::move_later (shared_ptr<Content> c)
        
        Changed ();
 }
-
-bool
-Playlist::content_paths_valid () const
-{
-       for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) {
-               if (!(*i)->path_valid ()) {
-                       return false;
-               }
-       }
-
-       return true;
-}
index f87b3397b4b68e388f3f5e0f37b512c385c4bcf5..1915e3d045a01cabe7058c0fb4af089599548842 100644 (file)
@@ -80,8 +80,6 @@ public:
 
        void repeat (ContentList, int);
 
-       bool content_paths_valid () const;
-
        mutable boost::signals2::signal<void ()> Changed;
        /** Third parameter is true if signals are currently being emitted frequently */
        mutable boost::signals2::signal<void (boost::weak_ptr<Content>, int, bool)> ContentChanged;
index 254109eb3c882083c52193abf816d8b04d8c871b..6372503d14db465069eb62b16ff010ad49dac0b8 100644 (file)
@@ -80,7 +80,7 @@ ContentMenu::popup (ContentList c, wxPoint p)
        
        _join->Enable (n > 1);
        
-       _find_missing->Enable (_content.size() == 1 && !_content.front()->path_valid ());
+       _find_missing->Enable (_content.size() == 1 && !_content.front()->paths_valid ());
        _remove->Enable (!_content.empty ());
        _parent->PopupMenu (_menu, p);
 }
index e478734c7149dbcdba326ba42be3cc44bea3599b..04bf6d2a809c10334b4a2b13b165d67fe6d52e2b 100644 (file)
@@ -734,7 +734,7 @@ FilmEditor::setup_content ()
        ContentList content = _film->content ();
        for (ContentList::iterator i = content.begin(); i != content.end(); ++i) {
                int const t = _content->GetItemCount ();
-               bool const valid = (*i)->path_valid ();
+               bool const valid = (*i)->paths_valid ();
 
                string s = (*i)->summary ();
                if (!valid) {