Пример #1
0
        public void Mux(CancellationToken cancellationToken, Job job)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }

            const string startStatus = "Starting mkvmerge process...";

            Host.ReportProgress(this, 0.0, startStatus);
            Logger.Info(startStatus);

            _exception = null;

            var mkvmerge = new MkvMerge(job, job.SelectedPlaylist, job.OutputPath, _jobObjectManager, _tempFileRegistrar);

            mkvmerge.ProgressUpdated += state => OnProgressUpdated(mkvmerge, state, cancellationToken);
            mkvmerge.Exited          += OnExited;
            mkvmerge.StartAsync();
            cancellationToken.Register(mkvmerge.Kill, true);
            WaitForThreadToExit();

            if (_exception == null)
            {
                return;
            }

//            Log(job, mkvmerge);

            throw new MkvMergeException(_exception.Message, _exception);
        }
Пример #2
0
        public static string ExeVersion(IJobObjectManager jobObjectManager)
        {
            string result = "";

            var arguments = new ArgumentList("--version");

            var mkvmerge = new MkvMerge(arguments, jobObjectManager);

            mkvmerge.StdOut += delegate(string line) { result += line; };

            mkvmerge.Start(); // sync

            return(result);
        }
Пример #3
0
        private void OnProgressUpdated(MkvMerge mkvmerge, ProgressState progressState, CancellationToken cancellationToken)
        {
//            var shortStatus = string.Format("Muxing {0} @ {2:F0} fps - {1}",
//                TimeSpan.FromMilliseconds(mkvmerge.CurOutTimeMs).ToStringShort(),
//                FileUtils.HumanFriendlyFileSize(mkvmerge.CurSize),
//                mkvmerge.CurFps);
//
//            var longStatus = string.Format("Muxing to MKV: {0} - {1} @ {2:N1} fps",
//                TimeSpan.FromMilliseconds(mkvmerge.CurOutTimeMs).ToStringMedium(),
//                FileUtils.HumanFriendlyFileSize(mkvmerge.CurSize),
//                mkvmerge.CurFps);

            Host.ReportProgress(this, progressState.PercentComplete, "short status", "long status");

            if (cancellationToken.IsCancellationRequested)
            {
                mkvmerge.Kill();
            }
        }
Пример #4
0
        void MakeVersion(object jobObjectManager)
        {
            string version = MkvMerge.ExeVersion(jobObjectManager as IJobObjectManager);

            lblVersion.Invoke((MethodInvoker) delegate { lblVersion.Text = version; });
        }