コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FlacSubFrame"/> class.
        /// </summary>
        /// <param name="flacFrame">The FLAC frame.</param>
        protected FlacSubFrame(FlacFrame flacFrame)
        {
            if (flacFrame == null)
                throw new ArgumentNullException("flacFrame");

            FlacFrame = flacFrame;
        }
コード例 #2
0
        ////------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Reads a <see cref="FlacSubFrame" /> from a <see cref="Stream" />.
        /// </summary>
        /// <param name="stream">The stream.</param>
        /// <param name="channel">The channel.</param>
        /// <param name="flacFrame">The FLAC frame.</param>
        /// <returns>
        /// true if found; otherwise, null.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">Thrown if stream is null.</exception>
        public static FlacSubFrame ReadFrame(Stream stream, int channel, FlacFrame flacFrame)
        {
            if (stream == null)
                throw new ArgumentNullException("stream");

            if (flacFrame == null)
                throw new ArgumentNullException("flacFrame");

            return ReadSubFrame(stream as StreamBuffer ?? new StreamBuffer(stream), channel, flacFrame);
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FlacVerbatimSubFrame"/> class.
 /// </summary>
 /// <param name="flacFrame">The <see cref="FlacFrame"/>.</param>
 public FlacVerbatimSubFrame(FlacFrame flacFrame)
     : base(flacFrame)
 {
     if (flacFrame == null)
         throw new ArgumentNullException("flacFrame");
 }
コード例 #4
0
ファイル: FlacFrame.cs プロジェクト: NeWbY100/AudioVideoLib
        ////------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Reads a <see cref="FlacFrame" /> from a <see cref="Stream" />.
        /// </summary>
        /// <param name="stream">The stream.</param>
        /// <param name="flacStream">The FLAC stream.</param>
        /// <returns>
        /// true if found; otherwise, null.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">Thrown if stream is null.</exception>
        public static FlacFrame ReadFrame(Stream stream, IO.FlacStream flacStream)
        {
            if (stream == null)
                throw new ArgumentNullException("stream");

            if (flacStream == null)
                throw new ArgumentNullException("flacStream");

            FlacFrame frame = new FlacFrame(flacStream);
            return frame.ReadFrame(stream as StreamBuffer ?? new StreamBuffer(stream)) ? frame : null;
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FlacLinearPredictorSubFrame"/> class.
 /// </summary>
 /// <param name="flacFrame">The <see cref="FlacFrame"/>.</param>
 public FlacLinearPredictorSubFrame(FlacFrame flacFrame)
     : base(flacFrame)
 {
     if (flacFrame == null)
         throw new ArgumentNullException("flacFrame");
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FlacConstantSubFrame"/> class.
 /// </summary>
 /// <param name="flacFrame">The FLAC frame.</param>
 public FlacConstantSubFrame(FlacFrame flacFrame)
     : base(flacFrame)
 {
     if (flacFrame == null)
         throw new ArgumentNullException("flacFrame");
 }
コード例 #7
0
        ////------------------------------------------------------------------------------------------------------------------------------
        private static FlacSubFrame ReadSubFrame(StreamBuffer sb, int channel, FlacFrame flacFrame)
        {
            if (sb == null)
                throw new ArgumentNullException("sb");

            if (flacFrame == null)
                throw new ArgumentNullException("flacFrame");

            FlacSubFrame frame;
            int header = sb.ReadBigEndianInt32(false);
            int type = (header >> 1) & 0x7E;
            switch (type)
            {
                case 0x00:
                    frame = new FlacConstantSubFrame(flacFrame);
                    break;

                case 0x01:
                    frame = new FlacVerbatimSubFrame(flacFrame);
                    break;

                default:
                    if ((type >= 0x08) && (type <= 0x0C))
                        frame = new FlacFixedSubFrame(flacFrame);
                    else if (type >= 0x20)
                        frame = new FlacLinearPredictorSubFrame(flacFrame);
                    else
                        frame = new FlacSubFrame(flacFrame);
                    break;
            }
            frame.ReadSubFrame(sb, channel);
            return frame;
        }