public static void Apply(string gameDataFile, int videoBitRate, string destFile, bool highlights, Action <long, long> progressReporter, Func <bool> isAborted, string pluginName)
        {
            try
            {
                var leaderBoard = new LeaderBoard {
                    OverlayData = OverlayData.FromFile(gameDataFile), PluginName = pluginName
                };

                var transcoder = new Transcoder
                {
                    VideoFiles      = leaderBoard.OverlayData.VideoFiles.ToSourceReaderExtra(),
                    DestinationFile = destFile,
                    VideoBitRate    = videoBitRate
                };

                new TranscodeAndOverlay(leaderBoard, progressReporter).Process(transcoder, highlights, progressReporter, isAborted);
            }
            catch (Exception e)
            {
                TraceError.WriteLine(e.Message);
                TraceError.WriteLine(e.StackTrace);
                throw e;
            }
        }
Ejemplo n.º 2
0
        void sourceVideoTextBox_TextChanged(object sender, EventArgs e)
        {
            Settings.Default.lastVideoFile = sourceVideoTextBox.Text;
            Settings.Default.Save();

            if (lookForAudioBitRates != null)
            {
                lookForAudioBitRates.Stop();
                lookForAudioBitRates.Dispose();
                lookForAudioBitRates = null;
            }

            OnGameDataFileChanged();

            SetTanscodeMessage("", "", "");

            if (sourceVideoTextBox.Text.Trim() == "")
            {
                return;
            }

            if (!File.Exists(sourceVideoTextBox.Text))
            {
                SetTanscodeMessage(sourceVideoFileErrorMessage: "*File does not exist");
                return;
            }

            try
            {
                var data     = OverlayData.FromFile(sourceVideoTextBox.Text);
                var fileName = data.VideoFiles.Last().FileName;

                if (!File.Exists(fileName))
                {
                    SetTanscodeMessage(sourceVideoFileErrorMessage: "*Captured video does not exist: " + fileName);
                    return;
                }

                var currentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();

                if (data.CapturedVersion != null && data.CapturedVersion != currentVersion)
                {
                    SetTanscodeMessage(warningDetails: "*Video was captured with version {0}.\nIt is recommended to transcode and capture using the same version.\nTranscoding may not work.".F(data.CapturedVersion));
                }

                var details = VideoAttributes.TestFor(data);

                SetTanscodeMessage(formatDetails: "Frame Rate: {0}, Frame Size: {1}x{2}, Video: {3} @ {4}Mbs, Audio: {5}, {6}Khz @ {7}Kbs, ".F
                                       (details.FrameRate,
                                       details.FrameSize.Width,
                                       details.FrameSize.Height,
                                       details.VideoEncoding,
                                       details.BitRate == 0 ? "-- " : details.BitRate.ToString(),
                                       details.AudioEncoding,
                                       details.AudioSamplesPerSecond / 1000,
                                       details.AudioAverageBytesPerSecond / 1000),
                                   sourceVideoFileErrorMessage: details.ErrorMessage);
            }
            catch (Exception ex)
            {
                SetTanscodeMessage(sourceVideoFileErrorMessage: "*Error reading the video file. {0}".F(ex.Message));

                lookForAudioBitRates          = new System.Windows.Forms.Timer();
                lookForAudioBitRates.Tick    += sourceVideoTextBox_TextChanged;
                lookForAudioBitRates.Interval = 5000;
                lookForAudioBitRates.Start();
            }
        }
Ejemplo n.º 3
0
 public void SetReplayConfig(string filePath)
 {
     this.data = OverlayData.FromFile(filePath);
 }