Example #1
0
        private void tsmiNew_Click(object sender, EventArgs e)
        {
            var frm = new frmInputBox(Language.Lang.InputBoxNewMedia.Title, Language.Lang.InputBoxNewMedia.Message, 1);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (string.IsNullOrEmpty(frm.ReturnValue))
                {
                    return;
                }

                if (string.IsNullOrWhiteSpace(frm.ReturnValue))
                {
                    return;
                }

                var queue = new MediaQueue
                {
                    Enable       = true,
                    FilePath     = frm.ReturnValue + ".new",
                    OutputFormat = "mkv",
                };

                MediaQueueAdd(queue);
            }
        }
Example #2
0
        private void btnVideoArgEdit_Click(object sender, EventArgs e)
        {
            if (lstQueue.SelectedItems.Count > 0)
            {
                var q = lstQueue.Items[0].Tag as Queue;

                if (q.Video.Count > 0)
                {
                    var f = new frmInputBox(btnVideoArgEdit.Text.Replace("&", ""), q.Video[0].EncoderArgs);

                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        q.Video[0].EncoderArgs = f.ReturnValue;
                    }
                }
            }
        }
Example #3
0
        private void btnAudioAdv_Click(object sender, EventArgs e)
        {
            if (lstMedia.SelectedItems.Count > 0)
            {
                var cmd = string.Empty;
                try
                {
                    var mq = lstMedia.SelectedItems[0].Tag as MediaQueue;
                    var id = lstAudio.SelectedItems[0].Index;
                    cmd = mq.Audio[id].EncoderCommand;
                }
                catch
                {
                    cmd = string.Empty;
                }


                var frm = new frmInputBox(Language.Lang.InputBoxCommandLine.Title, Language.Lang.InputBoxCommandLine.Message, cmd, 0);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    cmd = frm.ReturnValue;
                }

                // if apply one item in the queue including selected audio
                if (lstMedia.SelectedItems.Count == 1)
                {
                    foreach (ListViewItem a in lstAudio.SelectedItems)
                    {
                        (lstMedia.SelectedItems[0].Tag as MediaQueue).Audio[a.Index].EncoderCommand = cmd;
                    }
                }

                // if apply every item in the queue including every audio
                if (lstMedia.SelectedItems.Count >= 2)
                {
                    foreach (ListViewItem q in lstMedia.SelectedItems)
                    {
                        foreach (var a in (q.Tag as MediaQueue).Audio)
                        {
                            a.EncoderCommand = cmd;
                        }
                    }
                }
            }
        }
Example #4
0
        private void tsmiEncodingPresetSaveAs_Click(object sender, EventArgs e)
        {
            var frm = new frmInputBox(Language.Lang.InputBoxEncodingPreset.Title, Language.Lang.InputBoxEncodingPreset.Message, cboEncodingPreset.Text, 4);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (string.IsNullOrEmpty(frm.ReturnValue))
                {
                    return;
                }

                if (string.IsNullOrWhiteSpace(frm.ReturnValue))
                {
                    return;
                }

                EncodingPreset(frm.ReturnValue, frm.ReturnValue);
            }
        }
Example #5
0
        private void btnAudioEditArg_Click(object sender, EventArgs e)
        {
            if (lstQueue.SelectedItems.Count > 0)
            {
                var q = lstQueue.SelectedItems[0].Tag as Queue;

                if (lstAudio.SelectedItems.Count > 0)
                {
                    var i = lstAudio.SelectedItems[0].Index;

                    if (q.Audio.Count > 0)
                    {
                        var f = new frmInputBox(btnAudioEditArg.Text.Replace("&", ""), q.Audio[i].EncoderArgs);

                        if (f.ShowDialog() == DialogResult.OK)
                        {
                            q.Audio[i].EncoderArgs = f.ReturnValue;
                        }
                    }
                }
            }
        }
Example #6
0
        private void tsmiNew_Click(object sender, EventArgs e)
        {
            var frm = new frmInputBox(Language.Lang.InputBoxNewMedia.Title, Language.Lang.InputBoxNewMedia.Message, 1);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (string.IsNullOrEmpty(frm.ReturnValue))
                {
                    return;
                }

                if (string.IsNullOrWhiteSpace(frm.ReturnValue))
                {
                    return;
                }

                var queue = new MediaQueue();

                queue.Enable       = true;
                queue.File         = frm.ReturnValue;
                queue.OutputFormat = TargetFormat.MKV;

                var lst = new ListViewItem(new[]
                {
                    frm.ReturnValue,
                    "",
                    "New",
                    "MKV",
                    "Ready",
                });

                lst.Tag     = queue;
                lst.Checked = true;

                lstMedia.Items.Add(lst);
            }
        }
