hotfix for flying percussive hits while dragging.
[ardour.git] / gtk2_ardour / utils_videotl.cc
index 684bbf920c49832b7ba55269fd94bee81ac72937..3933022adc1fa0959800f6610c2d12caa52307a4 100644 (file)
@@ -47,6 +47,8 @@ using namespace PBD;
 using namespace ARDOUR;
 using namespace VideoUtils;
 
+unsigned int VideoUtils::harvid_version = 0x0;
+
 bool
 VideoUtils::confirm_video_outfn (Gtk::Window& parent, std::string outfn, std::string docroot)
 {
@@ -111,7 +113,11 @@ VideoUtils::video_get_docroot (ARDOUR::RCConfiguration* config)
 #ifndef PLATFORM_WINDOWS
        return X_("/");
 #else
-       return X_("C:\\");
+       if (harvid_version >= 0x000802) { // 0.8.2
+               return X_("");
+       } else {
+               return X_("C:\\");
+       }
 #endif
 }
 
@@ -260,6 +266,7 @@ VideoUtils::video_query_info (
                double &video_aspect_ratio
                )
 {
+       LocaleGuard lg;
        char url[2048];
 
        snprintf(url, sizeof(url), "%s%sinfo/?file=%s&format=csv"
@@ -282,6 +289,12 @@ VideoUtils::video_query_info (
        video_aspect_ratio = atof (lines.at(0).at(3));
        video_file_fps = atof (lines.at(0).at(4));
        video_duration = atoll(lines.at(0).at(5));
+
+       if (video_aspect_ratio < 0.01 || video_file_fps < 0.01) {
+               /* catch errors early, aspect == 0 or fps == 0 will
+                * wreak havoc down the road */
+               return false;
+       }
        return true;
 }