com.google.android.exoplayer2.extractor.ogg.VorbisUtil.Mode Java Examples

The following examples show how to use com.google.android.exoplayer2.extractor.ogg.VorbisUtil.Mode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VorbisReader.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
/* package */ VorbisSetup readSetupHeaders(ParsableByteArray scratch) throws IOException {

  if (vorbisIdHeader == null) {
    vorbisIdHeader = VorbisUtil.readVorbisIdentificationHeader(scratch);
    return null;
  }

  if (commentHeader == null) {
    commentHeader = VorbisUtil.readVorbisCommentHeader(scratch);
    return null;
  }

  // the third packet contains the setup header
  byte[] setupHeaderData = new byte[scratch.limit()];
  // raw data of vorbis setup header has to be passed to decoder as CSD buffer #2
  System.arraycopy(scratch.data, 0, setupHeaderData, 0, scratch.limit());
  // partially decode setup header to get the modes
  Mode[] modes = VorbisUtil.readVorbisModes(scratch, vorbisIdHeader.channels);
  // we need the ilog of modes all the time when extracting, so we compute it once
  int iLogModes = VorbisUtil.iLog(modes.length - 1);

  return new VorbisSetup(vorbisIdHeader, commentHeader, setupHeaderData, modes, iLogModes);
}
 
Example #2
Source File: VorbisReader.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
VorbisSetup readSetupHeaders(ParsableByteArray scratch) throws IOException {

    if (vorbisIdHeader == null) {
      vorbisIdHeader = VorbisUtil.readVorbisIdentificationHeader(scratch);
      return null;
    }

    if (commentHeader == null) {
      commentHeader = VorbisUtil.readVorbisCommentHeader(scratch);
      return null;
    }

    // the third packet contains the setup header
    byte[] setupHeaderData = new byte[scratch.limit()];
    // raw data of vorbis setup header has to be passed to decoder as CSD buffer #2
    System.arraycopy(scratch.data, 0, setupHeaderData, 0, scratch.limit());
    // partially decode setup header to get the modes
    Mode[] modes = VorbisUtil.readVorbisModes(scratch, vorbisIdHeader.channels);
    // we need the ilog of modes all the time when extracting, so we compute it once
    int iLogModes = VorbisUtil.iLog(modes.length - 1);

    return new VorbisSetup(vorbisIdHeader, commentHeader, setupHeaderData, modes, iLogModes);
  }
 
Example #3
Source File: VorbisReader.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
VorbisSetup readSetupHeaders(ParsableByteArray scratch) throws IOException {

    if (vorbisIdHeader == null) {
      vorbisIdHeader = VorbisUtil.readVorbisIdentificationHeader(scratch);
      return null;
    }

    if (commentHeader == null) {
      commentHeader = VorbisUtil.readVorbisCommentHeader(scratch);
      return null;
    }

    // the third packet contains the setup header
    byte[] setupHeaderData = new byte[scratch.limit()];
    // raw data of vorbis setup header has to be passed to decoder as CSD buffer #2
    System.arraycopy(scratch.data, 0, setupHeaderData, 0, scratch.limit());
    // partially decode setup header to get the modes
    Mode[] modes = VorbisUtil.readVorbisModes(scratch, vorbisIdHeader.channels);
    // we need the ilog of modes all the time when extracting, so we compute it once
    int iLogModes = VorbisUtil.iLog(modes.length - 1);

    return new VorbisSetup(vorbisIdHeader, commentHeader, setupHeaderData, modes, iLogModes);
  }
 
Example #4
Source File: VorbisReader.java    From K-Sonic with MIT License 6 votes vote down vote up
VorbisSetup readSetupHeaders(ParsableByteArray scratch) throws IOException {

    if (vorbisIdHeader == null) {
      vorbisIdHeader = VorbisUtil.readVorbisIdentificationHeader(scratch);
      return null;
    }

    if (commentHeader == null) {
      commentHeader = VorbisUtil.readVorbisCommentHeader(scratch);
      return null;
    }

    // the third packet contains the setup header
    byte[] setupHeaderData = new byte[scratch.limit()];
    // raw data of vorbis setup header has to be passed to decoder as CSD buffer #2
    System.arraycopy(scratch.data, 0, setupHeaderData, 0, scratch.limit());
    // partially decode setup header to get the modes
    Mode[] modes = VorbisUtil.readVorbisModes(scratch, vorbisIdHeader.channels);
    // we need the ilog of modes all the time when extracting, so we compute it once
    int iLogModes = VorbisUtil.iLog(modes.length - 1);

    return new VorbisSetup(vorbisIdHeader, commentHeader, setupHeaderData, modes, iLogModes);
  }
 
