public WavFormatInfoCollection(IBaseFilter filter, PinDirection direction) { IEnumerator <WavFormatInfo> enumerator = WavFormatInfoTools.EnumerateFormatsForDirection(filter, direction); while (enumerator.MoveNext()) { Items.Add(enumerator.Current); } }
public static AudioCompressor Create(AudioFormat format) { if (format == null) { throw new ArgumentNullException("format"); } AudioEncoder encoder = AudioEncoder.FindByFriendlyName(format.AudioCompressor); if (encoder == null) { throw new SplicerException( string.Format(CultureInfo.CurrentUICulture, Resources.ErrorCanResolveAudioEncoder, format.AudioCompressor)); } if (!format.UseDefaults) { WavFormatInfo formatInfo = WavFormatInfoTools.FindFormat(encoder.Filter, PinDirection.Output, format); if (formatInfo == null) { var builder = new StringBuilder(); builder.AppendFormat(CultureInfo.CurrentUICulture, Resources.ErrorCanNotResolveMediaTypeForEncoder, format.Khz, format.Kbps, format.IsMono); foreach (WavFormatInfo info in encoder.Formats) { builder.Append(Environment.NewLine); builder.Append(info.ToString()); } throw new SplicerException(builder.ToString()); } return(new AudioCompressor(encoder.Filter, formatInfo.MediaType)); } else { return(new AudioCompressor(encoder.Filter, null)); } }