com.google.android.exoplayer2.metadata.flac.PictureFrame Java Examples

The following examples show how to use com.google.android.exoplayer2.metadata.flac.PictureFrame. 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: FlacStreamMetadata.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * @param minBlockSize Minimum block size of the FLAC stream.
 * @param maxBlockSize Maximum block size of the FLAC stream.
 * @param minFrameSize Minimum frame size of the FLAC stream.
 * @param maxFrameSize Maximum frame size of the FLAC stream.
 * @param sampleRate Sample rate of the FLAC stream.
 * @param channels Number of channels of the FLAC stream.
 * @param bitsPerSample Number of bits per sample of the FLAC stream.
 * @param totalSamples Total samples of the FLAC stream.
 * @param vorbisComments Vorbis comments. Each entry must be in key=value form.
 * @param pictureFrames Picture frames.
 * @see <a href="https://xiph.org/flac/format.html#metadata_block_streaminfo">FLAC format
 *     METADATA_BLOCK_STREAMINFO</a>
 * @see <a href="https://xiph.org/flac/format.html#metadata_block_vorbis_comment">FLAC format
 *     METADATA_BLOCK_VORBIS_COMMENT</a>
 * @see <a href="https://xiph.org/flac/format.html#metadata_block_picture">FLAC format
 *     METADATA_BLOCK_PICTURE</a>
 */
public FlacStreamMetadata(
    int minBlockSize,
    int maxBlockSize,
    int minFrameSize,
    int maxFrameSize,
    int sampleRate,
    int channels,
    int bitsPerSample,
    long totalSamples,
    List<String> vorbisComments,
    List<PictureFrame> pictureFrames) {
  this.minBlockSize = minBlockSize;
  this.maxBlockSize = maxBlockSize;
  this.minFrameSize = minFrameSize;
  this.maxFrameSize = maxFrameSize;
  this.sampleRate = sampleRate;
  this.channels = channels;
  this.bitsPerSample = bitsPerSample;
  this.totalSamples = totalSamples;
  this.metadata = buildMetadata(vorbisComments, pictureFrames);
}
 
Example #2
Source File: FlacStreamMetadata.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
@Nullable
private static Metadata buildMetadata(
    List<String> vorbisComments, List<PictureFrame> pictureFrames) {
  if (vorbisComments.isEmpty() && pictureFrames.isEmpty()) {
    return null;
  }

  ArrayList<Metadata.Entry> metadataEntries = new ArrayList<>();
  for (int i = 0; i < vorbisComments.size(); i++) {
    String vorbisComment = vorbisComments.get(i);
    String[] keyAndValue = Util.splitAtFirst(vorbisComment, SEPARATOR);
    if (keyAndValue.length != 2) {
      Log.w(TAG, "Failed to parse vorbis comment: " + vorbisComment);
    } else {
      VorbisComment entry = new VorbisComment(keyAndValue[0], keyAndValue[1]);
      metadataEntries.add(entry);
    }
  }
  metadataEntries.addAll(pictureFrames);

  return metadataEntries.isEmpty() ? null : new Metadata(metadataEntries);
}
 
Example #3
Source File: FlacStreamMetadata.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param minBlockSize Minimum block size of the FLAC stream.
 * @param maxBlockSize Maximum block size of the FLAC stream.
 * @param minFrameSize Minimum frame size of the FLAC stream.
 * @param maxFrameSize Maximum frame size of the FLAC stream.
 * @param sampleRate Sample rate of the FLAC stream.
 * @param channels Number of channels of the FLAC stream.
 * @param bitsPerSample Number of bits per sample of the FLAC stream.
 * @param totalSamples Total samples of the FLAC stream.
 * @param vorbisComments Vorbis comments. Each entry must be in key=value form.
 * @param pictureFrames Picture frames.
 * @see <a href="https://xiph.org/flac/format.html#metadata_block_streaminfo">FLAC format
 *     METADATA_BLOCK_STREAMINFO</a>
 * @see <a href="https://xiph.org/flac/format.html#metadata_block_vorbis_comment">FLAC format
 *     METADATA_BLOCK_VORBIS_COMMENT</a>
 * @see <a href="https://xiph.org/flac/format.html#metadata_block_picture">FLAC format
 *     METADATA_BLOCK_PICTURE</a>
 */
