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