MediaStream.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. using MediaBrowser.Model.Extensions;
  2. using System.Diagnostics;
  3. namespace MediaBrowser.Model.Entities
  4. {
  5. /// <summary>
  6. /// Class MediaStream
  7. /// </summary>
  8. [DebuggerDisplay("StreamType = {Type}")]
  9. public class MediaStream
  10. {
  11. /// <summary>
  12. /// Gets or sets the codec.
  13. /// </summary>
  14. /// <value>The codec.</value>
  15. public string Codec { get; set; }
  16. /// <summary>
  17. /// Gets or sets the language.
  18. /// </summary>
  19. /// <value>The language.</value>
  20. public string Language { get; set; }
  21. /// <summary>
  22. /// Gets or sets a value indicating whether this instance is interlaced.
  23. /// </summary>
  24. /// <value><c>true</c> if this instance is interlaced; otherwise, <c>false</c>.</value>
  25. public bool IsInterlaced { get; set; }
  26. /// <summary>
  27. /// Gets or sets the channel layout.
  28. /// </summary>
  29. /// <value>The channel layout.</value>
  30. public string ChannelLayout { get; set; }
  31. /// <summary>
  32. /// Gets or sets the bit rate.
  33. /// </summary>
  34. /// <value>The bit rate.</value>
  35. public int? BitRate { get; set; }
  36. /// <summary>
  37. /// Gets or sets the bit depth.
  38. /// </summary>
  39. /// <value>The bit depth.</value>
  40. public int? BitDepth { get; set; }
  41. /// <summary>
  42. /// Gets or sets the reference frames.
  43. /// </summary>
  44. /// <value>The reference frames.</value>
  45. public int? RefFrames { get; set; }
  46. /// <summary>
  47. /// Gets or sets the length of the packet.
  48. /// </summary>
  49. /// <value>The length of the packet.</value>
  50. public int? PacketLength { get; set; }
  51. /// <summary>
  52. /// Gets or sets the channels.
  53. /// </summary>
  54. /// <value>The channels.</value>
  55. public int? Channels { get; set; }
  56. /// <summary>
  57. /// Gets or sets the sample rate.
  58. /// </summary>
  59. /// <value>The sample rate.</value>
  60. public int? SampleRate { get; set; }
  61. /// <summary>
  62. /// Gets or sets a value indicating whether this instance is default.
  63. /// </summary>
  64. /// <value><c>true</c> if this instance is default; otherwise, <c>false</c>.</value>
  65. public bool IsDefault { get; set; }
  66. /// <summary>
  67. /// Gets or sets a value indicating whether this instance is forced.
  68. /// </summary>
  69. /// <value><c>true</c> if this instance is forced; otherwise, <c>false</c>.</value>
  70. public bool IsForced { get; set; }
  71. /// <summary>
  72. /// Gets or sets the height.
  73. /// </summary>
  74. /// <value>The height.</value>
  75. public int? Height { get; set; }
  76. /// <summary>
  77. /// Gets or sets the width.
  78. /// </summary>
  79. /// <value>The width.</value>
  80. public int? Width { get; set; }
  81. /// <summary>
  82. /// Gets or sets the average frame rate.
  83. /// </summary>
  84. /// <value>The average frame rate.</value>
  85. public float? AverageFrameRate { get; set; }
  86. /// <summary>
  87. /// Gets or sets the real frame rate.
  88. /// </summary>
  89. /// <value>The real frame rate.</value>
  90. public float? RealFrameRate { get; set; }
  91. /// <summary>
  92. /// Gets or sets the profile.
  93. /// </summary>
  94. /// <value>The profile.</value>
  95. public string Profile { get; set; }
  96. /// <summary>
  97. /// Gets or sets the type.
  98. /// </summary>
  99. /// <value>The type.</value>
  100. public MediaStreamType Type { get; set; }
  101. /// <summary>
  102. /// Gets or sets the aspect ratio.
  103. /// </summary>
  104. /// <value>The aspect ratio.</value>
  105. public string AspectRatio { get; set; }
  106. /// <summary>
  107. /// Gets or sets the index.
  108. /// </summary>
  109. /// <value>The index.</value>
  110. public int Index { get; set; }
  111. /// <summary>
  112. /// Gets or sets a value indicating whether this instance is external.
  113. /// </summary>
  114. /// <value><c>true</c> if this instance is external; otherwise, <c>false</c>.</value>
  115. public bool IsExternal { get; set; }
  116. public bool IsTextSubtitleStream
  117. {
  118. get
  119. {
  120. if (Type != MediaStreamType.Subtitle) return false;
  121. string codec = Codec ?? string.Empty;
  122. // sub = external .sub file
  123. return StringHelper.IndexOfIgnoreCase(codec, "pgs") == -1 &&
  124. StringHelper.IndexOfIgnoreCase(codec, "dvd") == -1 &&
  125. !StringHelper.EqualsIgnoreCase(codec, "sub");
  126. }
  127. }
  128. /// <summary>
  129. /// Gets or sets the filename.
  130. /// </summary>
  131. /// <value>The filename.</value>
  132. public string Path { get; set; }
  133. /// <summary>
  134. /// Gets or sets the pixel format.
  135. /// </summary>
  136. /// <value>The pixel format.</value>
  137. public string PixelFormat { get; set; }
  138. /// <summary>
  139. /// Gets or sets the level.
  140. /// </summary>
  141. /// <value>The level.</value>
  142. public double? Level { get; set; }
  143. /// <summary>
  144. /// Gets a value indicating whether this instance is anamorphic.
  145. /// </summary>
  146. /// <value><c>true</c> if this instance is anamorphic; otherwise, <c>false</c>.</value>
  147. public bool? IsAnamorphic { get; set; }
  148. /// <summary>
  149. /// Gets or sets a value indicating whether this instance is cabac.
  150. /// </summary>
  151. /// <value><c>null</c> if [is cabac] contains no value, <c>true</c> if [is cabac]; otherwise, <c>false</c>.</value>
  152. public bool? IsCabac { get; set; }
  153. }
  154. }