AudioOptions.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. EnableDirectPlay = true;
  14. EnableDirectStream = true;
  15. }
  16. public bool EnableDirectPlay { get; set; }
  17. public bool EnableDirectStream { get; set; }
  18. public string ItemId { get; set; }
  19. public List<MediaSourceInfo> MediaSources { get; set; }
  20. public DeviceProfile Profile { get; set; }
  21. /// <summary>
  22. /// Optional. Only needed if a specific AudioStreamIndex or SubtitleStreamIndex are requested.
  23. /// </summary>
  24. public string MediaSourceId { get; set; }
  25. public string DeviceId { get; set; }
  26. /// <summary>
  27. /// Allows an override of supported number of audio channels
  28. /// Example: DeviceProfile supports five channel, but user only has stereo speakers
  29. /// </summary>
  30. public int? MaxAudioChannels { get; set; }
  31. /// <summary>
  32. /// The application's configured quality setting
  33. /// </summary>
  34. public int? MaxBitrate { get; set; }
  35. /// <summary>
  36. /// Gets or sets the context.
  37. /// </summary>
  38. /// <value>The context.</value>
  39. public EncodingContext Context { get; set; }
  40. /// <summary>
  41. /// Gets or sets the audio transcoding bitrate.
  42. /// </summary>
  43. /// <value>The audio transcoding bitrate.</value>
  44. public int? AudioTranscodingBitrate { get; set; }
  45. /// <summary>
  46. /// Gets the maximum bitrate.
  47. /// </summary>
  48. /// <returns>System.Nullable&lt;System.Int32&gt;.</returns>
  49. public int? GetMaxBitrate()
  50. {
  51. if (MaxBitrate.HasValue)
  52. {
  53. return MaxBitrate;
  54. }
  55. if (Profile != null)
  56. {
  57. if (Context == EncodingContext.Static)
  58. {
  59. return Profile.MaxStaticBitrate;
  60. }
  61. return Profile.MaxStreamingBitrate;
  62. }
  63. return null;
  64. }
  65. }
  66. }