// Constructor internal SegmentStoreBroker(string ID, MediaStreamingRequest _request, string pathToTools) { Request = _request; store = new SegmentStore(ID); PathToTools = pathToTools; string rpPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "RemotePotato"); WorkingDirectory = Path.Combine(rpPath, "static\\mediastreams\\" + ID.ToString()); if (!Directory.Exists(WorkingDirectory)) Directory.CreateDirectory(WorkingDirectory); // Probe / Map Audio streams: if (Request.UseAudioStreamIndex >= 0) { SendDebugMessage("MediaStreamer: Mapping streams using requested audio stream " + Request.UseAudioStreamIndex.ToString()); // We still have to probe again to discover the index of the video stream, as both A and V MUST be mapped, can't just map one MapArguments = GetProbeMapArguments(Request.UseAudioStreamIndex); if (string.IsNullOrEmpty(MapArguments)) // May take a small while throw new Exception("Probing failed"); } /* QUICKSTART CODE // So far, so good. If the required segment is available then don't bother starting transcoding; it could already be cached to disk. // Otherwise, let's start transcoding, as the client is likely to request the segment soon. double dStartingSegment = Math.Floor(Convert.ToDouble(Request.StartAt) / Convert.ToDouble(Runner.EncodingParameters.SegmentDuration)); int iStartingSegment = Convert.ToInt32(dStartingSegment); if (! CanGetSegment(iStartingSegment)) // cant get segment { string txtResult = ""; if (!Runner.Start(iStartingSegment, ref txtResult)) throw new Exception("The FFRunner failed to start : " + txtResult); }*/ }
public FFHLSRunner(string pathToTools, SegmentStore segStore) { // From parameters PathToTools = pathToTools; Store = segStore; // Defaults //EncodingParameters = new VideoEncodingParameters(); // AFAICT this is never used.... AudioSyncAmount = 1; // 2 can create streaming issues }
// Constructor internal SegmentStoreBroker(string ID, MediaStreamingRequest _request, string pathToTools) { Request = _request; store = new SegmentStore(ID, Request); PathToTools = pathToTools; string rpPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "RemotePotato"); WorkingDirectory = Path.Combine(rpPath, "static\\mediastreams\\" + ID.ToString()); if (!Directory.Exists(WorkingDirectory)) { Directory.CreateDirectory(WorkingDirectory); } if (Request.NewLiveTV) { //done in shelCmdRunner return; } // Probe / Map Audio streams: if (Request.NewLiveTV || Request.UseAudioStreamIndex >= 0 || Request.UseSubtitleStreamIndex >= 0 || (Request.UseNewerFFMPEG && !Request.LiveTV)) { SendDebugMessage("MediaStreamer: Mapping streams using requested audio stream " + Request.UseAudioStreamIndex.ToString()); // We still have to probe again to discover the index of the video stream, as both A and V MUST be mapped, can't just map one while (true) { MapArguments = GetProbeMapArguments(Request.UseAudioStreamIndex); if (string.IsNullOrEmpty(MapArguments)) // May take a small while { SendDebugMessage("Probing failed, trying again"); } else { SendDebugMessage("Success! Mappings are :" + MapArguments); break; } } } /* QUICKSTART CODE * // So far, so good. If the required segment is available then don't bother starting transcoding; it could already be cached to disk. * // Otherwise, let's start transcoding, as the client is likely to request the segment soon. * double dStartingSegment = Math.Floor(Convert.ToDouble(Request.StartAt) / Convert.ToDouble(Runner.EncodingParameters.SegmentDuration)); * int iStartingSegment = Convert.ToInt32(dStartingSegment); * if (! CanGetSegment(iStartingSegment)) // cant get segment * { * string txtResult = ""; * if (!Runner.Start(iStartingSegment, ref txtResult)) * throw new Exception("The FFRunner failed to start : " + txtResult); * }*/ }
public FFHLSRunner(string pathToTools, SegmentStore store, MediaStreamingRequest mrq) : this(pathToTools, store) { request = mrq; EncodingParameters = mrq.CustomParameters; if (request.LiveTV) { EncodingParameters.SegmentDuration = request.ActualSegmentDuration;//LiveTV } else { EncodingParameters.SegmentDuration = 4; } }
public FFHLSRunner(string pathToTools, SegmentStore store, VideoEncodingParameters vidParameters) : this(pathToTools, store) { EncodingParameters = vidParameters; }
public FFHLSRunner(string pathToTools, SegmentStore store, MediaStreamingRequest mrq) : this(pathToTools, store) { request = mrq; EncodingParameters = mrq.CustomParameters; if (request.LiveTV) { MaxIncomingDataSize = 20000000; // 20Mb per segment maximum size } if (request.LiveTV || request.NewLiveTV) { EncodingParameters.SegmentDuration = request.ActualSegmentDuration;//LiveTV } else { EncodingParameters.SegmentDuration = 4; } }
//private double CurrentPosition; //in seconds //private double CurrentOverallPosition; //in seconds public FFHLSRunner(string pathToTools, SegmentStore segStore) { // From parameters PathToTools = pathToTools; Store = segStore; ID = segStore.ID; // Defaults EncodingParameters = new VideoEncodingParameters(); AudioSyncAmount = 1; // 2 can create streaming issues }