private void fixFileNameExtensions(VideoStream video, AudioJob[] audioStreams, ContainerType container) { AudioEncoderType[] audioCodecs = new AudioEncoderType[audioStreams.Length]; for (int i = 0; i < audioStreams.Length; i++) { audioCodecs[i] = audioStreams[i].Settings.EncoderType; } MuxPath path; if (video.Settings == null) { path = mainForm.MuxProvider.GetMuxPath(VideoEncoderType.X264, audioCodecs, container); } else { path = mainForm.MuxProvider.GetMuxPath(video.Settings.EncoderType, audioCodecs, container); } if (path == null) { return; } List <AudioType> audioTypes = new List <AudioType>(); foreach (MuxableType type in path.InitialInputTypes) { if (type.outputType is VideoType) { // see http://forum.doom9.org/showthread.php?p=1243370#post1243370 if ((mainForm.Settings.ForceRawAVCExtension) && (video.Settings.EncoderType == VideoEncoderType.X264)) { video.Output = Path.ChangeExtension(video.Output, ".264"); } else { video.Output = Path.ChangeExtension(video.Output, type.outputType.Extension); } video.VideoType = type; } if (type.outputType is AudioType) { audioTypes.Add((AudioType)type.outputType); } } AudioEncoderProvider aProvider = new AudioEncoderProvider(); for (int i = 0; i < audioStreams.Length; i++) { AudioType[] types = aProvider.GetSupportedOutput(audioStreams[i].Settings.EncoderType); foreach (AudioType type in types) { if (audioTypes.Contains(type)) { audioStreams[i].Output = Path.ChangeExtension(audioStreams[i].Output, type.Extension); break; } } } }
private void fixFileNameExtensions(VideoStream video, AudioJob[] audioStreams, ContainerType container) { AudioEncoderType[] audioCodecs = new AudioEncoderType[audioStreams.Length]; for (int i = 0; i < audioStreams.Length; i++) { audioCodecs[i] = audioStreams[i].Settings.EncoderType; } MuxPath path = mainForm.MuxProvider.GetMuxPath(video.Settings.EncoderType, audioCodecs, container); if (path == null) { return; } List <AudioType> audioTypes = new List <AudioType>(); foreach (MuxableType type in path.InitialInputTypes) { if (type.outputType is VideoType) { video.Output = Path.ChangeExtension(video.Output, type.outputType.Extension); video.VideoType = type; } if (type.outputType is AudioType) { audioTypes.Add((AudioType)type.outputType); } } AudioEncoderProvider aProvider = new AudioEncoderProvider(); for (int i = 0; i < audioStreams.Length; i++) { AudioType[] types = aProvider.GetSupportedOutput(audioStreams[i].Settings.EncoderType); foreach (AudioType type in types) { if (audioTypes.Contains(type)) { audioStreams[i].Output = Path.ChangeExtension(audioStreams[i].Output, type.Extension); break; } } } }
public OneClickWindow(MainForm mainForm, JobUtil jobUtil, VideoEncoderProvider vProv, AudioEncoderProvider aProv) { this.mainForm = mainForm; vUtil = new VideoUtil(mainForm); this.muxProvider = mainForm.MuxProvider; acceptableContainerTypes = muxProvider.GetSupportedContainers().ToArray(); InitializeComponent(); initTabs(); videoProfile.Manager = mainForm.Profiles; initAudioHandler(); avsProfile.Manager = mainForm.Profiles; initOneClickHandler(); audioTrack1.StandardItems = audioTrack2.StandardItems = new object[] { "None" }; audioTrack1.SelectedIndex = audioTrack2.SelectedIndex = 0; //if containerFormat has not yet been set by the oneclick profile, add supported containers if (containerFormat.Items.Count == 0) { containerFormat.Items.AddRange(muxProvider.GetSupportedContainers().ToArray()); this.containerFormat.SelectedIndex = 0; } showAdvancedOptions_CheckedChanged(null, null); }
private static void fixFileNameExtensions(VideoStream video, AudioJob[] audioStreams, ContainerType container) { AudioEncoderType[] audioCodecs = new AudioEncoderType[audioStreams.Length]; for (int i = 0; i < audioStreams.Length; i++) { audioCodecs[i] = audioStreams[i].Settings.EncoderType; } MuxPath path; if (video.Settings == null) { path = MainForm.Instance.MuxProvider.GetMuxPath(VideoEncoderType.X264, audioCodecs, container); } else { path = MainForm.Instance.MuxProvider.GetMuxPath(video.Settings.EncoderType, audioCodecs, container); } if (path == null) { return; } List <AudioType> audioTypes = new List <AudioType>(); foreach (MuxableType type in path.InitialInputTypes) { if (type.outputType is VideoType) { if (video.Settings.EncoderType == VideoEncoderType.XVID && (type.outputType.ContainerType == ContainerType.AVI || type.outputType.ContainerType == ContainerType.MKV)) { video.Output = Path.ChangeExtension(video.Output, ".m4v"); } else if (video.Settings.EncoderType == VideoEncoderType.X264 && type.outputType.ContainerType == ContainerType.MP4) { video.Output = Path.ChangeExtension(video.Output, ".264"); } else if (video.Settings.EncoderType == VideoEncoderType.X265 && (type.outputType.ContainerType == ContainerType.MKV || type.outputType.ContainerType == ContainerType.MP4)) { video.Output = Path.ChangeExtension(video.Output, ".hevc"); } else { video.Output = Path.ChangeExtension(video.Output, type.outputType.Extension); } video.VideoType = type; } if (type.outputType is AudioType) { audioTypes.Add((AudioType)type.outputType); } } AudioEncoderProvider aProvider = new AudioEncoderProvider(); for (int i = 0; i < audioStreams.Length; i++) { AudioType[] types = aProvider.GetSupportedOutput(audioStreams[i].Settings.EncoderType); foreach (AudioType type in types) { if (audioTypes.Contains(type)) { string newFileName = Path.ChangeExtension(audioStreams[i].Output, type.Extension); if (!audioStreams[i].Input.Equals(newFileName)) { audioStreams[i].Output = newFileName; } break; } } } }