LibMPlayerCommon.MPlayer.InitializeMplayer C# (CSharp) Method

InitializeMplayer() private method

private InitializeMplayer ( ) : void
return void
        private void InitializeMplayer()
        {
            MediaPlayer.StartInfo.CreateNoWindow = true;
            MediaPlayer.StartInfo.UseShellExecute = false;
            MediaPlayer.StartInfo.ErrorDialog = false;
            MediaPlayer.StartInfo.RedirectStandardOutput = true;
            MediaPlayer.StartInfo.RedirectStandardInput = true;
            MediaPlayer.StartInfo.RedirectStandardError = true;

            this._currentPostionTimer.Start();

            //
            //slave
            //    mandatory; tells MPlayer to start in slave mode
            //quiet
            //    optional; reduces the amount of messages that MPlayer will output
            //idle
            //    optional; it doesn’t close MPlayer after a file finished playing;
            //    this is quite useful as you don’t want to start a new process everytime
            //    you want to play a file, but rather loading the file into the existing
            //    already started process (for performance reasons)
            //
            // -ss HH:MM:SS  seek the position. Works with webm.
            //
            // -bandwidth <bytes>    Specify the maximum bandwidth for network streaming (for servers
            //  that are able to send content in different bitrates).
            //
            // -cache
            //
            // -prefer-ipv4   Use  IPv4  on network connections.  Falls back on IPv6 automatically.
            //
            // -user <username>   Specify username for HTTP authentication.
            // -passwd <password> Specify password for HTTP authentication.
            //
            // -user-agent <string>
            //  Use <string> as user agent for HTTP streaming.
            //
            // -wid <window ID> (also see -guiwid) (X11, OpenGL and DirectX only)
            //
            // -vc <[-|+]codec1,[-|+]codec2,...[,]>
            //  Specify a priority list of video codecs to be used, according to
            //  their  codec  name  in  codecs.conf.

            string backend = MplayerBackend();
            /*
                if you like you can parse more args
                MediaPlayer.StartInfo.Arguments = string.Format("-slave -quiet -idle -priority abovenormal -nodr -double -nokeepaspect -cache 8192 -nofs -autosync 100 -mc 2.0 -nomouseinput -framedrop -osdlevel 0 -lavdopts threads=4 -ao dsound -v -monitorpixelaspect 1 -ontop -font \"{0}\" -subfont-autoscale {1} -subfont-text-scale {2} -subcp {3} -subpos {4} -volume {5} -vo {6} -wid {7} \"{8}\"", this._font, this._fontautoscale, this._textscale, this._subcp, this._subpos, this.volumemain, backend, this._wid, filePath);

            */
            MediaPlayer.StartInfo.Arguments = string.Format("-slave -quiet -idle -aspect 4/3 -v -ontop -vo {0} -wid {1}", backend, this._wid);
            MediaPlayer.StartInfo.FileName = this._backendProgram.MPlayer;

            MediaPlayer.Start();

            this.MplayerRunning = true;
            this._mplayerProcessID = MediaPlayer.Id;

            //System.IO.StreamWriter mw = MediaPlayer.StandardInput;
            //mw.AutoFlush = true;

            MediaPlayer.OutputDataReceived += HandleMediaPlayerOutputDataReceived;
            MediaPlayer.ErrorDataReceived += HandleMediaPlayerErrorDataReceived;
            MediaPlayer.BeginErrorReadLine();
            MediaPlayer.BeginOutputReadLine();
        }