Skip to content

Commit

Permalink
Added exhale audio transcoding - part #2.
Browse files Browse the repository at this point in the history
Signed-off-by: Lionel DUCHATEAU <[email protected]>
  • Loading branch information
Kurtnoise-zeus committed Jul 10, 2024
1 parent 0fa3387 commit ac366c8
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 5 deletions.
1 change: 1 addition & 0 deletions MeGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@
<Compile Include="packages\audio\exhale\ExhaleConfigurationPanel.Designer.cs">
<DependentUpon>ExhaleConfigurationPanel.cs</DependentUpon>
</Compile>
<Compile Include="packages\audio\exhale\ExhaleSettings.cs" />
<Compile Include="packages\audio\fdkaac\FDKAACSettings.cs" />
<Compile Include="packages\audio\fdkaac\FDKAACConfigurationPanel.cs">
<SubType>UserControl</SubType>
Expand Down
4 changes: 3 additions & 1 deletion core/details/CodecManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ public AudioEncoderType(string id, AudioCodec codec)
public static readonly AudioEncoderType OPUS = new AudioEncoderType("OPUS", AudioCodec.OPUS);
public static readonly AudioEncoderType FDKAAC = new AudioEncoderType("FDK-AAC", AudioCodec.AAC);
public static readonly AudioEncoderType FFAAC = new AudioEncoderType("FFAAC", AudioCodec.AAC);
public static readonly AudioEncoderType EXHALE = new AudioEncoderType("EXHALE", AudioCodec.AAC);

}
#endregion
Expand Down Expand Up @@ -284,7 +285,8 @@ static CodecManager()
AudioEncoderTypes.Register(AudioEncoderType.FLAC) &&
AudioEncoderTypes.Register(AudioEncoderType.QAAC) &&
AudioEncoderTypes.Register(AudioEncoderType.FDKAAC) &&
AudioEncoderTypes.Register(AudioEncoderType.FFAAC) &&
AudioEncoderTypes.Register(AudioEncoderType.FFAAC) &&
AudioEncoderTypes.Register(AudioEncoderType.EXHALE) &&
AudioEncoderTypes.Register(AudioEncoderType.OPUS)))
throw new Exception("Failed to register a standard audio encoder type");

Expand Down
34 changes: 32 additions & 2 deletions core/details/MeGUISettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public enum StandbySettings
private string strMainAudioFormat, strMainFileFormat, meguiupdatecache, neroAacEncPath, version,
defaultLanguage1, defaultLanguage2, afterEncodingCommand, videoExtension, audioExtension,
strEac3toLastFolderPath, strEac3toLastFilePath, strEac3toLastDestinationPath, tempDirMP4,
fdkAacPath, httpproxyaddress, httpproxyport, httpproxyuid, httpproxypwd, defaultOutputDir,
fdkAacPath, httpproxyaddress, httpproxyport, httpproxyuid, httpproxypwd, defaultOutputDir, exhalePath,
appendToForcedStreams, lastUsedOneClickFolder, lastUpdateServer, chapterCreatorSortString, muxInputPath, muxOutputPath;
private bool autoForceFilm, autoOpenScript, bUseQAAC, bUseDGIndexNV, bUseDGIndexIM, bInput8Bit,
overwriteStats, keep2of3passOutput, autoUpdate, deleteIntermediateFiles, workerAutoStart,
Expand Down Expand Up @@ -96,7 +96,7 @@ public enum StandbySettings
private List<WorkerPriority> arrWorkerPriority;
private ProgramSettings avimuxgui, avisynth, avisynthplugins, besplit, dgindexim, dgindex, dgindexnv,
eac3to, fdkaac, ffmpeg, ffms, flac, haali, lame, lsmash, mediainfo,
megui_core, megui_help, megui_libs, megui_updater, mkvmerge, mp4box, neroaacenc,
megui_core, megui_help, megui_libs, megui_updater, mkvmerge, mp4box, neroaacenc, exhale,
oggenc, opus, pgcdemux, qaac, redist, tsmuxer, vsrip, x264, x265, xvid, bestsource;
Dictionary<string, string> oRedistVersions;
#endregion
Expand Down Expand Up @@ -1136,6 +1136,27 @@ public string FDKAacPath
}
}


/// <summary>
/// filename and full path of the exhale executable
/// </summary>
public string ExhalePath
{
get
{
if (!File.Exists(exhalePath))
exhalePath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"tools\exhale\exhale.exe");
return exhalePath;
}
set
{
if (!File.Exists(value))
exhalePath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"tools\exhale\exhale.exe");
else
exhalePath = value;
}
}

public bool UseDGIndexNV
{
get { return bUseDGIndexNV; }
Expand Down Expand Up @@ -1317,6 +1338,12 @@ public ProgramSettings NeroAacEnc
set { neroaacenc = value; }
}

public ProgramSettings Exhale
{
get { return exhale; }
set { exhale = value; }
}

