MediaStream.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721
  1. #nullable disable
  2. #pragma warning disable CS1591
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Globalization;
  6. using System.Linq;
  7. using System.Text;
  8. using Jellyfin.Data.Enums;
  9. using Jellyfin.Extensions;
  10. using MediaBrowser.Model.Dlna;
  11. using MediaBrowser.Model.Extensions;
  12. using MediaBrowser.Model.MediaInfo;
  13. namespace MediaBrowser.Model.Entities
  14. {
  15. /// <summary>
  16. /// Class MediaStream.
  17. /// </summary>
  18. public class MediaStream
  19. {
  20. private static readonly string[] _specialCodes =
  21. {
  22. // Uncoded languages.
  23. "mis",
  24. // Multiple languages.
  25. "mul",
  26. // Undetermined.
  27. "und",
  28. // No linguistic content; not applicable.
  29. "zxx"
  30. };
  31. /// <summary>
  32. /// Gets or sets the codec.
  33. /// </summary>
  34. /// <value>The codec.</value>
  35. public string Codec { get; set; }
  36. /// <summary>
  37. /// Gets or sets the codec tag.
  38. /// </summary>
  39. /// <value>The codec tag.</value>
  40. public string CodecTag { get; set; }
  41. /// <summary>
  42. /// Gets or sets the language.
  43. /// </summary>
  44. /// <value>The language.</value>
  45. public string Language { get; set; }
  46. /// <summary>
  47. /// Gets or sets the color range.
  48. /// </summary>
  49. /// <value>The color range.</value>
  50. public string ColorRange { get; set; }
  51. /// <summary>
  52. /// Gets or sets the color space.
  53. /// </summary>
  54. /// <value>The color space.</value>
  55. public string ColorSpace { get; set; }
  56. /// <summary>
  57. /// Gets or sets the color transfer.
  58. /// </summary>
  59. /// <value>The color transfer.</value>
  60. public string ColorTransfer { get; set; }
  61. /// <summary>
  62. /// Gets or sets the color primaries.
  63. /// </summary>
  64. /// <value>The color primaries.</value>
  65. public string ColorPrimaries { get; set; }
  66. /// <summary>
  67. /// Gets or sets the Dolby Vision version major.
  68. /// </summary>
  69. /// <value>The Dolby Vision version major.</value>
  70. public int? DvVersionMajor { get; set; }
  71. /// <summary>
  72. /// Gets or sets the Dolby Vision version minor.
  73. /// </summary>
  74. /// <value>The Dolby Vision version minor.</value>
  75. public int? DvVersionMinor { get; set; }
  76. /// <summary>
  77. /// Gets or sets the Dolby Vision profile.
  78. /// </summary>
  79. /// <value>The Dolby Vision profile.</value>
  80. public int? DvProfile { get; set; }
  81. /// <summary>
  82. /// Gets or sets the Dolby Vision level.
  83. /// </summary>
  84. /// <value>The Dolby Vision level.</value>
  85. public int? DvLevel { get; set; }
  86. /// <summary>
  87. /// Gets or sets the Dolby Vision rpu present flag.
  88. /// </summary>
  89. /// <value>The Dolby Vision rpu present flag.</value>
  90. public int? RpuPresentFlag { get; set; }
  91. /// <summary>
  92. /// Gets or sets the Dolby Vision el present flag.
  93. /// </summary>
  94. /// <value>The Dolby Vision el present flag.</value>
  95. public int? ElPresentFlag { get; set; }
  96. /// <summary>
  97. /// Gets or sets the Dolby Vision bl present flag.
  98. /// </summary>
  99. /// <value>The Dolby Vision bl present flag.</value>
  100. public int? BlPresentFlag { get; set; }
  101. /// <summary>
  102. /// Gets or sets the Dolby Vision bl signal compatibility id.
  103. /// </summary>
  104. /// <value>The Dolby Vision bl signal compatibility id.</value>
  105. public int? DvBlSignalCompatibilityId { get; set; }
  106. /// <summary>
  107. /// Gets or sets the comment.
  108. /// </summary>
  109. /// <value>The comment.</value>
  110. public string Comment { get; set; }
  111. /// <summary>
  112. /// Gets or sets the time base.
  113. /// </summary>
  114. /// <value>The time base.</value>
  115. public string TimeBase { get; set; }
  116. /// <summary>
  117. /// Gets or sets the codec time base.
  118. /// </summary>
  119. /// <value>The codec time base.</value>
  120. public string CodecTimeBase { get; set; }
  121. /// <summary>
  122. /// Gets or sets the title.
  123. /// </summary>
  124. /// <value>The title.</value>
  125. public string Title { get; set; }
  126. /// <summary>
  127. /// Gets the video range.
  128. /// </summary>
  129. /// <value>The video range.</value>
  130. public VideoRange VideoRange
  131. {
  132. get
  133. {
  134. var (videoRange, _) = GetVideoColorRange();
  135. return videoRange;
  136. }
  137. }
  138. /// <summary>
  139. /// Gets the video range type.
  140. /// </summary>
  141. /// <value>The video range type.</value>
  142. public VideoRangeType VideoRangeType
  143. {
  144. get
  145. {
  146. var (_, videoRangeType) = GetVideoColorRange();
  147. return videoRangeType;
  148. }
  149. }
  150. /// <summary>
  151. /// Gets the video dovi title.
  152. /// </summary>
  153. /// <value>The video dovi title.</value>
  154. public string VideoDoViTitle
  155. {
  156. get
  157. {
  158. var dvProfile = DvProfile;
  159. var rpuPresentFlag = RpuPresentFlag == 1;
  160. var blPresentFlag = BlPresentFlag == 1;
  161. var dvBlCompatId = DvBlSignalCompatibilityId;
  162. if (rpuPresentFlag
  163. && blPresentFlag
  164. && (dvProfile == 4
  165. || dvProfile == 5
  166. || dvProfile == 7
  167. || dvProfile == 8
  168. || dvProfile == 9))
  169. {
  170. var title = "DV Profile " + dvProfile;
  171. if (dvBlCompatId > 0)
  172. {
  173. title += "." + dvBlCompatId;
  174. }
  175. return dvBlCompatId switch
  176. {
  177. 1 => title + " (HDR10)",
  178. 2 => title + " (SDR)",
  179. 4 => title + " (HLG)",
  180. _ => title
  181. };
  182. }
  183. return null;
  184. }
  185. }
  186. public string LocalizedUndefined { get; set; }
  187. public string LocalizedDefault { get; set; }
  188. public string LocalizedForced { get; set; }
  189. public string LocalizedExternal { get; set; }
  190. public string LocalizedHearingImpaired { get; set; }
  191. public string DisplayTitle
  192. {
  193. get
  194. {
  195. switch (Type)
  196. {
  197. case MediaStreamType.Audio:
  198. {
  199. var attributes = new List<string>();
  200. // Do not display the language code in display titles if unset or set to a special code. Show it in all other cases (possibly expanded).
  201. if (!string.IsNullOrEmpty(Language) && !_specialCodes.Contains(Language, StringComparison.OrdinalIgnoreCase))
  202. {
  203. // Get full language string i.e. eng -> English. Will not work for some languages which use ISO 639-2/B instead of /T codes.
  204. string fullLanguage = CultureInfo
  205. .GetCultures(CultureTypes.NeutralCultures)
  206. .FirstOrDefault(r => r.ThreeLetterISOLanguageName.Equals(Language, StringComparison.OrdinalIgnoreCase))
  207. ?.DisplayName;
  208. attributes.Add(StringHelper.FirstToUpper(fullLanguage ?? Language));
  209. }
  210. if (!string.IsNullOrEmpty(Codec) && !string.Equals(Codec, "dca", StringComparison.OrdinalIgnoreCase) && !string.Equals(Codec, "dts", StringComparison.OrdinalIgnoreCase))
  211. {
  212. attributes.Add(AudioCodec.GetFriendlyName(Codec));
  213. }
  214. else if (!string.IsNullOrEmpty(Profile) && !string.Equals(Profile, "lc", StringComparison.OrdinalIgnoreCase))
  215. {
  216. attributes.Add(Profile);
  217. }
  218. if (!string.IsNullOrEmpty(ChannelLayout))
  219. {
  220. attributes.Add(StringHelper.FirstToUpper(ChannelLayout));
  221. }
  222. else if (Channels.HasValue)
  223. {
  224. attributes.Add(Channels.Value.ToString(CultureInfo.InvariantCulture) + " ch");
  225. }
  226. if (IsDefault)
  227. {
  228. attributes.Add(string.IsNullOrEmpty(LocalizedDefault) ? "Default" : LocalizedDefault);
  229. }
  230. if (IsExternal)
  231. {
  232. attributes.Add(string.IsNullOrEmpty(LocalizedExternal) ? "External" : LocalizedExternal);
  233. }
  234. if (!string.IsNullOrEmpty(Title))
  235. {
  236. var result = new StringBuilder(Title);
  237. foreach (var tag in attributes)
  238. {
  239. // Keep Tags that are not already in Title.
  240. if (!Title.Contains(tag, StringComparison.OrdinalIgnoreCase))
  241. {
  242. result.Append(" - ").Append(tag);
  243. }
  244. }
  245. return result.ToString();
  246. }
  247. return string.Join(" - ", attributes);
  248. }
  249. case MediaStreamType.Video:
  250. {
  251. var attributes = new List<string>();
  252. var resolutionText = GetResolutionText();
  253. if (!string.IsNullOrEmpty(resolutionText))
  254. {
  255. attributes.Add(resolutionText);
  256. }
  257. if (!string.IsNullOrEmpty(Codec))
  258. {
  259. attributes.Add(Codec.ToUpperInvariant());
  260. }
  261. if (VideoRange != VideoRange.Unknown)
  262. {
  263. attributes.Add(VideoRange.ToString());
  264. }
  265. if (!string.IsNullOrEmpty(Title))
  266. {
  267. var result = new StringBuilder(Title);
  268. foreach (var tag in attributes)
  269. {
  270. // Keep Tags that are not already in Title.
  271. if (!Title.Contains(tag, StringComparison.OrdinalIgnoreCase))
  272. {
  273. result.Append(" - ").Append(tag);
  274. }
  275. }
  276. return result.ToString();
  277. }
  278. return string.Join(' ', attributes);
  279. }
  280. case MediaStreamType.Subtitle:
  281. {
  282. var attributes = new List<string>();
  283. if (!string.IsNullOrEmpty(Language))
  284. {
  285. // Get full language string i.e. eng -> English. Will not work for some languages which use ISO 639-2/B instead of /T codes.
  286. string fullLanguage = CultureInfo
  287. .GetCultures(CultureTypes.NeutralCultures)
  288. .FirstOrDefault(r => r.ThreeLetterISOLanguageName.Equals(Language, StringComparison.OrdinalIgnoreCase))
  289. ?.DisplayName;
  290. attributes.Add(StringHelper.FirstToUpper(fullLanguage ?? Language));
  291. }
  292. else
  293. {
  294. attributes.Add(string.IsNullOrEmpty(LocalizedUndefined) ? "Und" : LocalizedUndefined);
  295. }
  296. if (IsHearingImpaired)
  297. {
  298. attributes.Add(string.IsNullOrEmpty(LocalizedHearingImpaired) ? "Hearing Impaired" : LocalizedHearingImpaired);
  299. }
  300. if (IsDefault)
  301. {
  302. attributes.Add(string.IsNullOrEmpty(LocalizedDefault) ? "Default" : LocalizedDefault);
  303. }
  304. if (IsForced)
  305. {
  306. attributes.Add(string.IsNullOrEmpty(LocalizedForced) ? "Forced" : LocalizedForced);
  307. }
  308. if (!string.IsNullOrEmpty(Codec))
  309. {
  310. attributes.Add(Codec.ToUpperInvariant());
  311. }
  312. if (IsExternal)
  313. {
  314. attributes.Add(string.IsNullOrEmpty(LocalizedExternal) ? "External" : LocalizedExternal);
  315. }
  316. if (!string.IsNullOrEmpty(Title))
  317. {
  318. var result = new StringBuilder(Title);
  319. foreach (var tag in attributes)
  320. {
  321. // Keep Tags that are not already in Title.
  322. if (!Title.Contains(tag, StringComparison.OrdinalIgnoreCase))
  323. {
  324. result.Append(" - ").Append(tag);
  325. }
  326. }
  327. return result.ToString();
  328. }
  329. return string.Join(" - ", attributes);
  330. }
  331. default:
  332. return null;
  333. }
  334. }
  335. }
  336. public string NalLengthSize { get; set; }
  337. /// <summary>
  338. /// Gets or sets a value indicating whether this instance is interlaced.
  339. /// </summary>
  340. /// <value><c>true</c> if this instance is interlaced; otherwise, <c>false</c>.</value>
  341. public bool IsInterlaced { get; set; }
  342. public bool? IsAVC { get; set; }
  343. /// <summary>
  344. /// Gets or sets the channel layout.
  345. /// </summary>
  346. /// <value>The channel layout.</value>
  347. public string ChannelLayout { get; set; }
  348. /// <summary>
  349. /// Gets or sets the bit rate.
  350. /// </summary>
  351. /// <value>The bit rate.</value>
  352. public int? BitRate { get; set; }
  353. /// <summary>
  354. /// Gets or sets the bit depth.
  355. /// </summary>
  356. /// <value>The bit depth.</value>
  357. public int? BitDepth { get; set; }
  358. /// <summary>
  359. /// Gets or sets the reference frames.
  360. /// </summary>
  361. /// <value>The reference frames.</value>
  362. public int? RefFrames { get; set; }
  363. /// <summary>
  364. /// Gets or sets the length of the packet.
  365. /// </summary>
  366. /// <value>The length of the packet.</value>
  367. public int? PacketLength { get; set; }
  368. /// <summary>
  369. /// Gets or sets the channels.
  370. /// </summary>
  371. /// <value>The channels.</value>
  372. public int? Channels { get; set; }
  373. /// <summary>
  374. /// Gets or sets the sample rate.
  375. /// </summary>
  376. /// <value>The sample rate.</value>
  377. public int? SampleRate { get; set; }
  378. /// <summary>
  379. /// Gets or sets a value indicating whether this instance is default.
  380. /// </summary>
  381. /// <value><c>true</c> if this instance is default; otherwise, <c>false</c>.</value>
  382. public bool IsDefault { get; set; }
  383. /// <summary>
  384. /// Gets or sets a value indicating whether this instance is forced.
  385. /// </summary>
  386. /// <value><c>true</c> if this instance is forced; otherwise, <c>false</c>.</value>
  387. public bool IsForced { get; set; }
  388. /// <summary>
  389. /// Gets or sets a value indicating whether this instance is for the hearing impaired.
  390. /// </summary>
  391. /// <value><c>true</c> if this instance is for the hearing impaired; otherwise, <c>false</c>.</value>
  392. public bool IsHearingImpaired { get; set; }
  393. /// <summary>
  394. /// Gets or sets the height.
  395. /// </summary>
  396. /// <value>The height.</value>
  397. public int? Height { get; set; }
  398. /// <summary>
  399. /// Gets or sets the width.
  400. /// </summary>
  401. /// <value>The width.</value>
  402. public int? Width { get; set; }
  403. /// <summary>
  404. /// Gets or sets the average frame rate.
  405. /// </summary>
  406. /// <value>The average frame rate.</value>
  407. public float? AverageFrameRate { get; set; }
  408. /// <summary>
  409. /// Gets or sets the real frame rate.
  410. /// </summary>
  411. /// <value>The real frame rate.</value>
  412. public float? RealFrameRate { get; set; }
  413. /// <summary>
  414. /// Gets or sets the profile.
  415. /// </summary>
  416. /// <value>The profile.</value>
  417. public string Profile { get; set; }
  418. /// <summary>
  419. /// Gets or sets the type.
  420. /// </summary>
  421. /// <value>The type.</value>
  422. public MediaStreamType Type { get; set; }
  423. /// <summary>
  424. /// Gets or sets the aspect ratio.
  425. /// </summary>
  426. /// <value>The aspect ratio.</value>
  427. public string AspectRatio { get; set; }
  428. /// <summary>
  429. /// Gets or sets the index.
  430. /// </summary>
  431. /// <value>The index.</value>
  432. public int Index { get; set; }
  433. /// <summary>
  434. /// Gets or sets the score.
  435. /// </summary>
  436. /// <value>The score.</value>
  437. public int? Score { get; set; }
  438. /// <summary>
  439. /// Gets or sets a value indicating whether this instance is external.
  440. /// </summary>
  441. /// <value><c>true</c> if this instance is external; otherwise, <c>false</c>.</value>
  442. public bool IsExternal { get; set; }
  443. /// <summary>
  444. /// Gets or sets the method.
  445. /// </summary>
  446. /// <value>The method.</value>
  447. public SubtitleDeliveryMethod? DeliveryMethod { get; set; }
  448. /// <summary>
  449. /// Gets or sets the delivery URL.
  450. /// </summary>
  451. /// <value>The delivery URL.</value>
  452. public string DeliveryUrl { get; set; }
  453. /// <summary>
  454. /// Gets or sets a value indicating whether this instance is external URL.
  455. /// </summary>
  456. /// <value><c>null</c> if [is external URL] contains no value, <c>true</c> if [is external URL]; otherwise, <c>false</c>.</value>
  457. public bool? IsExternalUrl { get; set; }
  458. public bool IsTextSubtitleStream
  459. {
  460. get
  461. {
  462. if (Type != MediaStreamType.Subtitle)
  463. {
  464. return false;
  465. }
  466. if (string.IsNullOrEmpty(Codec) && !IsExternal)
  467. {
  468. return false;
  469. }
  470. return IsTextFormat(Codec);
  471. }
  472. }
  473. /// <summary>
  474. /// Gets or sets a value indicating whether [supports external stream].
  475. /// </summary>
  476. /// <value><c>true</c> if [supports external stream]; otherwise, <c>false</c>.</value>
  477. public bool SupportsExternalStream { get; set; }
  478. /// <summary>
  479. /// Gets or sets the filename.
  480. /// </summary>
  481. /// <value>The filename.</value>
  482. public string Path { get; set; }
  483. /// <summary>
  484. /// Gets or sets the pixel format.
  485. /// </summary>
  486. /// <value>The pixel format.</value>
  487. public string PixelFormat { get; set; }
  488. /// <summary>
  489. /// Gets or sets the level.
  490. /// </summary>
  491. /// <value>The level.</value>
  492. public double? Level { get; set; }
  493. /// <summary>
  494. /// Gets or sets whether this instance is anamorphic.
  495. /// </summary>
  496. /// <value><c>true</c> if this instance is anamorphic; otherwise, <c>false</c>.</value>
  497. public bool? IsAnamorphic { get; set; }
  498. internal string GetResolutionText()
  499. {
  500. if (!Width.HasValue || !Height.HasValue)
  501. {
  502. return null;
  503. }
  504. return Width switch
  505. {
  506. // 256x144 (16:9 square pixel format)
  507. <= 256 when Height <= 144 => IsInterlaced ? "144i" : "144p",
  508. // 426x240 (16:9 square pixel format)
  509. <= 426 when Height <= 240 => IsInterlaced ? "240i" : "240p",
  510. // 640x360 (16:9 square pixel format)
  511. <= 640 when Height <= 360 => IsInterlaced ? "360i" : "360p",
  512. // 682x384 (16:9 square pixel format)
  513. <= 682 when Height <= 384 => IsInterlaced ? "384i" : "384p",
  514. // 720x404 (16:9 square pixel format)
  515. <= 720 when Height <= 404 => IsInterlaced ? "404i" : "404p",
  516. // 854x480 (16:9 square pixel format)
  517. <= 854 when Height <= 480 => IsInterlaced ? "480i" : "480p",
  518. // 960x544 (16:9 square pixel format)
  519. <= 960 when Height <= 544 => IsInterlaced ? "540i" : "540p",
  520. // 1024x576 (16:9 square pixel format)
  521. <= 1024 when Height <= 576 => IsInterlaced ? "576i" : "576p",
  522. // 1280x720
  523. <= 1280 when Height <= 962 => IsInterlaced ? "720i" : "720p",
  524. // 2560x1080 (FHD ultra wide 21:9) using 1440px width to accommodate WQHD
  525. <= 2560 when Height <= 1440 => IsInterlaced ? "1080i" : "1080p",
  526. // 4K
  527. <= 4096 when Height <= 3072 => "4K",
  528. // 8K
  529. <= 8192 when Height <= 6144 => "8K",
  530. _ => null
  531. };
  532. }
  533. public static bool IsTextFormat(string format)
  534. {
  535. string codec = format ?? string.Empty;
  536. // sub = external .sub file
  537. return !codec.Contains("pgs", StringComparison.OrdinalIgnoreCase)
  538. && !codec.Contains("dvd", StringComparison.OrdinalIgnoreCase)
  539. && !codec.Contains("dvbsub", StringComparison.OrdinalIgnoreCase)
  540. && !string.Equals(codec, "sub", StringComparison.OrdinalIgnoreCase)
  541. && !string.Equals(codec, "sup", StringComparison.OrdinalIgnoreCase)
  542. && !string.Equals(codec, "dvb_subtitle", StringComparison.OrdinalIgnoreCase);
  543. }
  544. public bool SupportsSubtitleConversionTo(string toCodec)
  545. {
  546. if (!IsTextSubtitleStream)
  547. {
  548. return false;
  549. }
  550. var fromCodec = Codec;
  551. // Can't convert from this
  552. if (string.Equals(fromCodec, "ass", StringComparison.OrdinalIgnoreCase))
  553. {
  554. return false;
  555. }
  556. if (string.Equals(fromCodec, "ssa", StringComparison.OrdinalIgnoreCase))
  557. {
  558. return false;
  559. }
  560. // Can't convert to this
  561. if (string.Equals(toCodec, "ass", StringComparison.OrdinalIgnoreCase))
  562. {
  563. return false;
  564. }
  565. if (string.Equals(toCodec, "ssa", StringComparison.OrdinalIgnoreCase))
  566. {
  567. return false;
  568. }
  569. return true;
  570. }
  571. public (VideoRange VideoRange, VideoRangeType VideoRangeType) GetVideoColorRange()
  572. {
  573. if (Type != MediaStreamType.Video)
  574. {
  575. return (VideoRange.Unknown, VideoRangeType.Unknown);
  576. }
  577. var colorTransfer = ColorTransfer;
  578. if (string.Equals(colorTransfer, "smpte2084", StringComparison.OrdinalIgnoreCase))
  579. {
  580. return (VideoRange.HDR, VideoRangeType.HDR10);
  581. }
  582. if (string.Equals(colorTransfer, "arib-std-b67", StringComparison.OrdinalIgnoreCase))
  583. {
  584. return (VideoRange.HDR, VideoRangeType.HLG);
  585. }
  586. var codecTag = CodecTag;
  587. var dvProfile = DvProfile;
  588. var rpuPresentFlag = RpuPresentFlag == 1;
  589. var blPresentFlag = BlPresentFlag == 1;
  590. var dvBlCompatId = DvBlSignalCompatibilityId;
  591. var isDoViHDRProfile = dvProfile == 5 || dvProfile == 7 || dvProfile == 8;
  592. var isDoViHDRFlag = rpuPresentFlag && blPresentFlag && (dvBlCompatId == 0 || dvBlCompatId == 1 || dvBlCompatId == 4);
  593. if ((isDoViHDRProfile && isDoViHDRFlag)
  594. || string.Equals(codecTag, "dovi", StringComparison.OrdinalIgnoreCase)
  595. || string.Equals(codecTag, "dvh1", StringComparison.OrdinalIgnoreCase)
  596. || string.Equals(codecTag, "dvhe", StringComparison.OrdinalIgnoreCase)
  597. || string.Equals(codecTag, "dav1", StringComparison.OrdinalIgnoreCase))
  598. {
  599. return (VideoRange.HDR, VideoRangeType.DOVI);
  600. }
  601. return (VideoRange.SDR, VideoRangeType.SDR);
  602. }
  603. }
  604. }