diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-03-30 12:16:34 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-03-30 12:16:34 -0400 |
| commit | 5f044cfd68eecf116df1a646806fc091f3fb63aa (patch) | |
| tree | 572b7a009f9c308e1b365801028738b59762a1a4 /MediaBrowser.Api/Playback/StreamState.cs | |
| parent | 0bd27381e0ef5a0a17ea93bb86a752c5d2cc2e1a (diff) | |
add setting to control transcodng throttle
Diffstat (limited to 'MediaBrowser.Api/Playback/StreamState.cs')
| -rw-r--r-- | MediaBrowser.Api/Playback/StreamState.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs index b097f3b6a..2d1e896db 100644 --- a/MediaBrowser.Api/Playback/StreamState.cs +++ b/MediaBrowser.Api/Playback/StreamState.cs @@ -346,6 +346,42 @@ namespace MediaBrowser.Api.Playback } } + public int? TargetVideoStreamCount + { + get + { + if (Request.Static) + { + return GetMediaStreamCount(MediaStreamType.Video, int.MaxValue); + } + return GetMediaStreamCount(MediaStreamType.Video, 1); + } + } + + public int? TargetAudioStreamCount + { + get + { + if (Request.Static) + { + return GetMediaStreamCount(MediaStreamType.Audio, int.MaxValue); + } + return GetMediaStreamCount(MediaStreamType.Audio, 1); + } + } + + private int? GetMediaStreamCount(MediaStreamType type, int limit) + { + var count = MediaSource.GetStreamCount(type); + + if (count.HasValue) + { + count = Math.Min(count.Value, limit); + } + + return count; + } + /// <summary> /// Predicts the audio sample rate that will be in the output stream /// </summary> |
