Commit c828d9b0 by Oliver Woodman

Some ID3 bug fixes

parent 48099ee5
...@@ -35,6 +35,7 @@ import com.google.android.exoplayer2.metadata.id3.GeobFrame; ...@@ -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.Id3Frame;
import com.google.android.exoplayer2.metadata.id3.PrivFrame; import com.google.android.exoplayer2.metadata.id3.PrivFrame;
import com.google.android.exoplayer2.metadata.id3.TextInformationFrame; 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.AdaptiveMediaSourceEventListener;
import com.google.android.exoplayer2.source.ExtractorMediaSource; import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.TrackGroup; import com.google.android.exoplayer2.source.TrackGroup;
...@@ -362,6 +363,9 @@ import java.util.Locale; ...@@ -362,6 +363,9 @@ import java.util.Locale;
TextInformationFrame textInformationFrame = (TextInformationFrame) entry; TextInformationFrame textInformationFrame = (TextInformationFrame) entry;
Log.d(TAG, prefix + String.format("%s: value=%s", textInformationFrame.id, Log.d(TAG, prefix + String.format("%s: value=%s", textInformationFrame.id,
textInformationFrame.value)); 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) { } else if (entry instanceof PrivFrame) {
PrivFrame privFrame = (PrivFrame) entry; PrivFrame privFrame = (PrivFrame) entry;
Log.d(TAG, prefix + String.format("%s: owner=%s", privFrame.id, privFrame.owner)); Log.d(TAG, prefix + String.format("%s: owner=%s", privFrame.id, privFrame.owner));
...@@ -375,7 +379,7 @@ import java.util.Locale; ...@@ -375,7 +379,7 @@ import java.util.Locale;
apicFrame.id, apicFrame.mimeType, apicFrame.description)); apicFrame.id, apicFrame.mimeType, apicFrame.description));
} else if (entry instanceof CommentFrame) { } else if (entry instanceof CommentFrame) {
CommentFrame commentFrame = (CommentFrame) entry; 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)); commentFrame.language, commentFrame.description));
} else if (entry instanceof Id3Frame) { } else if (entry instanceof Id3Frame) {
Id3Frame id3Frame = (Id3Frame) entry; Id3Frame id3Frame = (Id3Frame) entry;
......
...@@ -382,7 +382,7 @@ public final class Id3Decoder implements MetadataDecoder { ...@@ -382,7 +382,7 @@ public final class Id3Decoder implements MetadataDecoder {
String url; String url;
int urlStartIndex = descriptionEndIndex + delimiterLength(encoding); int urlStartIndex = descriptionEndIndex + delimiterLength(encoding);
if (urlStartIndex < data.length) { if (urlStartIndex < data.length) {
int urlEndIndex = indexOfZeroByte(data, 0); int urlEndIndex = indexOfZeroByte(data, urlStartIndex);
url = new String(data, urlStartIndex, urlEndIndex - urlStartIndex, "ISO-8859-1"); url = new String(data, urlStartIndex, urlEndIndex - urlStartIndex, "ISO-8859-1");
} else { } else {
url = ""; url = "";
...@@ -521,10 +521,10 @@ public final class Id3Decoder implements MetadataDecoder { ...@@ -521,10 +521,10 @@ public final class Id3Decoder implements MetadataDecoder {
"ISO-8859-1"); "ISO-8859-1");
id3Data.setPosition(chapterIdEndIndex + 1); id3Data.setPosition(chapterIdEndIndex + 1);
int startTime = id3Data.readUnsignedByte(); int startTime = id3Data.readInt();
int endTime = id3Data.readUnsignedByte(); int endTime = id3Data.readInt();
int startOffset = id3Data.readUnsignedByte(); int startOffset = id3Data.readInt();
int endOffset = id3Data.readUnsignedByte(); int endOffset = id3Data.readInt();
ArrayList<Id3Frame> subFrames = new ArrayList<>(); ArrayList<Id3Frame> subFrames = new ArrayList<>();
int limit = framePosition + frameSize; int limit = framePosition + frameSize;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment