Prevent FFmpeg errors if export filenames are specified with no or incorrect extensions.
authorCarl Hetherington <cth@carlh.net>
Thu, 28 Jun 2018 23:05:19 +0000 (00:05 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 28 Jun 2018 23:05:19 +0000 (00:05 +0100)
src/wx/export_dialog.cc

index 95814c5186d4a5c0b6e059f7de1c88ec1819d43c..87a8248822b3fbd5bb86353008f3b5a7a7fe9254 100644 (file)
@@ -38,6 +38,11 @@ wxString format_filters[] = {
        _("MP4 files (*.mp4)|*.mp4"),
 };
 
+wxString format_extensions[] = {
+       "mov",
+       "mp4"
+};
+
 FFmpegEncoder::Format formats[] = {
        FFmpegEncoder::FORMAT_PRORES,
        FFmpegEncoder::FORMAT_H264,
@@ -81,7 +86,9 @@ ExportDialog::format_changed ()
 boost::filesystem::path
 ExportDialog::path () const
 {
-       return wx_to_std (_file->GetPath ());
+       wxFileName fn (_file->GetPath());
+       fn.SetExt (format_extensions[_format->GetSelection()]);
+       return wx_to_std (fn.GetFullPath());
 }
 
 FFmpegEncoder::Format