This commit is contained in:
Adrien Allard committed 2018-06-06 08:58:36 +02:00
1 parent e689705d91
commit ab9c7eb8f3
7 files changed
+38 -35

No files matched your search

@@ -415,7 +415,7 @@ namespace FileConverter.ConversionJobs
{
Debug.Log("Conversion Succeed!");
ChangeOutputFileTimestampToMatchOriginal();
this.ChangeOutputFileTimestampToMatchOriginal();
// Apply the input post conversion action.
switch (this.InputPostConversionAction)
@@ -451,6 +451,29 @@ namespace FileConverter.ConversionJobs
Debug.Log("Conversion Done!");
}
protected void ConversionFailed(string exitingMessage)
{
Debug.Log("Fail: {0}", exitingMessage);
if (this.State == ConversionState.Failed)
{
// Already failed, don't override informations.
return;
}
this.State = ConversionState.Failed;
this.UserState = Properties.Resources.ConversionStateFailed;
this.ErrorMessage = exitingMessage;
}
protected void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
private void ChangeOutputFileTimestampToMatchOriginal()
{
Debug.Log("Changing output files timestamp to match original timestamp ...");
@@ -480,29 +503,6 @@ namespace FileConverter.ConversionJobs
Debug.Log("... timestamp matching finished.");
}
protected void ConversionFailed(string exitingMessage)
{
Debug.Log("Fail: {0}", exitingMessage);
if (this.State == ConversionState.Failed)
{
// Already failed, don't override informations.
return;
}
this.State = ConversionState.Failed;
this.UserState = Properties.Resources.ConversionStateFailed;
this.ErrorMessage = exitingMessage;
}
protected void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
private bool AllOuputFilesExists()
{
for (int index = 0; index < this.OutputFilePaths.Length; index++)
@@ -100,8 +100,8 @@ namespace FileConverter.ConversionJobs
{
// http://trac.ffmpeg.org/wiki/Encode/H.264#Encodingfordumbplayers
// YUV planar color space with 4:2:0 chroma subsampling
transformArgs += (transformArgs.Length > 0 ? "," : "") + "format=yuv420p";
// maybe there should be an option for this on the settings?
transformArgs += (transformArgs.Length > 0 ? "," : string.Empty) + "format=yuv420p";
//// TODO: maybe there should be an option for this on the settings?
}
return transformArgs;
@@ -74,9 +74,10 @@ namespace FileConverter.ConversionJobs
protected virtual void FillFFMpegArgumentsList()
{
// This option are necessary to be able to read metadata on Windows. src: http://jonhall.info/how_to/create_id3_tags_using_ffmpeg
const string mp3MetadataArgs = "-id3v2_version 3 -write_id3v1 1";
const string MP3MetadataArgs = "-id3v2_version 3 -write_id3v1 1";
// AAC have no standard tag system, use ApeV2 (that are compatible). src: http://eolindel.free.fr/foobar/tags.shtml
const string aacMetadataArgs = "-write_apetag 1";
const string AACMetadataArgs = "-write_apetag 1";
switch (this.ConversionPreset.OutputType)
{
@@ -86,7 +87,7 @@ namespace FileConverter.ConversionJobs
// https://trac.ffmpeg.org/wiki/Encode/AAC
int audioEncodingBitrate = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.AudioBitrate);
string encoderArgs = $"-c:a aac -q:a {this.AACBitrateToQualityIndex(audioEncodingBitrate)} {channelArgs} {aacMetadataArgs}";
string encoderArgs = $"-c:a aac -q:a {this.AACBitrateToQualityIndex(audioEncodingBitrate)} {channelArgs} {AACMetadataArgs}";
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
@@ -111,7 +112,7 @@ namespace FileConverter.ConversionJobs
// Compute final arguments.
string videoFilteringArgs = ConversionJob_FFMPEG.Encapsulate("-vf", transformArgs);
string encoderArgs = $"-c:v mpeg4 -vtag xvid -qscale:v {this.MPEG4QualityToQualityIndex(videoEncodingQuality)} {audioArgs} {videoFilteringArgs} {mp3MetadataArgs}";
string encoderArgs = $"-c:v mpeg4 -vtag xvid -qscale:v {this.MPEG4QualityToQualityIndex(videoEncodingQuality)} {audioArgs} {videoFilteringArgs} {MP3MetadataArgs}";
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
@@ -203,11 +204,11 @@ namespace FileConverter.ConversionJobs
switch (encodingMode)
{
case EncodingMode.Mp3VBR:
encoderArgs = $"-codec:a libmp3lame -q:a {this.MP3VBRBitrateToQualityIndex(encodingQuality)} {channelArgs} {mp3MetadataArgs}";
encoderArgs = $"-codec:a libmp3lame -q:a {this.MP3VBRBitrateToQualityIndex(encodingQuality)} {channelArgs} {MP3MetadataArgs}";
break;
case EncodingMode.Mp3CBR:
encoderArgs = $"-codec:a libmp3lame -b:a {encodingQuality}k {channelArgs} {mp3MetadataArgs}";
encoderArgs = $"-codec:a libmp3lame -b:a {encodingQuality}k {channelArgs} {MP3MetadataArgs}";
break;
default:
@@ -106,7 +106,7 @@ namespace FileConverter
{
get;
set;
} = false;
}
[XmlElement]
public List<string> InputTypes
+1
View File
@@ -177,6 +177,7 @@ namespace FileConverter
/// <summary>
/// Check whether Microsoft office is available or not.
/// </summary>
/// <param name="application">The office application name.</param>
/// <returns>Returns true if Office is installed on the computer.</returns>
/// source: http://stackoverflow.com/questions/3266675/how-to-detect-installed-version-of-ms-office/3267832#3267832
/// source: http://www.codeproject.com/Articles/26520/Getting-Office-s-Version
@@ -2,13 +2,13 @@
namespace FileConverter
{
using System.ComponentModel;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using FileConverter.ConversionJobs;
using FileConverter.Annotations;
using FileConverter.ConversionJobs;
using FileConverter.Windows;
public partial class MainWindow : Window, INotifyPropertyChanged
+1
View File
@@ -20,6 +20,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CBR/@EntryIndexedValue">CBR</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OGGVBR/@EntryIndexedValue">OGGVBR</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VBR/@EntryIndexedValue">VBR</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=LocalConstants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=MethodPropertyEvent/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>