13
0

Merge branch 'master' of git.ardour.org:ardour/ardour

This commit is contained in:
Paul Davis 2013-03-28 09:56:31 -04:00
commit b47e71f8ac
11 changed files with 155 additions and 79 deletions

View File

@ -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<Gtk::TreeModelSort> 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<VtlImportOption>(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;

View File

@ -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);

View File

@ -818,35 +818,43 @@ public:
, _show_xjadeo_setup_button (_("Show Video Monitor Option Dialog"))
, _show_video_export_info_button (_("Show Video Export Info before export"))
, _show_video_server_dialog_button (_("Show Video Server Startup Dialog"))
, _video_advanced_setup_button (_("Advanced Setup (remote video server)"))
{
Table* t = manage (new Table (2, 6));
Table* t = manage (new Table (2, 7));
t->set_spacings (4);
t->attach (_video_advanced_setup_button, 0, 2, 0, 1);
_video_advanced_setup_button.signal_toggled().connect (sigc::mem_fun (*this, &VideoTimelineOptions::video_advanced_setup_toggled));
Gtkmm2ext::UI::instance()->set_tip (_video_advanced_setup_button,
_("<b>When enabled</b> you can speficify a custom video-server URL and docroot. - Do not enable this option unless you know what you are doing."));
Label* l = manage (new Label (_("Video Server URL:")));
l->set_alignment (0, 0.5);
t->attach (*l, 0, 1, 0, 1, FILL);
t->attach (_video_server_url_entry, 1, 2, 0, 1, FILL);
t->attach (*l, 0, 1, 1, 2, FILL);
t->attach (_video_server_url_entry, 1, 2, 1, 2, FILL);
Gtkmm2ext::UI::instance()->set_tip (_video_server_url_entry,
_("Base URL of the video-server including http prefix. This is usually 'http://hostname.example.org:1554/' and defaults to 'http://localhost:1554/' when the video-server is runing locally"));
l = manage (new Label (_("Video Server Docroot:")));
l = manage (new Label (_("Video Folder:")));
l->set_alignment (0, 0.5);
t->attach (*l, 0, 1, 1, 2, FILL);
t->attach (_video_server_docroot_entry, 1, 2, 1, 2);
t->attach (*l, 0, 1, 2, 3, FILL);
t->attach (_video_server_docroot_entry, 1, 2, 2, 3);
Gtkmm2ext::UI::instance()->set_tip (_video_server_docroot_entry,
_("Local path to the video-server docroot. If the server runs remotely, it should point to a network mounted folder of the server's docroot or be left empty if it is unvailable. It is used for the local video-monitor and file-browsing when opening/adding a video file."));
_("Local path to the video-server document-root. Only files below this directory will be accessible by the video-server. If the server run on a remote host, it should point to a network mounted folder of the server's docroot or be left empty if it is unvailable. It is used for the local video-monitor and file-browsing when opening/adding a video file."));
t->attach (_show_xjadeo_setup_button, 0, 2, 3, 4);
/* small vspace y=3..4 */
t->attach (_show_xjadeo_setup_button, 0, 2, 4, 5);
_show_xjadeo_setup_button.signal_toggled().connect (sigc::mem_fun (*this, &VideoTimelineOptions::show_xjadeo_setup_toggled));
Gtkmm2ext::UI::instance()->set_tip (_show_xjadeo_setup_button,
_("<b>When enabled</b> an option dialog is presented before opening the video monitor"));
t->attach (_show_video_export_info_button, 0, 2, 4, 5);
t->attach (_show_video_export_info_button, 0, 2, 5, 6);
_show_video_export_info_button.signal_toggled().connect (sigc::mem_fun (*this, &VideoTimelineOptions::show_video_export_info_toggled));
Gtkmm2ext::UI::instance()->set_tip (_show_video_export_info_button,
_("<b>When enabled</b> an information window with details is displayed before the video-export dialog."));
t->attach (_show_video_server_dialog_button, 0, 2, 5, 6);
t->attach (_show_video_server_dialog_button, 0, 2, 6, 7);
_show_video_server_dialog_button.signal_toggled().connect (sigc::mem_fun (*this, &VideoTimelineOptions::show_video_server_dialog_toggled));
Gtkmm2ext::UI::instance()->set_tip (_show_video_server_dialog_button,
_("<b>When enabled</b> the video server is never launched automatically without confirmation"));
@ -887,6 +895,12 @@ public:
_rc_config->set_show_video_server_dialog (x);
}
void video_advanced_setup_toggled ()
{
bool const x = _video_advanced_setup_button.get_active ();
_rc_config->set_video_advanced_setup(x);
}
void parameter_changed (string const & p)
{
if (p == "video-server-url") {
@ -899,6 +913,14 @@ public:
} else if (p == "show-video-export-info") {
bool const x = _rc_config->get_show_video_export_info();
_show_video_export_info_button.set_active (x);
} else if (p == "show-video-server-dialog") {
bool const x = _rc_config->get_show_video_server_dialog();
_show_video_server_dialog_button.set_active (x);
} else if (p == "video-advanced-setup") {
bool const x = _rc_config->get_video_advanced_setup();
_video_advanced_setup_button.set_active(x);
_video_server_docroot_entry.set_sensitive(x);
_video_server_url_entry.set_sensitive(x);
}
}
@ -908,7 +930,8 @@ public:
parameter_changed ("video-server-docroot");
parameter_changed ("video-monitor-setup-dialog");
parameter_changed ("show-video-export-info");
parameter_changed ("how-video-server-dialog");
parameter_changed ("show-video-server-dialog");
parameter_changed ("video-advanced-setup");
}
private:
@ -918,6 +941,7 @@ private:
CheckButton _show_xjadeo_setup_button;
CheckButton _show_video_export_info_button;
CheckButton _show_video_server_dialog_button;
CheckButton _video_advanced_setup_button;
};
#endif

