AudioOptions.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using MediaBrowser.Model.Dto;
  2. using System.Collections.Generic;
  3. namespace MediaBrowser.Model.Dlna
  4. {
  5. /// <summary>
  6. /// Class AudioOptions.
  7. /// </summary>
  8. public class AudioOptions
  9. {
  10. public AudioOptions()
  11. {
  12. Context = EncodingContext.Streaming;
  13. }
  14. public string ItemId { get; set; }
  15. public List<MediaSourceInfo> MediaSources { get; set; }
  16. public DeviceProfile Profile { get; set; }
  17. /// <summary>
  18. /// Optional. Only needed if a specific AudioStreamIndex or SubtitleStreamIndex are requested.
  19. /// </summary>
  20. public string MediaSourceId { get; set; }
  21. public string DeviceId { get; set; }
  22. /// <summary>
  23. /// Allows an override of supported number of audio channels
  24. /// Example: DeviceProfile supports five channel, but user only has stereo speakers
  25. /// </summary>
  26. public int? MaxAudioChannels { get; set; }
  27. /// <summary>
  28. /// The application's configured quality setting
  29. /// </summary>
  30. public int? MaxBitrate { get; set; }
  31. /// <summary>
  32. /// Gets or sets the context.
  33. /// </summary>
  34. /// <value>The context.</value>
  35. public EncodingContext Context { get; set; }
  36. /// <summary>
  37. /// Gets or sets the audio transcoding bitrate.
  38. /// </summary>
  39. /// <value>The audio transcoding bitrate.</value>
  40. public int? AudioTranscodingBitrate { get; set; }
  41. /// <summary>
  42. /// Gets the maximum bitrate.
  43. /// </summary>
  44. /// <returns>System.Nullable&lt;System.Int32&gt;.</returns>
  45. public int? GetMaxBitrate()
  46. {
  47. if (MaxBitrate.HasValue)
  48. {
  49. return MaxBitrate;
  50. }
  51. if (Profile != null)
  52. {
  53. if (Context == EncodingContext.Static)
  54. {
  55. return Profile.MaxStaticBitrate;
  56. }
  57. return Profile.MaxStreamingBitrate;
  58. }
  59. return null;
  60. }
  61. }
  62. }