aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/HttpHandlers/VideoHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/HttpHandlers/VideoHandler.cs')
-rw-r--r--MediaBrowser.Api/HttpHandlers/VideoHandler.cs37
1 files changed, 13 insertions, 24 deletions
diff --git a/MediaBrowser.Api/HttpHandlers/VideoHandler.cs b/MediaBrowser.Api/HttpHandlers/VideoHandler.cs
index 4f8621ce7..9d52136f0 100644
--- a/MediaBrowser.Api/HttpHandlers/VideoHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/VideoHandler.cs
@@ -34,7 +34,7 @@ namespace MediaBrowser.Api.HttpHandlers
// mp4, 3gp, mov - muxer does not support non-seekable output
// avi, mov, mkv, m4v - can't stream these when encoding. the player will try to download them completely before starting playback.
// wmv - can't seem to figure out the output format name
- return new VideoOutputFormats[] { VideoOutputFormats.Mp4, VideoOutputFormats.ThreeGP, VideoOutputFormats.M4v, VideoOutputFormats.Mkv, VideoOutputFormats.Avi, VideoOutputFormats.Mov, VideoOutputFormats.Wmv };
+ return new VideoOutputFormats[] { VideoOutputFormats.Mp4, VideoOutputFormats.ThreeGp, VideoOutputFormats.M4V, VideoOutputFormats.Mkv, VideoOutputFormats.Avi, VideoOutputFormats.Mov, VideoOutputFormats.Wmv };
}
}
@@ -43,15 +43,6 @@ namespace MediaBrowser.Api.HttpHandlers
/// </summary>
protected override bool RequiresConversion()
{
- string currentFormat = Path.GetExtension(LibraryItem.Path).Replace(".", string.Empty);
-
- // For now we won't allow these to pass through.
- // Later we'll add some intelligence to allow it when possible
- if (currentFormat.Equals("mp4", StringComparison.OrdinalIgnoreCase) || currentFormat.Equals("mkv", StringComparison.OrdinalIgnoreCase) || currentFormat.Equals("m4v", StringComparison.OrdinalIgnoreCase))
- {
- return true;
- }
-
if (base.RequiresConversion())
{
return true;
@@ -81,17 +72,17 @@ namespace MediaBrowser.Api.HttpHandlers
/// <summary>
/// Translates the output file extension to the format param that follows "-f" on the ffmpeg command line
/// </summary>
- private string GetFFMpegOutputFormat(VideoOutputFormats outputFormat)
+ private string GetFfMpegOutputFormat(VideoOutputFormats outputFormat)
{
if (outputFormat == VideoOutputFormats.Mkv)
{
return "matroska";
}
- else if (outputFormat == VideoOutputFormats.Ts)
+ if (outputFormat == VideoOutputFormats.Ts)
{
return "mpegts";
}
- else if (outputFormat == VideoOutputFormats.Ogv)
+ if (outputFormat == VideoOutputFormats.Ogv)
{
return "ogg";
}
@@ -104,15 +95,13 @@ namespace MediaBrowser.Api.HttpHandlers
/// </summary>
protected override string GetCommandLineArguments()
{
- List<string> audioTranscodeParams = new List<string>();
-
VideoOutputFormats outputFormat = GetConversionOutputFormat();
return string.Format("-i \"{0}\" -threads 0 {1} {2} -f {3} -",
LibraryItem.Path,
GetVideoArguments(outputFormat),
GetAudioArguments(outputFormat),
- GetFFMpegOutputFormat(outputFormat)
+ GetFfMpegOutputFormat(outputFormat)
);
}
@@ -195,15 +184,15 @@ namespace MediaBrowser.Api.HttpHandlers
// Per webm specification, it must be vpx
return "libvpx";
}
- else if (outputFormat == VideoOutputFormats.Asf)
+ if (outputFormat == VideoOutputFormats.Asf)
{
return "wmv2";
}
- else if (outputFormat == VideoOutputFormats.Wmv)
+ if (outputFormat == VideoOutputFormats.Wmv)
{
return "wmv2";
}
- else if (outputFormat == VideoOutputFormats.Ogv)
+ if (outputFormat == VideoOutputFormats.Ogv)
{
return "libtheora";
}
@@ -223,21 +212,21 @@ namespace MediaBrowser.Api.HttpHandlers
private string GetAudioCodec(AudioStream audioStream, VideoOutputFormats outputFormat)
{
// Some output containers require specific codecs
-
+
if (outputFormat == VideoOutputFormats.Webm)
{
// Per webm specification, it must be vorbis
return "libvorbis";
}
- else if (outputFormat == VideoOutputFormats.Asf)
+ if (outputFormat == VideoOutputFormats.Asf)
{
return "wmav2";
}
- else if (outputFormat == VideoOutputFormats.Wmv)
+ if (outputFormat == VideoOutputFormats.Wmv)
{
return "wmav2";
}
- else if (outputFormat == VideoOutputFormats.Ogv)
+ if (outputFormat == VideoOutputFormats.Ogv)
{
return "libvorbis";
}
@@ -263,7 +252,7 @@ namespace MediaBrowser.Api.HttpHandlers
// libvo_aacenc currently only supports two channel output
return 2;
}
- else if (audioCodec.Equals("wmav2"))
+ if (audioCodec.Equals("wmav2"))
{
// wmav2 currently only supports two channel output
return 2;