AndroidProfile.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. using System.Collections.Generic;
  2. using System.Xml.Serialization;
  3. namespace MediaBrowser.Model.Dlna.Profiles
  4. {
  5. [XmlRoot("Profile")]
  6. public class AndroidProfile : DefaultProfile
  7. {
  8. public AndroidProfile()
  9. : this(true, true, new[] { "baseline", "constrained baseline" })
  10. {
  11. }
  12. public AndroidProfile(bool supportsHls,
  13. bool supportsMpegDash,
  14. string[] supportedH264Profiles)
  15. {
  16. Name = "Android";
  17. List<TranscodingProfile> transcodingProfiles = new List<TranscodingProfile>();
  18. transcodingProfiles.Add(new TranscodingProfile
  19. {
  20. Container = "mp3",
  21. AudioCodec = "mp3",
  22. Type = DlnaProfileType.Audio
  23. });
  24. if (supportsMpegDash)
  25. {
  26. }
  27. if (supportsHls)
  28. {
  29. transcodingProfiles.Add(new TranscodingProfile
  30. {
  31. Protocol = "hls",
  32. Container = "ts",
  33. VideoCodec = "h264",
  34. AudioCodec = "aac",
  35. Type = DlnaProfileType.Video,
  36. VideoProfile = "baseline",
  37. Context = EncodingContext.Streaming
  38. });
  39. }
  40. transcodingProfiles.Add(new TranscodingProfile
  41. {
  42. Container = "mp4",
  43. VideoCodec = "h264",
  44. AudioCodec = "aac",
  45. Type = DlnaProfileType.Video,
  46. VideoProfile = "baseline",
  47. Context = EncodingContext.Static
  48. });
  49. TranscodingProfiles = transcodingProfiles.ToArray();
  50. DirectPlayProfiles = new[]
  51. {
  52. new DirectPlayProfile
  53. {
  54. Container = "mp4",
  55. VideoCodec = "h264,mpeg4",
  56. AudioCodec = "aac",
  57. Type = DlnaProfileType.Video
  58. },
  59. new DirectPlayProfile
  60. {
  61. Container = "mp4,aac",
  62. AudioCodec = "aac",
  63. Type = DlnaProfileType.Audio
  64. },
  65. new DirectPlayProfile
  66. {
  67. Container = "mp3",
  68. AudioCodec = "mp3",
  69. Type = DlnaProfileType.Audio
  70. },
  71. new DirectPlayProfile
  72. {
  73. Container = "flac",
  74. AudioCodec = "flac",
  75. Type = DlnaProfileType.Audio
  76. },
  77. new DirectPlayProfile
  78. {
  79. Container = "ogg",
  80. AudioCodec = "vorbis",
  81. Type = DlnaProfileType.Audio
  82. },
  83. new DirectPlayProfile
  84. {
  85. Container = "jpeg,png,gif,bmp",
  86. Type = DlnaProfileType.Photo
  87. }
  88. };
  89. CodecProfiles = new[]
  90. {
  91. new CodecProfile
  92. {
  93. Type = CodecType.Video,
  94. Codec= "h264",
  95. Conditions = new []
  96. {
  97. new ProfileCondition(ProfileConditionType.EqualsAny, ProfileConditionValue.VideoProfile, string.Join("|", supportedH264Profiles)),
  98. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.Width, "1920"),
  99. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.Height, "1080"),
  100. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.VideoBitDepth, "8"),
  101. new ProfileCondition(ProfileConditionType.NotEquals, ProfileConditionValue.IsAnamorphic, "true")
  102. }
  103. },
  104. new CodecProfile
  105. {
  106. Type = CodecType.Video,
  107. Conditions = new []
  108. {
  109. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.Width, "1920"),
  110. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.Height, "1080"),
  111. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.VideoBitDepth, "8"),
  112. new ProfileCondition(ProfileConditionType.NotEquals, ProfileConditionValue.IsAnamorphic, "true")
  113. }
  114. },
  115. new CodecProfile
  116. {
  117. Type = CodecType.VideoAudio,
  118. Codec = "aac",
  119. Conditions = new []
  120. {
  121. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioChannels, "2")
  122. }
  123. },
  124. new CodecProfile
  125. {
  126. Type = CodecType.Audio,
  127. Codec = "aac",
  128. Conditions = new []
  129. {
  130. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioChannels, "2")
  131. }
  132. },
  133. new CodecProfile
  134. {
  135. Type = CodecType.Audio,
  136. Codec = "mp3",
  137. Conditions = new []
  138. {
  139. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioChannels, "2"),
  140. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioBitrate, "320000")
  141. }
  142. }
  143. };
  144. }
  145. }
  146. }