summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2013-06-08 09:03:26 +0200
committerRobin Gareus <robin@gareus.org>2013-06-08 09:03:26 +0200
commitce0aa96838ff7c517eae7b4070afdb61932be3aa (patch)
tree3e6ed31b0830f6d4826210c7f2dd1937eca196c7 /gtk2_ardour
parentfea8e860c625fc669bbdc469e44e9ba5026b9bf2 (diff)
NOOP - use PBD's std::string to number functions
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/route_time_axis.cc2
-rw-r--r--gtk2_ardour/sfdb_ui.cc6
-rw-r--r--gtk2_ardour/transcode_ffmpeg.cc34
-rw-r--r--gtk2_ardour/transcode_video_dialog.cc6
-rw-r--r--gtk2_ardour/video_monitor.cc14
-rw-r--r--gtk2_ardour/video_timeline.cc15
-rw-r--r--gtk2_ardour/window_manager.cc9
7 files changed, 46 insertions, 40 deletions
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index fa78d6dbf6..174cceeede 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -999,7 +999,7 @@ RouteTimeAxisView::resolve_new_group_playlist_name(std::string &basename, vector
tmp = tmp.substr(idx + group_string.length());
// and find the largest current number
- int x = atoi(tmp.c_str());
+ int x = atoi(tmp);
if (x > maxnumber) {
maxnumber = x;
}
diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc
index 8916a53971..85b4f7d7ef 100644
--- a/gtk2_ardour/sfdb_ui.cc
+++ b/gtk2_ardour/sfdb_ui.cc
@@ -949,7 +949,7 @@ SoundFileBrowser::freesound_search()
XMLNode *res = root->child("num_pages");
if (res) {
string result = res->child("text")->content();
- freesound_n_pages = atoi(result.c_str());
+ freesound_n_pages = atoi(result);
}
int more_pages = freesound_n_pages - freesound_page;
@@ -1010,7 +1010,7 @@ SoundFileBrowser::freesound_search()
std::string r;
// cerr << "id=" << id << ",uri=" << uri << ",ofn=" << ofn << ",dur=" << dur << endl;
- double duration_seconds = atof(dur.c_str());
+ double duration_seconds = atof(dur);
double h, m, s;
char duration_hhmmss[16];
if (duration_seconds >= 99 * 60 * 60) {
@@ -1023,7 +1023,7 @@ SoundFileBrowser::freesound_search()
);
}
- double size_bytes = atof(siz.c_str());
+ double size_bytes = atof(siz);
char bsize[32];
if (size_bytes < 1000) {
sprintf(bsize, "%.0f %s", size_bytes, _("B"));
diff --git a/gtk2_ardour/transcode_ffmpeg.cc b/gtk2_ardour/transcode_ffmpeg.cc
index 9cbc40564c..56c55ff4ee 100644
--- a/gtk2_ardour/transcode_ffmpeg.cc
+++ b/gtk2_ardour/transcode_ffmpeg.cc
@@ -23,7 +23,7 @@
#include <sys/types.h>
#include "pbd/error.h"
-#include "pbd/file_utils.h"
+#include "pbd/convert.h"
#include "pbd/file_utils.h"
#include "gui_thread.h"
@@ -32,6 +32,8 @@
#include "i18n.h"
+using namespace PBD;
+
TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
: infile(f)
{
@@ -48,7 +50,7 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
#endif
std::string ff_file_path;
- if (find_file_in_search_path (PBD::SearchPath(Glib::getenv("PATH")), X_("ffmpeg_harvid"), ff_file_path)) { ffmpeg_exe = ff_file_path; }
+ if (find_file_in_search_path (SearchPath(Glib::getenv("PATH")), X_("ffmpeg_harvid"), ff_file_path)) { ffmpeg_exe = ff_file_path; }
else if (Glib::file_test(X_("C:\\Program Files\\harvid\\ffmpeg.exe"), Glib::FILE_TEST_EXISTS)) {
ffmpeg_exe = X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe");
}
@@ -56,7 +58,7 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
ffmpeg_exe = X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe");
}
- if (find_file_in_search_path (PBD::SearchPath(Glib::getenv("PATH")), X_("ffprobe_harvid"), ff_file_path)) { ffprobe_exe = ff_file_path; }
+ if (find_file_in_search_path (SearchPath(Glib::getenv("PATH")), X_("ffprobe_harvid"), ff_file_path)) { ffprobe_exe = ff_file_path; }
else if (Glib::file_test(X_("C:\\Program Files\\harvid\\ffprobe.exe"), Glib::FILE_TEST_EXISTS)) {
ffprobe_exe = X_("C:\\Program Files\\ffmpeg\\ffprobe.exe");
}
@@ -65,7 +67,7 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
}
if (ffmpeg_exe.empty() || ffprobe_exe.empty()) {
- PBD::warning << _(
+ warning << _(
"No ffprobe or ffmpeg executables could be found on this system.\n"
"Video import and export is not possible until you install those tools.\n"
"Ardour requires ffmpeg and ffprobe from ffmpeg.org - version 1.1 or newer.\n"
@@ -128,10 +130,10 @@ TranscodeFfmpeg::probe ()
#define PARSE_FRACTIONAL_FPS(VAR) \
{ \
std::string::size_type pos; \
- VAR = atof(value.c_str()); \
+ VAR = atof(value); \
pos = value.find_first_of('/'); \
if (pos != std::string::npos) { \
- VAR = atof(value.substr(0, pos).c_str()) / atof(value.substr(pos+1).c_str()); \
+ VAR = atof(value.substr(0, pos)) / atof(value.substr(pos+1)); \
} \
}
@@ -149,11 +151,11 @@ TranscodeFfmpeg::probe ()
std::string value = kv->substr(kvsep + 1);
if (key == X_("index")) {
- m_videoidx = atoi(value.c_str());
+ m_videoidx = atoi(value);
} else if (key == X_("width")) {
- m_width = atoi(value.c_str());
+ m_width = atoi(value);
} else if (key == X_("height")) {
- m_height = atoi(value.c_str());
+ m_height = atoi(value);
} else if (key == X_("codec_name")) {
if (!m_codec.empty()) m_codec += " ";
m_codec += value;
@@ -180,14 +182,14 @@ TranscodeFfmpeg::probe ()
));
}
} else if (key == X_("duration_ts") && m_fps == 0 && timebase !=0 ) {
- m_duration = atof(value.c_str()) * m_fps * timebase;
+ m_duration = atof(value) * m_fps * timebase;
} else if (key == X_("duration") && m_fps != 0 && m_duration == 0) {
- m_duration = atof(value.c_str()) * m_fps;
+ m_duration = atof(value) * m_fps;
} else if (key == X_("display_aspect_ratio")) {
std::string::size_type pos;
pos = value.find_first_of(':');
- if (pos != std::string::npos && atof(value.substr(pos+1).c_str()) != 0) {
- m_aspect = atof(value.substr(0, pos).c_str()) / atof(value.substr(pos+1).c_str());
+ if (pos != std::string::npos && atof(value.substr(pos+1)) != 0) {
+ m_aspect = atof(value.substr(0, pos)) / atof(value.substr(pos+1));
}
}
}
@@ -205,7 +207,7 @@ TranscodeFfmpeg::probe ()
std::string value = kv->substr(kvsep + 1);
if (key == X_("channels")) {
- as.channels = atoi(value.c_str());
+ as.channels = atoi(value);
} else if (key == X_("index")) {
as.stream_id = value;
} else if (key == X_("codec_long_name")) {
@@ -542,7 +544,7 @@ void
TranscodeFfmpeg::ffmpegparse_v (std::string d, size_t /* s */)
{
if (strstr(d.c_str(), "ERROR") || strstr(d.c_str(), "Error") || strstr(d.c_str(), "error")) {
- PBD::warning << "ffmpeg-error: " << d << endmsg;
+ warning << "ffmpeg-error: " << d << endmsg;
}
if (strncmp(d.c_str(), "frame=",6)) {
#if 1 /* DEBUG */
@@ -554,7 +556,7 @@ TranscodeFfmpeg::ffmpegparse_v (std::string d, size_t /* s */)
Progress(0, 0); /* EMIT SIGNAL */
return;
}
- ARDOUR::framecnt_t f = atol(d.substr(6).c_str());
+ ARDOUR::framecnt_t f = atol(d.substr(6));
if (f == 0) {
Progress(0, 0); /* EMIT SIGNAL */
} else {
diff --git a/gtk2_ardour/transcode_video_dialog.cc b/gtk2_ardour/transcode_video_dialog.cc
index f3373c0376..fa5d447a3a 100644
--- a/gtk2_ardour/transcode_video_dialog.cc
+++ b/gtk2_ardour/transcode_video_dialog.cc
@@ -388,7 +388,7 @@ TranscodeVideoDialog::launch_transcode ()
if (scale_combo.get_active_row_number() == 0 ) {
scale_width =0;
} else {
- scale_width = atoi(scale_combo.get_active_text().c_str());
+ scale_width = atoi(scale_combo.get_active_text());
}
if (!aspect_checkbox.get_active()) {
scale_height = 0;
@@ -443,7 +443,7 @@ TranscodeVideoDialog::scale_combo_changed ()
if (scale_combo.get_active_row_number() == 0 ) {
h = transcoder->get_height();
} else {
- h = floor(atof(scale_combo.get_active_text().c_str()) / m_aspect);
+ h = floor(atof(scale_combo.get_active_text()) / m_aspect);
}
height_spinner.set_value(h);
}
@@ -477,7 +477,7 @@ TranscodeVideoDialog::update_bitrate ()
if (scale_combo.get_active_row_number() == 0 ) {
br *= transcoder->get_width();
} else {
- br *= atof(scale_combo.get_active_text().c_str());
+ br *= atof(scale_combo.get_active_text());
}
if (br != 0) {
bitrate_spinner.set_value(floor(br/10000.0)*10);
diff --git a/gtk2_ardour/video_monitor.cc b/gtk2_ardour/video_monitor.cc
index db90da7747..75ae6b4946 100644
--- a/gtk2_ardour/video_monitor.cc
+++ b/gtk2_ardour/video_monitor.cc
@@ -18,6 +18,7 @@
*/
#include "pbd/file_utils.h"
+#include "pbd/convert.h"
#include "gui_thread.h"
#include "ardour_ui.h"
@@ -28,6 +29,7 @@
#include "i18n.h"
using namespace std;
+using namespace PBD;
VideoMonitor::VideoMonitor (PublicEditor *ed, std::string xjadeo_bin_path)
: editor (ed)
@@ -248,7 +250,7 @@ VideoMonitor::parse_output (std::string d, size_t /*s*/)
printf("xjadeo: '%s'\n", line.c_str());
}
#endif
- int status = atoi(line.substr(1,3).c_str());
+ int status = atoi(line.substr(1,3));
switch(status / 100) {
case 4: /* errors */
if (status == 403) {
@@ -295,7 +297,7 @@ VideoMonitor::parse_output (std::string d, size_t /*s*/)
knownstate |= 2;
if (starting || xjadeo_settings["window ontop"] != value) {
if (!starting && _session) _session->set_dirty ();
- if (atoi(value.c_str())) { UiState("xjadeo-window-ontop-on"); }
+ if (atoi(value)) { UiState("xjadeo-window-ontop-on"); }
else { UiState("xjadeo-window-ontop-off"); }
starting &= ~2;
}
@@ -304,7 +306,7 @@ VideoMonitor::parse_output (std::string d, size_t /*s*/)
knownstate |= 4;
if (starting || xjadeo_settings["window zoom"] != value) {
if (!starting && _session) _session->set_dirty ();
- if (atoi(value.c_str())) { UiState("xjadeo-window-fullscreen-on"); }
+ if (atoi(value)) { UiState("xjadeo-window-fullscreen-on"); }
else { UiState("xjadeo-window-fullscreen-off"); }
starting &= ~4;
}
@@ -313,15 +315,15 @@ VideoMonitor::parse_output (std::string d, size_t /*s*/)
knownstate |= 8;
if (starting || xjadeo_settings["window letterbox"] != value) {
if (!starting && _session) _session->set_dirty ();
- if (atoi(value.c_str())) { UiState("xjadeo-window-letterbox-on"); }
+ if (atoi(value)) { UiState("xjadeo-window-letterbox-on"); }
else { UiState("xjadeo-window-letterbox-off"); }
starting &= ~8;
}
xjadeo_settings["window letterbox"] = value;
} else if(key == "osdmode") {
knownstate |= 1;
- osdmode = atoi(value.c_str());
- if (starting || atoi(xjadeo_settings["osd mode"].c_str()) != osdmode) {
+ osdmode = atoi(value);
+ if (starting || atoi(xjadeo_settings["osd mode"]) != 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"); }
diff --git a/gtk2_ardour/video_timeline.cc b/gtk2_ardour/video_timeline.cc
index d8e129a2de..3b3d401c5e 100644
--- a/gtk2_ardour/video_timeline.cc
+++ b/gtk2_ardour/video_timeline.cc
@@ -22,6 +22,7 @@
#include "ardour/tempo.h"
#include "pbd/file_utils.h"
+#include "pbd/convert.h"
#include "ardour/session_directory.h"
#include "ardour_ui.h"
@@ -156,29 +157,29 @@ VideoTimeLine::set_session (ARDOUR::Session *s)
const XMLProperty* proph = node->property (X_("Height"));
if (proph) {
- editor->set_video_timeline_height(atoi(proph->value().c_str()));
+ editor->set_video_timeline_height(atoi(proph->value()));
}
#if 0 /* TODO THINK: set FPS first time only ?! */
const XMLProperty* propasfps = node->property (X_("AutoFPS"));
if (propasfps) {
- auto_set_session_fps = atoi(propasfps->value().c_str())?true:false;
+ auto_set_session_fps = atoi(propasfps->value())?true:false;
}
#endif
const XMLProperty* propoffset = node->property (X_("VideoOffset"));
if (propoffset) {
- video_offset = atoll(propoffset->value().c_str());
+ video_offset = atoll(propoffset->value());
video_offset_p = video_offset;
}
const XMLProperty* proplock = node->property (X_("VideoOffsetLock"));
if (proplock) {
- video_offset_lock = atoi(proplock->value().c_str())?true:false;
+ video_offset_lock = atoi(proplock->value())?true:false;
}
const XMLProperty* localfile = node->property (X_("LocalFile"));
if (localfile) {
- local_file = atoi(localfile->value().c_str())?true:false;
+ local_file = atoi(localfile->value())?true:false;
}
const XMLProperty* propf = node->property (X_("Filename"));
@@ -226,7 +227,7 @@ VideoTimeLine::set_state (const XMLNode& node, int /*version*/)
LocaleGuard lg (X_("POSIX"));
const XMLProperty* propoffset = node.property (X_("VideoOffset"));
if (propoffset) {
- video_offset = atoll(propoffset->value().c_str());
+ video_offset = atoll(propoffset->value());
}
ARDOUR_UI::instance()->flush_videotimeline_cache(true);
return 0;
@@ -714,7 +715,7 @@ VideoTimeLine::open_video_monitor() {
if (node) {
const XMLProperty* prop = node->property (X_("mask"));
if (prop) {
- xj_settings_mask = atoi(prop->value().c_str());
+ xj_settings_mask = atoi(prop->value());
}
}
}
diff --git a/gtk2_ardour/window_manager.cc b/gtk2_ardour/window_manager.cc
index 2a195ac90f..b76958d4d4 100644
--- a/gtk2_ardour/window_manager.cc
+++ b/gtk2_ardour/window_manager.cc
@@ -34,6 +34,7 @@
using std::string;
using namespace WM;
+using namespace PBD;
Manager* Manager::_instance = 0;
@@ -218,16 +219,16 @@ ProxyBase::set_state (const XMLNode& node)
}
if ((prop = (*i)->property (X_("x-off"))) != 0) {
- _x_off = atoi (prop->value().c_str());
+ _x_off = atoi (prop->value());
}
if ((prop = (*i)->property (X_("y-off"))) != 0) {
- _y_off = atoi (prop->value().c_str());
+ _y_off = atoi (prop->value());
}
if ((prop = (*i)->property (X_("x-size"))) != 0) {
- _width = atoi (prop->value().c_str());
+ _width = atoi (prop->value());
}
if ((prop = (*i)->property (X_("y-size"))) != 0) {
- _height = atoi (prop->value().c_str());
+ _height = atoi (prop->value());
}
}