/// ------------------------------------------------------------------------------------ private void StartPlayback(bool resampleToMono) { DebugOutput = Application.OpenForms.OfType <ILogger>().FirstOrDefault(); if (_loopDelayTimer != null) { _loopDelayTimer.Dispose(); _loopDelayTimer = null; } if (_mplayerProcess != null) { ShutdownMPlayerProcess(); } var videoWindowHandle = 0; int bitsPerSample = 0; // If the file is a video file and we don't have a window in which to play // the video, then set the handle to -1 to indicate to the helper that we // only want to play the audio from the video file. if (MediaInfo != null) { if (MediaInfo.IsVideo) { videoWindowHandle = (VideoWindowHandle > 0 ? VideoWindowHandle : -1); } bitsPerSample = MediaInfo.BitsPerSample; } var args = MPlayerHelper.GetPlaybackArguments(PlaybackStartPosition, PlaybackLength, Volume, Speed, resampleToMono, videoWindowHandle, bitsPerSample); _mplayerProcess = MPlayerHelper.StartProcessToMonitor(args, HandleDataReceived, HandleDataReceived); if (_outputDebuggingWindow != null) { _mplayerStartInfo.Length = 0; _mplayerStartInfo.AppendLine("*** COMMAND LINE:"); _mplayerStartInfo.Append(_mplayerProcess.StartInfo.FileName); _mplayerStartInfo.Append(" "); _mplayerStartInfo.AppendLine(_mplayerProcess.StartInfo.Arguments); _mplayerStartInfo.Append("*** MEDIA FILE: "); _mplayerStartInfo.AppendLine(MediaFile); _mplayerStartInfo.AppendLine(); _outputDebuggingWindow.AddText(_mplayerStartInfo.ToString()); } _mplayerProcess.FileOpenedByProcess = MediaFile; _stdIn = _mplayerProcess.StandardInput; _stdIn.WriteLine("loadfile \"{0}\" ", MediaFile); HasPlaybackStarted = true; if (PlaybackStarted != null) { PlaybackStarted(this, EventArgs.Empty); } }