diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
index 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.Probing
return codec;
}
+ ///
+ /// Converts ffprobe stream info to our MediaAttachment class
+ ///
+ /// The stream info.
+ /// MediaAttachments.
+ 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;
+ }
+
///
/// Converts ffprobe stream info to our MediaStream class
///
diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.cs
index 5bdc4809a9..8a1aa55b69 100644
--- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs
+++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs
@@ -57,6 +57,8 @@ namespace MediaBrowser.Model.Dto
public List MediaStreams { get; set; }
+ public List 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.cs
new file mode 100644
index 0000000000..daabbe91df
--- /dev/null
+++ b/MediaBrowser.Model/Entities/MediaAttachment.cs
@@ -0,0 +1,44 @@
+namespace MediaBrowser.Model.Entities
+{
+ ///
+ /// Class MediaAttachment
+ ///
+ public class MediaAttachment
+ {
+ ///
+ /// Gets or sets the codec.
+ ///
+ /// The codec.
+ public string Codec { get; set; }
+
+ ///
+ /// Gets or sets the codec tag.
+ ///
+ /// The codec tag.
+ public string CodecTag { get; set; }
+
+ ///
+ /// Gets or sets the comment.
+ ///
+ /// The comment.
+ public string Comment { get; set; }
+
+ ///
+ /// Gets or sets the index.
+ ///
+ /// The index.
+ public int Index { get; set; }
+
+ ///
+ /// Gets or sets the filename.
+ ///
+ /// The filename.
+ public string Filename { get; set; }
+
+ ///
+ /// Gets or sets the MIME type.
+ ///
+ /// The MIME type.
+ public string MIMEType { get; set; }
+ }
+}