Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.neoworks.mpeg
Class XingVBRHeader

    java.lang.Object
      |
      +--com.neoworks.mpeg.XingVBRHeader

public class XingVBRHeader
extends java.lang.Object

Reads information from a Xing variable bitrate info header. Thanks to the Scilla project (http://www.xs4all.nl/~rwvtveer/scilla/) for code ideas.

Version:
  $Id: XingVBRHeader.java,v 1.4 2002/06/24 17:21:27 nigel Exp $
Author:
  Nigel Atkinson (nigel@neoworks.com)
, Jonathan Hilliker

Constructor Summary
`XingVBRHeader(byte[] data, long offset, int layer, int mpegVersion, int sampleRate, int channelMode)` Looks for a Xing VBR header in the file.

Method Summary
`int` | `getAvgBitrate()` Returns the average bit rate of the mpeg file if a Xing header exists and -1 otherwise.
`int` | `getHeaderOffset()` Get the offset from the end of the MPEG header to the beginning of the VBR header in bytes
`int` | `getLength()` Returns the length (in bytes) of this Xing VBR header.
`int` | `getNumBytes()` Returns the number of data bytes in the mpeg frames.
`int` | `getNumFrames()` Returns the number of MPEG frames in the file passed to the constructor.
`int` | `getPlayingTime()` Returns the calculated playing time of the mpeg file if a Xing header exists and -1 otherwise.
`byte[]` | `getTOC()` Returns the toc used to seek to an area of this VBR file.
`int` | `getVBRScale()` Returns the VBR scale used to generate this VBR file.
`boolean` | `headerExists()` Returns true if a Xing VBR header was found in the file passed to the constructor.
`java.lang.String` | `toString()` Return a string representation of this object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### XingVBRHeader

    public XingVBRHeader(byte[] data,
                         long offset,
                         int layer,
                         int mpegVersion,
                         int sampleRate,
                         int channelMode)

  Looks for a Xing VBR header in the file. If it is found then that means this is a variable bit rate file and all the data in the header will be parsed.

Parameters:
  `data` - The MPEG frame data to extract the header from
  `offset` - the location of the first mpeg frame
  `layer` - the layer value read by the MPEGAudioFrameHeader
  `mpegVersion` - the version value read by the MPEGAudioFrameHeader
  `sampleRate` - the sample rate read by the MPEGAudioFrameHeader
  `channelMode` - the channel mode read by the MPEGAudioFrameHeader

Method Detail

### headerExists

    public boolean headerExists()

  Returns true if a Xing VBR header was found in the file passed to the constructor.

  Returns:
    true if a Xinb VBR header was found

### getNumFrames

    public int getNumFrames()

  Returns the number of MPEG frames in the file passed to the constructor. If a header is not found, -1 is returned.

  Returns:
    the number of MPEG frames

### getNumBytes

    public int getNumBytes()

  Returns the number of data bytes in the mpeg frames. If a header is not found, -1 is returned.

  Returns:
    the number of data bytes in the mpeg frames

### getVBRScale

    public int getVBRScale()

  Returns the VBR scale used to generate this VBR file. If a header is not found, -1 is returned.

  Returns:
    the VBR scale used to generate this VBR file

### getTOC

    public byte[] getTOC()

  Returns the toc used to seek to an area of this VBR file. If a header is not found an empty array is returned.

  Returns:
    the toc used to seek to an area of this VBR file

### getAvgBitrate

    public int getAvgBitrate()

  Returns the average bit rate of the mpeg file if a Xing header exists and -1 otherwise.

  Returns:
    the average bit rate (in kbps)

### getHeaderOffset

    public int getHeaderOffset()

  Get the offset from the end of the MPEG header to the beginning of the VBR header in bytes

  Returns:
    The offset in bytes

### getPlayingTime

    public int getPlayingTime()

  Returns the calculated playing time of the mpeg file if a Xing header exists and -1 otherwise.

  Returns:
    the playing time (in seconds) of the mpeg file

### toString

    public java.lang.String toString()

  Return a string representation of this object. Includes all information read in and computed.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a string representation of this object

### getLength

    public int getLength()

  Returns the length (in bytes) of this Xing VBR header.

  Returns:
    the length of this Xing VBR header

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD