diff --git a/gtk2_ardour/about.cc b/gtk2_ardour/about.cc index 01a4c8cf47..3ba17449bc 100644 --- a/gtk2_ardour/about.cc +++ b/gtk2_ardour/about.cc @@ -132,6 +132,7 @@ static const char* authors[] = { N_("Sam Chessman"), N_("André Colomb"), N_("Paul Davis"), + N_("Julien Dekozak"), N_("Gerard van Dongen"), N_("Colin Fletcher"), N_("Dave Flick"), diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 8484ffff36..91a5ac8c43 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -834,13 +834,10 @@ ARDOUR_UI::idle_finish () void ARDOUR_UI::finish() { -#ifdef WITH_VIDEOTIMELINE - /* close video-monitor & pending requests - * would better be done in ~Editor() but that is not called.. - */ - ARDOUR_UI::instance()->video_timeline->close_session(); -#endif if (_session) { +#ifdef WITH_VIDEOTIMELINE + ARDOUR_UI::instance()->video_timeline->sync_session_state(); +#endif if (_session->dirty()) { vector actions; @@ -2558,7 +2555,7 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri */ #ifdef WITH_VIDEOTIMELINE if (_session && ARDOUR_UI::instance()->video_timeline) { - ARDOUR_UI::instance()->video_timeline->close_session(); + ARDOUR_UI::instance()->video_timeline->sync_session_state(); } #endif if (_session && _session->dirty()) { @@ -2745,9 +2742,6 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri void ARDOUR_UI::close_session() { -#ifdef WITH_VIDEOTIMELINE - ARDOUR_UI::instance()->video_timeline->close_session(); -#endif if (!check_audioengine()) { return; } diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 2789c37464..0cfe341211 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -217,7 +217,7 @@ ARDOUR_UI::unload_session (bool hide_stuff) { #ifdef WITH_VIDEOTIMELINE if (_session) { - ARDOUR_UI::instance()->video_timeline->close_session(); + ARDOUR_UI::instance()->video_timeline->sync_session_state(); } #endif if (_session && _session->dirty()) { @@ -250,6 +250,9 @@ ARDOUR_UI::unload_session (bool hide_stuff) ActionManager::set_sensitive (ActionManager::session_sensitive_actions, false); rec_button.set_sensitive (false); +#ifdef WITH_VIDEOTIMELINE + ARDOUR_UI::instance()->video_timeline->close_session(); +#endif stop_blinking (); stop_clocking (); diff --git a/gtk2_ardour/pingback.cc b/gtk2_ardour/pingback.cc index e3cf383e17..dea7f52f01 100644 --- a/gtk2_ardour/pingback.cc +++ b/gtk2_ardour/pingback.cc @@ -89,9 +89,6 @@ _pingback (void *arg) char errbuf[CURL_ERROR_SIZE]; curl_easy_setopt (c, CURLOPT_ERRORBUFFER, errbuf); - //get announcements from our server - std::cerr << "Checking for Announcements from ardour.org ...\n"; - string url; #ifdef __APPLE__ diff --git a/gtk2_ardour/video_monitor.cc b/gtk2_ardour/video_monitor.cc index 5bc6bb6777..9bcd244cf0 100644 --- a/gtk2_ardour/video_monitor.cc +++ b/gtk2_ardour/video_monitor.cc @@ -79,11 +79,9 @@ VideoMonitor::start () } void -VideoMonitor::quit () +VideoMonitor::query_full_state (bool wait) { - if (!is_started()) return; - if (state_connection.connected()) { state_connection.disconnect(); } - if (clock_connection.connected()) { clock_connection.disconnect(); } + knownstate = 0; process->write_to_stdin("get windowsize\n"); process->write_to_stdin("get windowpos\n"); process->write_to_stdin("get letterbox\n"); @@ -91,10 +89,21 @@ VideoMonitor::quit () process->write_to_stdin("get ontop\n"); process->write_to_stdin("get offset\n"); process->write_to_stdin("get osdcfg\n"); + int timeout = 40; + if (wait && knownstate !=127 && --timeout) { + usleep(50000); + sched_yield(); + } +} + +void +VideoMonitor::quit () +{ + if (!is_started()) return; + if (state_connection.connected()) { state_connection.disconnect(); } + if (clock_connection.connected()) { clock_connection.disconnect(); } process->write_to_stdin("quit\n"); -#if 1 - /* wait for replies to the config requests above. - * the 'quit' command should result in process termination + /* the 'quit' command should result in process termination * but in case it fails (communication failure, SIGSTOP, ??) * here's a timeout.. */ @@ -104,11 +113,8 @@ VideoMonitor::quit () sched_yield(); } if (timeout <= 0) { - printf("xjadeo connection: time-out. session may not be saved.\n"); process->terminate(); } -#endif - save_session(); } void @@ -145,9 +151,16 @@ void VideoMonitor::querystate () { /* clock-divider hack -- RapidScreenUpdate == every_point_one_seconds */ - state_clk_divide = (state_clk_divide + 1) % 15; // every 1.5 seconds - if (state_clk_divide != 0) return; - + state_clk_divide = (state_clk_divide + 1) % 300; // 30 secs + if (state_clk_divide == 0) { + // every 30 seconds + query_full_state(false); + return; + } + if (state_clk_divide%25 != 0) { + return; + } + // every 2.5 seconds: process->write_to_stdin("get fullscreen\n"); process->write_to_stdin("get ontop\n"); process->write_to_stdin("get osdcfg\n"); @@ -268,35 +281,50 @@ VideoMonitor::parse_output (std::string d, size_t s) #if 0 /* DEBUG */ std::cout << "parsed: " << key << " => " << value << std::endl; #endif - if(key == "windowpos") { + if (key == "windowpos") { + knownstate |= 16; + if (xjadeo_settings["window xy"] != value) { + if (!starting && _session) _session->set_dirty (); + } xjadeo_settings["window xy"] = value; } else if(key == "windowsize") { + knownstate |= 32; + if (xjadeo_settings["window size"] != value) { + if (!starting && _session) _session->set_dirty (); + } xjadeo_settings["window size"] = value; } else if(key == "windowontop") { + knownstate |= 2; if (starting || xjadeo_settings["window ontop"] != value) { - starting &= ~2; + if (!starting && _session) _session->set_dirty (); if (atoi(value.c_str())) { UiState("xjadeo-window-ontop-on"); } else { UiState("xjadeo-window-ontop-off"); } + starting &= ~2; } xjadeo_settings["window ontop"] = value; } else if(key == "fullscreen") { + knownstate |= 4; if (starting || xjadeo_settings["window zoom"] != value) { - starting &= ~4; + if (!starting && _session) _session->set_dirty (); if (atoi(value.c_str())) { UiState("xjadeo-window-fullscreen-on"); } else { UiState("xjadeo-window-fullscreen-off"); } + starting &= ~4; } xjadeo_settings["window zoom"] = value; } else if(key == "letterbox") { + knownstate |= 8; if (starting || xjadeo_settings["window letterbox"] != value) { - starting &= ~8; + if (!starting && _session) _session->set_dirty (); if (atoi(value.c_str())) { UiState("xjadeo-window-letterbox-on"); } else { UiState("xjadeo-window-letterbox-off"); } + starting &= ~8; } xjadeo_settings["window letterbox"] = value; } else if(key == "osdmode") { - if (starting || xjadeo_settings["osd mode"] != value) { - starting &= ~1; - osdmode = atoi(value.c_str()); + knownstate |= 1; + osdmode = atoi(value.c_str()); + if (starting || atoi(xjadeo_settings["osd mode"].c_str()) != osdmode) { + if (!starting && _session) _session->set_dirty (); if ((osdmode & 1) == 1) { UiState("xjadeo-window-osd-frame-on"); } if ((osdmode & 1) == 0) { UiState("xjadeo-window-osd-frame-off"); } if ((osdmode & 2) == 2) { UiState("xjadeo-window-osd-timecode-on"); } @@ -304,8 +332,13 @@ VideoMonitor::parse_output (std::string d, size_t s) if ((osdmode & 8) == 8) { UiState("xjadeo-window-osd-box-on"); } if ((osdmode & 8) == 0) { UiState("xjadeo-window-osd-box-off"); } } + starting &= ~1; xjadeo_settings["osd mode"] = value; } else if(key == "offset") { + knownstate |= 64; + if (xjadeo_settings["set offset"] != value) { + if (!starting && _session) _session->set_dirty (); + } xjadeo_settings["set offset"] = value; } } @@ -321,7 +354,6 @@ void VideoMonitor::terminated () { process->terminate(); // from gui-context clean up - save_session(); Terminated(); } @@ -329,35 +361,13 @@ void VideoMonitor::save_session () { if (!_session) { return; } - bool is_dirty = false; - - XMLNode* prev = _session->extra_xml (X_("XJSettings")); - XMLNode* node = new XMLNode(X_("XJSettings")); - XMLNodeList nlist; - if (!prev) { is_dirty = true; } - else { nlist = prev->children(); } + XMLNode* node = _session->extra_xml (X_("XJSettings")); + if (!node) return; for(XJSettings::const_iterator it = xjadeo_settings.begin(); it != xjadeo_settings.end(); ++it) { XMLNode* child = node->add_child (X_("XJSetting")); child->add_property (X_("k"), it->first); child->add_property (X_("v"), it->second); - if (!is_dirty) { - bool found = false; - XMLNodeConstIterator i; - for (i = nlist.begin(); i != nlist.end(); ++i) { - if ((*i)->property(X_("k"))->value() == it->first && - (*i)->property(X_("v"))->value() == it->second ) { - found=true; - break; - } - } - if (!found) {is_dirty = true;} - } - } - - if (is_dirty) { - _session->add_extra_xml (*node); - _session->set_dirty (); } } diff --git a/gtk2_ardour/video_monitor.h b/gtk2_ardour/video_monitor.h index be3b76f9a4..0f954e9cd5 100644 --- a/gtk2_ardour/video_monitor.h +++ b/gtk2_ardour/video_monitor.h @@ -62,7 +62,9 @@ class VideoMonitor : public sigc::trackable , public ARDOUR::SessionHandlePtr, p void open (std::string); void set_session (ARDOUR::Session *s); + void save_session (); void clear_session_state (); + void query_full_state (bool); bool set_custom_setting (const std::string, const std::string); const std::string get_custom_setting (const std::string); void restore_settings_mask (int i) { _restore_settings_mask = i;} @@ -89,7 +91,6 @@ class VideoMonitor : public sigc::trackable , public ARDOUR::SessionHandlePtr, p void parse_output (std::string d, size_t s); void terminated (); - void save_session (); void parameter_changed (std::string const & p); typedef std::map XJSettings; @@ -105,6 +106,7 @@ class VideoMonitor : public sigc::trackable , public ARDOUR::SessionHandlePtr, p sigc::connection state_connection; int state_clk_divide; int starting; + int knownstate; int osdmode; #if 1 bool debug_enable; diff --git a/gtk2_ardour/video_timeline.cc b/gtk2_ardour/video_timeline.cc index 8360ef75d4..aebb4f5d9f 100644 --- a/gtk2_ardour/video_timeline.cc +++ b/gtk2_ardour/video_timeline.cc @@ -87,63 +87,26 @@ VideoTimeLine::save_session () LocaleGuard lg (X_("POSIX")); - bool is_dirty = false; - - XMLNode* prev = _session->extra_xml (X_("Videomonitor")); - - /* remember if vmonitor was open.. */ XMLNode* node = new XMLNode(X_("Videomonitor")); - + if (!node) return; node->add_property (X_("active"), (vmonitor && vmonitor->is_started())?"yes":"no"); - if (!prev || !(prev->property (X_("active")) && prev->property (X_("active"))->value() == node->property(X_("active"))->value()) ){ - _session->add_extra_xml (*node); - is_dirty=true; // TODO not if !prev && value==default + _session->add_extra_xml (*node); + + if (vmonitor) { + if (vmonitor->is_started()) { + vmonitor->query_full_state(true); + } + vmonitor->save_session(); } /* VTL settings */ node = _session->extra_xml (X_("Videotimeline")); - - if (node) { - if (!(node->property(X_("id")) && node->property(X_("id"))->value() == id().to_s())) { - node->add_property (X_("id"), id().to_s()); - is_dirty=true; - } - } - - /* remember timeline height.. */ - if (node) { - int h = editor->get_videotl_bar_height(); - if (!(node->property(X_("Height")) && atoi(node->property(X_("Height"))->value().c_str())==h)) { - node->add_property (X_("Height"), h); - is_dirty=true; - } - } - - /* save video-offset-lock */ - if (node) { - if (!(node->property(X_("VideoOffsetLock")) && atoi(node->property(X_("VideoOffsetLock"))->value().c_str())==video_offset_lock)) { - node->add_property (X_("VideoOffsetLock"), video_offset_lock?X_("1"):X_("0")); - is_dirty=true; - } - } - /* save video-offset */ - if (node) { - if (!(node->property(X_("VideoOffset")) && atoll(node->property(X_("VideoOffset"))->value().c_str())==video_offset)) { - node->add_property (X_("VideoOffset"), video_offset); - is_dirty=true; - } - } - - /* save 'auto_set_session_fps' */ - if (node) { - if (!(node->property(X_("AutoFPS")) && atoi(node->property(X_("AutoFPS"))->value().c_str())==auto_set_session_fps)) { - node->add_property (X_("AutoFPS"), auto_set_session_fps?X_("1"):X_("0")); - is_dirty=true; - } - } - if (is_dirty) { - _session->set_dirty (); - } + if (!node) return; + node->add_property (X_("id"), id().to_s()); + node->add_property (X_("Height"), editor->get_videotl_bar_height()); + node->add_property (X_("VideoOffsetLock"), video_offset_lock?X_("1"):X_("0")); + node->add_property (X_("VideoOffset"), video_offset); + node->add_property (X_("AutoFPS"), auto_set_session_fps?X_("1"):X_("0")); } /* close and save settings */ @@ -153,7 +116,7 @@ VideoTimeLine::close_session () if (video_duration == 0) { return; } - save_session(); + sessionsave.disconnect(); close_video_monitor(); remove_frames(); @@ -162,6 +125,15 @@ VideoTimeLine::close_session () GuiUpdate("set-xjadeo-sensitive-off"); } +void +VideoTimeLine::sync_session_state () +{ + if (!_session || !vmonitor || !vmonitor->is_started()) { + return; + } + save_session(); +} + /** load settings from session */ void VideoTimeLine::set_session (ARDOUR::Session *s) @@ -169,6 +141,7 @@ VideoTimeLine::set_session (ARDOUR::Session *s) SessionHandlePtr::set_session (s); if (!_session) { return ; } + _session->SaveSession.connect_same_thread (sessionsave, boost::bind (&VideoTimeLine::save_session, this)); LocaleGuard lg (X_("POSIX")); XMLNode* node = _session->extra_xml (X_("Videotimeline")); @@ -225,9 +198,28 @@ VideoTimeLine::set_session (ARDOUR::Session *s) _session->config.ParameterChanged.connect (*this, invalidator (*this), ui_bind (&VideoTimeLine::parameter_changed, this, _1), gui_context()); } +void +VideoTimeLine::set_offset_locked (bool v) { + if (_session && v != video_offset_lock) { + _session->set_dirty (); + } + video_offset_lock = v; +} + +void +VideoTimeLine::toggle_offset_locked () { + video_offset_lock = !video_offset_lock; + if (_session) { + _session->set_dirty (); + } +} + void VideoTimeLine::save_undo () { + if (_session && video_offset_p != video_offset) { + _session->set_dirty (); + } video_offset_p = video_offset; } @@ -608,6 +600,9 @@ VideoTimeLine::gui_update(std::string const & t) { void VideoTimeLine::set_height (int height) { + if (_session && bar_height != height) { + _session->set_dirty (); + } bar_height = height; flush_local_cache(); } @@ -736,6 +731,17 @@ VideoTimeLine::open_video_monitor() { GuiUpdate("set-xjadeo-active-on"); vmonitor->set_fps(video_file_fps); vmonitor->open(video_filename); + + if (_session) { + XMLNode* node = _session->extra_xml (X_("Videomonitor")); + if (node) { + const XMLProperty* prop = node->property (X_("active")); + if (prop && prop->value() != "yes") _session->set_dirty (); + } else { + _session->set_dirty (); + } + } + } } @@ -762,9 +768,13 @@ VideoTimeLine::terminated_video_monitor () { } GuiUpdate("set-xjadeo-active-off"); vmonitor=0; - if (reopen_vmonitor) { + if (reopen_vmonitor) { reopen_vmonitor=false; open_video_monitor(); + } else { + if (_session) { + _session->set_dirty (); + } } } diff --git a/gtk2_ardour/video_timeline.h b/gtk2_ardour/video_timeline.h index 8775a64265..4b157d08ba 100644 --- a/gtk2_ardour/video_timeline.h +++ b/gtk2_ardour/video_timeline.h @@ -72,8 +72,8 @@ class VideoTimeLine : public sigc::trackable, public ARDOUR::SessionHandlePtr, p double get_video_file_fps () { return video_file_fps; } void set_update_session_fps (bool v=true) { auto_set_session_fps = v; } - void set_offset_locked (bool v) { video_offset_lock = v; } - void toggle_offset_locked () { video_offset_lock = !video_offset_lock; } + void set_offset_locked (bool v); + void toggle_offset_locked (); bool is_offset_locked () { return video_offset_lock; } void open_video_monitor (); @@ -93,6 +93,7 @@ class VideoTimeLine : public sigc::trackable, public ARDOUR::SessionHandlePtr, p void flush_cache (); void save_session (); void close_session (); + void sync_session_state (); /* video-monitor does not actively report window/pos changes, query it */ float get_apv(); /* audio frames per video frame; */ ARDOUR::framecnt_t get_duration () { return video_duration;} ARDOUR::frameoffset_t get_offset () { return video_offset;} @@ -137,6 +138,8 @@ class VideoTimeLine : public sigc::trackable, public ARDOUR::SessionHandlePtr, p PBD::Signal0 VtlUpdate; PBD::Signal1 GuiUpdate; void gui_update (const std::string &); + + PBD::ScopedConnection sessionsave; }; #endif /* __ardour_video_timeline_h__ */ diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 525faa4e13..a149224607 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -397,6 +397,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi PBD::Signal1 StateSaved; PBD::Signal0 StateReady; + PBD::Signal0 SaveSession; std::vector* possible_states() const; static std::vector* possible_states (std::string path); diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index a713375755..9a82192175 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -772,6 +772,8 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot } } + SaveSession (); /* EMIT SIGNAL */ + tree.set_root (&get_state()); if (snapshot_name.empty()) { diff --git a/tools/linux_packaging/build b/tools/linux_packaging/build index 1928fadd8f..b332365407 100755 --- a/tools/linux_packaging/build +++ b/tools/linux_packaging/build @@ -530,8 +530,8 @@ done if test x$WITH_HARVID != x ; then cd $APPBIN - HARVID_VERSION="v0.7.0" # todo make 'latest' symlink on github work somehow. - curl -L http://x42.github.com/harvid/releases/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \ + HARVID_VERSION=$(curl http://ardour.org/files/video-tools/latest_version_numer.txt) + curl -L http://ardour.org/files/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \ | tar -x -z --exclude=README --exclude=harvid.1 --strip-components=1 || exit 1 cd - fi diff --git a/tools/linux_packaging/define_versions.sh b/tools/linux_packaging/define_versions.sh index 611df8017e..def50ec079 100644 --- a/tools/linux_packaging/define_versions.sh +++ b/tools/linux_packaging/define_versions.sh @@ -4,9 +4,11 @@ release_version=`grep -m 1 '[^A-Za-z_]LINUX_VERSION = ' ../../wscript | awk '{print $3}' | sed "s/'//g"` r=`cut -d'"' -f2 < ../../libs/ardour/revision.cc | sed -e 1d -e "s/$release_version-//"` -revcount=`echo $r | cut -d- -f1` +if echo $r | grep -q -e - ; then + revcount=`echo $r | cut -d- -f1` +fi commit=`echo $r | cut -d- -f2` -version=${release_version}.${revcount} +version=${release_version}${revcount:+.$revcount} # # Figure out the Build Type diff --git a/wscript b/wscript index f49ce3a11f..3ce4b2210c 100644 --- a/wscript +++ b/wscript @@ -15,8 +15,8 @@ if sys.platform == 'darwin': OSX_VERSION = '3.0beta6' VERSION = '3.0beta6' else: - LINUX_VERSION = '3.0' - VERSION = '3.0' + LINUX_VERSION = '3.1' + VERSION = '3.1' APPNAME = 'Ardour3'