コード例 #1
0
        private void SaveDest(string path)
        {
            bool wasStopped;

            _destPath = path;

            // Aspect Ratio
            try {
                _mp4Mod.PARInfo = GetMPEG4PARFromForm();
            }
            catch {
                MessageBox.Show(this, "The aspect ratio you entered is invalid.", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // User Data
            _mp4Mod.UserDataList = UDListBoxItems;

            // Packed Bitstream
            _mp4Mod.NewIsPacked = _mp4Mod.IsPacked ^ chkChangePacking.Checked;

            // Interlacing
            _mp4Mod.TopFieldFirst = rbTFF.Checked;

            // Save video
            _waitForm = new frmWait("Saving", "Saving video, please wait...",
                                    new Thread(SaveDestThread));
            _waitForm.ShowDialog(this);
            _waitForm.Dispose();
            _waitForm  = null;
            wasStopped = _aviMod.WasStopped;

            SetupForm(false);

            if (_workEx != null)
            {
                MessageBox.Show(this, _workEx.Message, "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            if (!wasStopped)
            {
                MessageBox.Show(this, "Video has been saved successfully.", "Done",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #2
0
        private void LoadSource(string path)
        {
            SetupForm(false);
            _sourcePath        = path;
            txtSourcePath.Text = path;

            // Load video
            _waitForm = new frmWait("Loading", "Loading video, please wait...",
                                    new Thread(LoadSourceThread));
            _waitForm.ShowDialog(this);
            _waitForm.Dispose();
            _waitForm = null;

            if (_workEx != null)
            {
                SetupForm(false);
                MessageBox.Show(this, _workEx.Message, "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }
            else if (_aviMod.WasStopped)
            {
                SetupForm(false);
                return;
            }

            SetupForm(true);

            _updatingUI = true;

            // Aspect Ratio
            switch (_mp4Mod.PARInfo.Type)
            {
            case PARType.VGA_1_1:
                rbPAR_VGA_1_1.Checked = true;
                break;

            case PARType.PAL_4_3:
                rbPAR_PAL_4_3.Checked = true;
                break;

            case PARType.NTSC_4_3:
                rbPAR_NTSC_4_3.Checked = true;
                break;

            case PARType.PAL_16_9:
                rbPAR_PAL_16_9.Checked = true;
                break;

            case PARType.NTSC_16_9:
                rbPAR_NTSC_16_9.Checked = true;
                break;

            case PARType.Custom: {
                double par = (double)_mp4Mod.PARInfo.Width / (double)_mp4Mod.PARInfo.Height;
                double rar = (double)_mp4Mod.FrameWidth / (double)_mp4Mod.FrameHeight;
                double dar = par * rar;

                rbPAR_Custom.Checked = true;
                txtPAR_Width.Text    = _mp4Mod.PARInfo.Width.ToString();
                txtPAR_Height.Text   = _mp4Mod.PARInfo.Height.ToString();

                txtDAR_Width.Text  = dar.ToString("0.###");
                txtDAR_Height.Text = "1";

                break;
            }
            }

            // Packed Bitstream
            lblIsPacked.Text         = _mp4Mod.IsPacked ? "Yes" : "No";
            chkChangePacking.Text    = _mp4Mod.IsPacked ? "Unpack" : "Pack";
            chkChangePacking.Enabled = _mp4Mod.IsPacked || _mp4Mod.ContainsBVOPs;

            // User Data
            _regUDList     = _mp4Mod.UserDataList;
            _autoUDList    = _mp4Mod.SuggestedUserData();
            UDListBoxItems = _regUDList;

            // Interlacing
            bool isInt = _mp4Mod.IsInterlaced;

            lblIsInterlaced.Text = isInt ? "Yes" : "No";
            rbTFF.Enabled        = isInt;
            rbBFF.Enabled        = isInt;
            if (isInt)
            {
                (_mp4Mod.TopFieldFirst ? rbTFF : rbBFF).Checked = true;
            }

            _updatingUI = false;
        }