| TagLib 1.13 |  |

Public Types | Public Member Functions | List of all members
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 }
enum | ChannelMode { Stereo = 0 , JointStereo = 1 , DualChannel = 2 , SingleChannel = 3 }

## Public Member Functions
TAGLIB_DEPRECATED | Header (const ByteVector &data)
| Header (File *file, long offset, bool checkLength=true)
| Header (const Header &h)
virtual | ~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
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. I've used this document as a reference.

## Member Enumeration Documentation

## ◆ 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.

## Constructor & Destructor Documentation

## ◆ Header() [1/3]

TAGLIB_DEPRECATED TagLib::MPEG::Header::Header | ( | const ByteVector & | data | ) |

Parses an MPEG header based on data.

Deprecated:
  Use Header(File *, long, bool).

## ◆ Header() [2/3]

TagLib::MPEG::Header::Header | ( | File * | file,
|  | long | 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.

## ◆ Header() [3/3]

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

Does a shallow copy of h.

## ◆ ~Header()

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

Destroys this Header instance.

## Member Function Documentation

## ◆ bitrate()

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

Returns the bitrate encoded in the header.

## ◆ 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.

## ◆ 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.

## ◆ 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