コード例 #1
0
        private void Convert_Click(object sender, EventArgs e)
        {
            lblUpdate.Text = string.Format("Converting and downloading: 0/{0}", listCount);
            EnableConvert(false);
            flpDestination.Enabled = false;

            foreach (VideoInfos url in urlList)
                workingList.Add(url);

            urlList.Clear();
            flpSettings.Enabled = false;

            Parameter param;

            if (chkAudio.Checked)
            {
                commandsList.AddCommand(Com.ExtractAudio);
                commandsList.AddCommand(Com.AudioQuality, new Parameter(0));

                param = new Parameter(AudioFormats.GetAudioFormat(cmbOptions.SelectedItem.ToString()));
            }
            else
                param = new Parameter(VideoFormats.GetVideoFormat(cmbOptions.SelectedItem.ToString()));

            commandsList.AddCommand(chkVideo.Checked ? Com.VideoFormat : Com.AudioFormat, param);

            // Output
            commandsList.AddCommand(Com.Output, new Parameter(destinationPath));

            Thread thread = new Thread(Download);
            thread.Start();
        }
コード例 #2
0
        public static int GetFourCC(VideoFormats format)
        {
            // Looked up from https://www.fourcc.org/codecs.php
            switch (format)
            {
            case VideoFormats.MP4:
                return(VideoWriter.Fourcc('M', 'P', '4', '2'));

            default:
                throw new NotImplementedException($"Video format {format} is not yet supported. Please implement first!!");
            }
        }
コード例 #3
0
        private void VideoCheckedChanged(object sender, EventArgs e)
        {
            CheckBox chk = (CheckBox)sender;

            if (chk.Checked)
            {
                cmbOptions.Items.Clear();
                chkAudio.Checked = false;
                foreach (string format in VideoFormats.GetAllFormats())
                    cmbOptions.Items.Add(format.ToUpper());

                cmbOptions.SelectedIndex = 0;
                cmbOptions.Enabled = true;

                if (!string.IsNullOrEmpty(destinationPath) && urlList.Count > 0)
                    EnableConvert(true);
            }
            else if (!chkVideo.Checked)
            {
                cmbOptions.Items.Clear();
                EnableConvert(false);
            }
        }
コード例 #4
0
 public Parameter(VideoFormats value)
 {
     videoFormat = value;
 }