diff --git a/gtk2_ardour/add_video_dialog.cc b/gtk2_ardour/add_video_dialog.cc index d6e18bb718..7050c8412a 100644 --- a/gtk2_ardour/add_video_dialog.cc +++ b/gtk2_ardour/add_video_dialog.cc @@ -76,46 +76,45 @@ AddVideoDialog::AddVideoDialog (Session* s) set_size_request (800, -1); harvid_initialized = false; - std::string dstdir = video_dest_dir(_session->session_directory().video_path(), Config->get_video_server_docroot()); + std::string dstdir = video_dest_dir(_session->session_directory().video_path(), video_get_docroot(Config)); + if (Config->get_video_advanced_setup()) { - /* Harvid Browser */ - harvid_list_view.append_column("", pixBufRenderer); - harvid_list_view.append_column(_("Filename"), harvid_list_columns.filename); + /* Harvid Browser */ + harvid_list_view.append_column("", pixBufRenderer); + harvid_list_view.append_column(_("Filename"), harvid_list_columns.filename); - harvid_list_view.get_column(0)->set_alignment(0.5); - harvid_list_view.get_column(0)->add_attribute(pixBufRenderer, "stock-id", harvid_list_columns.id); - harvid_list_view.get_column(1)->set_expand(true); - harvid_list_view.get_column(1)->set_sort_column(harvid_list_columns.filename); - harvid_list_view.set_enable_search(true); - harvid_list_view.set_search_column(1); + harvid_list_view.get_column(0)->set_alignment(0.5); + harvid_list_view.get_column(0)->add_attribute(pixBufRenderer, "stock-id", harvid_list_columns.id); + harvid_list_view.get_column(1)->set_expand(true); + harvid_list_view.get_column(1)->set_sort_column(harvid_list_columns.filename); + harvid_list_view.set_enable_search(true); + harvid_list_view.set_search_column(1); + harvid_list_view.get_selection()->set_mode (SELECTION_SINGLE); - //Glib::RefPtr refTreeModelSort = Gtk::TreeModelSort::create(harvid_list_view.get_model()); - //refTreeModelSort->set_sort_column(harvid_list_columns.filename, Gtk::SORT_ASCENDING); - //harvid_list_view.set_model(refTreeModelSort); + harvid_list_view.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &AddVideoDialog::harvid_list_view_selected)); + harvid_list_view.signal_row_activated().connect (sigc::mem_fun (*this, &AddVideoDialog::harvid_list_view_activated)); - harvid_list_view.get_selection()->set_mode (SELECTION_SINGLE); + VBox* vbox = manage (new VBox); + Gtk::ScrolledWindow *scroll = manage(new ScrolledWindow); + scroll->add(harvid_list_view); + scroll->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - harvid_list_view.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &AddVideoDialog::harvid_list_view_selected)); - harvid_list_view.signal_row_activated().connect (sigc::mem_fun (*this, &AddVideoDialog::harvid_list_view_activated)); - - VBox* vbox = manage (new VBox); - Gtk::ScrolledWindow *scroll = manage(new ScrolledWindow); - scroll->add(harvid_list_view); - scroll->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - - HBox* hbox = manage (new HBox); - harvid_path.set_alignment (0, 0.5); - hbox->pack_start (harvid_path, true, true); - hbox->pack_start (harvid_reset, false, false); - - vbox->pack_start (*hbox, false, false); - vbox->pack_start (*scroll, true, true); - - notebook.append_page (*vbox, _("VideoServerIndex")); + HBox* hbox = manage (new HBox); + harvid_path.set_alignment (0, 0.5); + hbox->pack_start (harvid_path, true, true); + hbox->pack_start (harvid_reset, false, false); + vbox->pack_start (*hbox, false, false); + vbox->pack_start (*scroll, true, true); + notebook.append_page (*vbox, _("VideoServerIndex")); + } else { + /* dummy entry */ + VBox* vbox = manage (new VBox); + notebook.append_page (*vbox, _("VideoServerIndex")); + } /* file chooser */ chooser.set_border_width (4); @@ -144,12 +143,13 @@ AddVideoDialog::AddVideoDialog (Session* s) import_combo.append_text(_("Transcode to Session")); import_combo.set_active(2); - vbox = manage (new VBox); - vbox->pack_start (chooser, true, true, 0); - vbox->pack_start (import_combo, false, true, 4); + VBox* vboxfb = manage (new VBox); + vboxfb->pack_start (chooser, true, true, 0); + vboxfb->pack_start (import_combo, false, true, 4); - if (Config->get_video_server_docroot().size() > 0) { - notebook.append_page (*vbox, _("Browse Files")); + if (video_get_docroot(Config).size() > 0 && + Config->get_video_advanced_setup()) { + notebook.append_page (*vboxfb, _("Browse Files")); } /* Global Options*/ @@ -190,7 +190,7 @@ AddVideoDialog::AddVideoDialog (Session* s) preview_image->set(imgbuf); seek_slider.set_draw_value(false); - hbox = manage (new HBox); + HBox* hbox = manage (new HBox); hbox->pack_start (*table, true, false); Gtk::Alignment *al = manage(new Gtk::Alignment()); @@ -203,7 +203,11 @@ AddVideoDialog::AddVideoDialog (Session* s) /* Overall layout */ hbox = manage (new HBox); - hbox->pack_start (notebook, true, true); + if (Config->get_video_advanced_setup()) { + hbox->pack_start (notebook, true, true); + } else { + hbox->pack_start (*vboxfb, true, true); + } hbox->pack_start (*previewpane, false, false); get_vbox()->set_spacing (4); @@ -214,7 +218,7 @@ AddVideoDialog::AddVideoDialog (Session* s) /* xjadeo checkbox */ if (ARDOUR_UI::instance()->video_timeline->found_xjadeo() /* TODO xjadeo setup w/ xjremote */ - && Config->get_video_server_docroot().size() > 0) { + && video_get_docroot(Config).size() > 0) { xjadeo_checkbox.set_active(true); /* set in ardour_ui.cpp ?! */ } else { printf("xjadeo was not found or video-server docroot is unset (remote video-server)\n"); @@ -295,7 +299,7 @@ std::string AddVideoDialog::file_name (bool &local_file) { int n = notebook.get_current_page (); - if (n == 1) { + if (n == 1 || ! Config->get_video_advanced_setup()) { local_file = true; return chooser.get_filename(); } else { @@ -304,10 +308,10 @@ AddVideoDialog::file_name (bool &local_file) if(!iter) return ""; std::string uri = (*iter)[harvid_list_columns.uri]; - std::string video_server_url = Config->get_video_server_url(); + std::string video_server_url = video_get_server_url(Config); /* check if video server is running locally */ - if (Config->get_video_server_docroot().size() > 0 + if (video_get_docroot(Config).size() > 0 && !video_server_url.compare(0, 16, "http://localhost")) { /* check if the file can be accessed */ @@ -315,7 +319,7 @@ AddVideoDialog::file_name (bool &local_file) CURL *curl; curl = curl_easy_init(); char *ue = curl_easy_unescape(curl, uri.c_str(), uri.length(), &plen); - std::string path = Config->get_video_server_docroot() + ue; + std::string path = video_get_docroot(Config) + ue; if (!::access(path.c_str(), R_OK)) { uri = path; local_file = true; @@ -331,7 +335,7 @@ enum VtlImportOption AddVideoDialog::import_option () { int n = notebook.get_current_page (); - if (n == 0) { return VTL_IMPORT_NONE; } + if (n == 0 && Config->get_video_advanced_setup()) { return VTL_IMPORT_NONE; } int i = import_combo.get_active_row_number(); return static_cast(i); } @@ -377,7 +381,7 @@ AddVideoDialog::file_selection_changed () && !Glib::file_test(path.c_str(), Glib::FILE_TEST_IS_DIR); set_action_ok(ok); if (ok) { - request_preview(video_map_path(Config->get_video_server_docroot(), path)); + request_preview(video_map_path(video_get_docroot(Config), path)); } } else { set_action_ok(false); @@ -443,7 +447,7 @@ void AddVideoDialog::harvid_load_docroot() { set_action_ok(false); - std::string video_server_url = Config->get_video_server_url(); + std::string video_server_url = video_get_server_url(Config); char url[2048]; snprintf(url, sizeof(url), "%s%sindex/" , video_server_url.c_str() @@ -454,7 +458,7 @@ AddVideoDialog::harvid_load_docroot() { bool AddVideoDialog::page_switch() { - if (notebook.get_current_page () == 1) { + if (notebook.get_current_page () == 1 || Config->get_video_advanced_setup()) { file_selection_changed(); return true; } @@ -540,7 +544,7 @@ AddVideoDialog::seek_preview() void AddVideoDialog::request_preview(std::string u) { - std::string video_server_url = Config->get_video_server_url(); + std::string video_server_url = video_get_server_url(Config); double video_file_fps; long long int video_duration; diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 238c530627..dc53f8fa6e 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -3336,7 +3336,7 @@ ARDOUR_UI::start_video_server (Gtk::Window* float_window, bool popup_msg) std::string icsd_exec = video_server_dialog->get_exec_path(); std::string icsd_docroot = video_server_dialog->get_docroot(); - if (icsd_docroot.empty()) {icsd_docroot = "/";} + if (icsd_docroot.empty()) {icsd_docroot = X_("/");} struct stat sb; if (!lstat (icsd_docroot.c_str(), &sb) == 0 || !S_ISDIR(sb.st_mode)) { @@ -3362,10 +3362,16 @@ ARDOUR_UI::start_video_server (Gtk::Window* float_window, bool popup_msg) argp[8] = 0; stop_video_server(); - std::ostringstream osstream; - osstream << "http://localhost:" << video_server_dialog->get_listenport() << "/"; - Config->set_video_server_url(osstream.str()); - Config->set_video_server_docroot(icsd_docroot); + if (icsd_docroot == X_("/")) { + Config->set_video_advanced_setup(false); + } else { + std::ostringstream osstream; + osstream << "http://localhost:" << video_server_dialog->get_listenport() << "/"; + Config->set_video_server_url(osstream.str()); + Config->set_video_server_docroot(icsd_docroot); + Config->set_video_advanced_setup(true); + } + video_server_process = new SystemExec(icsd_exec, argp); video_server_process->start(); sleep(1); diff --git a/gtk2_ardour/transcode_video_dialog.cc b/gtk2_ardour/transcode_video_dialog.cc index 00e7d2ec5c..bb9f185750 100644 --- a/gtk2_ardour/transcode_video_dialog.cc +++ b/gtk2_ardour/transcode_video_dialog.cc @@ -105,7 +105,7 @@ TranscodeVideoDialog::TranscodeVideoDialog (Session* s, std::string infile) height_spinner.set_sensitive(false); bitrate_spinner.set_sensitive(false); - std::string dstdir = video_dest_dir(_session->session_directory().video_path(), Config->get_video_server_docroot()); + std::string dstdir = video_dest_dir(_session->session_directory().video_path(), video_get_docroot(Config)); std::string dstfn = video_dest_file(dstdir, infile); path_entry.set_text (dstfn); @@ -402,7 +402,7 @@ void TranscodeVideoDialog::launch_transcode () { std::string outfn = path_entry.get_text(); - if (!confirm_video_outfn(outfn, Config->get_video_server_docroot())) return; + if (!confirm_video_outfn(outfn, video_get_docroot(Config))) return; progress_label.set_text (_("Transcoding Video..")); dialog_progress_mode(); #if 1 /* tentative debug mode */ diff --git a/gtk2_ardour/video_copy_dialog.cc b/gtk2_ardour/video_copy_dialog.cc index 30d93837a7..27926227a4 100644 --- a/gtk2_ardour/video_copy_dialog.cc +++ b/gtk2_ardour/video_copy_dialog.cc @@ -72,7 +72,7 @@ VideoCopyDialog::VideoCopyDialog (Session* s, std::string infile) set_resizable (false); p_connection = sigc::connection(); - std::string dstdir = video_dest_dir(_session->session_directory().video_path(), Config->get_video_server_docroot()); + std::string dstdir = video_dest_dir(_session->session_directory().video_path(), video_get_docroot(Config)); std::string dstfn = dstdir + G_DIR_SEPARATOR + Glib::path_get_basename(infile); path_entry.set_text (dstfn); @@ -110,7 +110,7 @@ void VideoCopyDialog::setup_non_interactive_copy (std::string destfn) { if (destfn.empty()) { - std::string dstdir = video_dest_dir(_session->session_directory().video_path(), Config->get_video_server_docroot()); + std::string dstdir = video_dest_dir(_session->session_directory().video_path(), video_get_docroot(Config)); outfn= dstdir + G_DIR_SEPARATOR + Glib::path_get_basename(infn); } else { outfn=destfn; diff --git a/gtk2_ardour/video_server_dialog.cc b/gtk2_ardour/video_server_dialog.cc index 5809b9a7d4..ca70c11a0f 100644 --- a/gtk2_ardour/video_server_dialog.cc +++ b/gtk2_ardour/video_server_dialog.cc @@ -32,6 +32,7 @@ #include "ardour/session.h" #include "video_server_dialog.h" +#include "utils_videotl.h" #include "i18n.h" using namespace Gtk; @@ -131,17 +132,23 @@ VideoServerDialog::VideoServerDialog (Session* s) t->attach (*l, 0, 1, 2, 3, FILL); t->attach (cachesize_spinner, 1, 2, 2, 3); - l = manage (new Label (_("Ardour relies on an external Video Server for the videotimeline. The server configured in Edit -> Prefereces -> Video is not reachable. Do you want ardour to launch 'harvid' on this machine?"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false)); + l = manage (new Label (_("Ardour relies on an external Video Server for the videotimeline.\nThe server configured in Edit -> Prefereces -> Video is not reachable.\nDo you want ardour to launch 'harvid' on this machine?"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false)); + l->set_max_width_chars(80); l->set_line_wrap(); - vbox->pack_start (*l, false, true, 4); + vbox->pack_start (*l, true, true, 4); vbox->pack_start (*path_hbox, false, false); - vbox->pack_start (*docroot_hbox, false, false); + if (Config->get_video_advanced_setup()){ + vbox->pack_start (*docroot_hbox, false, false); + } else { + docroot_entry.set_text(X_("/")); + listenport_spinner.set_sensitive(false); + } vbox->pack_start (*options_box, false, true); get_vbox()->set_spacing (4); get_vbox()->pack_start (*vbox, false, false); get_vbox()->pack_start (showagain_checkbox, false, false); - showagain_checkbox.set_active(false); + showagain_checkbox.set_active(!Config->get_show_video_server_dialog()); path_browse_button.signal_clicked().connect (sigc::mem_fun (*this, &VideoServerDialog::open_path_dialog)); docroot_browse_button.signal_clicked().connect (sigc::mem_fun (*this, &VideoServerDialog::open_docroot_dialog)); @@ -195,10 +202,19 @@ VideoServerDialog::open_docroot_dialog () if (result == Gtk::RESPONSE_OK) { std::string dirname = dialog.get_filename(); + if (dirname.empty() || dirname.at(dirname.length()-1) != G_DIR_SEPARATOR) { + dirname += "/"; + } + if (dirname.length()) { docroot_entry.set_text (dirname); } } } +std::string +VideoServerDialog::get_docroot () { + return docroot_entry.get_text(); +} + #endif /* WITH_VIDEOTIMELINE */ diff --git a/gtk2_ardour/video_server_dialog.h b/gtk2_ardour/video_server_dialog.h index e6216cfed7..fae0f06390 100644 --- a/gtk2_ardour/video_server_dialog.h +++ b/gtk2_ardour/video_server_dialog.h @@ -40,7 +40,7 @@ class VideoServerDialog : public ArdourDialog ~VideoServerDialog (); std::string get_exec_path () { return path_entry.get_text(); } - std::string get_docroot () { return docroot_entry.get_text(); } + std::string get_docroot (); std::string get_listenaddr () { return listenaddr_combo.get_active_text();} int get_listenport () { return listenport_spinner.get_value_as_int();} int get_cachesize () { return cachesize_spinner.get_value_as_int();} diff --git a/gtk2_ardour/video_timeline.cc b/gtk2_ardour/video_timeline.cc index f751866ba7..e214341d20 100644 --- a/gtk2_ardour/video_timeline.cc +++ b/gtk2_ardour/video_timeline.cc @@ -61,8 +61,8 @@ VideoTimeLine::VideoTimeLine (PublicEditor *ed, ArdourCanvas::Group *vbg, int in video_aspect_ratio = 4.0/3.0; open_video_monitor_dialog = 0; Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind (&VideoTimeLine::parameter_changed, this, _1), gui_context()); - video_server_url = Config->get_video_server_url(); - server_docroot = Config->get_video_server_docroot(); + video_server_url = video_get_server_url(Config); + server_docroot = video_get_docroot(Config); video_filename = ""; local_file = true; video_file_fps = 25.0; @@ -616,9 +616,12 @@ void VideoTimeLine::parameter_changed (std::string const & p) { if (p == "video-server-url") { - set_video_server_url (Config->get_video_server_url ()); + set_video_server_url (video_get_server_url(Config)); } else if (p == "video-server-docroot") { - set_video_server_docroot (Config->get_video_server_docroot ()); + set_video_server_docroot (video_get_docroot(Config)); + } else if (p == "video-advanced-setup") { + set_video_server_url (video_get_server_url(Config)); + set_video_server_docroot (video_get_docroot(Config)); } if (p == "use-video-file-fps" || p == "videotimeline-pullup" ) { /* session->config parameter */ VtlUpdate();