Example #7
0
		private void btnProfileSave_Click(object sender, EventArgs e)
		{
			if (cboProfile.SelectedIndex == -1) // Error free
				return;

			var i = cboProfile.SelectedIndex;
			var p = Profile.List[i == 0 ? 0 : i - 1];

			string file;
			string platform;
			string name;
			string author;
			string web;

			if (i == 0)
			{
				file = Path.Combine(Global.Folder.Profile, $"{DateTime.Now:yyyyMMdd_HHmmss}.ifp");
				platform = "User";
				name = $"{DateTime.Now:yyyy-MM-dd_HH:mm:ss}";
				author = Environment.UserName;
				web = "";
			}
			else
			{
				file = p.File;
				platform = p.Info.Platform;
				name = p.Info.Name;
				author = p.Info.Author;
				web = p.Info.Web;
			}

			using (var form = new frmInputBox(Language.SaveNewProfilesTitle, Language.SaveNewProfilesInfo, name))
			{
				var result = form.ShowDialog();
				if (result == DialogResult.OK)
				{
					name = form.ReturnValue; // return
				}
				else
				{
					return;
				}
			}

			var parser = new FileIniDataParser();
			IniData data = new IniData();

			data.Sections.AddSection("info");
			data["info"].AddKey("format", rdoMKV.Checked ? "mkv" : "mp4");
			data["info"].AddKey("platform", platform);
			data["info"].AddKey("name", name);
			data["info"].AddKey("author", author);
			data["info"].AddKey("web", web);

			data.Sections.AddSection("picture");
			data["picture"].AddKey("resolution", cboPictureRes.Text);
			data["picture"].AddKey("framerate", cboPictureFps.Text);
			data["picture"].AddKey("bitdepth", cboPictureBit.Text);
			data["picture"].AddKey("chroma", cboPictureYuv.Text);

			data.Sections.AddSection("video");
			data["video"].AddKey("preset", cboVideoPreset.Text);
			data["video"].AddKey("tune", cboVideoTune.Text);
			data["video"].AddKey("type", cboVideoType.SelectedIndex.ToString());
			data["video"].AddKey("value", txtVideoValue.Text);
			data["video"].AddKey("cmd", txtVideoCmd.Text);

			data.Sections.AddSection("audio");
			data["audio"].AddKey("encoder", $"{cboAudioEncoder.SelectedValue}");
			data["audio"].AddKey("bitrate", cboAudioBit.Text);
			data["audio"].AddKey("frequency", cboAudioFreq.Text);
			data["audio"].AddKey("channel", cboAudioChannel.Text);
			data["audio"].AddKey("compile", chkAudioMerge.Checked ? "true" : "false");
			data["audio"].AddKey("cmd", txtAudioCmd.Text);

			parser.WriteFile(file, data, Encoding.UTF8);
			Profile.Load(); //reload list
			ProfileAdd();
		}
Example #8
0
		private void tsmiFFmpeg_Click(object sender, EventArgs e)
		{
			if (lstQueue.SelectedItems.Count > 0)
			{
				string title = tsmiFFmpeg.Text.Replace("&", "");
				string desc = tsmiFFmpeg.Text;
				string input = (lstQueue.SelectedItems[0].Tag as Queue).Picture.Command;

                using (var form = new frmInputBox(title, desc, input))
				{
					var result = form.ShowDialog();
					if (result == DialogResult.OK)
					{
						foreach (ListViewItem item in lstQueue.SelectedItems)
						{
							(item.Tag as Queue).Picture.Command = form.ReturnValue;
                        }
					}
					else
					{
						return;
					}
				}
			}
		}
Example #9
0
        private void btnAdvanceCommand_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem queue in lstMedia.SelectedItems)
            {
                var media = queue.Tag as MediaQueue;

                var command = string.Empty;

                var ibtitle = string.Empty;
                var ibmsg   = string.Empty;

                var type = 0; // 0 = decoder video, 1 = encoder video, 2 = decoder audio, 3 = encoder video
                var ctrl = sender as Button;

                if (string.Equals(ctrl.Name, btnVideoAdvDec.Name))
                {
                    if (media.Video.Count > 0)
                    {
                        command = media.Video[0].Quality.Command;
                    }

                    type    = 0;
                    ibtitle = Language.Lang.InputBoxCommandLineFFmpeg.Title;
                    ibmsg   = Language.Lang.InputBoxCommandLineFFmpeg.Message;
                }
                else if (string.Equals(ctrl.Name, btnVideoAdv.Name))
                {
                    if (media.Video.Count > 0)
                    {
                        command = media.Video[0].Encoder.Command;
                    }

                    type    = 1;
                    ibtitle = Language.Lang.InputBoxCommandLine.Title;
                    ibmsg   = Language.Lang.InputBoxCommandLine.Message;
                }
                else if (string.Equals(ctrl.Name, btnAudioAdvDec.Name))
                {
                    if (media.Audio.Count > 0)
                    {
                        command = media.Audio[0].Command;
                    }

                    type    = 2;
                    ibtitle = Language.Lang.InputBoxCommandLineFFmpeg.Title;
                    ibmsg   = Language.Lang.InputBoxCommandLineFFmpeg.Message;
                }
                else if (string.Equals(ctrl.Name, btnAudioAdv.Name))
                {
                    if (media.Audio.Count > 0)
                    {
                        command = media.Audio[0].Encoder.Command;
                    }

                    type    = 3;
                    ibtitle = Language.Lang.InputBoxCommandLine.Title;
                    ibmsg   = Language.Lang.InputBoxCommandLine.Message;
                }
                else
                {
                    type = 0;
                }

                // display
                var frm = new frmInputBox(ibtitle, ibmsg, command, 0);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    command = frm.ReturnValue;
                }

                // apply
                foreach (var video in media.Video)
                {
                    switch (type)
                    {
                    case 0:
                        video.Quality.Command = command;
                        break;

                    case 1:
                        video.Encoder.Command = command;
                        break;

                    default:
                        break;
                    }
                }

                foreach (var audio in media.Audio)
                {
                    switch (type)
                    {
                    case 2:
                        audio.Command = command;
                        break;

                    case 3:
                        audio.Encoder.Command = command;
                        break;

                    default:
                        break;
                    }
                }
            }
        }