예제 #1
0
        private void input_SelectionChanged(object sender, string val)
        {
            // get language
            bool   bFound      = false;
            string strLanguage = LanguageSelectionContainer.GetLanguageFromFileName(System.IO.Path.GetFileNameWithoutExtension(input.SelectedText));

            if (!String.IsNullOrEmpty(strLanguage))
            {
                SetLanguage(strLanguage);
                bFound = true;
            }
            else if (input.SelectedText.ToLowerInvariant().EndsWith(".idx"))
            {
                List <SubtitleInfo> subTracks;
                idxReader.readFileProperties(input.SelectedText, out subTracks);
                if (subTracks.Count > 0)
                {
                    SetLanguage(LanguageSelectionContainer.LookupISOCode(subTracks[0].Name));
                    bFound = true;
                }
            }
            if (!bFound && this.SelectedItem != null && this.SelectedStreamIndex > 0)
            {
                SetLanguage(MainForm.Instance.Settings.DefaultLanguage1);
            }

            // get delay & track name
            delay.Value = 0;
            if (this.SelectedItem != null && this.SelectedStreamIndex > 0 && this.SelectedItem.Tag is OneClickStream)
            {
                delay.Value  = ((OneClickStream)this.SelectedItem.Tag).Delay;
                subName.Text = ((OneClickStream)this.SelectedItem.Tag).Name;
            }
            if (PrettyFormatting.getDelayAndCheck(input.SelectedText) != null)
            {
                delay.Value = PrettyFormatting.getDelayAndCheck(input.SelectedText) ?? 0;
            }

            if (showDefaultStream)
            {
                chkDefaultStream.Checked = this.SelectedStream.DefaultStream;
            }

            if (showForceStream)
            {
                chkForceStream.Checked = this.SelectedStream.ForcedStream;
            }

            raiseEvent();
        }
예제 #2
0
        /// <summary>
        /// handles the go button for automated encoding
        /// checks if we're in automated 2 pass video mode
        /// then the video and audio configuration is checked, and if it checks out
        /// the audio job, video jobs and muxing job are generated, audio and video job are linked
        /// and encoding is started
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void queueButton_Click(object sender, System.EventArgs e)
        {
            if (String.IsNullOrEmpty(this.muxedOutput.Filename))
            {
                return;
            }

            FileSize?desiredSize = targetSize.Value;
            FileSize?splitSize   = splitting.Value;
            LogItem  log         = new LogItem(this.muxedOutput.Filename);

            MainForm.Instance.AutoEncodeLog.Add(log);

            if (FileSizeRadio.Checked)
            {
                log.LogValue("Desired Size", desiredSize);
            }
            else if (averageBitrateRadio.Checked)
            {
                log.LogValue("Projected Bitrate", string.Format("{0}kbps", projectedBitrateKBits.Text));
            }
            else
            {
                log.LogEvent("No Target Size (use profile settings)");
            }

            log.LogValue("Split Size", splitSize);

            MuxStream[]        audio;
            AudioJob[]         aStreams;
            AudioEncoderType[] muxTypes;
            separateEncodableAndMuxableAudioStreams(out aStreams, out audio, out muxTypes);
            MuxStream[]   subtitles   = new MuxStream[0];
            ChapterInfo   chapters    = new ChapterInfo();
            string        videoInput  = vInfo.VideoInput;
            string        videoOutput = vInfo.VideoOutput;
            string        muxedOutput = this.muxedOutput.Filename;
            ContainerType cot         = this.container.SelectedItem as ContainerType;

            // determine audio language
            foreach (MuxStream stream in audio)
            {
                string strLanguage = LanguageSelectionContainer.GetLanguageFromFileName(Path.GetFileNameWithoutExtension(stream.path));
                if (!String.IsNullOrEmpty(strLanguage))
                {
                    stream.language = strLanguage;
                }
            }

            if (addSubsNChapters.Checked)
            {
                AdaptiveMuxWindow amw = new AdaptiveMuxWindow();
                amw.setMinimizedMode(videoOutput, "", videoStream.Settings.EncoderType, JobUtil.getFramerate(videoInput), audio,
                                     muxTypes, muxedOutput, splitSize, cot);
                if (amw.ShowDialog() == DialogResult.OK)
                {
                    amw.getAdditionalStreams(out audio, out subtitles, out chapters, out muxedOutput, out cot);
                }
                else // user aborted, abort the whole process
                {
                    return;
                }
            }
            removeStreamsToBeEncoded(ref audio, aStreams);
            MainForm.Instance.Jobs.AddJobsWithDependencies(VideoUtil.GenerateJobSeries(videoStream, muxedOutput, aStreams, subtitles, new List <string>(), String.Empty, chapters,
                                                                                       desiredSize, splitSize, cot, prerender, audio, log, device.Text, vInfo.Zones, null, null, false), true);
            this.Close();
        }