diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-02-21 11:20:15 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-02-21 11:20:15 +0000 |
| commit | fe886ca75591e3122e7123590dd09bedbc549199 (patch) | |
| tree | 4f5de78c7d183b32ff62ee220274b6c8ed89cce1 /src | |
| parent | df8f80913c8083c2d5d3408da6f8dd67193d890b (diff) | |
Remove stream _legacy_id stuff.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/content.cc | 2 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 33 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.h | 7 | ||||
| -rw-r--r-- | src/lib/film.cc | 9 | ||||
| -rw-r--r-- | src/lib/film.h | 8 | ||||
| -rw-r--r-- | src/tools/dcpomatic.cc | 16 |
6 files changed, 36 insertions, 39 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc index ccca46bc0..1883dfb4a 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -195,7 +195,7 @@ Content::clone () const xmlpp::Document doc; xmlpp::Node* node = doc.create_root_node ("Content"); as_xml (node); - return content_factory (film, cxml::NodePtr (new cxml::Node (node)), Film::state_version); + return content_factory (film, cxml::NodePtr (new cxml::Node (node)), Film::current_state_version); } string diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index bb2b629c8..34486d08b 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -66,7 +66,7 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> f, shared_ptr<const cxml::N { list<cxml::NodePtr> c = node->node_children ("SubtitleStream"); for (list<cxml::NodePtr>::const_iterator i = c.begin(); i != c.end(); ++i) { - _subtitle_streams.push_back (shared_ptr<FFmpegSubtitleStream> (new FFmpegSubtitleStream (*i, version))); + _subtitle_streams.push_back (shared_ptr<FFmpegSubtitleStream> (new FFmpegSubtitleStream (*i))); if ((*i)->optional_number_child<int> ("Selected")) { _subtitle_stream = _subtitle_streams.back (); } @@ -337,14 +337,11 @@ operator!= (FFmpegStream const & a, FFmpegStream const & b) return a._id != b._id; } -FFmpegStream::FFmpegStream (shared_ptr<const cxml::Node> node, int version) +FFmpegStream::FFmpegStream (shared_ptr<const cxml::Node> node) : name (node->string_child ("Name")) , _id (node->number_child<int> ("Id")) - , _legacy_id (false) { - if (version == 4 || node->optional_bool_child ("LegacyId")) { - _legacy_id = true; - } + } void @@ -352,16 +349,10 @@ FFmpegStream::as_xml (xmlpp::Node* root) const { root->add_child("Name")->add_child_text (name); root->add_child("Id")->add_child_text (lexical_cast<string> (_id)); - if (_legacy_id) { - /* Write this so that version > 4 files are read in correctly - if the Id came originally from a version <= 4 file. - */ - root->add_child("LegacyId")->add_child_text ("1"); - } } FFmpegAudioStream::FFmpegAudioStream (shared_ptr<const cxml::Node> node, int version) - : FFmpegStream (node, version) + : FFmpegStream (node) , mapping (node->node_child ("Mapping"), version) { frame_rate = node->number_child<int> ("FrameRate"); @@ -384,10 +375,6 @@ FFmpegAudioStream::as_xml (xmlpp::Node* root) const bool FFmpegStream::uses_index (AVFormatContext const * fc, int index) const { - if (_legacy_id) { - return _id == index; - } - size_t i = 0; while (i < fc->nb_streams) { if (fc->streams[i]->id == _id) { @@ -402,14 +389,6 @@ FFmpegStream::uses_index (AVFormatContext const * fc, int index) const AVStream * FFmpegStream::stream (AVFormatContext const * fc) const { - if (_legacy_id) { - if (_id >= int (fc->nb_streams)) { - return 0; - } - - return fc->streams[_id]; - } - size_t i = 0; while (i < fc->nb_streams) { if (fc->streams[i]->id == _id) { @@ -426,8 +405,8 @@ FFmpegStream::stream (AVFormatContext const * fc) const * @param t String returned from to_string(). * @param v State file version. */ -FFmpegSubtitleStream::FFmpegSubtitleStream (shared_ptr<const cxml::Node> node, int version) - : FFmpegStream (node, version) +FFmpegSubtitleStream::FFmpegSubtitleStream (shared_ptr<const cxml::Node> node) + : FFmpegStream (node) { } diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index 2339705d0..ed2169de0 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -38,10 +38,9 @@ public: FFmpegStream (std::string n, int i) : name (n) , _id (i) - , _legacy_id (false) {} - FFmpegStream (boost::shared_ptr<const cxml::Node>, int); + FFmpegStream (boost::shared_ptr<const cxml::Node>); void as_xml (xmlpp::Node *) const; @@ -62,8 +61,6 @@ public: private: int _id; - /** If this is true, id is in fact the index */ - bool _legacy_id; }; class FFmpegAudioStream : public FFmpegStream @@ -106,7 +103,7 @@ public: : FFmpegStream (n, i) {} - FFmpegSubtitleStream (boost::shared_ptr<const cxml::Node>, int); + FFmpegSubtitleStream (boost::shared_ptr<const cxml::Node>); void as_xml (xmlpp::Node *) const; }; diff --git a/src/lib/film.cc b/src/lib/film.cc index fb5014b3a..1d07ec77f 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -86,7 +86,7 @@ using libdcp::Signer; * 6 -> 7 * Subtitle offset changed to subtitle y offset, and subtitle x offset added. */ -int const Film::state_version = 7; +int const Film::current_state_version = 7; /** Construct a Film object in a given directory. * @@ -110,6 +110,7 @@ Film::Film (boost::filesystem::path dir, bool log) , _three_d (false) , _sequence_video (true) , _interop (false) + , _state_version (current_state_version) , _dirty (false) { set_dci_date_today (); @@ -339,7 +340,7 @@ Film::metadata () const shared_ptr<xmlpp::Document> doc (new xmlpp::Document); xmlpp::Element* root = doc->create_root_node ("Metadata"); - root->add_child("Version")->add_child_text (lexical_cast<string> (state_version)); + root->add_child("Version")->add_child_text (lexical_cast<string> (current_state_version)); root->add_child("Name")->add_child_text (_name); root->add_child("UseDCIName")->add_child_text (_use_dci_name ? "1" : "0"); @@ -393,7 +394,7 @@ Film::read_metadata () cxml::Document f ("Metadata"); f.read_file (file ("metadata.xml")); - int const version = f.number_child<int> ("Version"); + _state_version = f.number_child<int> ("Version"); _name = f.string_child ("Name"); _use_dci_name = f.bool_child ("UseDCIName"); @@ -426,7 +427,7 @@ Film::read_metadata () _three_d = f.bool_child ("ThreeD"); _interop = f.bool_child ("Interop"); _key = libdcp::Key (f.string_child ("Key")); - _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), version); + _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version); _dirty = false; } diff --git a/src/lib/film.h b/src/lib/film.h index 06d19e67e..7e65ecb16 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -138,6 +138,10 @@ public: return _key; } + int state_version () const { + return _state_version; + } + /** Identifiers for the parts of our state; used for signalling changes. */ @@ -271,7 +275,7 @@ public: mutable boost::signals2::signal<void (boost::weak_ptr<Content>, int)> ContentChanged; /** Current version number of the state file */ - static int const state_version; + static int const current_state_version; private: @@ -325,6 +329,8 @@ private: bool _interop; libdcp::Key _key; + int _state_version; + /** true if our state has changed since we last saved it */ mutable bool _dirty; diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 1f546b64f..ce00cb13f 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -324,6 +324,17 @@ public: overall_panel->SetSizer (main_sizer); } + void check_film_state_version (int v) + { + if (v == 4) { + error_dialog ( + this, + _("This film was created with an old version of DVD-o-matic and may not load correctly " + "in this version. Please check the film's settings carefully.") + ); + } + } + private: void set_film () @@ -405,6 +416,7 @@ private: try { film.reset (new Film (wx_to_std (c->GetPath ()))); film->read_metadata (); + check_film_state_version (film->state_version ()); film->log()->set_level (log_level); set_film (); } catch (std::exception& e) { @@ -662,6 +674,8 @@ class App : public wxApp _timer.reset (new wxTimer (this)); _timer->Start (1000); + _frame->check_film_state_version (film->state_version ()); + UpdateChecker::instance()->StateChanged.connect (boost::bind (&App::update_checker_state_changed, this)); if (Config::instance()->check_for_updates ()) { UpdateChecker::instance()->run (); @@ -746,7 +760,7 @@ class App : public wxApp } } - wxFrame* _frame; + Frame* _frame; shared_ptr<wxTimer> _timer; }; |
