Update GUI, use/remove meta-data methods that have been migrated to the backend

This commit is contained in:
Robin Gareus
2018-11-21 00:05:13 +01:00
parent d6a92dc521
commit 79731a716d
3 changed files with 4 additions and 56 deletions

View File

@@ -1000,30 +1000,11 @@ ExportVideoDialog::encode_pass (int pass)
_transcoder->set_avoffset(av_offset / (double)_session->nominal_sample_rate());
}
TranscodeFfmpeg::FFSettings meta = _transcoder->default_meta_data();
/* NOTE: type (MetaDataMap) == type (FFSettings) == map<string, string> */
ARDOUR::SessionMetadata::MetaDataMap meta = _transcoder->default_meta_data();
if (meta_checkbox.get_active()) {
ARDOUR::SessionMetadata * session_data = ARDOUR::SessionMetadata::Metadata();
if (session_data->year() > 0 ) {
std::ostringstream osstream; osstream << session_data->year();
meta["year"] = osstream.str();
}
if (session_data->track_number() > 0 ) {
std::ostringstream osstream; osstream << session_data->track_number();
meta["track"] = osstream.str();
}
if (session_data->disc_number() > 0 ) {
std::ostringstream osstream; osstream << session_data->disc_number();
meta["disc"] = osstream.str();
}
if (!session_data->title().empty()) {meta["title"] = session_data->title();}
if (!session_data->artist().empty()) {meta["author"] = session_data->artist();}
if (!session_data->album_artist().empty()) {meta["album_artist"] = session_data->album_artist();}
if (!session_data->album().empty()) {meta["album"] = session_data->album();}
if (!session_data->genre().empty()) {meta["genre"] = session_data->genre();}
if (!session_data->composer().empty()) {meta["composer"] = session_data->composer();}
if (!session_data->comment().empty()) {meta["comment"] = session_data->comment();}
if (!session_data->copyright().empty()) {meta["copyright"] = session_data->copyright();}
if (!session_data->subtitle().empty()) {meta["description"] = session_data->subtitle();}
session_data->av_export_tag (meta);
}
#if 1 /* tentative debug mode */

View File

@@ -295,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)
@@ -354,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) {

View File

@@ -150,7 +150,6 @@ class TranscodeFfmpeg : public sigc::trackable
FFAudioStreams m_audio;
char *format_metadata (std::string, std::string);
void ffmpegparse_v (std::string d, size_t s);
void ffmpegparse_a (std::string d, size_t s);
void ffprobeparse (std::string d, size_t s);