Some ID3 bug fixes

This commit is contained in:
Oliver Woodman 2017-01-17 15:49:51 +00:00
parent 48099ee52e
commit c828d9b0bf
2 changed files with 10 additions and 6 deletions

View File

@ -35,6 +35,7 @@ import com.google.android.exoplayer2.metadata.id3.GeobFrame;
import com.google.android.exoplayer2.metadata.id3.Id3Frame;
import com.google.android.exoplayer2.metadata.id3.PrivFrame;
import com.google.android.exoplayer2.metadata.id3.TextInformationFrame;
import com.google.android.exoplayer2.metadata.id3.UrlLinkFrame;
import com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener;
import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.TrackGroup;
@ -362,6 +363,9 @@ import java.util.Locale;
TextInformationFrame textInformationFrame = (TextInformationFrame) entry;
Log.d(TAG, prefix + String.format("%s: value=%s", textInformationFrame.id,
textInformationFrame.value));
} else if (entry instanceof UrlLinkFrame) {
UrlLinkFrame urlLinkFrame = (UrlLinkFrame) entry;
Log.d(TAG, prefix + String.format("%s: url=%s", urlLinkFrame.id, urlLinkFrame.url));
} else if (entry instanceof PrivFrame) {
PrivFrame privFrame = (PrivFrame) entry;
Log.d(TAG, prefix + String.format("%s: owner=%s", privFrame.id, privFrame.owner));
@ -375,7 +379,7 @@ import java.util.Locale;
apicFrame.id, apicFrame.mimeType, apicFrame.description));
} else if (entry instanceof CommentFrame) {
CommentFrame commentFrame = (CommentFrame) entry;
Log.d(TAG, prefix + String.format("%s: language=%s description=%s", commentFrame.id,
Log.d(TAG, prefix + String.format("%s: language=%s, description=%s", commentFrame.id,
commentFrame.language, commentFrame.description));
} else if (entry instanceof Id3Frame) {
Id3Frame id3Frame = (Id3Frame) entry;

View File

@ -382,7 +382,7 @@ public final class Id3Decoder implements MetadataDecoder {
String url;
int urlStartIndex = descriptionEndIndex + delimiterLength(encoding);
if (urlStartIndex < data.length) {
int urlEndIndex = indexOfZeroByte(data, 0);
int urlEndIndex = indexOfZeroByte(data, urlStartIndex);
url = new String(data, urlStartIndex, urlEndIndex - urlStartIndex, "ISO-8859-1");
} else {
url = "";
@ -521,10 +521,10 @@ public final class Id3Decoder implements MetadataDecoder {
"ISO-8859-1");
id3Data.setPosition(chapterIdEndIndex + 1);
int startTime = id3Data.readUnsignedByte();
int endTime = id3Data.readUnsignedByte();
int startOffset = id3Data.readUnsignedByte();
int endOffset = id3Data.readUnsignedByte();
int startTime = id3Data.readInt();
int endTime = id3Data.readInt();
int startOffset = id3Data.readInt();
int endOffset = id3Data.readInt();
ArrayList<Id3Frame> subFrames = new ArrayList<>();
int limit = framePosition + frameSize;