Example #5
Source File: VorbisReader.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@VisibleForTesting
/* package */ VorbisSetup readSetupHeaders(ParsableByteArray scratch) throws IOException {

  if (vorbisIdHeader == null) {
    vorbisIdHeader = VorbisUtil.readVorbisIdentificationHeader(scratch);
    return null;
  }

  if (commentHeader == null) {
    commentHeader = VorbisUtil.readVorbisCommentHeader(scratch);
    return null;
  }

  // the third packet contains the setup header
  byte[] setupHeaderData = new byte[scratch.limit()];
  // raw data of vorbis setup header has to be passed to decoder as CSD buffer #2
  System.arraycopy(scratch.data, 0, setupHeaderData, 0, scratch.limit());
  // partially decode setup header to get the modes
  Mode[] modes = VorbisUtil.readVorbisModes(scratch, vorbisIdHeader.channels);
  // we need the ilog of modes all the time when extracting, so we compute it once
  int iLogModes = VorbisUtil.iLog(modes.length - 1);

  return new VorbisSetup(vorbisIdHeader, commentHeader, setupHeaderData, modes, iLogModes);
}
 
Example #6
Source File: VorbisReader.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@VisibleForTesting
/* package */ VorbisSetup readSetupHeaders(ParsableByteArray scratch) throws IOException {

  if (vorbisIdHeader == null) {
    vorbisIdHeader = VorbisUtil.readVorbisIdentificationHeader(scratch);
    return null;
  }

  if (commentHeader == null) {
    commentHeader = VorbisUtil.readVorbisCommentHeader(scratch);
    return null;
  }

  // the third packet contains the setup header
  byte[] setupHeaderData = new byte[scratch.limit()];
  // raw data of vorbis setup header has to be passed to decoder as CSD buffer #2
  System.arraycopy(scratch.data, 0, setupHeaderData, 0, scratch.limit());
  // partially decode setup header to get the modes
  Mode[] modes = VorbisUtil.readVorbisModes(scratch, vorbisIdHeader.channels);
  // we need the ilog of modes all the time when extracting, so we compute it once
  int iLogModes = VorbisUtil.iLog(modes.length - 1);

  return new VorbisSetup(vorbisIdHeader, commentHeader, setupHeaderData, modes, iLogModes);
}
 
Example #7
Source File: VorbisReader.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
public VorbisSetup(VorbisUtil.VorbisIdHeader idHeader, VorbisUtil.CommentHeader
    commentHeader, byte[] setupHeaderData, Mode[] modes, int iLogModes) {
  this.idHeader = idHeader;
  this.commentHeader = commentHeader;
  this.setupHeaderData = setupHeaderData;
  this.modes = modes;
  this.iLogModes = iLogModes;
}
 
Example #8
Source File: VorbisReader.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public VorbisSetup(VorbisUtil.VorbisIdHeader idHeader, VorbisUtil.CommentHeader
    commentHeader, byte[] setupHeaderData, Mode[] modes, int iLogModes) {
  this.idHeader = idHeader;
  this.commentHeader = commentHeader;
  this.setupHeaderData = setupHeaderData;
  this.modes = modes;
  this.iLogModes = iLogModes;
}
 
Example #9
Source File: VorbisReader.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public VorbisSetup(VorbisUtil.VorbisIdHeader idHeader, VorbisUtil.CommentHeader
    commentHeader, byte[] setupHeaderData, Mode[] modes, int iLogModes) {
  this.idHeader = idHeader;
  this.commentHeader = commentHeader;
  this.setupHeaderData = setupHeaderData;
  this.modes = modes;
  this.iLogModes = iLogModes;
}
 
Example #10
Source File: VorbisReader.java    From K-Sonic with MIT License 5 votes vote down vote up
public VorbisSetup(VorbisUtil.VorbisIdHeader idHeader, VorbisUtil.CommentHeader
    commentHeader, byte[] setupHeaderData, Mode[] modes, int iLogModes) {
  this.idHeader = idHeader;
  this.commentHeader = commentHeader;
  this.setupHeaderData = setupHeaderData;
  this.modes = modes;
  this.iLogModes = iLogModes;
}
 
Example #11
Source File: VorbisReader.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public VorbisSetup(VorbisUtil.VorbisIdHeader idHeader, VorbisUtil.CommentHeader
    commentHeader, byte[] setupHeaderData, Mode[] modes, int iLogModes) {
  this.idHeader = idHeader;
  this.commentHeader = commentHeader;
  this.setupHeaderData = setupHeaderData;
  this.modes = modes;
  this.iLogModes = iLogModes;
}
 
Example #12
Source File: VorbisReader.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public VorbisSetup(VorbisUtil.VorbisIdHeader idHeader, VorbisUtil.CommentHeader
    commentHeader, byte[] setupHeaderData, Mode[] modes, int iLogModes) {
  this.idHeader = idHeader;
  this.commentHeader = commentHeader;
  this.setupHeaderData = setupHeaderData;
  this.modes = modes;
  this.iLogModes = iLogModes;
}