View File

@ -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 */

View File

@ -28,8 +28,8 @@
#include "pbd/error.h"
#include "ardour/ardour.h"
#include "ardour/session_directory.h"
#include "ardour_dialog.h"
#include "video_image_frame.h"
#include "utils_videotl.h"
#include "i18n.h"
@ -93,6 +93,25 @@ video_dest_dir (const std::string sessiondir, const std::string docroot)
return dir;
}
std::string
video_get_docroot (ARDOUR::RCConfiguration* config)
{
if (config->get_video_advanced_setup()) {
return config->get_video_server_docroot();
}
return X_("/");
}
std::string
video_get_server_url (ARDOUR::RCConfiguration* config)
{
if (config->get_video_advanced_setup()) {
return config->get_video_server_url();
}
return X_("http://localhost:1554");
}
std::string
strip_file_extension (const std::string infile)
{

View File

@ -28,6 +28,7 @@
#include <string>
#include <gtkmm.h>
#include "ardour/rc_configuration.h"
#include "ardour/types.h"
#include "ardour/template_utils.h"
#include "ardour_dialog.h"
@ -41,6 +42,8 @@ std::string get_file_extension (const std::string infile);
void ParseCSV(const std::string &csv, std::vector<std::vector<std::string> > &lines);
std::string video_map_path (std::string server_docroot, std::string filepath);
void video_draw_cross (Glib::RefPtr<Gdk::Pixbuf> img);
std::string video_get_server_url (ARDOUR::RCConfiguration* config);
std::string video_get_docroot (ARDOUR::RCConfiguration* config);
bool video_query_info (
std::string video_server_url,

View File

@ -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;

View File

@ -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 */

View File

@ -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();}

View File

@ -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();

View File

@ -217,9 +217,10 @@ CONFIG_VARIABLE (std::string, updates_url, "updates-url", "http://ardour.org/wha
CONFIG_VARIABLE (std::string, donate_url, "donate-url", "http://ardour.org/donate")
#ifdef WITH_VIDEOTIMELINE
CONFIG_VARIABLE (bool, video_advanced_setup, "video-advanced-setup", false)
CONFIG_VARIABLE (std::string, video_server_url, "video-server-url", "http://localhost:1554")
CONFIG_VARIABLE (std::string, video_server_docroot, "video-server-docroot", "/")
CONFIG_VARIABLE (bool, video_monitor_setup_dialog, "video-monitor-setup-dialog", false)
CONFIG_VARIABLE (bool, show_video_export_info, "show-video-export-info", true)
CONFIG_VARIABLE (bool, show_video_server_dialog, "show-video-server-dialog", true)
CONFIG_VARIABLE (bool, show_video_server_dialog, "show-video-server-dialog", false)
#endif