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

The following examples show how to use com.google.android.exoplayer2.metadata.flac.VorbisComment. 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
@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 #2
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 #3
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);
}