X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Ftranscode_ffmpeg.cc;h=a26c7622f5ea985bb65a3cc0e6bc434552e36166;hb=65bda27d4218d9d4ebf809d91e716c892e1f1d8b;hp=6b66123aaed96096075b4b143756957e3106a9fa;hpb=cf52d6e4b40111eb04b244ec054055a4ec15dbe0;p=ardour.git diff --git a/gtk2_ardour/transcode_ffmpeg.cc b/gtk2_ardour/transcode_ffmpeg.cc index 6b66123aae..a26c7622f5 100644 --- a/gtk2_ardour/transcode_ffmpeg.cc +++ b/gtk2_ardour/transcode_ffmpeg.cc @@ -27,9 +27,10 @@ #include "pbd/file_utils.h" #include "gui_thread.h" +#include "ardour/filesystem_paths.h" + #include "transcode_ffmpeg.h" #include "utils_videotl.h" -#include "video_tool_paths.h" #include "pbd/i18n.h" @@ -50,7 +51,7 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f) debug_enable = false; #endif - if (!ArdourVideoToolPaths::transcoder_exe(ffmpeg_exe, ffprobe_exe)) { + if (!ARDOUR::ArdourVideoToolPaths::transcoder_exe(ffmpeg_exe, ffprobe_exe)) { warning << string_compose( _( "ffmpeg installation was not found on this system.\n" @@ -186,7 +187,7 @@ TranscodeFfmpeg::probe () } else if (key == X_("timecode") && m_duration == 0 && m_fps > 0) { int h,m,s; char f[32]; if (sscanf(i->at(16).c_str(), "%d:%d:%d:%32s",&h,&m,&s,f) == 4) { - m_duration = (ARDOUR::framecnt_t) floor(m_fps * ( + m_duration = (ARDOUR::samplecnt_t) floor(m_fps * ( h * 3600.0 + m * 60.0 + s * 1.0 @@ -294,38 +295,6 @@ TranscodeFfmpeg::default_meta_data () return ffm; } -char * -TranscodeFfmpeg::format_metadata (std::string key, std::string value) -{ - size_t start_pos = 0; - std::string v1 = value; - while((start_pos = v1.find_first_not_of( - "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789(),.\"'", - start_pos)) != std::string::npos) - { - v1.replace(start_pos, 1, "_"); - start_pos += 1; - } - - start_pos = 0; - while((start_pos = v1.find("\"", start_pos)) != std::string::npos) { - v1.replace(start_pos, 1, "\\\""); - start_pos += 2; - } - - size_t len = key.length() + v1.length() + 4; - char *mds = (char*) calloc(len, sizeof(char)); -#ifdef PLATFORM_WINDOWS - /* SystemExec::make_wargs() adds quotes around the complete argument - * windows uses CreateProcess() with a parameter string - * (and not an array list of separate arguments) - */ - snprintf(mds, len, "%s=%s", key.c_str(), v1.c_str()); -#else - snprintf(mds, len, "%s=\"%s\"", key.c_str(), v1.c_str()); -#endif - return mds; -} bool TranscodeFfmpeg::encode (std::string outfile, std::string inf_a, std::string inf_v, TranscodeFfmpeg::FFSettings ffs, TranscodeFfmpeg::FFSettings meta, bool map) @@ -353,7 +322,7 @@ TranscodeFfmpeg::encode (std::string outfile, std::string inf_a, std::string inf } for(TranscodeFfmpeg::FFSettings::const_iterator it = meta.begin(); it != meta.end(); ++it) { argp[a++] = strdup("-metadata"); - argp[a++] = format_metadata(it->first.c_str(), it->second.c_str()); + argp[a++] = SystemExec::format_key_value_parameter (it->first.c_str(), it->second.c_str()); } if (m_fps > 0) { @@ -425,7 +394,7 @@ TranscodeFfmpeg::encode (std::string outfile, std::string inf_a, std::string inf } bool -TranscodeFfmpeg::extract_audio (std::string outfile, ARDOUR::framecnt_t /*samplerate*/, unsigned int stream) +TranscodeFfmpeg::extract_audio (std::string outfile, ARDOUR::samplecnt_t /*samplerate*/, unsigned int stream) { if (!probeok) return false; if (stream >= m_audio.size()) return false; @@ -566,12 +535,12 @@ TranscodeFfmpeg::ffmpegparse_a (std::string d, size_t /* s */) { const char *t; int h,m,s; char f[7]; - ARDOUR::framecnt_t p = -1; + ARDOUR::samplecnt_t p = -1; if (!(t=strstr(d.c_str(), "time="))) { return; } if (sscanf(t+5, "%d:%d:%d.%s",&h,&m,&s,f) == 4) { - p = (ARDOUR::framecnt_t) floor( 100.0 * ( + p = (ARDOUR::samplecnt_t) floor( 100.0 * ( h * 3600.0 + m * 60.0 + s * 1.0 @@ -598,10 +567,9 @@ TranscodeFfmpeg::ffmpegparse_v (std::string d, size_t /* s */) printf("ffmpeg: '%s'\n", d.c_str()); } #endif - Progress(0, 0); /* EMIT SIGNAL */ return; } - ARDOUR::framecnt_t f = atol(d.substr(6)); + ARDOUR::samplecnt_t f = atol(d.substr(6)); if (f == 0) { Progress(0, 0); /* EMIT SIGNAL */ } else {