public ProgramSettings OggEnc
{
get { return oggenc; }
Expand Down Expand Up @@ -1606,6 +1633,8 @@ public void InitializeProgramSettings()
mp4box = new ProgramSettings("mp4box");
if (neroaacenc == null)
neroaacenc = new ProgramSettings("neroaacenc");
if (exhale == null)
exhale = new ProgramSettings("exhale");
if (oggenc == null)
oggenc = new ProgramSettings("oggenc2");
if (opus == null)
Expand Down Expand Up @@ -1685,6 +1714,7 @@ public void InitializeProgramSettings()
eac3to.UpdateInformation("eac3to", "eac3to", Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"tools\eac3to\eac3to.exe"));
eac3to.DoNotDeleteFilesOnUpdate.Add(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"tools\eac3to\neroaacenc.exe"));
fdkaac.UpdateInformation("fdkaac", "FDK-AAC", FDKAacPath);
exhale.UpdateInformation("exhale", "Exhale", ExhalePath);
if (!MainForm.Instance.Settings.UseFDKAac)
UpdateCacher.CheckPackage("fdkaac", false, false);
ffmpeg.UpdateInformation("ffmpeg", "FFmpeg", Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"tools\ffmpeg\ffmpeg.exe"));
Expand Down
1 change: 1 addition & 0 deletions core/details/ProfileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public ProfileManager(string profileFolder)
SafeRegister<OpusSettings, MeGUI.packages.audio.opus.OpusConfigurationPanel>("Audio");
SafeRegister<FDKAACSettings, MeGUI.packages.audio.fdkaac.FDKAACConfigurationPanel>("Audio");
SafeRegister<FFAACSettings, MeGUI.packages.audio.ffaac.FFAACConfigurationPanel>("Audio");
SafeRegister<ExhaleSettings, MeGUI.packages.audio.exhale.ExhaleConfigurationPanel>("Audio");

SafeRegister<OneClickSettings, OneClickConfigPanel>();
SafeRegister<AviSynthSettings, AviSynthProfileConfigPanel>();
Expand Down
13 changes: 13 additions & 0 deletions core/details/mux/MuxProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,7 @@ public AudioEncoderProvider()
RegisterEncoder(new OpusEncodingProvider());
RegisterEncoder(new FdkaacEncodingProvider());
RegisterEncoder(new FfaacEncodingProvider());
RegisterEncoder(new ExhaleEncodingProvider());
}
}
#endregion
Expand Down Expand Up @@ -1425,5 +1426,17 @@ public FfaacEncodingProvider()
supportedEncoderTypes.Add(AudioEncoderType.FFAAC);
}
}

public class ExhaleEncodingProvider : AudioEncodingProvider
{
public ExhaleEncodingProvider()
: base()
{
supportedCodecs.Add(AudioCodec.AAC);
supportedTypes.Add(AudioType.M4A);
supportedTypes.Add(AudioType.MP4AAC);
supportedEncoderTypes.Add(AudioEncoderType.EXHALE);
}
}
#endregion
}
3 changes: 2 additions & 1 deletion packages/audio/AudioCodecSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ public enum TimeModificationMode
XmlInclude(typeof(QaacSettings)),
XmlInclude(typeof(OpusSettings)),
XmlInclude(typeof(FDKAACSettings)),
XmlInclude(typeof(FFAACSettings))
XmlInclude(typeof(FFAACSettings)),
XmlInclude(typeof(ExhaleSettings))
]
public abstract class AudioCodecSettings : MeGUI.core.plugins.interfaces.GenericSettings
{
Expand Down
32 changes: 31 additions & 1 deletion packages/audio/AudioEncoderInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ private static IJobProcessor init(MainForm mf, Job j)
((j as AudioJob).Settings is QaacSettings) ||
((j as AudioJob).Settings is OpusSettings) ||
((j as AudioJob).Settings is FDKAACSettings) ||
((j as AudioJob).Settings is FFAACSettings)))
((j as AudioJob).Settings is FFAACSettings) ||
((j as AudioJob).Settings is ExhaleSettings)))
return new AviSynthAudioEncoder(mf.Settings);
return null;
}
Expand Down Expand Up @@ -1845,6 +1846,35 @@ private bool CreateAviSynthScript(out string strError)
sb.Append(" - -o \"{0}\"");

}
else if (audioJob.Settings is ExhaleSettings)
{
UpdateCacher.CheckPackage("exhale");
ExhaleSettings oSettings = audioJob.Settings as ExhaleSettings;
_encoderExecutablePath = this._settings.Exhale.Path;
_sendWavHeaderToEncoderStdIn = HeaderType.WAV;

switch (oSettings.Profile)
{
case ExhaleProfile.xHEAAC: sb.Append(" " + oSettings.Quality); break;
case ExhaleProfile.xHEAACeSBR:
switch (oSettings.Quality)
{
case 0: sb.Append(" a"); break;
case 1: sb.Append(" b"); break;
case 2: sb.Append(" c"); break;
case 3: sb.Append(" d"); break;
case 4: sb.Append(" e"); break;
case 5: sb.Append(" f"); break;
case 6: sb.Append(" g"); break;
}
break;
}

if (!String.IsNullOrEmpty(oSettings.CustomEncoderOptions))
sb.Append(" " + oSettings.CustomEncoderOptions.Trim());
sb.Append(" \"{0}\"");
}

else if (audioJob.Settings is OpusSettings)
{
UpdateCacher.CheckPackage("opus");
Expand Down

0 comments on commit ac366c8

Please sign in to comment.