added new stream info properties

This commit is contained in:
Luke Pulverenti 2014-01-21 20:37:01 -05:00
parent a29e1eb036
commit 3d697cdab2
5 changed files with 51 additions and 4 deletions

View File

@ -1059,9 +1059,10 @@ namespace MediaBrowser.Api.Playback
}
//state.RunTimeTicks = recording.RunTimeTicks;
state.SendInputOverStandardInput = recording.RecordingInfo.Status == RecordingStatus.InProgress;
state.ReadInputAtNativeFramerate = recording.RecordingInfo.Status == RecordingStatus.InProgress;
state.AudioSync = 1000;
state.DeInterlace = true;
state.InputFormat = "mpegts";
}
else if (item is LiveTvChannel)
{
@ -1087,8 +1088,10 @@ namespace MediaBrowser.Api.Playback
}
state.SendInputOverStandardInput = true;
state.ReadInputAtNativeFramerate = true;
state.AudioSync = 1000;
state.DeInterlace = true;
state.InputFormat = "mpegts";
}
else
{
@ -1140,6 +1143,33 @@ namespace MediaBrowser.Api.Playback
return state;
}
protected string GetInputModifier(StreamState state)
{
var inputModifier = string.Empty;
if (!string.IsNullOrEmpty(state.InputFormat))
{
inputModifier += " -f " + state.InputFormat;
}
if (!string.IsNullOrEmpty(state.InputVideoCodec))
{
inputModifier += " -vcodec " + state.InputVideoCodec;
}
if (!string.IsNullOrEmpty(state.InputAudioCodec))
{
inputModifier += " -acodec " + state.InputAudioCodec;
}
if (state.ReadInputAtNativeFramerate)
{
inputModifier += " -re";
}
return inputModifier;
}
/// <summary>
/// Infers the audio codec based on the url
/// </summary>

View File

@ -274,11 +274,14 @@ namespace MediaBrowser.Api.Playback.Hls
var threads = GetNumberOfThreads(false);
var args = string.Format("{0}{1} {2} {3} -fflags genpts -i {4}{5} -map_metadata -1 -threads {6} {7} {8} -sc_threshold 0 {9} -hls_time {10} -start_number 0 -hls_list_size 1440 \"{11}\"",
var inputModifier = GetInputModifier(state);
var args = string.Format("{0}{1} {2} {3} -fflags genpts{4} -i {5}{6} -map_metadata -1 -threads {7} {8} {9} -sc_threshold 0 {10} -hls_time {11} -start_number 0 -hls_list_size 1440 \"{12}\"",
itsOffset,
probeSize,
GetUserAgentParam(state.MediaPath),
GetFastSeekCommandLineParameter(state.Request),
inputModifier,
GetInputArgument(state),
GetSlowSeekCommandLineParameter(state.Request),
threads,

View File

@ -104,8 +104,11 @@ namespace MediaBrowser.Api.Playback.Progressive
var threads = GetNumberOfThreads(false);
return string.Format("{0} -i {1}{2} -threads {3}{4} {5} -id3v2_version 3 -write_id3v1 1 \"{6}\"",
var inputModifier = GetInputModifier(state);
return string.Format("{0}{1} -i {2}{3} -threads {4}{5} {6} -id3v2_version 3 -write_id3v1 1 \"{7}\"",
GetFastSeekCommandLineParameter(request),
inputModifier,
GetInputArgument(state),
GetSlowSeekCommandLineParameter(request),
threads,

View File

@ -106,10 +106,13 @@ namespace MediaBrowser.Api.Playback.Progressive
var threads = GetNumberOfThreads(string.Equals(videoCodec, "libvpx", StringComparison.OrdinalIgnoreCase));
return string.Format("{0} {1} {2} -fflags genpts -i {3}{4}{5} {6} {7} -map_metadata -1 -threads {8} {9}{10} \"{11}\"",
var inputModifier = GetInputModifier(state);
return string.Format("{0} {1} {2} -fflags genpts{3} -i {4}{5}{6} {7} {8} -map_metadata -1 -threads {9} {10}{11} \"{12}\"",
probeSize,
GetUserAgentParam(state.MediaPath),
GetFastSeekCommandLineParameter(state.Request),
inputModifier,
GetInputArgument(state),
GetSlowSeekCommandLineParameter(state.Request),
keyFrame,

View File

@ -62,5 +62,13 @@ namespace MediaBrowser.Api.Playback
public int AudioSync = 1;
public bool DeInterlace { get; set; }
public bool ReadInputAtNativeFramerate { get; set; }
public string InputFormat { get; set; }
public string InputVideoCodec { get; set; }
public string InputAudioCodec { get; set; }
}
}