RVS_MediaServer_FFMPEGServerManager
class RVS_MediaServer_FFMPEGServerManager
This is a model for the server status screen. It handles the management of the actual ffmpeg instance.
-
The size of time slices in the HLS output. ffmpeg defaults to 2. Apple recommends 6.
Declaration
Swift
private static let _hlsTimeSliceInSeconds: Int -
The number of seconds to wait between page refreshes, while waiting to load.
Declaration
Swift
private static let _pageReloadDelayInSeconds: Float -
The number of seconds to wait as a timeout, when starting the server.
Declaration
Swift
private static let _serverStartTimeoutThresholdInSeconds: TimeInterval
-
This will hold the url of our output streaming file.
Declaration
Swift
private var _outputTmpFile: TemporaryFile! -
This will hold the ffmpeg command line task.
Declaration
Swift
private var _ffmpegTask: Process? -
ffmpeg sends its reports out via stderr; not stdout, so we trap that, in order to report it in the console.
Declaration
Swift
private var _stderrPipe: Pipe! -
This is an observer handler for stderr (ffmpeg).
Declaration
Swift
private var _stdErrObserver: NSObjectProtocol! -
This is an input source URI.
Declaration
Swift
private let _inputURI: String -
This is a login ID for authorization.
Declaration
Swift
private let _loginID: String! -
This is a password for authorization.
Declaration
Swift
private let _password: String! -
A String, containing raw parameters to use, if that is how we are rolling.
Declaration
Swift
private let _raw_parameters: String!
-
A delegate object for handling the operation of the manager. This is a weak class reference.
Declaration
Swift
weak var delegate: RVS_MediaServer_FFMPEGServerManagerDelegate!
-
Declaration
Swift
init(outputTmpFile inOutputTmpFile: TemporaryFile! = nil, inputURI inInputURI: String, login_id inLoginID: String! = nil, password inPassword: String! = nil, raw_parameters inRawParameters: String! = nil, delegate inDelegate: RVS_MediaServer_FFMPEGServerManagerDelegate! = nil)Parameters
outputTmpFileThe temporary file object that describes the temporary directory, where we fetch our data. This can be omitted or nil, if we are not using one.
inputURIA String with the input URI.
login_idA String, with a login for authorization. This is optional. If not provided, authorization will not be attempted.
passwordA String, with a password for authorization. This is optional. If not provided, authorization will not be attempted.
raw_parametersA String, containing raw parameters to use (instead of the standard HLS).
delegateThe delegate for the object. This is optional.
-
This will create a
clean
RTSP URI, adding the login and password as inline Auth elements (rtsp://user:pass@server/path?query).If either the login ID or password is left out, then the stream will be returned without adding authentication.
Declaration
Swift
func createRTSPURI(uri inURI: String, loginID inLoginID: String! = nil, password inPassword: String! = nil) -> StringParameters
uriThe URL, without auth, as a String. This is required.
loginIDThe Login ID, as a String. This is optional. If left out, authentication is not added to the URI.
passwordThe Password, as a String. This is optional. If left out, authentication is not added to the URI.
-
This starts the ffmpeg task.
Declaration
Swift
func startFFMPEGProcess() -> BoolReturn Value
True, if the task launched successfully.
-
This sets up a trap, so we can intercept the textual output from ffmpeg (which comes out on stderr).
Declaration
Swift
func openErrorPipe(_ inTask: Process)Parameters
inTaskThe ffmpeg task we’re intercepting.
-
This simply stops the Web server.
Declaration
Swift
func stopFFMPEGServer() -
This will throw up an error alert, if we encounter an error.
Declaration
Swift
func handleError(message inMessage: String = "")Parameters
messageA string, with the error message to be displayed, in un-localized form.
View on GitHub
RVS_MediaServer_FFMPEGServerManager Class Reference