public AudioFormatInfo( SampleFormat sampleFormat, int sampleRate, ChannelLayout channelLayout) : this(sampleFormat, sampleRate, ChannelLayoutHelper.GetChannelCount(channelLayout), channelLayout) { }
public AudioFormatInfo( SampleFormat sampleFormat, int sampleRate, int channelCount, ChannelLayout channelLayout = default) { if (sampleFormat == SampleFormat.Unknown) { throw new ArgumentException("Must not be Unknown", nameof(sampleFormat)); } if (sampleRate <= 0 || sampleRate > Constants.MaxSampleRate) { throw ExceptionHelper.OutOfRange(nameof(sampleRate), 1, Constants.MaxSampleRate, sampleRate); } if (channelCount <= 0 || channelCount > Constants.MaxChannelCount) { throw ExceptionHelper.OutOfRange(nameof(sampleRate), 1, Constants.MaxChannelCount, sampleRate); } SampleFormat = sampleFormat; SampleRate = sampleRate; ChannelCount = channelCount; ChannelLayout = channelLayout; }
/// <summary> /// <see cref="swr_alloc_set_opts(SwrContext*, long, AVSampleFormat, int, long, AVSampleFormat, int, int, void*)"/> /// </summary> public void Reset( ChannelLayout outputChannelLayout, SampleFormat outputSampleFormat, int outputSampleRate, ChannelLayout inputChannelLayout, SampleFormat inputSampleFormat, int inputSampleRate) { _nativePointer = NativeUtils.NotNull((IntPtr)swr_alloc_set_opts(this, (long)outputChannelLayout, (AVSampleFormat)outputSampleFormat, outputSampleRate, (long)inputChannelLayout, (AVSampleFormat)inputSampleFormat, inputSampleRate, log_offset: 0, log_ctx: null)); }
public override int GetHashCode() { var hashCode = 1182625657; hashCode = hashCode * -1521134295 + Codec.GetHashCode(); hashCode = hashCode * -1521134295 + ChannelLayout.GetHashCode(); hashCode = hashCode * -1521134295 + SampleRate.GetHashCode(); hashCode = hashCode * -1521134295 + BitsPerChannel.GetHashCode(); hashCode = hashCode * -1521134295 + BitRate.GetHashCode(); return(hashCode); }
// Set Layout public void SetLayout(ChannelLayout cLayout) { try { vsLayout = cLayout; GenerateLayout(); } catch (Exception err) { logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);; } }
internal static int get_right_channel(ChannelLayout layout, int stream_id, int prev) { int i; i = (prev < 0) ? 0 : prev + 1; for (; i < layout.nb_channels; i++) { if (layout.mapping[i] == stream_id * 2 + 1) { return(i); } } return(-1); }
internal static int get_mono_channel(ChannelLayout layout, int stream_id, int prev) { int i; i = (prev < 0) ? 0 : prev + 1; for (; i < layout.nb_channels; i++) { if (layout.mapping[i] == stream_id + layout.nb_coupled_streams) { return(i); } } return(-1); }
public static Frame CreateWritableAudio(SampleFormat sampleFormat, ChannelLayout channelLayout, int sampleRate, int sampleCount) { var frame = new Frame { Format = (int)sampleFormat, ChannelLayout = channelLayout, SampleRate = sampleRate, NbSamples = sampleCount, }; frame.EnsureBuffer(); frame.MakeWritable(); return(frame); }
internal static int validate_layout(ChannelLayout layout) { int i, max_channel; max_channel = layout.nb_streams + layout.nb_coupled_streams; if (max_channel > 255) { return(0); } for (i = 0; i < layout.nb_channels; i++) { if (layout.mapping[i] >= max_channel && layout.mapping[i] != 255) { return(0); } } return(1); }
public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteStartElement("item", Properties.Resources.CasparPlayoutSchemaURL); writer.WriteAttributeString("clipname", Clipname); writer.WriteAttributeString("videoLayer", VideoLayer.ToString()); writer.WriteAttributeString("seek", Seek.ToString()); writer.WriteAttributeString("length", Length.ToString()); writer.WriteAttributeString("loop", Loop.ToString()); writer.WriteAttributeString("channel_layout", ChannelLayout.ToString()); writer.WriteStartElement("transition"); writer.WriteAttributeString("type", Transition.Type.ToString()); writer.WriteAttributeString("duration", Transition.Duration.ToString()); writer.WriteAttributeString("easing", Transition.Easing.ToString()); writer.WriteAttributeString("pause", Transition.Pause.ToString()); writer.WriteEndElement(); writer.WriteEndElement(); }
public static bool TryParse(string text, out ChannelLayout layout) { switch (text) { case "mono": layout = ChannelLayout.Mono; return(true); case "stereo": layout = ChannelLayout.Stereo; return(true); case "downmix": layout = ChannelLayout.StereoDownmix; return(true); case "quad": layout = ChannelLayout.Quad; return(true); case "2.1": layout = ChannelLayout._2_1; return(true); case "2.2": layout = ChannelLayout._2_2; return(true); case "3.0": layout = ChannelLayout._3_0; return(true); case "3.1": layout = ChannelLayout._3_1; return(true); case "4.1": layout = ChannelLayout._4_1; return(true); case "4.0": layout = ChannelLayout._4_0; return(true); case "5.0": layout = ChannelLayout._5_0; return(true); case "5.1": layout = ChannelLayout._5_1; return(true); case "6.0": layout = ChannelLayout._6_0; return(true); case "6.1": layout = ChannelLayout._6_1; return(true); case "7.0": layout = ChannelLayout._7_0; return(true); case "7.1": layout = ChannelLayout._7_1; return(true); case "octagonal": layout = ChannelLayout.Octagonal; return(true); } layout = default; return(false); }
public static int GetChannelCount(this ChannelLayout layout) { return(CountSetBits((ulong)layout)); }
/// <summary> /// <see cref="av_opt_set_channel_layout(void*, string, long, int)"/> /// </summary> public void Set(string name, ChannelLayout value, OptionSearchFlags searchFlags = OptionSearchFlags.None) => av_opt_set_channel_layout(_obj, name, (long)value, (int)searchFlags).ThrowIfError();
/// <summary> /// Set audio layout for the channel /// </summary> /// <param name="layout"></param> /// <returns></returns> public virtual bool SetChannelLayout(ChannelLayout layout) { return(_amcpTcpParser.SendCommand($"SET {ID} CHANNEL_LAYOUT {layout.ToAmcpValue()}")); }
/// <summary> /// Init with default values /// </summary> /// <param name="channelLayout">channel layout</param> /// <param name="sampleRate">sample rate</param> /// <param name="framesPerBuffer">frames per buffer</param> public AudioParameters(ChannelLayout channelLayout, int sampleRate, int framesPerBuffer) { ChannelLayout = channelLayout; SampleRate = sampleRate; FramesPerBuffer = framesPerBuffer; }
public void OnAudioStreamStarted(IWebBrowser chromiumWebBrowser, IBrowser browser, int audioStreamId, int channels, ChannelLayout channelLayout, int sampleRate, int framesPerBuffer) { Console.WriteLine("OnAudioStreamStarted"); }
public Mp3EncodingParameters(BitRate bitRate, ChannelLayout channelLayout = ChannelLayout.Stereo) { this.BitRate = bitRate; this.ChannelLayout = channelLayout; }
public static long GetAvChannelLayout(ChannelLayout channelLayout) { return(channelLayout == ChannelLayout.Mono ? ffmpeg.AV_CH_LAYOUT_MONO : ffmpeg.AV_CH_LAYOUT_STEREO); }
void IAudioHandler.OnAudioStreamStarted(IWebBrowser chromiumWebBrowser, IBrowser browser, int audioStreamId, int channels, ChannelLayout channelLayout, int sampleRate, int framesPerBuffer) { this.channelLayout = channelLayout; this.channelCount = channels; this.sampleRate = sampleRate; }
public void EqualToFFmpeg(ChannelLayout channel, long value) { Assert.Equal(value, (long)channel); }
protected override void OnAudioStreamStarted(IWebBrowser chromiumWebBrowser, IBrowser browser, AudioParameters parameters, int channels) { this.channelLayout = parameters.ChannelLayout; this.sampleRate = parameters.SampleRate; this.channelCount = channels; }
public void EqualToMediaFoundation(ChannelLayout channel, long value) { Assert.Equal(value, (long)channel); }