Skip to content

Commit

Permalink
added -vq and -aq flags to select quality
Browse files Browse the repository at this point in the history
  • Loading branch information
Milek7 committed Jun 20, 2014
1 parent fd17a09 commit 32635fc
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
19 changes: 19 additions & 0 deletions src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public void Process(IList<string> inputUrls, IList<string> 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();
Expand All @@ -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)
{
Expand Down
23 changes: 21 additions & 2 deletions src/Smooth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,28 @@ public StreamInfo(XmlNode element, Uri manifestUri)
this.pureUrl = this.pureUrl.Substring(0, this.pureUrl.LastIndexOf('/'));
this.SelectedTracks = new List<TrackInfo>();

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()
Expand Down

0 comments on commit 32635fc

Please sign in to comment.