AndroidProfile.cs 5.6 KB

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