Video.cs 24 KB

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