2014-05-12 11:04:25 -07:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
2014-05-31 21:11:04 -07:00
|
|
|
|
using MediaBrowser.Model.Extensions;
|
2014-04-24 19:00:19 -07:00
|
|
|
|
using MediaBrowser.Model.MediaInfo;
|
2014-04-30 20:24:55 -07:00
|
|
|
|
using System.Collections.Generic;
|
2014-05-12 11:04:25 -07:00
|
|
|
|
using System.Runtime.Serialization;
|
2014-03-18 21:59:45 -07:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Model.Dto
|
|
|
|
|
{
|
2014-03-22 09:16:43 -07:00
|
|
|
|
public class MediaSourceInfo
|
2014-03-18 21:59:45 -07:00
|
|
|
|
{
|
2014-06-16 18:56:23 -07:00
|
|
|
|
public MediaProtocol Protocol { get; set; }
|
2014-03-21 20:35:03 -07:00
|
|
|
|
public string Id { get; set; }
|
2014-03-18 21:59:45 -07:00
|
|
|
|
|
|
|
|
|
public string Path { get; set; }
|
|
|
|
|
|
2014-06-02 19:01:30 -07:00
|
|
|
|
public MediaSourceType Type { get; set; }
|
|
|
|
|
|
2014-04-01 15:23:07 -07:00
|
|
|
|
public string Container { get; set; }
|
2014-04-17 22:03:01 -07:00
|
|
|
|
public long? Size { get; set; }
|
2014-04-01 15:23:07 -07:00
|
|
|
|
|
2014-03-18 21:59:45 -07:00
|
|
|
|
public string Name { get; set; }
|
2014-05-09 16:08:08 -07:00
|
|
|
|
|
2014-03-18 21:59:45 -07:00
|
|
|
|
public long? RunTimeTicks { get; set; }
|
2014-10-25 11:32:58 -07:00
|
|
|
|
public bool ReadAtNativeFramerate { get; set; }
|
2015-03-02 11:48:21 -07:00
|
|
|
|
public bool SupportsTranscoding { get; set; }
|
2014-03-18 21:59:45 -07:00
|
|
|
|
|
|
|
|
|
public VideoType? VideoType { get; set; }
|
|
|
|
|
|
|
|
|
|
public IsoType? IsoType { get; set; }
|
|
|
|
|
|
|
|
|
|
public Video3DFormat? Video3DFormat { get; set; }
|
2014-05-09 16:08:08 -07:00
|
|
|
|
|
2014-03-18 21:59:45 -07:00
|
|
|
|
public List<MediaStream> MediaStreams { get; set; }
|
2014-06-11 19:38:40 -07:00
|
|
|
|
public List<string> PlayableStreamFileNames { get; set; }
|
2014-04-06 10:53:23 -07:00
|
|
|
|
|
2014-04-17 22:03:01 -07:00
|
|
|
|
public List<string> Formats { get; set; }
|
2014-05-09 16:08:08 -07:00
|
|
|
|
|
2014-04-06 10:53:23 -07:00
|
|
|
|
public int? Bitrate { get; set; }
|
2014-04-17 22:03:01 -07:00
|
|
|
|
|
2014-04-24 19:45:06 -07:00
|
|
|
|
public TransportStreamTimestamp? Timestamp { get; set; }
|
2014-06-02 12:32:41 -07:00
|
|
|
|
public Dictionary<string, string> RequiredHttpHeaders { get; set; }
|
2014-05-09 16:08:08 -07:00
|
|
|
|
|
2014-04-17 22:03:01 -07:00
|
|
|
|
public MediaSourceInfo()
|
|
|
|
|
{
|
|
|
|
|
Formats = new List<string>();
|
|
|
|
|
MediaStreams = new List<MediaStream>();
|
2014-06-02 12:32:41 -07:00
|
|
|
|
RequiredHttpHeaders = new Dictionary<string, string>();
|
2014-06-11 19:38:40 -07:00
|
|
|
|
PlayableStreamFileNames = new List<string>();
|
2015-03-02 11:48:21 -07:00
|
|
|
|
SupportsTranscoding = true;
|
2014-04-17 22:03:01 -07:00
|
|
|
|
}
|
2014-05-09 16:08:08 -07:00
|
|
|
|
|
2014-05-12 11:04:25 -07:00
|
|
|
|
public int? DefaultAudioStreamIndex { get; set; }
|
|
|
|
|
public int? DefaultSubtitleStreamIndex { get; set; }
|
|
|
|
|
|
2014-05-09 16:08:08 -07:00
|
|
|
|
[IgnoreDataMember]
|
|
|
|
|
public MediaStream DefaultAudioStream
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2014-05-12 11:04:25 -07:00
|
|
|
|
if (DefaultAudioStreamIndex.HasValue)
|
|
|
|
|
{
|
|
|
|
|
var val = DefaultAudioStreamIndex.Value;
|
|
|
|
|
|
|
|
|
|
foreach (MediaStream i in MediaStreams)
|
|
|
|
|
{
|
|
|
|
|
if (i.Type == MediaStreamType.Audio && i.Index == val)
|
|
|
|
|
{
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-09 16:08:08 -07:00
|
|
|
|
foreach (MediaStream i in MediaStreams)
|
|
|
|
|
{
|
|
|
|
|
if (i.Type == MediaStreamType.Audio && i.IsDefault)
|
|
|
|
|
{
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (MediaStream i in MediaStreams)
|
|
|
|
|
{
|
|
|
|
|
if (i.Type == MediaStreamType.Audio)
|
|
|
|
|
{
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[IgnoreDataMember]
|
|
|
|
|
public MediaStream VideoStream
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
foreach (MediaStream i in MediaStreams)
|
|
|
|
|
{
|
2014-05-31 21:11:04 -07:00
|
|
|
|
if (i.Type == MediaStreamType.Video && StringHelper.IndexOfIgnoreCase((i.Codec ?? string.Empty), "jpeg") == -1)
|
2014-05-09 16:08:08 -07:00
|
|
|
|
{
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-07-18 12:07:28 -07:00
|
|
|
|
|
|
|
|
|
public MediaStream GetMediaStream(MediaStreamType type, int index)
|
|
|
|
|
{
|
|
|
|
|
foreach (MediaStream i in MediaStreams)
|
|
|
|
|
{
|
|
|
|
|
if (i.Type == type && i.Index == index)
|
|
|
|
|
{
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2014-03-18 21:59:45 -07:00
|
|
|
|
}
|
|
|
|
|
}
|