fixes #619 - Command line fail for internal subs

This commit is contained in:
Luke Pulverenti 2013-11-20 10:50:54 -05:00
parent f727179222
commit 7dd75e079a
4 changed files with 31 additions and 25 deletions

View File

@ -1,5 +1,4 @@
using System.Globalization; using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Common.MediaInfo; using MediaBrowser.Common.MediaInfo;
using MediaBrowser.Controller; using MediaBrowser.Controller;
@ -11,15 +10,15 @@ using MediaBrowser.Controller.MediaInfo;
using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Api.Playback namespace MediaBrowser.Api.Playback
{ {

View File

@ -88,7 +88,7 @@ namespace MediaBrowser.Api.Playback.Hls
} }
var volParam = string.Empty; var volParam = string.Empty;
var AudioSampleRate = string.Empty; var audioSampleRate = string.Empty;
// Boost volume to 200% when downsampling from 6ch to 2ch // Boost volume to 200% when downsampling from 6ch to 2ch
if (channels.HasValue && channels.Value <= 2 && state.AudioStream.Channels.HasValue && state.AudioStream.Channels.Value > 5) if (channels.HasValue && channels.Value <= 2 && state.AudioStream.Channels.HasValue && state.AudioStream.Channels.Value > 5)
@ -98,10 +98,10 @@ namespace MediaBrowser.Api.Playback.Hls
if (state.Request.AudioSampleRate.HasValue) if (state.Request.AudioSampleRate.HasValue)
{ {
AudioSampleRate= state.Request.AudioSampleRate.Value + ":"; audioSampleRate= state.Request.AudioSampleRate.Value + ":";
} }
args += string.Format(" -af \"adelay=1,aresample={0}async=1000{1}\"",AudioSampleRate, volParam); args += string.Format(" -af \"adelay=1,aresample={0}async=1000{1}\"",audioSampleRate, volParam);
return args; return args;
} }
@ -127,6 +127,10 @@ namespace MediaBrowser.Api.Playback.Hls
const string keyFrameArg = " -force_key_frames expr:if(isnan(prev_forced_t),gte(t,.1),gte(t,prev_forced_t+5))"; const string keyFrameArg = " -force_key_frames expr:if(isnan(prev_forced_t),gte(t,.1),gte(t,prev_forced_t+5))";
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsExternal &&
(state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 ||
state.SubtitleStream.Codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1);
var args = "-codec:v:0 " + codec + " -preset superfast" + keyFrameArg; var args = "-codec:v:0 " + codec + " -preset superfast" + keyFrameArg;
var bitrate = GetVideoBitrateParam(state); var bitrate = GetVideoBitrateParam(state);
@ -137,9 +141,12 @@ namespace MediaBrowser.Api.Playback.Hls
} }
// Add resolution params, if specified // Add resolution params, if specified
if (state.VideoRequest.Width.HasValue || state.VideoRequest.Height.HasValue || state.VideoRequest.MaxHeight.HasValue || state.VideoRequest.MaxWidth.HasValue) if (!hasGraphicalSubs)
{ {
args += GetOutputSizeParam(state, codec, performSubtitleConversion); if (state.VideoRequest.Width.HasValue || state.VideoRequest.Height.HasValue || state.VideoRequest.MaxHeight.HasValue || state.VideoRequest.MaxWidth.HasValue)
{
args += GetOutputSizeParam(state, codec, performSubtitleConversion);
}
} }
if (state.VideoRequest.Framerate.HasValue) if (state.VideoRequest.Framerate.HasValue)
@ -158,14 +165,11 @@ namespace MediaBrowser.Api.Playback.Hls
{ {
args += " -level " + state.VideoRequest.Level; args += " -level " + state.VideoRequest.Level;
} }
if (state.SubtitleStream != null) // This is for internal graphical subs
if (hasGraphicalSubs)
{ {
// This is for internal graphical subs args += GetInternalGraphicalSubtitleParam(state, codec);
if (!state.SubtitleStream.IsExternal && (state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 || state.SubtitleStream.Codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1))
{
args += GetInternalGraphicalSubtitleParam(state, codec);
}
} }
return args; return args;

View File

@ -143,12 +143,19 @@ namespace MediaBrowser.Api.Playback.Progressive
args += keyFrameArg; args += keyFrameArg;
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsExternal &&
(state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 ||
state.SubtitleStream.Codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1);
var request = state.VideoRequest; var request = state.VideoRequest;
// Add resolution params, if specified // Add resolution params, if specified
if (request.Width.HasValue || request.Height.HasValue || request.MaxHeight.HasValue || request.MaxWidth.HasValue) if (!hasGraphicalSubs)
{ {
args += GetOutputSizeParam(state, codec, performSubtitleConversion); if (request.Width.HasValue || request.Height.HasValue || request.MaxHeight.HasValue || request.MaxWidth.HasValue)
{
args += GetOutputSizeParam(state, codec, performSubtitleConversion);
}
} }
if (request.Framerate.HasValue) if (request.Framerate.HasValue)
@ -175,13 +182,10 @@ namespace MediaBrowser.Api.Playback.Progressive
args += " -level " + state.VideoRequest.Level; args += " -level " + state.VideoRequest.Level;
} }
if (state.SubtitleStream != null) // This is for internal graphical subs
if (hasGraphicalSubs)
{ {
// This is for internal graphical subs args += GetInternalGraphicalSubtitleParam(state, codec);
if (!state.SubtitleStream.IsExternal && (state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 || state.SubtitleStream.Codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1))
{
args += GetInternalGraphicalSubtitleParam(state, codec);
}
} }
return args; return args;

View File

@ -1244,7 +1244,6 @@ namespace MediaBrowser.Controller.Entities
/// <summary> /// <summary>
/// Adds the tagline. /// Adds the tagline.
/// </summary> /// </summary>
/// <param name="item">The item.</param>
/// <param name="tagline">The tagline.</param> /// <param name="tagline">The tagline.</param>
/// <exception cref="System.ArgumentNullException">tagline</exception> /// <exception cref="System.ArgumentNullException">tagline</exception>
public void AddTagline(string tagline) public void AddTagline(string tagline)