public FlacStreamMetadata(
    int minBlockSize,
    int maxBlockSize,
    int minFrameSize,
    int maxFrameSize,
    int sampleRate,
    int channels,
    int bitsPerSample,
    long totalSamples,
    List<String> vorbisComments,
    List<PictureFrame> pictureFrames) {
  this.minBlockSize = minBlockSize;
  this.maxBlockSize = maxBlockSize;
  this.minFrameSize = minFrameSize;
  this.maxFrameSize = maxFrameSize;
  this.sampleRate = sampleRate;
  this.channels = channels;
  this.bitsPerSample = bitsPerSample;
  this.totalSamples = totalSamples;
  this.metadata = buildMetadata(vorbisComments, pictureFrames);
}
 
Example #4
Source File: FlacStreamMetadata.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@Nullable
private static Metadata buildMetadata(
    List<String> vorbisComments, List<PictureFrame> pictureFrames) {
  if (vorbisComments.isEmpty() && pictureFrames.isEmpty()) {
    return null;
  }

  ArrayList<Metadata.Entry> metadataEntries = new ArrayList<>();
  for (int i = 0; i < vorbisComments.size(); i++) {
    String vorbisComment = vorbisComments.get(i);
    String[] keyAndValue = Util.splitAtFirst(vorbisComment, SEPARATOR);
    if (keyAndValue.length != 2) {
      Log.w(TAG, "Failed to parse vorbis comment: " + vorbisComment);
    } else {
      VorbisComment entry = new VorbisComment(keyAndValue[0], keyAndValue[1]);
      metadataEntries.add(entry);
    }
  }
  metadataEntries.addAll(pictureFrames);

  return metadataEntries.isEmpty() ? null : new Metadata(metadataEntries);
}
 
Example #5
Source File: FlacStreamMetadata.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param minBlockSize Minimum block size of the FLAC stream.
 * @param maxBlockSize Maximum block size of the FLAC stream.
 * @param minFrameSize Minimum frame size of the FLAC stream.
 * @param maxFrameSize Maximum frame size of the FLAC stream.
 * @param sampleRate Sample rate of the FLAC stream.
 * @param channels Number of channels of the FLAC stream.
 * @param bitsPerSample Number of bits per sample of the FLAC stream.
 * @param totalSamples Total samples of the FLAC stream.
 * @param vorbisComments Vorbis comments. Each entry must be in key=value form.
 * @param pictureFrames Picture frames.
 * @see <a href="https://xiph.org/flac/format.html#metadata_block_streaminfo">FLAC format
 *     METADATA_BLOCK_STREAMINFO</a>
 * @see <a href="https://xiph.org/flac/format.html#metadata_block_vorbis_comment">FLAC format
 *     METADATA_BLOCK_VORBIS_COMMENT</a>
 * @see <a href="https://xiph.org/flac/format.html#metadata_block_picture">FLAC format
 *     METADATA_BLOCK_PICTURE</a>
 */
public FlacStreamMetadata(
    int minBlockSize,
    int maxBlockSize,
    int minFrameSize,
    int maxFrameSize,
    int sampleRate,
    int channels,
    int bitsPerSample,
    long totalSamples,
    List<String> vorbisComments,
    List<PictureFrame> pictureFrames) {
  this.minBlockSize = minBlockSize;
  this.maxBlockSize = maxBlockSize;
  this.minFrameSize = minFrameSize;
  this.maxFrameSize = maxFrameSize;
  this.sampleRate = sampleRate;
  this.channels = channels;
  this.bitsPerSample = bitsPerSample;
  this.totalSamples = totalSamples;
  this.metadata = buildMetadata(vorbisComments, pictureFrames);
}
 
Example #6
Source File: FlacStreamMetadata.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Nullable
private static Metadata buildMetadata(
    List<String> vorbisComments, List<PictureFrame> pictureFrames) {
  if (vorbisComments.isEmpty() && pictureFrames.isEmpty()) {
    return null;
  }

  ArrayList<Metadata.Entry> metadataEntries = new ArrayList<>();
  for (int i = 0; i < vorbisComments.size(); i++) {
    String vorbisComment = vorbisComments.get(i);
    String[] keyAndValue = Util.splitAtFirst(vorbisComment, SEPARATOR);
    if (keyAndValue.length != 2) {
      Log.w(TAG, "Failed to parse vorbis comment: " + vorbisComment);
    } else {
      VorbisComment entry = new VorbisComment(keyAndValue[0], keyAndValue[1]);
      metadataEntries.add(entry);
    }
  }
  metadataEntries.addAll(pictureFrames);

  return metadataEntries.isEmpty() ? null : new Metadata(metadataEntries);
}