diff --git a/src/Program.cs b/src/Program.cs index 9fddac3..2bb71ed 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -40,6 +40,9 @@ public void Process(IList inputUrls, IList outputUrls) internal class MainClass { + public static int audioQuality = 0; //TODO: Move audioQuality and videoQuality somewhere else. + public static int videoQuality = 0; + private static void Main(string[] args) { Logo(); @@ -60,6 +63,22 @@ private static void Main(string[] args) { isDeterministic = true; } + else if (args[j] == "--vq") + { + ++j; + if (j <= args.Length) + { + videoQuality = Convert.ToInt32(args[j]); + } + } + else if (args[j] == "--aq") + { + ++j; + if (j <= args.Length) + { + audioQuality = Convert.ToInt32(args[j]); + } + } } if (args.Length < j + 2) { diff --git a/src/Smooth.cs b/src/Smooth.cs index d82b2e0..ec1df32 100644 --- a/src/Smooth.cs +++ b/src/Smooth.cs @@ -200,9 +200,28 @@ public StreamInfo(XmlNode element, Uri manifestUri) this.pureUrl = this.pureUrl.Substring(0, this.pureUrl.LastIndexOf('/')); this.SelectedTracks = new List(); - if (this.AvailableTracks.Count > 0) + if (this.AvailableTracks[0] is AudioTrackInfo) { - this.SelectedTracks.Add(this.AvailableTracks[0]); + if (this.AvailableTracks.Count >= MainClass.audioQuality) + { + this.SelectedTracks.Add(this.AvailableTracks[MainClass.audioQuality]); + } + else + { + this.SelectedTracks.Add(this.AvailableTracks[0]); + } + } + + if (this.AvailableTracks[0] is VideoTrackInfo) + { + if (this.AvailableTracks.Count >= MainClass.videoQuality) + { + this.SelectedTracks.Add(this.AvailableTracks[MainClass.videoQuality]); + } + else + { + this.SelectedTracks.Add(this.AvailableTracks[0]); + } } } private void CheckUrlAttribute()