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
outputTmpFile
The 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.
inputURI
A String with the input URI.
login_id
A String, with a login for authorization. This is optional. If not provided, authorization will not be attempted.
password
A String, with a password for authorization. This is optional. If not provided, authorization will not be attempted.
raw_parameters
A String, containing raw parameters to use (instead of the standard HLS).
delegate
The 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) -> String
Parameters
uri
The URL, without auth, as a String. This is required.
loginID
The Login ID, as a String. This is optional. If left out, authentication is not added to the URI.
password
The 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() -> Bool
Return 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
inTask
The 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
message
A string, with the error message to be displayed, in un-localized form.