Skip to content

Commit 8655605

Browse files
author
RandomEngy
committed
Filter by output extension when browsing for encode destination.
1 parent 5252d6d commit 8655605

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

VidCoder/ViewModel/MainViewModel.cs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,7 +1985,16 @@ public ICommand PickOutputPathCommand
19851985
{
19861986
this.pickOutputPathCommand = new RelayCommand(param =>
19871987
{
1988-
string newOutputPath = FileService.Instance.GetFileNameSave(Settings.Default.LastOutputFolder, "Encode output location");
1988+
string extensionDot = this.GetOutputExtensionForCurrentEncodingProfile();
1989+
string extension = this.GetOutputExtensionForCurrentEncodingProfile(includeDot: false);
1990+
string extensionLabel = extension.ToUpperInvariant();
1991+
1992+
string newOutputPath = FileService.Instance.GetFileNameSave(
1993+
Settings.Default.LastOutputFolder,
1994+
"Encode output location",
1995+
null,
1996+
extension,
1997+
string.Format("{0} Files|*{1}", extensionLabel, extensionDot));
19891998
this.SetManualOutputPath(newOutputPath, this.OutputPath);
19901999
},
19912000
param =>
@@ -3493,21 +3502,25 @@ private string GetOutputExtension()
34933502
return this.GetOutputExtensionForCurrentEncodingProfile();
34943503
}
34953504

3496-
private string GetOutputExtensionForCurrentEncodingProfile()
3505+
private string GetOutputExtensionForCurrentEncodingProfile(bool includeDot = true)
34973506
{
34983507
EncodingProfile profile = this.SelectedPreset.Preset.EncodingProfile;
3508+
string extension;
3509+
34993510
if (profile.OutputFormat == OutputFormat.Mkv)
35003511
{
3501-
return ".mkv";
3512+
extension = "mkv";
35023513
}
35033514
else if (profile.PreferredExtension == OutputExtension.Mp4)
35043515
{
3505-
return ".mp4";
3516+
extension = "mp4";
35063517
}
35073518
else
35083519
{
3509-
return ".m4v";
3520+
extension = "m4v";
35103521
}
3522+
3523+
return includeDot ? "." + extension : extension;
35113524
}
35123525

35133526
private void UpdateDrives()

0 commit comments

Comments
 (0)