AudioOptions.cs 2.5 KB

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