summaryrefslogtreecommitdiffstats
path: root/win/C#/Functions
diff options
context:
space:
mode:
authorsr55 <[email protected]>2008-04-12 14:54:33 +0000
committersr55 <[email protected]>2008-04-12 14:54:33 +0000
commitbfc5f40ecc86e307db383d8c00428b8fd9234484 (patch)
treeb17d839a896be1ab3f7eb41c1b398fff76d0ddce /win/C#/Functions
parent58b120562cb887b0df4e3d25c1f04d2177a4e2fb (diff)
WinGui:
- Expands the audio tab to 4 audio tracks. This will require through testing. Users should avoid track combinations such as 1 & 4, 1 & 3, and 2 & 4. Instead, 1 & 2 & 3 or 1 & 2 or 2 & 3 & 4 should be used. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1406 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Functions')
-rw-r--r--win/C#/Functions/Common.cs499
-rw-r--r--win/C#/Functions/QueryParser.cs481
2 files changed, 664 insertions, 316 deletions
diff --git a/win/C#/Functions/Common.cs b/win/C#/Functions/Common.cs
index 184fadb30..d87e93716 100644
--- a/win/C#/Functions/Common.cs
+++ b/win/C#/Functions/Common.cs
@@ -288,7 +288,7 @@ namespace Handbrake.Functions
// Audio Settings Tab
#region Audio
-
+
if (presetQuery.AudioTrack1 == "")
mainWindow.drp_track1Audio.Text = "Automatic";
else
@@ -296,44 +296,114 @@ namespace Handbrake.Functions
if (presetQuery.AudioTrack2 == "None")
{
- if (presetQuery.AudioEncoder2 != null)
- {
- mainWindow.drp_track2Audio.SelectedIndex = 1;
- mainWindow.drp_audsr_2.Enabled = true;
- mainWindow.drp_audmix_2.Enabled = true;
- mainWindow.drp_audenc_2.Enabled = true;
- mainWindow.drp_audbit_2.Enabled = true;
- }
- else
- {
- mainWindow.drp_track2Audio.SelectedIndex = 0;
- mainWindow.drp_audsr_2.Enabled = false;
- mainWindow.drp_audmix_2.Enabled = false;
- mainWindow.drp_audenc_2.Enabled = false;
- mainWindow.drp_audbit_2.Enabled = false;
- }
-
+ mainWindow.drp_track2Audio.SelectedIndex = 0;
+ mainWindow.drp_audsr_2.Enabled = false;
+ mainWindow.drp_audmix_2.Enabled = false;
+ mainWindow.drp_audenc_2.Enabled = false;
+ mainWindow.drp_audbit_2.Enabled = false;
}
else
+ {
mainWindow.drp_track2Audio.Text = presetQuery.AudioTrack2;
+ mainWindow.drp_audsr_2.Enabled = true;
+ mainWindow.drp_audmix_2.Enabled = true;
+ mainWindow.drp_audenc_2.Enabled = true;
+ mainWindow.drp_audbit_2.Enabled = true;
+ }
+
+ if (presetQuery.AudioTrack3 == "None")
+ {
+ mainWindow.drp_track3Audio.SelectedIndex = 0;
+ mainWindow.drp_audsr_3.Enabled = false;
+ mainWindow.drp_audmix_3.Enabled = false;
+ mainWindow.drp_audenc_3.Enabled = false;
+ mainWindow.drp_audbit_3.Enabled = false;
+
+ }
+ else
+ {
+ mainWindow.drp_track3Audio.Text = presetQuery.AudioTrack3;
+ mainWindow.drp_audsr_3.Enabled = true;
+ mainWindow.drp_audmix_3.Enabled = true;
+ mainWindow.drp_audenc_3.Enabled = true;
+ mainWindow.drp_audbit_3.Enabled = true;
+ }
+
+ if (presetQuery.AudioTrack4 == "None")
+ {
+ mainWindow.drp_track4Audio.SelectedIndex = 0;
+ mainWindow.drp_audsr_4.Enabled = false;
+ mainWindow.drp_audmix_4.Enabled = false;
+ mainWindow.drp_audenc_4.Enabled = false;
+ mainWindow.drp_audbit_4.Enabled = false;
+ }
+ else
+ {
+ mainWindow.drp_track4Audio.Text = presetQuery.AudioTrack4;
+ mainWindow.drp_audsr_4.Enabled = true;
+ mainWindow.drp_audmix_4.Enabled = true;
+ mainWindow.drp_audenc_4.Enabled = true;
+ mainWindow.drp_audbit_4.Enabled = true;
+ }
if (presetQuery.AudioEncoder1 != null)
- mainWindow.drp_audenc_1.Text = presetQuery.AudioEncoder1;
+ mainWindow.drp_audenc_1.Text = presetQuery.AudioEncoder1;
mainWindow.drp_audenc_2.Text = presetQuery.AudioEncoder2;
+ mainWindow.drp_audenc_3.Text = presetQuery.AudioEncoder3;
+ mainWindow.drp_audenc_4.Text = presetQuery.AudioEncoder4;
if (presetQuery.AudioBitrate1 != null)
- mainWindow.drp_audbit_1.Text = presetQuery.AudioBitrate1;
+ mainWindow.drp_audbit_1.Text = presetQuery.AudioBitrate1;
mainWindow.drp_audbit_2.Text = presetQuery.AudioBitrate2;
+ mainWindow.drp_audbit_3.Text = presetQuery.AudioBitrate4;
+ mainWindow.drp_audbit_3.Text = presetQuery.AudioBitrate4;
if (presetQuery.AudioSamplerate1 != null)
- mainWindow.drp_audsr_1.Text = presetQuery.AudioSamplerate1;
+ mainWindow.drp_audsr_1.Text = presetQuery.AudioSamplerate1;
mainWindow.drp_audsr_2.Text = presetQuery.AudioSamplerate2;
+ mainWindow.drp_audsr_3.Text = presetQuery.AudioSamplerate3;
+ mainWindow.drp_audsr_4.Text = presetQuery.AudioSamplerate4;
mainWindow.drp_audmix_1.Text = presetQuery.AudioTrackMix1;
mainWindow.drp_audmix_2.Text = presetQuery.AudioTrackMix2;
+ mainWindow.drp_audmix_3.Text = presetQuery.AudioTrackMix3;
+ mainWindow.drp_audmix_4.Text = presetQuery.AudioTrackMix4;
+
-
-
+ // Dynamic Range Compression (Should be a float but we use double for ease)
+ double value = 0;
+ double actualValue = 0;
+
+ value = presetQuery.DRC1;
+ if (value > 0)
+ value = value - 10;
+ mainWindow.trackBar1.Value = int.Parse(value.ToString());
+ actualValue = presetQuery.DRC1 / 10;
+ mainWindow.lbl_drc1.Text = actualValue.ToString();
+
+ value = presetQuery.DRC2;
+ if (value > 0)
+ value = value - 10;
+ mainWindow.trackBar2.Value = int.Parse(value.ToString());
+ actualValue = presetQuery.DRC2 / 10;
+ mainWindow.lbl_drc2.Text = actualValue.ToString();
+
+ value = presetQuery.DRC3;
+ if (value > 0)
+ value = value - 10;
+ mainWindow.trackBar3.Value = int.Parse(value.ToString());
+ actualValue = presetQuery.DRC3 / 10;
+ mainWindow.lbl_drc3.Text = actualValue.ToString();
+
+ value = presetQuery.DRC4;
+ if (value > 0)
+ value = value - 10;
+ mainWindow.trackBar4.Value = int.Parse(value.ToString());
+ actualValue = presetQuery.DRC4 / 10;
+ mainWindow.lbl_drc4.Text = actualValue.ToString();
+
+
+ // Subtitle Stuff
mainWindow.drp_subtitle.Text = presetQuery.Subtitles;
if (presetQuery.ForcedSubtitles == true)
@@ -344,15 +414,6 @@ namespace Handbrake.Functions
else
mainWindow.check_forced.CheckState = CheckState.Unchecked;
- // Dynamic Range Compression (Should be a float but we use double for ease)
- double value = presetQuery.DRC;
- if (value > 0)
- value = value - 10;
- mainWindow.slider_drc.Value = int.Parse(value.ToString());
-
- double actualValue = presetQuery.DRC / 10;
- mainWindow.lbl_drc.Text = actualValue.ToString();
-
#endregion
@@ -627,223 +688,250 @@ namespace Handbrake.Functions
// Audio Settings Tab
#region Audio Settings Tab
- // Used Varibles
+ // Query
+ string tracks = "";
+ string aencoder = "";
string audioBitrate = "";
- string audioChannels = "";
- string SixChannelAudio = "";
+ string audioSampleRate = "";
+ string Mixdown = "";
+ string drc = "";
string subScan = "";
string forced = "";
- string drc = "";
- string audioSampleRate = "";
- string audioEncoder = "";
// Track 1
string track1 = mainWindow.drp_track1Audio.Text;
- string vencoder1 = mainWindow.drp_audenc_1.Text;
+ string aencoder1 = mainWindow.drp_audenc_1.Text;
string audioBitrate1 = mainWindow.drp_audbit_1.Text;
string audioSampleRate1 = mainWindow.drp_audsr_1.Text;
string Mixdown1 = mainWindow.drp_audmix_1.Text;
+ string drc1 = mainWindow.trackBar1.Value.ToString();
// Track 2
string track2 = mainWindow.drp_track2Audio.Text;
- string vencoder2 = mainWindow.drp_audenc_2.Text;
+ string aencoder2 = mainWindow.drp_audenc_2.Text;
string audioBitrate2 = mainWindow.drp_audbit_2.Text;
string audioSampleRate2 = mainWindow.drp_audsr_2.Text;
string Mixdown2 = mainWindow.drp_audmix_2.Text;
-
+ string drc2 = mainWindow.trackBar2.Value.ToString();
+
+ // Track 3
+ string track3 = mainWindow.drp_track3Audio.Text;
+ string aencoder3 = mainWindow.drp_audenc_3.Text;
+ string audioBitrate3 = mainWindow.drp_audbit_3.Text;
+ string audioSampleRate3 = mainWindow.drp_audsr_3.Text;
+ string Mixdown3 = mainWindow.drp_audmix_3.Text;
+ string drc3 = mainWindow.trackBar3.Value.ToString();
+
+ // Track 4
+ string track4 = mainWindow.drp_track4Audio.Text;
+ string aencoder4 = mainWindow.drp_audenc_4.Text;
+ string audioBitrate4 = mainWindow.drp_audbit_4.Text;
+ string audioSampleRate4 = mainWindow.drp_audsr_4.Text;
+ string Mixdown4 = mainWindow.drp_audmix_4.Text;
+ string drc4 = mainWindow.trackBar4.Value.ToString();
+
+
+ //
// Audio Track Selections
+ //
if (track1 == "Automatic")
- audioChannels = "";
+ tracks = " -a auto";
else if (track1 == "")
- audioChannels = "";
+ tracks = "";
else if (track1 == "None")
- audioChannels = " -a none";
+ tracks = "";
else
{
- string[] tempSub;
- tempSub = track1.Split(' ');
- audioChannels = " -a " + tempSub[0];
+ string[] tempSub = track1.Split(' ');
+ tracks = " -a " + tempSub[0];
}
- if (audioChannels != "")
+ if (track2 != "None")
{
- if ((track2 != "") && (track2 != "None"))
- {
- string[] tempSub;
- tempSub = track2.Split(' ');
- audioChannels = audioChannels + "," + tempSub[0];
- }
- }
- else
- {
- if ((track2 != "") && (track2 != "None"))
- {
- string[] tempSub;
- tempSub = track2.Split(' ');
- audioChannels = " -a " + tempSub[0];
- }
+ string[] tempSub;
+ tempSub = track2.Split(' ');
+ if (tracks == "")
+ tracks = " -a none," + tempSub[0];
+ else
+ tracks = tracks + "," + tempSub[0];
}
- // Audio Mixdown Selections
- switch (Mixdown1)
+ if (track3 != "None")
{
- case "Automatic":
- Mixdown1 = "";
- break;
- case "Mono":
- Mixdown1 = "mono";
- break;
- case "Stereo":
- Mixdown1 = "stereo";
- break;
- case "Dolby Surround":
- Mixdown1 = "dpl1";
- break;
- case "Dolby Pro Logic II":
- Mixdown1 = "dpl2";
- break;
- case "6 Channel Discrete":
- Mixdown1 = "6ch";
- break;
- default:
- Mixdown1 = "";
- break;
+ string[] tempSub;
+ tempSub = track3.Split(' ');
+ if (tracks == "")
+ tracks = " -a none,none," + tempSub[0];
+ else
+ tracks = tracks + "," + tempSub[0];
}
- if (Mixdown1 != "")
- SixChannelAudio = " -6 " + Mixdown1;
- else
+ if (track4 != "None")
{
- if (mainWindow.drp_track2Audio.Text == "None")
- SixChannelAudio = "";
+ string[] tempSub;
+ tempSub = track4.Split(' ');
+ if (tracks == "")
+ tracks = " -a none,none,none," + tempSub[0];
else
- {
- if (mainWindow.drp_audmix_2.Text == "Automatic")
- SixChannelAudio = "";
- else
- SixChannelAudio = " -6 dpl2";
- }
+ tracks = tracks + "," + tempSub[0];
}
- switch (Mixdown2)
- {
- case "Automatic":
- Mixdown2 = "";
- break;
- case "Mono":
- Mixdown2 = "mono";
- break;
- case "Stereo":
- Mixdown2 = "stereo";
- break;
- case "Dolby Surround":
- Mixdown2 = "dpl1";
- break;
- case "Dolby Pro Logic II":
- Mixdown2 = "dpl2";
- break;
- case "6 Channel Discrete":
- Mixdown2 = "6ch";
- break;
- default:
- Mixdown2 = "";
- break;
- }
+ //
+ // Audio Encoder
+ //
+ if (aencoder1 != "")
+ aencoder = " -E " + getAudioEncoder(aencoder1);
- if (Mixdown2 != "")
+ if (aencoder2 != "")
{
- if (SixChannelAudio != "")
- SixChannelAudio = SixChannelAudio + "," + Mixdown2;
+ if (aencoder == "")
+ aencoder = " -E faac," + getAudioEncoder(aencoder2);
else
- SixChannelAudio = " -6 " + Mixdown2;
+ aencoder = aencoder + "," + getAudioEncoder(aencoder2);
}
- // Audio Encoder Selections
- switch (mainWindow.drp_audenc_1.Text)
+ if (aencoder3 != "")
{
- case "AAC":
- audioEncoder = " -E faac";
- break;
- case "MP3":
- audioEncoder = " -E lame";
- break;
- case "Vorbis":
- audioEncoder = " -E vorbis";
- break;
- case "AC3":
- audioEncoder = " -E ac3";
- break;
- case "AAC + AC3":
- audioEncoder = " -E aac+ac3";
- break;
- default:
- break;
+ if (aencoder == "")
+ aencoder = " -E faac,faac," + getAudioEncoder(aencoder3);
+ else
+ aencoder = aencoder + "," + getAudioEncoder(aencoder3);
}
- switch (mainWindow.drp_audenc_2.Text)
+ if (aencoder4 != "")
{
- case "AAC":
- if (audioEncoder == "")
- audioEncoder = " -E faac";
- else
- audioEncoder = audioEncoder + ",faac";
- break;
- case "MP3":
- if (audioEncoder == "")
- audioEncoder = " -E lame";
- else
- audioEncoder = audioEncoder + ",lame";
- break;
- case "Vorbis":
- if (audioEncoder == "")
- audioEncoder = " -E vorbis";
- else
- audioEncoder = audioEncoder + ",vorbis";
- break;
- case "AC3":
- if (audioEncoder == "")
- audioEncoder = " -E ac3";
- else
- audioEncoder = audioEncoder + ",ac3";
- break;
- case "AAC + AC3":
- if (audioEncoder == "")
- audioEncoder = " -E aac+ac3";
- else
- audioEncoder = audioEncoder + ",aac+ac3";
- break;
- default:
- break;
+ if (aencoder == "")
+ aencoder = " -E faac,faac,faac," + getAudioEncoder(aencoder4);
+ else
+ aencoder = aencoder + "," + getAudioEncoder(aencoder4);
}
- // Audio BitRate Selections
+ //
+ // Audio Bitrate Selections
+ //
if (audioBitrate1 != "")
audioBitrate = " -B " + audioBitrate1;
if (audioBitrate2 != "")
{
if (audioBitrate == "")
- audioBitrate = " -B " + audioBitrate2;
+ audioBitrate = " -B 160," + audioBitrate2;
else
audioBitrate = audioBitrate + "," + audioBitrate2;
}
- // Audio SampleRate Selections
+ if (audioBitrate3 != "")
+ {
+ if (audioBitrate == "")
+ audioBitrate = " -B 160,160," + audioBitrate3;
+ else
+ audioBitrate = audioBitrate + "," + audioBitrate3;
+ }
+
+ if (audioBitrate4 != "")
+ {
+ if (audioBitrate == "")
+ audioBitrate = " -B 160,160,160," + audioBitrate4;
+ else
+ audioBitrate = audioBitrate + "," + audioBitrate4;
+ }
+
+ //Audio Sample Rate - audioSampleRate
+
if (audioSampleRate1 != "")
audioSampleRate = " -R " + audioSampleRate1;
if (audioSampleRate2 != "")
{
if (audioSampleRate == "")
- audioSampleRate = " -R " + audioSampleRate2;
+ audioSampleRate = " -R 48," + audioSampleRate2;
else
audioSampleRate = audioSampleRate + "," + audioSampleRate2;
}
- //Dynamic Range Compression (expects a float but a double is used for ease)
- double value = mainWindow.slider_drc.Value / 10.0;
+ if (audioSampleRate3 != "")
+ {
+ if (audioSampleRate == "")
+ audioSampleRate = " -R 48,48," + audioSampleRate3;
+ else
+ audioSampleRate = audioSampleRate + "," + audioSampleRate3;
+ }
+
+ if (audioSampleRate4 != "")
+ {
+ if (audioSampleRate == "")
+ audioSampleRate = " -R 48,48,48," + audioSampleRate4;
+ else
+ audioSampleRate = audioSampleRate + "," + audioSampleRate4;
+ }
+
+ //
+ // Audio Mixdown Selections
+ //
+
+ if ((Mixdown1 != "") && (Mixdown1 != "Automatic"))
+ Mixdown = " -6 " + getMixDown(Mixdown1);
+
+ if ((Mixdown2 != "") && (Mixdown2 != "Automatic"))
+ {
+ if (Mixdown != "")
+ Mixdown = Mixdown + "," + getMixDown(Mixdown2);
+ }
+
+ if ((Mixdown3 != "") && (Mixdown3 != "Automatic"))
+ {
+ if (Mixdown != "")
+ Mixdown = Mixdown + "," + getMixDown(Mixdown3);
+ }
+
+ if ((Mixdown4 != "") && (Mixdown4 != "Automatic"))
+ {
+ if (Mixdown != "")
+ Mixdown = Mixdown + "," + getMixDown(Mixdown4);
+ }
+
+
+ //
+ // DRC
+ //
+ double value = 0;
+
+ value = mainWindow.trackBar1.Value / 10.0;
+ value++;
+
+ if (value > 1.0)
+ drc = " -D " + value;
+
+ value = mainWindow.trackBar2.Value / 10.0;
value++;
- drc = " -D " + value;
+ if (drc2 != "0")
+ {
+ if (drc == "")
+ drc = " -D 1," + value;
+ else
+ drc = drc + "," + value;
+ }
+
+ value = mainWindow.trackBar3.Value / 10.0;
+ value++;
+ if (drc3 != "0")
+ {
+ if (drc == "")
+ drc = " -D 1,1," + value;
+ else
+ drc = drc + "," + value;
+ }
+
+ value = mainWindow.trackBar4.Value / 10.0;
+ value++;
+ if (drc4 != "0")
+ {
+ if (drc == "")
+ drc = " -D 1,1,1," + value;
+ else
+ drc = drc + "," + value;
+ }
+
// Subtitles
string subtitles = mainWindow.drp_subtitle.Text;
@@ -867,7 +955,8 @@ namespace Handbrake.Functions
forced = " -F ";
- string queryAudioSettings = audioChannels + SixChannelAudio + audioEncoder + audioBitrate + audioSampleRate + drc + subScan + subtitles + forced;
+ string queryAudioSettings = tracks + aencoder + audioBitrate + audioSampleRate + Mixdown + drc + subScan + subtitles + forced;
+
#endregion
// Chapter Markers Tab
@@ -1029,6 +1118,46 @@ namespace Handbrake.Functions
}
}
+
+ private string getMixDown(string selectedAudio)
+ {
+ switch (selectedAudio)
+ {
+ case "Automatic":
+ return "";
+ case "Mono":
+ return "mono";
+ case "Stereo":
+ return "stereo";
+ case "Dolby Surround":
+ return "dpl1";
+ case "Dolby Pro Logic II":
+ return "dpl2";
+ case "6 Channel Discrete":
+ return "6ch";
+ default:
+ return "";
+ }
+ }
+
+ private string getAudioEncoder(string selectedEncoder)
+ {
+ switch (selectedEncoder)
+ {
+ case "AAC":
+ return "faac";
+ case "MP3":
+ return "lame";
+ case "Vorbis":
+ return "vorbis";
+ case "AC3":
+ return "ac3";
+ default:
+ return "";
+ }
+ }
+
+
// End of Functions
}
}
diff --git a/win/C#/Functions/QueryParser.cs b/win/C#/Functions/QueryParser.cs
index 1599bdbcf..df82fc2cc 100644
--- a/win/C#/Functions/QueryParser.cs
+++ b/win/C#/Functions/QueryParser.cs
@@ -428,7 +428,7 @@ namespace Handbrake.Functions
#region Audio Settings
private string q_audioTrack1;
/// <summary>
- /// Returns a string with the First selected Audio track
+ /// Returns a string with the selected Audio track
/// </summary>
public string AudioTrack1
{
@@ -440,7 +440,7 @@ namespace Handbrake.Functions
private string q_audioTrack2;
/// <summary>
- /// Returns a string with the First selected Audio track
+ /// Returns a string with the selected Audio track
/// </summary>
public string AudioTrack2
{
@@ -450,6 +450,30 @@ namespace Handbrake.Functions
}
}
+ private string q_audioTrack3;
+ /// <summary>
+ /// Returns a string with the selected Audio track
+ /// </summary>
+ public string AudioTrack3
+ {
+ get
+ {
+ return this.q_audioTrack3;
+ }
+ }
+
+ private string q_audioTrack4;
+ /// <summary>
+ /// Returns a string with the selected Audio track
+ /// </summary>
+ public string AudioTrack4
+ {
+ get
+ {
+ return this.q_audioTrack4;
+ }
+ }
+
private string q_audioTrackMix1;
/// <summary>
/// Returns a string with the First selected Audio track Mix
@@ -474,6 +498,30 @@ namespace Handbrake.Functions
}
}
+ private string q_audioTrackMix3;
+ /// <summary>
+ /// Returns a string with the First selected Audio track Mix
+ /// </summary>
+ public string AudioTrackMix3
+ {
+ get
+ {
+ return this.q_audioTrackMix3;
+ }
+ }
+
+ private string q_audioTrackMix4;
+ /// <summary>
+ /// Returns a string with the First selected Audio track Mix
+ /// </summary>
+ public string AudioTrackMix4
+ {
+ get
+ {
+ return this.q_audioTrackMix4;
+ }
+ }
+
private string q_audioEncoder1;
/// <summary>
/// Returns an String
@@ -500,6 +548,32 @@ namespace Handbrake.Functions
}
}
+ private string q_audioEncoder3;
+ /// <summary>
+ /// Returns an String
+ /// The Audio Encoder used.
+ /// </summary>
+ public string AudioEncoder3
+ {
+ get
+ {
+ return this.q_audioEncoder3;
+ }
+ }
+
+ private string q_audioEncoder4;
+ /// <summary>
+ /// Returns an String
+ /// The Audio Encoder used.
+ /// </summary>
+ public string AudioEncoder4
+ {
+ get
+ {
+ return this.q_audioEncoder4;
+ }
+ }
+
private string q_audioBitrate1;
/// <summary>
/// Returns a string with the audio bitrate
@@ -524,6 +598,30 @@ namespace Handbrake.Functions
}
}
+ private string q_audioBitrate3;
+ /// <summary>
+ /// Returns a string with the audio bitrate
+ /// </summary>
+ public string AudioBitrate3
+ {
+ get
+ {
+ return this.q_audioBitrate3;
+ }
+ }
+
+ private string q_audioBitrate4;
+ /// <summary>
+ /// Returns a string with the audio bitrate
+ /// </summary>
+ public string AudioBitrate4
+ {
+ get
+ {
+ return this.q_audioBitrate4;
+ }
+ }
+
private string q_audioSamplerate1;
/// <summary>
/// Returns a string with the audio sample rate
@@ -548,15 +646,75 @@ namespace Handbrake.Functions
}
}
- private double q_drc;
+ private string q_audioSamplerate3;
+ /// <summary>
+ /// Returns a string with the audio sample rate
+ /// </summary>
+ public string AudioSamplerate3
+ {
+ get
+ {
+ return this.q_audioSamplerate3;
+ }
+ }
+
+ private string q_audioSamplerate4;
+ /// <summary>
+ /// Returns a string with the audio sample rate
+ /// </summary>
+ public string AudioSamplerate4
+ {
+ get
+ {
+ return this.q_audioSamplerate4;
+ }
+ }
+
+ private double q_drc1;
+ /// <summary>
+ /// Returns a string with the selected subtitle track
+ /// </summary>
+ public double DRC1
+ {
+ get
+ {
+ return this.q_drc1;
+ }
+ }
+
+ private double q_drc2;
+ /// <summary>
+ /// Returns a string with the selected subtitle track
+ /// </summary>
+ public double DRC2
+ {
+ get
+ {
+ return this.q_drc2;
+ }
+ }
+
+ private double q_drc3;
/// <summary>
/// Returns a string with the selected subtitle track
/// </summary>
- public double DRC
+ public double DRC3
{
get
{
- return this.q_drc;
+ return this.q_drc3;
+ }
+ }
+
+ private double q_drc4;
+ /// <summary>
+ /// Returns a string with the selected subtitle track
+ /// </summary>
+ public double DRC4
+ {
+ get
+ {
+ return this.q_drc4;
}
}
@@ -659,16 +817,34 @@ namespace Handbrake.Functions
//Audio Settings Tab
Match audioTrack1 = Regex.Match(input, @"-a ([0-9]*)");
Match audioTrack2 = Regex.Match(input, @"-a ([0-9]*),([0-9]*)");
+ Match audioTrack3 = Regex.Match(input, @"-a ([0-9]*),([0-9]*),([0-9]*)");
+ Match audioTrack4 = Regex.Match(input, @"-a ([0-9]*),([0-9]*),([0-9]*),([0-9]*)");
+
Match audioTrack1Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*)");
- Match audioTrack2Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*)");
+ Match audioTrack2Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*)");
+ Match audioTrack3Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*)");
+ Match audioTrack4Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*)");
+
Match audioEncoder1 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*)");
Match audioEncoder2 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");
+ Match audioEncoder3 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");
+ Match audioEncoder4 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");
+
Match audioBitrate1 = Regex.Match(input, @"-B ([0-9]*)");
Match audioBitrate2 = Regex.Match(input, @"-B ([0-9]*),([0-9]*)");
+ Match audioBitrate3 = Regex.Match(input, @"-B ([0-9]*),([0-9]*),([0-9]*)");
+ Match audioBitrate4 = Regex.Match(input, @"-B ([0-9]*),([0-9]*),([0-9]*),([0-9]*)");
+
Match audioSampleRate1 = Regex.Match(input, @"-R ([0-9.]*)");
Match audioSampleRate2 = Regex.Match(input, @"-R ([0-9.]*),([0-9.]*)");
+ Match audioSampleRate3 = Regex.Match(input, @"-R ([0-9.]*),([0-9.]*),([0-9.]*)");
+ Match audioSampleRate4 = Regex.Match(input, @"-R ([0-9.]*),([0-9.]*),([0-9.]*),([0-9.]*)");
+
+ Match drc1 = Regex.Match(input, @"-D ([0-9.]*)");
+ Match drc2 = Regex.Match(input, @"-D ([0-9.]*),([0-9.]*)");
+ Match drc3 = Regex.Match(input, @"-D ([0-9.]*),([0-9.]*),([0-9.]*)");
+ Match drc4 = Regex.Match(input, @"-D ([0-9.]*),([0-9.]*),([0-9.]*),([0-9.]*)");
- Match drc = Regex.Match(input, @"-D ([0-9.]*)");
Match subtitles = Regex.Match(input, @"-s ([0-9a-zA-Z]*)");
Match subScan = Regex.Match(input, @"-U");
Match forcedSubtitles = Regex.Match(input, @"-F");
@@ -683,9 +859,7 @@ namespace Handbrake.Functions
#region Set Varibles
try
{
- /*
- * Source
- */
+
#region Source Tab
thisQuery.q_source = source.ToString().Replace("-i ", "").Replace("\"", "");
@@ -711,14 +885,10 @@ namespace Handbrake.Functions
#endregion
- /*
- * Destination
- */
#region Destination
thisQuery.q_destination = destination.ToString().Replace("-o ", "").Replace("\"", "");
string videoEncoderConvertion;
- string audioEncoderConvertion;
videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", "");
switch (videoEncoderConvertion)
@@ -746,9 +916,6 @@ namespace Handbrake.Functions
#endregion
- /*
- * Picture Settings Tab
- */
#region Picture Tab
if (width.Success != false)
@@ -821,11 +988,8 @@ namespace Handbrake.Functions
thisQuery.q_looseAnamorphic = lanamorphic.Success;
#endregion
-
- /*
- * Video Settings Tab
- */
- #region Video
+
+ #region Video Settings Tab
thisQuery.q_grayscale = grayscale.Success;
thisQuery.q_twoPass = twoPass.Success;
thisQuery.q_turboFirst = turboFirstPass.Success;
@@ -852,10 +1016,8 @@ namespace Handbrake.Functions
#endregion
- /*
- * Audio Settings Tab
- */
- #region Audio
+ #region Audio Tab
+
// Tracks
if (audioTrack1.Success != false)
thisQuery.q_audioTrack1 = audioTrack1.ToString().Replace("-a ", "");
@@ -869,32 +1031,29 @@ namespace Handbrake.Functions
}
else
thisQuery.q_audioTrack2 = "None";
+
+ if (audioTrack3.Success != false)
+ {
+ string[] audioChan = audioTrack3.ToString().Split(',');
+ thisQuery.q_audioTrack3 = audioChan[2];
+ }
+ else
+ thisQuery.q_audioTrack3 = "None";
+
+ if (audioTrack4.Success != false)
+ {
+ string[] audioChan = audioTrack4.ToString().Split(',');
+ thisQuery.q_audioTrack4 = audioChan[3];
+ }
+ else
+ thisQuery.q_audioTrack4 = "None";
+
// Mixdowns
thisQuery.q_audioTrackMix1 = "Automatic";
if (audioTrack1Mix.Success != false)
{
- switch (audioTrack1Mix.ToString().Replace("-6 ", "").Replace(" ", ""))
- {
- case "mono":
- thisQuery.q_audioTrackMix1 = "Mono";
- break;
- case "stereo":
- thisQuery.q_audioTrackMix1 = "Stereo";
- break;
- case "dpl1":
- thisQuery.q_audioTrackMix1 = "Dolby Surround";
- break;
- case "dpl2":
- thisQuery.q_audioTrackMix1 = "Dolby Pro Logic II";
- break;
- case "6ch":
- thisQuery.q_audioTrackMix1 = "6 Channel Discrete";
- break;
- default:
- thisQuery.q_audioTrackMix1 = "Automatic";
- break;
- }
+ thisQuery.q_audioTrackMix1 = getMixDown(audioTrack1Mix.ToString().Replace("-6 ", "").Replace(" ", ""));
}
thisQuery.q_audioTrackMix2 = "Automatic";
@@ -902,84 +1061,46 @@ namespace Handbrake.Functions
{
string[] audio2mix = audioTrack2Mix.ToString().Split(',');
audio2mix[1] = audio2mix[1].Trim();
- switch (audio2mix[1])
- {
- case "mono":
- thisQuery.q_audioTrackMix2 = "Mono";
- break;
- case "stereo":
- thisQuery.q_audioTrackMix2 = "Stereo";
- break;
- case "dpl1":
- thisQuery.q_audioTrackMix2 = "Dolby Surround";
- break;
- case "dpl2":
- thisQuery.q_audioTrackMix2 = "Dolby Pro Logic II";
- break;
- case "6ch":
- thisQuery.q_audioTrackMix2 = "6 Channel Discrete";
- break;
- default:
- thisQuery.q_audioTrackMix2 = "Automatic";
- break;
- }
+ thisQuery.q_audioTrackMix2 = getMixDown(audio2mix[1]);
}
- // Audio Encoders
- if (audioEncoder1.Success != false)
+ thisQuery.q_audioTrackMix3 = "Automatic";
+ if (audioTrack3Mix.Success != false)
{
- audioEncoderConvertion = audioEncoder1.ToString().Replace("-E ", "");
- switch (audioEncoderConvertion)
- {
- case "faac":
- audioEncoderConvertion = "AAC";
- break;
- case "lame":
- audioEncoderConvertion = "MP3";
- break;
- case "vorbis":
- audioEncoderConvertion = "Vorbis";
- break;
- case "ac3":
- audioEncoderConvertion = "AC3";
- break;
- case "aac+ac3":
- audioEncoderConvertion = "AAC + AC3";
- break;
- default:
- audioEncoderConvertion = "AAC";
- break;
- }
- thisQuery.q_audioEncoder1 = audioEncoderConvertion;
+ string[] audio3mix = audioTrack3Mix.ToString().Split(',');
+ audio3mix[1] = audio3mix[2].Trim();
+ thisQuery.q_audioTrackMix3 = getMixDown(audio3mix[1]);
}
+ thisQuery.q_audioTrackMix4 = "Automatic";
+ if (audioTrack4Mix.Success != false)
+ {
+ string[] audio4mix = audioTrack4Mix.ToString().Split(',');
+ audio4mix[1] = audio4mix[3].Trim();
+ thisQuery.q_audioTrackMix4 = getMixDown(audio4mix[1]);
+ }
+
+
+ // Audio Encoders
+ if (audioEncoder1.Success != false)
+ thisQuery.q_audioEncoder1 = getAudioEncoder(audioEncoder1.ToString().Replace("-E ", ""));
+
if (audioEncoder2.Success != false)
{
- audioEncoderConvertion = audioEncoder2.ToString().Replace("-E ", "");
string[] audio2enc = audioEncoder2.ToString().Split(',');
- audio2enc[1] = audio2enc[1].Trim();
- switch (audio2enc[1])
- {
- case "faac":
- audioEncoderConvertion = "AAC";
- break;
- case "lame":
- audioEncoderConvertion = "MP3";
- break;
- case "vorbis":
- audioEncoderConvertion = "Vorbis";
- break;
- case "ac3":
- audioEncoderConvertion = "AC3";
- break;
- case "aac+ac3":
- audioEncoderConvertion = "AAC + AC3";
- break;
- default:
- audioEncoderConvertion = "AAC";
- break;
- }
- thisQuery.q_audioEncoder2 = audioEncoderConvertion;
+ thisQuery.q_audioEncoder2 = getAudioEncoder(audio2enc[1].Trim());
+ }
+
+ if (audioEncoder3.Success != false)
+ {
+ string[] audio3enc = audioEncoder3.ToString().Split(',');
+ thisQuery.q_audioEncoder3 = getAudioEncoder(audio3enc[2].Trim());
+ }
+
+ if (audioEncoder4.Success != false)
+ {
+ string[] audio4enc = audioEncoder4.ToString().Split(',');
+ thisQuery.q_audioEncoder4 = getAudioEncoder(audio4enc[3].Trim());
}
@@ -997,6 +1118,23 @@ namespace Handbrake.Functions
else
thisQuery.q_audioBitrate2 = "";
+ if (audioBitrate3.Success != false)
+ {
+ string[] audioBitrateSelect = audioBitrate3.ToString().Split(',');
+ thisQuery.q_audioBitrate3 = audioBitrateSelect[2].Trim();
+ }
+ else
+ thisQuery.q_audioBitrate3 = "";
+
+ if (audioBitrate4.Success != false)
+ {
+ string[] audioBitrateSelect = audioBitrate4.ToString().Split(',');
+ thisQuery.q_audioBitrate4 = audioBitrateSelect[3].Trim();
+ }
+ else
+ thisQuery.q_audioBitrate4 = "";
+
+
// Audio Sample Rate
if (audioSampleRate1.Success != false)
thisQuery.q_audioSamplerate1 = audioSampleRate1.ToString().Replace("-R ", "").Trim();
@@ -1007,35 +1145,79 @@ namespace Handbrake.Functions
thisQuery.q_audioSamplerate2 = audioSRSelect[1].Trim();
}
+ if (audioSampleRate3.Success != false)
+ {
+ string[] audioSRSelect = audioSampleRate3.ToString().Split(',');
+ thisQuery.q_audioSamplerate3 = audioSRSelect[2].Trim();
+ }
- if (subtitles.Success != false)
- thisQuery.q_subtitles = subtitles.ToString().Replace("-s ", "");
+ if (audioSampleRate4.Success != false)
+ {
+ string[] audioSRSelect = audioSampleRate4.ToString().Split(',');
+ thisQuery.q_audioSamplerate4 = audioSRSelect[3].Trim();
+ }
+
+ // DRC
+ if (drc1.Success != false)
+ {
+ string value = drc1.ToString().Replace("-D ", "");
+ float drcValue = float.Parse(value);
+ drcValue = drcValue * 10;
+ thisQuery.q_drc1 = drcValue;
+ }
else
+ thisQuery.q_drc1 = 0;
+
+ if (drc2.Success != false)
{
- if (subScan.Success)
- thisQuery.q_subtitles = "Autoselect";
- else
- thisQuery.q_subtitles = "None";
+ string[] drcPoint = drc2.ToString().Split(',');
+ string value = drcPoint[1];
+ float drcValue = float.Parse(value);
+ drcValue = drcValue * 10;
+ thisQuery.q_drc2 = drcValue;
+ }
+ else
+ thisQuery.q_drc2 = 0;
+
+ if (drc3.Success != false)
+ {
+ string[] drcPoint = drc3.ToString().Split(',');
+ string value = drcPoint[2];
+ float drcValue = float.Parse(value);
+ drcValue = drcValue * 10;
+ thisQuery.q_drc3 = drcValue;
}
+ else
+ thisQuery.q_drc3 = 0;
- if (drc.Success != false)
+ if (drc4.Success != false)
{
- string value = drc.ToString().Replace("-D ", "");
+ string[] drcPoint = drc4.ToString().Split(',');
+ string value = drcPoint[3];
float drcValue = float.Parse(value);
drcValue = drcValue * 10;
- thisQuery.q_drc = drcValue;
+ thisQuery.q_drc4 = drcValue;
}
else
- thisQuery.q_drc = 0;
+ thisQuery.q_drc4 = 0;
+
+
+ // Subtitle Stuff
+ if (subtitles.Success != false)
+ thisQuery.q_subtitles = subtitles.ToString().Replace("-s ", "");
+ else
+ {
+ if (subScan.Success)
+ thisQuery.q_subtitles = "Autoselect";
+ else
+ thisQuery.q_subtitles = "None";
+ }
thisQuery.q_forcedSubs = forcedSubtitles.Success;
#endregion
- //
- //H264 tab and other
- //
- #region h264 and other
+ #region H.264 and other
//
//H264 Tab
//
@@ -1058,5 +1240,42 @@ namespace Handbrake.Functions
return thisQuery;
}
+
+
+ private static string getMixDown(string mixdown)
+ {
+ switch (mixdown)
+ {
+ case "mono":
+ return "Mono";
+ case "stereo":
+ return "Stereo";
+ case "dpl1":
+ return "Dolby Surround";
+ case "dpl2":
+ return "Dolby Pro Logic II";
+ case "6ch":
+ return "6 Channel Discrete";
+ default:
+ return "Automatic";
+ }
+ }
+
+ private static string getAudioEncoder(string audioEnc)
+ {
+ switch (audioEnc)
+ {
+ case "faac":
+ return "AAC";
+ case "lame":
+ return "MP3";
+ case "vorbis":
+ return "Vorbis";
+ case "ac3":
+ return "AC3";
+ default:
+ return "AAC";
+ }
+ }
}
} \ No newline at end of file