aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-05-01 22:44:52 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-05-01 22:44:52 -0400
commitb11d06f36f31317f072e6cd1a27bd7d06b5f0c17 (patch)
treea8144b47e8a7eb11e0e0b74b386f1e7912f420b1
parente9cfa6cd267786f8fd97ef2aeb88941c98c8aacf (diff)
more work on streaming remotely
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs24
-rw-r--r--MediaBrowser.Common/Plugins/BasePlugin.cs2
-rw-r--r--MediaBrowser.Controller/Entities/BasePluginFolder.cs13
-rw-r--r--MediaBrowser.Controller/Entities/Video.cs7
-rw-r--r--MediaBrowser.Controller/Providers/ImageFromMediaLocationProvider.cs5
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs2
6 files changed, 35 insertions, 18 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index f09b9f684..3e5da5b53 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -264,30 +264,24 @@ namespace MediaBrowser.Api.Playback
}
// If a max width was requested
- if (request.MaxWidth.HasValue && !request.MaxHeight.HasValue)
+ if (request.MaxWidth.HasValue && (!request.MaxHeight.HasValue || state.VideoStream == null))
{
return isH264Output ?
string.Format(" -vf \"scale=min(iw\\,{0}):trunc(ow/a/2)*2{1}\"", request.MaxWidth.Value, assSubtitleParam) :
string.Format(" -vf \"scale=min(iw\\,{0}):-1{1}\"", request.MaxWidth.Value, assSubtitleParam);
}
+ if (state.VideoStream == null)
+ {
+ // No way to figure this out
+ return string.Empty;
+ }
+
// Need to perform calculations manually
// Try to account for bad media info
- var currentHeight = request.MaxHeight ?? request.Height ?? 0;
- var currentWidth = request.MaxWidth ?? request.Width ?? 0;
-
- if (state.VideoStream != null)
- {
- if (state.VideoStream.Height.HasValue)
- {
- currentHeight = state.VideoStream.Height.Value;
- }
- if (state.VideoStream.Width.HasValue)
- {
- currentWidth = state.VideoStream.Width.Value;
- }
- }
+ var currentHeight = state.VideoStream.Height ?? request.MaxHeight ?? request.Height ?? 0;
+ var currentWidth = state.VideoStream.Width ?? request.MaxWidth ?? request.Width ?? 0;
var outputSize = DrawingUtils.Resize(currentWidth, currentHeight, request.Width, request.Height, request.MaxWidth, request.MaxHeight);
diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs
index f90cd2c0f..3a7a57455 100644
--- a/MediaBrowser.Common/Plugins/BasePlugin.cs
+++ b/MediaBrowser.Common/Plugins/BasePlugin.cs
@@ -253,6 +253,8 @@ namespace MediaBrowser.Common.Plugins
{
ApplicationPaths = applicationPaths;
XmlSerializer = xmlSerializer;
+
+ IsFirstRun = !File.Exists(ConfigurationFilePath);
}
/// <summary>
diff --git a/MediaBrowser.Controller/Entities/BasePluginFolder.cs b/MediaBrowser.Controller/Entities/BasePluginFolder.cs
index ca6cfd246..bf8040a9f 100644
--- a/MediaBrowser.Controller/Entities/BasePluginFolder.cs
+++ b/MediaBrowser.Controller/Entities/BasePluginFolder.cs
@@ -29,8 +29,21 @@ namespace MediaBrowser.Controller.Entities
{
base.Id = value;
}
+ }
+
+ /// <summary>
+ /// Gets or sets the type of the location.
+ /// </summary>
+ /// <value>The type of the location.</value>
+ public override LocationType LocationType
+ {
+ get
+ {
+ return LocationType.Virtual;
+ }
}
+
/// <summary>
/// We don't resolve normally so need to fill this in
/// </summary>
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index b3ed21b19..bac29f0f5 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -11,6 +11,13 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
public class Video : BaseItem, IHasMediaStreams
{
+ public Video()
+ {
+ MediaStreams = new List<MediaStream>();
+ Chapters = new List<ChapterInfo>();
+ PlayableStreamFileNames = new List<string>();
+ }
+
/// <summary>
/// Gets or sets the type of the video.
/// </summary>
diff --git a/MediaBrowser.Controller/Providers/ImageFromMediaLocationProvider.cs b/MediaBrowser.Controller/Providers/ImageFromMediaLocationProvider.cs
index cb3445dd3..5a9f5890e 100644
--- a/MediaBrowser.Controller/Providers/ImageFromMediaLocationProvider.cs
+++ b/MediaBrowser.Controller/Providers/ImageFromMediaLocationProvider.cs
@@ -1,14 +1,13 @@
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.IO;
using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Logging;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-using MediaBrowser.Model.Logging;
namespace MediaBrowser.Controller.Providers
{
@@ -29,7 +28,7 @@ namespace MediaBrowser.Controller.Providers
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
public override bool Supports(BaseItem item)
{
- return item.ResolveArgs.IsDirectory && item.LocationType == LocationType.FileSystem;
+ return item.LocationType == LocationType.FileSystem && item.ResolveArgs.IsDirectory;
}
/// <summary>
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index b89ed54e3..b78aa88f3 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -518,6 +518,8 @@ namespace MediaBrowser.Server.Implementations.Library
// Add in the plug-in folders
foreach (var child in PluginFolderCreators)
{
+ var folder = child.GetFolder();
+
rootFolder.AddVirtualChild(child.GetFolder());
}