AndroidProfile.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. Context = EncodingContext.Streaming
  37. });
  38. }
  39. transcodingProfiles.Add(new TranscodingProfile
  40. {
  41. Container = "mp4",
  42. VideoCodec = "h264",
  43. AudioCodec = "aac",
  44. Type = DlnaProfileType.Video,
  45. Context = EncodingContext.Static
  46. });
  47. TranscodingProfiles = transcodingProfiles.ToArray();
  48. DirectPlayProfiles = new[]
  49. {
  50. new DirectPlayProfile
  51. {
  52. Container = "mp4",
  53. VideoCodec = "h264,mpeg4",
  54. AudioCodec = "aac",
  55. Type = DlnaProfileType.Video
  56. },
  57. new DirectPlayProfile
  58. {
  59. Container = "mp4,aac",
  60. AudioCodec = "aac",
  61. Type = DlnaProfileType.Audio
  62. },
  63. new DirectPlayProfile
  64. {
  65. Container = "mp3",
  66. AudioCodec = "mp3",
  67. Type = DlnaProfileType.Audio
  68. },
  69. new DirectPlayProfile
  70. {
  71. Container = "flac",
  72. AudioCodec = "flac",
  73. Type = DlnaProfileType.Audio
  74. },
  75. new DirectPlayProfile
  76. {
  77. Container = "ogg",
  78. AudioCodec = "vorbis",
  79. Type = DlnaProfileType.Audio
  80. },
  81. new DirectPlayProfile
  82. {
  83. Container = "jpeg,png,gif,bmp",
  84. Type = DlnaProfileType.Photo
  85. }
  86. };
  87. CodecProfiles = new[]
  88. {
  89. new CodecProfile
  90. {
  91. Type = CodecType.Video,
  92. Codec= "h264",
  93. Conditions = new []
  94. {
  95. new ProfileCondition(ProfileConditionType.EqualsAny, ProfileConditionValue.VideoProfile, string.Join("|", supportedH264Profiles)),
  96. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.Width, "1920"),
  97. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.Height, "1080"),
  98. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.VideoBitDepth, "8"),
  99. new ProfileCondition(ProfileConditionType.NotEquals, ProfileConditionValue.IsAnamorphic, "true"),
  100. new ProfileCondition(ProfileConditionType.Equals, ProfileConditionValue.IsCabac, "true")
  101. }
  102. },
  103. new CodecProfile
  104. {
  105. Type = CodecType.Video,
  106. Conditions = new []
  107. {
  108. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.Width, "1920"),
  109. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.Height, "1080"),
  110. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.VideoBitDepth, "8"),
  111. new ProfileCondition(ProfileConditionType.NotEquals, ProfileConditionValue.IsAnamorphic, "true")
  112. }
  113. },
  114. new CodecProfile
  115. {
  116. Type = CodecType.VideoAudio,
  117. Codec = "aac",
  118. Conditions = new []
  119. {
  120. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioChannels, "2")
  121. }
  122. },
  123. new CodecProfile
  124. {
  125. Type = CodecType.Audio,
  126. Codec = "aac",
  127. Conditions = new []
  128. {
  129. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioChannels, "2")
  130. }
  131. },
  132. new CodecProfile
  133. {
  134. Type = CodecType.Audio,
  135. Codec = "mp3",
  136. Conditions = new []
  137. {
  138. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioChannels, "2"),
  139. new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioBitrate, "320000")
  140. }
  141. }
  142. };
  143. }
  144. }
  145. }