Exemplo n.º 1
0
        private void setVideoOffsetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(_videoFileName) && mediaPlayer.VideoPlayer != null)
                mediaPlayer.Pause();

            using (var form = new SetVideoOffset())
            {
                form.VideoOffset = new TimeCode(10, 0, 0, 0);
                if (Configuration.Settings.General.CurrentVideoOffsetInMs > 0.001)
                    form.VideoOffset = new TimeCode(Configuration.Settings.General.CurrentVideoOffsetInMs);
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    Configuration.Settings.General.CurrentVideoOffsetInMs = (long)(Math.Round(form.VideoOffset.TotalSeconds * 1000.0));
                    SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
                    //var offsetInSeconds = form.VideoOffset.TotalSeconds;
                    //if (form.FromCurrentVideoPosition)
                    //    offsetInSeconds -= mediaPlayer.VideoPlayer.CurrentPosition;
                    //mediaPlayer.Offset = offsetInSeconds;
                    //if (audioVisualizer != null)
                    //    audioVisualizer.Offset = offsetInSeconds;
                }
            }
        }
Exemplo n.º 2
0
        private void setVideoOffsetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(_videoFileName) && mediaPlayer.VideoPlayer != null)
                mediaPlayer.Pause();

            using (var form = new SetVideoOffset())
            {
                form.VideoOffset = new TimeCode(10, 0, 0, 0);
                if (mediaPlayer.Offset > 0.001)
                    form.VideoOffset = TimeCode.FromSeconds(mediaPlayer.Offset);
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    var offsetInSeconds = form.VideoOffset.TotalSeconds;
                    if (form.FromCurrentVideoPosition)
                        offsetInSeconds -= mediaPlayer.VideoPlayer.CurrentPosition;
                    mediaPlayer.Offset = offsetInSeconds;
                    if (audioVisualizer != null)
                        audioVisualizer.Offset = offsetInSeconds;
                }
            }
        }
Exemplo n.º 3
0
        private void setVideoOffsetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(_videoFileName) && mediaPlayer.VideoPlayer != null)
                mediaPlayer.Pause();

            using (var form = new SetVideoOffset())
            {
                form.VideoOffset = new TimeCode(10, 0, 0, 0);
                if (Configuration.Settings.General.CurrentVideoOffsetInMs > 0)
                    form.VideoOffset = new TimeCode(Configuration.Settings.General.CurrentVideoOffsetInMs);
                var oldVideoOffset = Configuration.Settings.General.CurrentVideoOffsetInMs;
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    if (form.FromCurrentVideoPosition && mediaPlayer.VideoPlayer != null)
                    {
                        Configuration.Settings.General.CurrentVideoOffsetInMs = (long)(Math.Round((form.VideoOffset.TotalSeconds - mediaPlayer.VideoPlayer.CurrentPosition) * 1000.0));
                    }
                    else
                    {
                        Configuration.Settings.General.CurrentVideoOffsetInMs = (long)(Math.Round(form.VideoOffset.TotalSeconds * 1000.0));
                    }
                    if (form.DoNotaddVideoOffsetToTimeCodes)
                    {
                        if (form.Reset)
                        {
                            _subtitle.AddTimeToAllParagraphs(TimeSpan.FromMilliseconds(oldVideoOffset));
                            _subtitleAlternate?.AddTimeToAllParagraphs(TimeSpan.FromMilliseconds(oldVideoOffset));
                        }
                        else
                        {
                            _subtitle.AddTimeToAllParagraphs(TimeSpan.FromMilliseconds(-Configuration.Settings.General.CurrentVideoOffsetInMs));
                            _subtitleAlternate?.AddTimeToAllParagraphs(TimeSpan.FromMilliseconds(-Configuration.Settings.General.CurrentVideoOffsetInMs));
                        }
                    }
                    SaveSubtitleListviewIndices();
                    SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
                    RefreshSelectedParagraph();
                    RestoreSubtitleListviewIndices();
                }
            }
        }