The Free Software Media System - Server Backend & API
Add new MediaAttachment to store attachments found during media probing.
Andrew Mahone321e5cba6082
diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.csindex 54d02fc9f7..2c001d775a 100644--- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs+++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs@@ -49,6 +49,10 @@ namespace MediaBrowser.MediaEncoding.Probing.Where(i => i.Type != MediaStreamType.Subtitle || !string.IsNullOrWhiteSpace(i.Codec)).ToList();+ info.MediaAttachments = internalStreams.Select(s => GetMediaAttachment(s))+ .Where(i => i != null)+ .ToList();+if (data.format != null){info.Container = NormalizeFormat(data.format.format_name);@@ -513,6 +517,40 @@ namespace MediaBrowser.MediaEncoding.Probingreturn codec;}+ /// <summary>+ /// Converts ffprobe stream info to our MediaAttachment class+ /// </summary>+ /// <param name="streamInfo">The stream info.</param>+ /// <returns>MediaAttachments.</returns>+ private MediaAttachment GetMediaAttachment(MediaStreamInfo streamInfo)+ {+ if (!string.Equals(streamInfo.codec_type, "attachment", StringComparison.OrdinalIgnoreCase))+ {+ return null;+ }++ var attachment = new MediaAttachment+ {+ Codec = streamInfo.codec_name,+ Index = streamInfo.index+ };++ // Filter out junk+ if (!string.IsNullOrWhiteSpace(streamInfo.codec_tag_string) && streamInfo.codec_tag_string.IndexOf("[0]", StringComparison.OrdinalIgnoreCase) == -1)+ {+ attachment.CodecTag = streamInfo.codec_tag_string;+ }++ if (streamInfo.tags != null)+ {+ attachment.Filename = GetDictionaryValue(streamInfo.tags, "filename");+ attachment.MIMEType = GetDictionaryValue(streamInfo.tags, "mimetype");+ attachment.Comment = GetDictionaryValue(streamInfo.tags, "comment");+ }++ return attachment;+ }+/// <summary>/// Converts ffprobe stream info to our MediaStream class/// </summary>diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.csindex 5bdc4809a9..8a1aa55b69 100644--- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs+++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs@@ -57,6 +57,8 @@ namespace MediaBrowser.Model.Dtopublic List<MediaStream> MediaStreams { get; set; }+ public List<MediaAttachment> MediaAttachments { get; set; }+public string[] Formats { get; set; }public int? Bitrate { get; set; }diff --git a/MediaBrowser.Model/Entities/MediaAttachment.cs b/MediaBrowser.Model/Entities/MediaAttachment.csnew file mode 100644index 0000000000..daabbe91df--- /dev/null+++ b/MediaBrowser.Model/Entities/MediaAttachment.cs@@ -0,0 +1,44 @@+namespace MediaBrowser.Model.Entities+{+ /// <summary>+ /// Class MediaAttachment+ /// </summary>+ public class MediaAttachment+ {+ /// <summary>+ /// Gets or sets the codec.+ /// </summary>+ /// <value>The codec.</value>+ public string Codec { get; set; }++ /// <summary>+ /// Gets or sets the codec tag.+ /// </summary>+ /// <value>The codec tag.</value>+ public string CodecTag { get; set; }++ /// <summary>+ /// Gets or sets the comment.+ /// </summary>+ /// <value>The comment.</value>+ public string Comment { get; set; }++ /// <summary>+ /// Gets or sets the index.+ /// </summary>+ /// <value>The index.</value>+ public int Index { get; set; }++ /// <summary>+ /// Gets or sets the filename.+ /// </summary>+ /// <value>The filename.</value>+ public string Filename { get; set; }++ /// <summary>+ /// Gets or sets the MIME type.+ /// </summary>+ /// <value>The MIME type.</value>+ public string MIMEType { get; set; }+ }+}