Video.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. using MediaBrowser.Controller.Library;
  2. using MediaBrowser.Controller.Persistence;
  3. using MediaBrowser.Controller.Providers;
  4. using MediaBrowser.Controller.Resolvers;
  5. using MediaBrowser.Model.Dto;
  6. using MediaBrowser.Model.Entities;
  7. using MediaBrowser.Model.MediaInfo;
  8. using System;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. using System.IO;
  12. using System.Linq;
  13. using System.Runtime.Serialization;
  14. using System.Threading;
  15. using System.Threading.Tasks;
  16. namespace MediaBrowser.Controller.Entities
  17. {
  18. /// <summary>
  19. /// Class Video
  20. /// </summary>
  21. public class Video : BaseItem,
  22. IHasAspectRatio,
  23. IHasTags,
  24. ISupportsPlaceHolders,
  25. IHasMediaSources,
  26. IHasShortOverview
  27. {
  28. public bool IsMultiPart { get; set; }
  29. public bool HasLocalAlternateVersions { get; set; }
  30. public Guid? PrimaryVersionId { get; set; }
  31. public List<Guid> AdditionalPartIds { get; set; }
  32. public List<Guid> LocalAlternateVersionIds { get; set; }
  33. public string FormatName { get; set; }
  34. public long? Size { get; set; }
  35. public string Container { get; set; }
  36. public int? TotalBitrate { get; set; }
  37. public string ShortOverview { get; set; }
  38. /// <summary>
  39. /// Gets or sets the timestamp.
  40. /// </summary>
  41. /// <value>The timestamp.</value>
  42. public TransportStreamTimestamp? Timestamp { get; set; }
  43. public Video()
  44. {
  45. PlayableStreamFileNames = new List<string>();
  46. AdditionalPartIds = new List<Guid>();
  47. LocalAlternateVersionIds = new List<Guid>();
  48. Tags = new List<string>();
  49. SubtitleFiles = new List<string>();
  50. LinkedAlternateVersions = new List<LinkedChild>();
  51. }
  52. [IgnoreDataMember]
  53. public int MediaSourceCount
  54. {
  55. get
  56. {
  57. return LinkedAlternateVersions.Count + LocalAlternateVersionIds.Count + 1;
  58. }
  59. }
  60. public List<LinkedChild> LinkedAlternateVersions { get; set; }
  61. /// <summary>
  62. /// Gets the linked children.
  63. /// </summary>
  64. /// <returns>IEnumerable{BaseItem}.</returns>
  65. public IEnumerable<Video> GetAlternateVersions()
  66. {
  67. var filesWithinSameDirectory = LocalAlternateVersionIds
  68. .Select(i => LibraryManager.GetItemById(i))
  69. .Where(i => i != null)
  70. .OfType<Video>();
  71. return filesWithinSameDirectory.Concat(GetLinkedAlternateVersions())
  72. .OrderBy(i => i.SortName);
  73. }
  74. public IEnumerable<Video> GetLinkedAlternateVersions()
  75. {
  76. var linkedVersions = LinkedAlternateVersions
  77. .Select(GetLinkedChild)
  78. .Where(i => i != null)
  79. .OfType<Video>();
  80. return linkedVersions
  81. .OrderBy(i => i.SortName);
  82. }
  83. /// <summary>
  84. /// Gets the additional parts.
  85. /// </summary>
  86. /// <returns>IEnumerable{Video}.</returns>
  87. public IEnumerable<Video> GetAdditionalParts()
  88. {
  89. return AdditionalPartIds
  90. .Select(i => LibraryManager.GetItemById(i))
  91. .Where(i => i != null)
  92. .OfType<Video>()
  93. .OrderBy(i => i.SortName);
  94. }
  95. /// <summary>
  96. /// Gets or sets the subtitle paths.
  97. /// </summary>
  98. /// <value>The subtitle paths.</value>
  99. public List<string> SubtitleFiles { get; set; }
  100. /// <summary>
  101. /// Gets or sets a value indicating whether this instance has subtitles.
  102. /// </summary>
  103. /// <value><c>true</c> if this instance has subtitles; otherwise, <c>false</c>.</value>
  104. public bool HasSubtitles { get; set; }
  105. public bool IsPlaceHolder { get; set; }
  106. /// <summary>
  107. /// Gets or sets the tags.
  108. /// </summary>
  109. /// <value>The tags.</value>
  110. public List<string> Tags { get; set; }
  111. /// <summary>
  112. /// Gets or sets the video bit rate.
  113. /// </summary>
  114. /// <value>The video bit rate.</value>
  115. public int? VideoBitRate { get; set; }
  116. /// <summary>
  117. /// Gets or sets the default index of the video stream.
  118. /// </summary>
  119. /// <value>The default index of the video stream.</value>
  120. public int? DefaultVideoStreamIndex { get; set; }
  121. /// <summary>
  122. /// Gets or sets the type of the video.
  123. /// </summary>
  124. /// <value>The type of the video.</value>
  125. public VideoType VideoType { get; set; }
  126. /// <summary>
  127. /// Gets or sets the type of the iso.
  128. /// </summary>
  129. /// <value>The type of the iso.</value>
  130. public IsoType? IsoType { get; set; }
  131. /// <summary>
  132. /// Gets or sets the video3 D format.
  133. /// </summary>
  134. /// <value>The video3 D format.</value>
  135. public Video3DFormat? Video3DFormat { get; set; }
  136. /// <summary>
  137. /// If the video is a folder-rip, this will hold the file list for the largest playlist
  138. /// </summary>
  139. public List<string> PlayableStreamFileNames { get; set; }
  140. /// <summary>
  141. /// Gets the playable stream files.
  142. /// </summary>
  143. /// <returns>List{System.String}.</returns>
  144. public List<string> GetPlayableStreamFiles()
  145. {
  146. return GetPlayableStreamFiles(Path);
  147. }
  148. /// <summary>
  149. /// Gets or sets the aspect ratio.
  150. /// </summary>
  151. /// <value>The aspect ratio.</value>
  152. public string AspectRatio { get; set; }
  153. [IgnoreDataMember]
  154. public override string ContainingFolderPath
  155. {
  156. get
  157. {
  158. if (IsMultiPart)
  159. {
  160. return System.IO.Path.GetDirectoryName(Path);
  161. }
  162. if (!IsPlaceHolder)
  163. {
  164. if (VideoType == VideoType.BluRay || VideoType == VideoType.Dvd ||
  165. VideoType == VideoType.HdDvd)
  166. {
  167. return Path;
  168. }
  169. }
  170. return base.ContainingFolderPath;
  171. }
  172. }
  173. public string MainFeaturePlaylistName { get; set; }
  174. /// <summary>
  175. /// Gets the playable stream files.
  176. /// </summary>
  177. /// <param name="rootPath">The root path.</param>
  178. /// <returns>List{System.String}.</returns>
  179. public List<string> GetPlayableStreamFiles(string rootPath)
  180. {
  181. var allFiles = Directory.EnumerateFiles(rootPath, "*", SearchOption.AllDirectories).ToList();
  182. return PlayableStreamFileNames.Select(name => allFiles.FirstOrDefault(f => string.Equals(System.IO.Path.GetFileName(f), name, StringComparison.OrdinalIgnoreCase)))
  183. .Where(f => !string.IsNullOrEmpty(f))
  184. .ToList();
  185. }
  186. /// <summary>
  187. /// Gets a value indicating whether [is3 D].
  188. /// </summary>
  189. /// <value><c>true</c> if [is3 D]; otherwise, <c>false</c>.</value>
  190. [IgnoreDataMember]
  191. public bool Is3D
  192. {
  193. get { return Video3DFormat.HasValue; }
  194. }
  195. public bool IsHD { get; set; }
  196. /// <summary>
  197. /// Gets the type of the media.
  198. /// </summary>
  199. /// <value>The type of the media.</value>
  200. public override string MediaType
  201. {
  202. get
  203. {
  204. return Model.Entities.MediaType.Video;
  205. }
  206. }
  207. protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
  208. {
  209. var hasChanges = await base.RefreshedOwnedItems(options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
  210. // Must have a parent to have additional parts or alternate versions
  211. // In other words, it must be part of the Parent/Child tree
  212. // The additional parts won't have additional parts themselves
  213. if (LocationType == LocationType.FileSystem && Parent != null)
  214. {
  215. if (IsMultiPart)
  216. {
  217. var additionalPartsChanged = await RefreshAdditionalParts(options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
  218. if (additionalPartsChanged)
  219. {
  220. hasChanges = true;
  221. }
  222. }
  223. else
  224. {
  225. RefreshLinkedAlternateVersions();
  226. var additionalPartsChanged = await RefreshAlternateVersionsWithinSameDirectory(options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
  227. if (additionalPartsChanged)
  228. {
  229. hasChanges = true;
  230. }
  231. }
  232. }
  233. return hasChanges;
  234. }
  235. private bool RefreshLinkedAlternateVersions()
  236. {
  237. foreach (var child in LinkedAlternateVersions)
  238. {
  239. // Reset the cached value
  240. if (child.ItemId.HasValue && child.ItemId.Value == Guid.Empty)
  241. {
  242. child.ItemId = null;
  243. }
  244. }
  245. return false;
  246. }
  247. /// <summary>
  248. /// Refreshes the additional parts.
  249. /// </summary>
  250. /// <param name="options">The options.</param>
  251. /// <param name="fileSystemChildren">The file system children.</param>
  252. /// <param name="cancellationToken">The cancellation token.</param>
  253. /// <returns>Task{System.Boolean}.</returns>
  254. private async Task<bool> RefreshAdditionalParts(MetadataRefreshOptions options, IEnumerable<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
  255. {
  256. var newItems = LoadAdditionalParts(fileSystemChildren, options.DirectoryService).ToList();
  257. var newItemIds = newItems.Select(i => i.Id).ToList();
  258. var itemsChanged = !AdditionalPartIds.SequenceEqual(newItemIds);
  259. var tasks = newItems.Select(i => i.RefreshMetadata(options, cancellationToken));
  260. await Task.WhenAll(tasks).ConfigureAwait(false);
  261. AdditionalPartIds = newItemIds;
  262. return itemsChanged;
  263. }
  264. /// <summary>
  265. /// Loads the additional parts.
  266. /// </summary>
  267. /// <returns>IEnumerable{Video}.</returns>
  268. private IEnumerable<Video> LoadAdditionalParts(IEnumerable<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
  269. {
  270. IEnumerable<FileSystemInfo> files;
  271. var path = Path;
  272. if (VideoType == VideoType.BluRay || VideoType == VideoType.Dvd)
  273. {
  274. files = fileSystemChildren.Where(i =>
  275. {
  276. if ((i.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
  277. {
  278. return !string.Equals(i.FullName, path, StringComparison.OrdinalIgnoreCase) && EntityResolutionHelper.IsMultiPartFolder(i.FullName) && EntityResolutionHelper.IsMultiPartFile(i.Name);
  279. }
  280. return false;
  281. });
  282. }
  283. else
  284. {
  285. files = fileSystemChildren.Where(i =>
  286. {
  287. if ((i.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
  288. {
  289. return false;
  290. }
  291. return !string.Equals(i.FullName, path, StringComparison.OrdinalIgnoreCase) && EntityResolutionHelper.IsVideoFile(i.FullName) && EntityResolutionHelper.IsMultiPartFile(i.Name);
  292. });
  293. }
  294. return LibraryManager.ResolvePaths<Video>(files, directoryService, null).Select(video =>
  295. {
  296. // Try to retrieve it from the db. If we don't find it, use the resolved version
  297. var dbItem = LibraryManager.GetItemById(video.Id) as Video;
  298. if (dbItem != null)
  299. {
  300. video = dbItem;
  301. }
  302. return video;
  303. // Sort them so that the list can be easily compared for changes
  304. }).OrderBy(i => i.Path).ToList();
  305. }
  306. private async Task<bool> RefreshAlternateVersionsWithinSameDirectory(MetadataRefreshOptions options, IEnumerable<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
  307. {
  308. var newItems = HasLocalAlternateVersions ?
  309. LoadAlternateVersionsWithinSameDirectory(fileSystemChildren, options.DirectoryService).ToList() :
  310. new List<Video>();
  311. var newItemIds = newItems.Select(i => i.Id).ToList();
  312. var itemsChanged = !LocalAlternateVersionIds.SequenceEqual(newItemIds);
  313. var tasks = newItems.Select(i => RefreshAlternateVersion(options, i, cancellationToken));
  314. await Task.WhenAll(tasks).ConfigureAwait(false);
  315. LocalAlternateVersionIds = newItemIds;
  316. return itemsChanged;
  317. }
  318. private Task RefreshAlternateVersion(MetadataRefreshOptions options, Video video, CancellationToken cancellationToken)
  319. {
  320. var currentImagePath = video.GetImagePath(ImageType.Primary);
  321. var ownerImagePath = this.GetImagePath(ImageType.Primary);
  322. var newOptions = new MetadataRefreshOptions
  323. {
  324. DirectoryService = options.DirectoryService,
  325. ImageRefreshMode = options.ImageRefreshMode,
  326. MetadataRefreshMode = options.MetadataRefreshMode,
  327. ReplaceAllMetadata = options.ReplaceAllMetadata
  328. };
  329. if (!string.Equals(currentImagePath, ownerImagePath, StringComparison.OrdinalIgnoreCase))
  330. {
  331. newOptions.ForceSave = true;
  332. if (string.IsNullOrWhiteSpace(ownerImagePath))
  333. {
  334. video.ImageInfos.Clear();
  335. }
  336. else
  337. {
  338. video.SetImagePath(ImageType.Primary, ownerImagePath);
  339. }
  340. }
  341. return video.RefreshMetadata(newOptions, cancellationToken);
  342. }
  343. public override async Task UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken)
  344. {
  345. await base.UpdateToRepository(updateReason, cancellationToken).ConfigureAwait(false);
  346. foreach (var item in LocalAlternateVersionIds.Select(i => LibraryManager.GetItemById(i)))
  347. {
  348. item.ImageInfos = ImageInfos;
  349. item.Overview = Overview;
  350. item.ProductionYear = ProductionYear;
  351. item.PremiereDate = PremiereDate;
  352. item.CommunityRating = CommunityRating;
  353. item.OfficialRating = OfficialRating;
  354. item.Genres = Genres;
  355. item.ProviderIds = ProviderIds;
  356. await item.UpdateToRepository(ItemUpdateType.MetadataDownload, cancellationToken).ConfigureAwait(false);
  357. }
  358. }
  359. /// <summary>
  360. /// Loads the additional parts.
  361. /// </summary>
  362. /// <returns>IEnumerable{Video}.</returns>
  363. private IEnumerable<Video> LoadAlternateVersionsWithinSameDirectory(IEnumerable<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
  364. {
  365. IEnumerable<FileSystemInfo> files;
  366. // Only support this for video files. For folder rips, they'll have to use the linking feature
  367. if (VideoType == VideoType.VideoFile || VideoType == VideoType.Iso)
  368. {
  369. var path = Path;
  370. var filenamePrefix = System.IO.Path.GetFileName(System.IO.Path.GetDirectoryName(path));
  371. files = fileSystemChildren.Where(i =>
  372. {
  373. if ((i.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
  374. {
  375. return false;
  376. }
  377. return !string.Equals(i.FullName, path, StringComparison.OrdinalIgnoreCase) &&
  378. EntityResolutionHelper.IsVideoFile(i.FullName) &&
  379. i.Name.StartsWith(filenamePrefix + " - ", StringComparison.OrdinalIgnoreCase);
  380. });
  381. }
  382. else
  383. {
  384. files = new List<FileSystemInfo>();
  385. }
  386. return LibraryManager.ResolvePaths<Video>(files, directoryService, null).Select(video =>
  387. {
  388. // Try to retrieve it from the db. If we don't find it, use the resolved version
  389. var dbItem = LibraryManager.GetItemById(video.Id) as Video;
  390. if (dbItem != null)
  391. {
  392. video = dbItem;
  393. }
  394. video.PrimaryVersionId = Id;
  395. return video;
  396. // Sort them so that the list can be easily compared for changes
  397. }).OrderBy(i => i.Path).ToList();
  398. }
  399. public override IEnumerable<string> GetDeletePaths()
  400. {
  401. if (!IsInMixedFolder)
  402. {
  403. return new[] { ContainingFolderPath };
  404. }
  405. return base.GetDeletePaths();
  406. }
  407. public virtual IEnumerable<MediaStream> GetMediaStreams()
  408. {
  409. return ItemRepository.GetMediaStreams(new MediaStreamQuery
  410. {
  411. ItemId = Id
  412. });
  413. }
  414. public virtual MediaStream GetDefaultVideoStream()
  415. {
  416. if (!DefaultVideoStreamIndex.HasValue)
  417. {
  418. return null;
  419. }
  420. return ItemRepository.GetMediaStreams(new MediaStreamQuery
  421. {
  422. ItemId = Id,
  423. Index = DefaultVideoStreamIndex.Value
  424. }).FirstOrDefault();
  425. }
  426. public virtual IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
  427. {
  428. var item = this;
  429. var result = item.GetAlternateVersions()
  430. .Select(i => GetVersionInfo(enablePathSubstitution, i, MediaSourceType.Grouping))
  431. .ToList();
  432. result.Add(GetVersionInfo(enablePathSubstitution, item, MediaSourceType.Default));
  433. return result.OrderBy(i =>
  434. {
  435. if (item.VideoType == VideoType.VideoFile)
  436. {
  437. return 0;
  438. }
  439. return 1;
  440. }).ThenBy(i => i.Video3DFormat.HasValue ? 1 : 0)
  441. .ThenByDescending(i =>
  442. {
  443. var stream = i.VideoStream;
  444. return stream == null || stream.Width == null ? 0 : stream.Width.Value;
  445. })
  446. .ToList();
  447. }
  448. private static MediaSourceInfo GetVersionInfo(bool enablePathSubstitution, Video i, MediaSourceType type)
  449. {
  450. var mediaStreams = ItemRepository.GetMediaStreams(new MediaStreamQuery { ItemId = i.Id }).ToList();
  451. var locationType = i.LocationType;
  452. var info = new MediaSourceInfo
  453. {
  454. Id = i.Id.ToString("N"),
  455. IsoType = i.IsoType,
  456. Protocol = locationType == LocationType.Remote ? MediaProtocol.Http : MediaProtocol.File,
  457. MediaStreams = mediaStreams,
  458. Name = GetMediaSourceName(i, mediaStreams),
  459. Path = enablePathSubstitution ? GetMappedPath(i.Path, locationType) : i.Path,
  460. RunTimeTicks = i.RunTimeTicks,
  461. Video3DFormat = i.Video3DFormat,
  462. VideoType = i.VideoType,
  463. Container = i.Container,
  464. Size = i.Size,
  465. Formats = (i.FormatName ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(),
  466. Timestamp = i.Timestamp,
  467. Type = type,
  468. PlayableStreamFileNames = i.PlayableStreamFileNames.ToList()
  469. };
  470. if (string.IsNullOrEmpty(info.Container))
  471. {
  472. if (i.VideoType == VideoType.VideoFile || i.VideoType == VideoType.Iso)
  473. {
  474. if (!string.IsNullOrWhiteSpace(i.Path) && locationType != LocationType.Remote && locationType != LocationType.Virtual)
  475. {
  476. info.Container = System.IO.Path.GetExtension(i.Path).TrimStart('.');
  477. }
  478. }
  479. }
  480. try
  481. {
  482. var bitrate = i.TotalBitrate ??
  483. info.MediaStreams.Where(m => m.Type != MediaStreamType.Subtitle && !string.Equals(m.Codec, "mjpeg", StringComparison.OrdinalIgnoreCase))
  484. .Select(m => m.BitRate ?? 0)
  485. .Sum();
  486. if (bitrate > 0)
  487. {
  488. info.Bitrate = bitrate;
  489. }
  490. }
  491. catch (OverflowException ex)
  492. {
  493. Logger.ErrorException("Error calculating total bitrate", ex);
  494. }
  495. return info;
  496. }
  497. private static string GetMediaSourceName(Video video, List<MediaStream> mediaStreams)
  498. {
  499. var terms = new List<string>();
  500. var videoStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);
  501. var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
  502. if (video.Video3DFormat.HasValue)
  503. {
  504. terms.Add("3D");
  505. }
  506. if (video.VideoType == VideoType.BluRay)
  507. {
  508. terms.Add("Bluray");
  509. }
  510. else if (video.VideoType == VideoType.Dvd)
  511. {
  512. terms.Add("DVD");
  513. }
  514. else if (video.VideoType == VideoType.HdDvd)
  515. {
  516. terms.Add("HD-DVD");
  517. }
  518. else if (video.VideoType == VideoType.Iso)
  519. {
  520. if (video.IsoType.HasValue)
  521. {
  522. if (video.IsoType.Value == Model.Entities.IsoType.BluRay)
  523. {
  524. terms.Add("Bluray");
  525. }
  526. else if (video.IsoType.Value == Model.Entities.IsoType.Dvd)
  527. {
  528. terms.Add("DVD");
  529. }
  530. }
  531. else
  532. {
  533. terms.Add("ISO");
  534. }
  535. }
  536. if (videoStream != null)
  537. {
  538. if (videoStream.Width.HasValue)
  539. {
  540. if (videoStream.Width.Value >= 3800)
  541. {
  542. terms.Add("4K");
  543. }
  544. else if (videoStream.Width.Value >= 1900)
  545. {
  546. terms.Add("1080P");
  547. }
  548. else if (videoStream.Width.Value >= 1270)
  549. {
  550. terms.Add("720P");
  551. }
  552. else if (videoStream.Width.Value >= 700)
  553. {
  554. terms.Add("480P");
  555. }
  556. else
  557. {
  558. terms.Add("SD");
  559. }
  560. }
  561. }
  562. if (videoStream != null && !string.IsNullOrWhiteSpace(videoStream.Codec))
  563. {
  564. terms.Add(videoStream.Codec.ToUpper());
  565. }
  566. if (audioStream != null)
  567. {
  568. var audioCodec = string.Equals(audioStream.Codec, "dca", StringComparison.OrdinalIgnoreCase)
  569. ? audioStream.Profile
  570. : audioStream.Codec;
  571. if (!string.IsNullOrEmpty(audioCodec))
  572. {
  573. terms.Add(audioCodec.ToUpper());
  574. }
  575. }
  576. return string.Join("/", terms.ToArray());
  577. }
  578. }
  579. }