Пример #1
0
        /// <summary>
        /// Cut End
        /// </summary>
        public static String CutEnd(string input_Text,
                                    bool batch_IsChecked,
                                    string mediaType_SelectedItem,
                                    string cut_SelectedItem,
                                    string cutEnd_Text_Hours,
                                    string cutEnd_Text_Minutes,
                                    string cutEnd_Text_Seconds,
                                    string cutEnd_Text_Milliseconds,
                                    string frameEnd_Text
                                    )
        {
            // -------------------------
            // Yes
            // -------------------------
            if (cut_SelectedItem == "Yes")
            {
                // Video, Image Sequence, Audio
                // Image only has Start, no End
                if (mediaType_SelectedItem != "Image")
                {
                    // -------------------------
                    // Time
                    // -------------------------
                    // If Frame Textboxes Default Use Time
                    if (string.IsNullOrEmpty(frameEnd_Text))
                    {
                        // End
                        trimEnd = cutEnd_Text_Hours.PadLeft(2, '0') + ":" +
                                  cutEnd_Text_Minutes.PadLeft(2, '0') + ":" +
                                  cutEnd_Text_Seconds.PadLeft(2, '0') + "." +
                                  cutEnd_Text_Milliseconds.PadLeft(3, '0');

                        // If End Time is Empty, Default to Full Duration
                        // Input Null Check
                        if (!string.IsNullOrEmpty(input_Text))
                        {
                            if (trimEnd == "00:00:00.000" ||
                                string.IsNullOrEmpty(trimEnd))
                            {
                                trimEnd = FFprobe.CutDuration(input_Text, batch_IsChecked);
                            }
                        }
                    }

                    // -------------------------
                    // Frames
                    // -------------------------
                    // If Frame Textboxes have Text, but not Default,
                    // use FramesToDecimal Method (Override Time)
                    else if (!string.IsNullOrEmpty(frameEnd_Text))
                    {
                        trimEnd = Video.FramesToDecimal(frameEnd_Text);
                    }


                    trimEnd = "-to " + trimEnd;
                }
            }

            // -------------------------
            // No
            // -------------------------
            else if (cut_SelectedItem == "No")
            {
                trimEnd = string.Empty;
            }

            // Return Value
            return(trimEnd);
        }
Пример #2
0
        /// <summary>
        /// Cut (Method)
        /// </summary>
        public static String Cut(MainWindow mainwindow)
        {
            // -------------------------
            // Yes
            // -------------------------
            // VIDEO
            //
            if ((string)mainwindow.cboCut.SelectedItem == "Yes")
            {
                if ((string)mainwindow.cboMediaType.SelectedItem == "Video")
                {
                    // Use Time
                    // If Frame Textboxes Default Use Time
                    if (mainwindow.frameStart.Text == "Frame" ||
                        mainwindow.frameEnd.Text == "Range" ||
                        string.IsNullOrWhiteSpace(mainwindow.frameStart.Text) ||
                        string.IsNullOrWhiteSpace(mainwindow.frameEnd.Text))
                    {
                        trimStart = mainwindow.cutStart.Text;
                        trimEnd   = mainwindow.cutEnd.Text;
                    }

                    // Use Frames
                    // If Frame Textboxes have Text, but not Default, use FramesToDecimal Method (Override Time)
                    else if (mainwindow.frameStart.Text != "Frame" &&
                             mainwindow.frameEnd.Text != "Range" &&
                             !string.IsNullOrWhiteSpace(mainwindow.frameStart.Text) &&
                             !string.IsNullOrWhiteSpace(mainwindow.frameEnd.Text))
                    {
                        Video.FramesToDecimal(mainwindow);
                    }

                    // If End Time is Empty, Default to Full Duration
                    // Input Null Check
                    if (!string.IsNullOrWhiteSpace(mainwindow.tbxInput.Text))
                    {
                        if (mainwindow.cutEnd.Text == "00:00:00.000" || string.IsNullOrWhiteSpace(mainwindow.cutEnd.Text))
                        {
                            trimEnd = FFprobe.CutDuration(mainwindow);
                        }
                    }

                    // Combine
                    trim = "-ss " + trimStart + " " + "-to " + trimEnd;
                }

                // AUDIO
                //
                else if ((string)mainwindow.cboMediaType.SelectedItem == "Audio")
                {
                    trimStart = mainwindow.cutStart.Text;
                    trimEnd   = mainwindow.cutEnd.Text;

                    // If End Time is Empty, Default to Full Duration
                    // Input Null Check
                    if (!string.IsNullOrWhiteSpace(mainwindow.tbxInput.Text))
                    {
                        if (mainwindow.cutEnd.Text == "00:00:00.000" || string.IsNullOrWhiteSpace(mainwindow.cutEnd.Text))
                        {
                            trimEnd = FFprobe.CutDuration(mainwindow);
                        }
                    }

                    // Combine
                    trim = "-ss " + trimStart + " " + "-to " + trimEnd;
                }

                // JPEG & PNG Screenshot
                //
                else if ((string)mainwindow.cboMediaType.SelectedItem == "Image")
                {
                    // Use Time
                    // If Frame Textbox Default Use Time
                    if (mainwindow.frameStart.Text == "Frame" || string.IsNullOrWhiteSpace(mainwindow.frameStart.Text))
                    {
                        trimStart = mainwindow.cutStart.Text;
                    }

                    // Use Frames
                    // If Frame Textboxes have Text, but not Default, use FramesToDecimal Method (Override Time)
                    else if (mainwindow.frameStart.Text != "Frame" &&
                             mainwindow.frameEnd.Text != "Range" &&
                             !string.IsNullOrWhiteSpace(mainwindow.frameStart.Text) &&
                             string.IsNullOrWhiteSpace(mainwindow.frameEnd.Text))
                    {
                        Video.FramesToDecimal(mainwindow);
                    }

                    trim = "-ss " + trimStart;
                }

                // JPEG & PNG Sequence
                //
                else if ((string)mainwindow.cboMediaType.SelectedItem == "Sequence")
                {
                    // Use Time
                    // If Frame Textboxes Default Use Time
                    if (mainwindow.frameStart.Text == "Frame" ||
                        mainwindow.frameEnd.Text == "Range" ||
                        string.IsNullOrWhiteSpace(mainwindow.frameStart.Text) ||
                        string.IsNullOrWhiteSpace(mainwindow.frameEnd.Text))
                    {
                        trimStart = mainwindow.cutStart.Text;
                        trimEnd   = mainwindow.cutEnd.Text;
                    }

                    // Use Frames
                    // If Frame Textboxes have Text, but not Default, use FramesToDecimal Method (Override Time)
                    else if (mainwindow.frameStart.Text != "Frame" &&
                             mainwindow.frameEnd.Text != "Range" &&
                             !string.IsNullOrWhiteSpace(mainwindow.frameStart.Text) &&
                             !string.IsNullOrWhiteSpace(mainwindow.frameEnd.Text))
                    {
                        Video.FramesToDecimal(mainwindow);
                    }

                    trim = "-ss " + trimStart + " " + "-to " + trimEnd;
                }
            }

            // -------------------------
            // No
            // -------------------------
            else if ((string)mainwindow.cboCut.SelectedItem == "No")
            {
                trim = string.Empty;
            }

            // Return Value
            return(trim);
        }