TagLib::MPEG::Header Class Reference

An implementation of MP3 frame headers. More...

`#include <mpegheader.h>`

## Public Types

enum | Version { Version1 = 0 , Version2 = 1 , Version2_5 = 2 , Version4 = 3 }
enum | ChannelMode { Stereo = 0 , JointStereo = 1 , DualChannel = 2 , SingleChannel = 3 }
enum | ChannelConfiguration { Custom = 0 , FrontCenter = 1 , FrontLeftRight = 2 , FrontCenterLeftRight = 3 , FrontCenterLeftRightBackCenter = 4 , FrontCenterLeftRightBackLeftRight = 5 , FrontCenterLeftRightBackLeftRightLFE = 6 , FrontCenterLeftRightSideLeftRightBackLeftRightLFE = 7 }

## Public Member Functions

| Header (File *file, offset_t offset, bool checkLength=true)
| Header (const Header &h)
| ~Header ()
bool | isValid () const
Version | version () const
int | layer () const
bool | protectionEnabled () const
int | bitrate () const
int | sampleRate () const
bool | isPadded () const
ChannelMode | channelMode () const
ChannelConfiguration | channelConfiguration () const
bool | isADTS () const
bool | isCopyrighted () const
bool | isOriginal () const
int | frameLength () const
int | samplesPerFrame () const
Header & | operator= (const Header &h)

## Detailed Description

An implementation of MP3 frame headers.

This is an implementation of MPEG Layer III headers. The API follows more or less the binary format of these headers.

See these documents as a reference

- MPEG Audio Layer I/II/III frame header
- ADTS

## Member Enumeration Documentation

## ChannelConfiguration

enum TagLib::MPEG::Header::ChannelConfiguration

MPEG-4 channel configuration.

Enumerator
Custom | Defined in audio object type (AOT) specific configuration.
FrontCenter | 1 channel: front-center
FrontLeftRight | 2 channels: front-left, front-right
FrontCenterLeftRight | 3 channels: front-center, front-left, front-right
FrontCenterLeftRightBackCenter | 4 channels: front-center, front-left, front-right, back-center
FrontCenterLeftRightBackLeftRight | 5 channels: front-center, front-left, front-right, back-left, back-right
FrontCenterLeftRightBackLeftRightLFE | 6 channels: front-center, front-left, front-right, back-left, back-right, LFE-channel
FrontCenterLeftRightSideLeftRightBackLeftRightLFE | 8 channels: front-center, front-left, front-right, side-left, side-right, back-left, back-right, LFE-channel

## ChannelMode

enum TagLib::MPEG::Header::ChannelMode

There are a few combinations or one or two channel audio that are possible:

Enumerator
Stereo | Stereo.
JointStereo | Stereo.
DualChannel | Dual Mono.
SingleChannel | Mono.

## Version

enum TagLib::MPEG::Header::Version

The MPEG Version.

Enumerator
Version1 | MPEG Version 1.
Version2 | MPEG Version 2.
Version2_5 | MPEG Version 2.5.
Version4 | MPEG Version 4.

## Constructor & Destructor Documentation

## Header() [1/2]

TagLib::MPEG::Header::Header | ( | File * | file,
|  | offset_t | offset,
|  | bool | checkLength = true )

Parses an MPEG header based on file and offset.

Note
  If checkLength is `true`, this requires the next MPEG frame to check if the frame length is parsed and calculated correctly. So it's suitable for seeking for the first valid frame.

Referenced by Header(), and operator=().

## Header() [2/2]

TagLib::MPEG::Header::Header | ( | const Header & | h | ) |

Does a shallow copy of h.

References Header().

## ~Header()

TagLib::MPEG::Header::~Header | ( |  | ) |

Destroys this Header instance.

## Member Function Documentation

## bitrate()

int TagLib::MPEG::Header::bitrate | ( |  | ) | const

Returns the bitrate encoded in the header.

## channelConfiguration()

ChannelConfiguration TagLib::MPEG::Header::channelConfiguration | ( |  | ) | const

Returns the MPEG-4 channel configuration.

## channelMode()

ChannelMode TagLib::MPEG::Header::channelMode | ( |  | ) | const

Returns the channel mode for this frame.

## frameLength()

int TagLib::MPEG::Header::frameLength | ( |  | ) | const

Returns the frame length in bytes.

## isADTS()

bool TagLib::MPEG::Header::isADTS | ( |  | ) | const

Returns `true` if this is the header of an Audio Data Transport Stream (ADTS), usually AAC.

## isCopyrighted()

bool TagLib::MPEG::Header::isCopyrighted | ( |  | ) | const

Returns `true` if the copyrighted bit is set.

## isOriginal()

bool TagLib::MPEG::Header::isOriginal | ( |  | ) | const

Returns `true` if the "original" bit is set.

## isPadded()

bool TagLib::MPEG::Header::isPadded | ( |  | ) | const

Returns `true` if the frame is padded.

## isValid()

bool TagLib::MPEG::Header::isValid | ( |  | ) | const

Returns `true` if the frame is at least an appropriate size and has legal values.

## layer()

int TagLib::MPEG::Header::layer | ( |  | ) | const

Returns the layer version. This will be between the values 1-3.

## operator=()

Header & TagLib::MPEG::Header::operator= | ( | const Header & | h | ) |

Makes a shallow copy of the header.

References Header(), and TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE.

## protectionEnabled()

bool TagLib::MPEG::Header::protectionEnabled | ( |  | ) | const

Returns `true` if the MPEG protection bit is enabled.

## sampleRate()

int TagLib::MPEG::Header::sampleRate | ( |  | ) | const

Returns the sample rate in Hz.

## samplesPerFrame()

int TagLib::MPEG::Header::samplesPerFrame | ( |  | ) | const

Returns the number of frames per sample.

## version()

Version TagLib::MPEG::Header::version | ( |  | ) | const

Returns the MPEG Version of the header.

The documentation for this class was generated from the following file:

- mpegheader.h