Skip to content

Commit

Permalink
Some ID3 bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ojw28 committed Jan 17, 2017
1 parent 48099ee commit c828d9b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
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;
Expand Down Expand Up @@ -362,6 +363,9 @@ private void printMetadata(Metadata metadata, String prefix) {
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));
Expand All @@ -375,7 +379,7 @@ private void printMetadata(Metadata metadata, String prefix) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ private static UrlLinkFrame decodeWxxxFrame(ParsableByteArray id3Data,
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 = "";
Expand Down Expand Up @@ -521,10 +521,10 @@ private static ChapterFrame decodeChapterFrame(ParsableByteArray id3Data, int fr
"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;
Expand Down

0 comments on commit c828d9b

Please sign in to comment.