AndroidProfile.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. new ProfileCondition(ProfileConditionType.Equals, ProfileConditionValue.IsCabac, "true")
  103. }
  104. },
  105. new CodecProfile
  106. {
  107. Type = CodecType.Video,
  108. Conditions = new []
  109. {
  110. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.Width, "1920"),
  111. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.Height, "1080"),
  112. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.VideoBitDepth, "8"),
  113. new ProfileCondition(ProfileConditionType.NotEquals, ProfileConditionValue.IsAnamorphic, "true")
  114. }
  115. },
  116. new CodecProfile
  117. {
  118. Type = CodecType.VideoAudio,
  119. Codec = "aac",
  120. Conditions = new []
  121. {
  122. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioChannels, "2")
  123. }
  124. },
  125. new CodecProfile
  126. {
  127. Type = CodecType.Audio,
  128. Codec = "aac",
  129. Conditions = new []
  130. {
  131. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioChannels, "2")
  132. }
  133. },
  134. new CodecProfile
  135. {
  136. Type = CodecType.Audio,
  137. Codec = "mp3",
  138. Conditions = new []
  139. {
  140. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioChannels, "2"),
  141. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioBitrate, "320000")
  142. }
  143. }
  144. };
  145. }
  146. }
  147. }