StreamRequest.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. using MediaBrowser.Model.Dto;
  2. using ServiceStack;
  3. namespace MediaBrowser.Api.Playback
  4. {
  5. /// <summary>
  6. /// Class StreamRequest
  7. /// </summary>
  8. public class StreamRequest
  9. {
  10. /// <summary>
  11. /// Gets or sets the id.
  12. /// </summary>
  13. /// <value>The id.</value>
  14. [ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
  15. public string Id { get; set; }
  16. [ApiMember(Name = "DeviceId", Description = "The device id of the client requesting. Used to stop encoding processes when needed.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  17. public string DeviceId { get; set; }
  18. /// <summary>
  19. /// Gets or sets the audio codec.
  20. /// </summary>
  21. /// <value>The audio codec.</value>
  22. [ApiMember(Name = "AudioCodec", Description = "Optional. Specify a audio codec to encode to, e.g. mp3. If omitted the server will auto-select using the url's extension. Options: aac, mp3, vorbis, wma.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  23. public AudioCodecs? AudioCodec { get; set; }
  24. /// <summary>
  25. /// Gets or sets the start time ticks.
  26. /// </summary>
  27. /// <value>The start time ticks.</value>
  28. [ApiMember(Name = "StartTimeTicks", Description = "Optional. Specify a starting offset, in ticks. 1 tick = 10000 ms", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  29. public long? StartTimeTicks { get; set; }
  30. /// <summary>
  31. /// Gets or sets the audio bit rate.
  32. /// </summary>
  33. /// <value>The audio bit rate.</value>
  34. [ApiMember(Name = "AudioBitRate", Description = "Optional. Specify an audio bitrate to encode to, e.g. 128000. If omitted this will be left to encoder defaults.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  35. public int? AudioBitRate { get; set; }
  36. /// <summary>
  37. /// Gets or sets the audio channels.
  38. /// </summary>
  39. /// <value>The audio channels.</value>
  40. [ApiMember(Name = "AudioChannels", Description = "Optional. Specify a specific number of audio channels to encode to, e.g. 2", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  41. public int? AudioChannels { get; set; }
  42. /// <summary>
  43. /// Gets or sets the audio sample rate.
  44. /// </summary>
  45. /// <value>The audio sample rate.</value>
  46. [ApiMember(Name = "AudioSampleRate", Description = "Optional. Specify a specific audio sample rate, e.g. 44100", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  47. public int? AudioSampleRate { get; set; }
  48. /// <summary>
  49. /// Gets or sets a value indicating whether this <see cref="StreamRequest" /> is static.
  50. /// </summary>
  51. /// <value><c>true</c> if static; otherwise, <c>false</c>.</value>
  52. [ApiMember(Name = "Static", Description = "Optional. If true, the original file will be streamed statically without any encoding. Use either no url extension or the original file extension. true/false", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
  53. public bool Static { get; set; }
  54. /// <summary>
  55. /// For testing purposes
  56. /// </summary>
  57. public bool ThrowDebugError { get; set; }
  58. public string Params { get; set; }
  59. public string ForcedMimeType { get; set; }
  60. }
  61. public class VideoStreamRequest : StreamRequest
  62. {
  63. /// <summary>
  64. /// Gets or sets the video codec.
  65. /// </summary>
  66. /// <value>The video codec.</value>
  67. [ApiMember(Name = "VideoCodec", Description = "Optional. Specify a video codec to encode to, e.g. h264. If omitted the server will auto-select using the url's extension. Options: h264, mpeg4, theora, vpx, wmv.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  68. public VideoCodecs? VideoCodec { get; set; }
  69. /// <summary>
  70. /// Gets or sets the video bit rate.
  71. /// </summary>
  72. /// <value>The video bit rate.</value>
  73. [ApiMember(Name = "VideoBitRate", Description = "Optional. Specify a video bitrate to encode to, e.g. 500000. If omitted this will be left to encoder defaults.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  74. public int? VideoBitRate { get; set; }
  75. /// <summary>
  76. /// Gets or sets the index of the audio stream.
  77. /// </summary>
  78. /// <value>The index of the audio stream.</value>
  79. [ApiMember(Name = "AudioStreamIndex", Description = "Optional. The index of the audio stream to use. If omitted the first audio stream will be used.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  80. public int? AudioStreamIndex { get; set; }
  81. /// <summary>
  82. /// Gets or sets the index of the video stream.
  83. /// </summary>
  84. /// <value>The index of the video stream.</value>
  85. [ApiMember(Name = "VideoStreamIndex", Description = "Optional. The index of the video stream to use. If omitted the first video stream will be used.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  86. public int? VideoStreamIndex { get; set; }
  87. /// <summary>
  88. /// Gets or sets the index of the subtitle stream.
  89. /// </summary>
  90. /// <value>The index of the subtitle stream.</value>
  91. [ApiMember(Name = "SubtitleStreamIndex", Description = "Optional. The index of the subtitle stream to use. If omitted no subtitles will be used.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  92. public int? SubtitleStreamIndex { get; set; }
  93. /// <summary>
  94. /// Gets or sets the width.
  95. /// </summary>
  96. /// <value>The width.</value>
  97. [ApiMember(Name = "Width", Description = "Optional. The fixed horizontal resolution of the encoded video.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  98. public int? Width { get; set; }
  99. /// <summary>
  100. /// Gets or sets the height.
  101. /// </summary>
  102. /// <value>The height.</value>
  103. [ApiMember(Name = "Height", Description = "Optional. The fixed vertical resolution of the encoded video.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  104. public int? Height { get; set; }
  105. /// <summary>
  106. /// Gets or sets the width of the max.
  107. /// </summary>
  108. /// <value>The width of the max.</value>
  109. [ApiMember(Name = "MaxWidth", Description = "Optional. The maximum horizontal resolution of the encoded video.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  110. public int? MaxWidth { get; set; }
  111. /// <summary>
  112. /// Gets or sets the height of the max.
  113. /// </summary>
  114. /// <value>The height of the max.</value>
  115. [ApiMember(Name = "MaxHeight", Description = "Optional. The maximum vertical resolution of the encoded video.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  116. public int? MaxHeight { get; set; }
  117. /// <summary>
  118. /// Gets or sets the framerate.
  119. /// </summary>
  120. /// <value>The framerate.</value>
  121. [ApiMember(Name = "Framerate", Description = "Optional. A specific video framerate to encode to, e.g. 23.976. Generally this should be omitted unless the device has specific requirements.", IsRequired = false, DataType = "double", ParameterType = "query", Verb = "GET")]
  122. public double? Framerate { get; set; }
  123. /// <summary>
  124. /// Gets or sets the profile.
  125. /// </summary>
  126. /// <value>The profile.</value>
  127. [ApiMember(Name = "Profile", Description = "Optional. Specify a specific h264 profile, e.g. main, baseline, high.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  128. public string Profile { get; set; }
  129. /// <summary>
  130. /// Gets or sets the level.
  131. /// </summary>
  132. /// <value>The level.</value>
  133. [ApiMember(Name = "Level", Description = "Optional. Specify a level for the h264 profile, e.g. 3, 3.1.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  134. public string Level { get; set; }
  135. /// <summary>
  136. /// Gets a value indicating whether this instance has fixed resolution.
  137. /// </summary>
  138. /// <value><c>true</c> if this instance has fixed resolution; otherwise, <c>false</c>.</value>
  139. public bool HasFixedResolution
  140. {
  141. get
  142. {
  143. return Width.HasValue || Height.HasValue;
  144. }
  145. }
  146. }
  147. }