Normalize orgPn usage

This commit is contained in:
Luke Pulverenti
2014-04-22 22:47:46 -04:00
parent fdd8c67162
commit 44bfad70d2
13 changed files with 302 additions and 157 deletions

View File

@@ -1,4 +1,5 @@
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
@@ -56,6 +57,8 @@ namespace MediaBrowser.Model.Dlna
public MediaSourceInfo MediaSource { get; set; }
public TransportStreamTimestamp TargetTimestamp { get; set; }
public string MediaSourceId
{
get
@@ -252,6 +255,68 @@ namespace MediaBrowser.Model.Dlna
: stream == null ? null : stream.Channels;
}
}
public int? TotalOutputBitrate
{
get
{
return (TargetAudioBitrate ?? 0) + (VideoBitrate ?? 0);
}
}
public int? TargetWidth
{
get
{
var videoStream = TargetVideoStream;
if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue)
{
var size = new ImageSize
{
Width = videoStream.Width.Value,
Height = videoStream.Height.Value
};
var newSize = DrawingUtils.Resize(size,
null,
null,
MaxWidth,
MaxHeight);
return Convert.ToInt32(newSize.Width);
}
return MaxWidth;
}
}
public int? TargetHeight
{
get
{
var videoStream = TargetVideoStream;
if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue)
{
var size = new ImageSize
{
Width = videoStream.Width.Value,
Height = videoStream.Height.Value
};
var newSize = DrawingUtils.Resize(size,
null,
null,
MaxWidth,
MaxHeight);
return Convert.ToInt32(newSize.Height);
}
return MaxHeight;
}
}
}
/// <summary>