#region CPL License
/*
Nuclex Framework
Copyright (C) 2002-2009 Nuclex Development Labs
This library is free software; you can redistribute it and/or
modify it under the terms of the IBM Common Public License as
published by the IBM Corporation; either version 1.0 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
IBM Common Public License for more details.
You should have received a copy of the IBM Common Public
License along with this library
*/
#endregion
using System;
using System.Collections.Generic;
namespace Nuclex.Audio.Formats.Flac {
#if ENABLE_PINVOKE_FLAC_DECODER
/// An enumeration of the available channel assignments
public enum ChannelAssignment {
/// Independent channels
Independent = 0,
/// Left+side stereo
LeftAndSide = 1,
/// Right+side stereo
RightAndSide = 2,
/// Mid+side stereo
MidAndSide = 3
}
/// An enumeration of the available subframe types
public enum SubframeType {
/// Constant signal
Constant = 0,
/// Uncompressed signal
Verbatim = 1,
/// Fixed polynomial prediction
Fixed = 2,
/// Linear prediction
Lpc = 3
}
/// FLAC frame header structure
public struct FrameHeader {
/// Number of samples per subframe
public int Blocksize;
/// Sample rate in Hz
public int SampleRate;
/// Number of channels (== number of subframes)
///
///
/// -
/// 1 channel
/// mono
///
/// -
/// 2 channel
/// left, right
///
/// -
/// 3 channel
/// left, right, center
///
/// -
/// 4 channel
/// left, right, back left, back right
///
/// -
/// 5 channel
///
/// left, right, center, back/surround left, back/surround right
///
///
/// -
/// 6 channel
///
/// left, right, center, LFE, back/surround left, back/surround right
///
///
///
///
public int Channels;
/// Channel assignment for the frame
public ChannelAssignment ChannelAssignment;
/// The sample resolution.
public int BitsPerSample;
/// Frame number of first sample in frame (if provided)
///
/// Either a FrameNumber or a SampleNumber will be provided. The omitted element
/// will be set to -1.
///
public int FrameNumber;
/// Sample number of first sample in frame (if provided)
///
/// Either a FrameNumber or a SampleNumber will be provided. The omitted element
/// will be set to -1.
///
public long SampleNumber;
/// CRC-8 of the raw frame header bytes
///
/// Polynomial = x^8 + x^2 + x^1 + x^0, initialized with 0. Includes everything before
/// the CRC byte including the sync code.
///
public byte Crc;
}
/// FLAC frame footer structure
public struct FrameFooter {
/// CRC-16 of the bytes before the crc
///
/// Polynomial = x^16 + x^15 + x^2 + x^0, initialized with 0. Goes back to and includes
/// the frame header sync code.
///
public UInt16 Crc;
}
/// FLAC frame structure
public struct Frame {
/// Header providing informations that describe the frame
public FrameHeader Header;
/// Subframes for the decoded data of the individual channels
public Subframe[] Subframes;
/// Footer containing data to verify the frame
public FrameFooter Footer;
}
#endif // ENABLE_PINVOKE_FLAC_DECODER
} // namespace Nuclex.Audio.Formats.Flac