private void Init() { ffmpeg = new FFWrapper(); ffmpeg.CreateDecoder((int)VideoFrame.ImageFormat.YUV420P); //ffmpeg.CreateDecoder((int)VideoFrame.ImageFormat.BGR24); decodedCallback = new FFWrapper.FrameDecodedCallback_(DecodedVideoFrameCallback); ffmpeg.RegisterDecodedCallback(decodedCallback); }
private async void OnStartConversion(object sender, EventArgs e) { if (String.IsNullOrEmpty(inputFileName.Text)) { MessageBox.Show(this, Resources.Form1_onStartConversion_No_input_file_selected, Resources.Form1_onStartConversion_Invalid_input_file, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (String.IsNullOrEmpty(outputFileName.Text)) { MessageBox.Show(this, Resources.Form1_onStartConversion_No_output_file_selected, Resources.Form1_onStartConversion_Invalid_output_file, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var advancedOptions = GetEncodingOptions(); if (advancedOptions == null) { return; } try { toolStripStatusLabel1.Text = "Converting..."; toolStripProgressBar1.Visible = true; bool success = false; if (checkBoxBatchMode.Checked) { string outputFormat = conversionFormats.SelectedItem.ToString(); success = await FFWrapper.StartBatchConversion(inputFileName.Text, outputFileName.Text, outputFormat, advancedOptions); } else { success = await FFWrapper.StartConversion(inputFileName.Text, outputFileName.Text, advancedOptions); } var messageBoxMessage = String.Format("The conversion completed successfully. The result is saved at: \"{0}\".", outputFileName.Text); var toolStripMessage = "Ready"; if (!success) { toolStripMessage = "Conversion Failed"; if (checkBoxBatchMode.Checked) { messageBoxMessage = "Not all files could be converted succesfully. Please review the log and try again."; } else { messageBoxMessage = "Something went wrong during conversion. Please try again."; } } toolStripStatusLabel1.Text = toolStripMessage; toolStripProgressBar1.Visible = false; MessageBox.Show(this, messageBoxMessage, "Conversion Complete", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }