mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Clean up ID3 frame implementations
This commit is contained in:
parent
6a3b66987a
commit
3b34f850f2
9 changed files with 150 additions and 153 deletions
|
|
@ -17,6 +17,7 @@ package com.google.android.exoplayer2.metadata.id3;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
import com.google.android.exoplayer2.util.Util;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -39,8 +40,8 @@ public final class ApicFrame extends Id3Frame {
|
||||||
this.pictureData = pictureData;
|
this.pictureData = pictureData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApicFrame(Parcel in) {
|
/* package */ ApicFrame(Parcel in) {
|
||||||
super(in);
|
super(ID);
|
||||||
mimeType = in.readString();
|
mimeType = in.readString();
|
||||||
description = in.readString();
|
description = in.readString();
|
||||||
pictureType = in.readInt();
|
pictureType = in.readInt();
|
||||||
|
|
@ -48,53 +49,49 @@ public final class ApicFrame extends Id3Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object obj) {
|
||||||
if (this == o) return true;
|
if (this == obj) {
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
return true;
|
||||||
|
}
|
||||||
ApicFrame that = (ApicFrame) o;
|
if (obj == null || getClass() != obj.getClass()) {
|
||||||
|
|
||||||
if (id != null ? !id.equals(that.id) : that.id != null) return false;
|
|
||||||
if (pictureType != that.pictureType) return false;
|
|
||||||
if (mimeType != null ? !mimeType.equals(that.mimeType) : that.mimeType != null)
|
|
||||||
return false;
|
return false;
|
||||||
if (description != null ? !description.equals(that.description) : that.description != null)
|
}
|
||||||
return false;
|
ApicFrame other = (ApicFrame) obj;
|
||||||
return Arrays.equals(pictureData, that.pictureData);
|
return pictureType == other.pictureType && Util.areEqual(mimeType, other.mimeType)
|
||||||
|
&& Util.areEqual(description, other.description)
|
||||||
|
&& Arrays.equals(pictureData, other.pictureData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = id != null ? id.hashCode() : 0;
|
int result = 17;
|
||||||
|
result = 31 * result + pictureType;
|
||||||
result = 31 * result + (mimeType != null ? mimeType.hashCode() : 0);
|
result = 31 * result + (mimeType != null ? mimeType.hashCode() : 0);
|
||||||
result = 31 * result + (description != null ? description.hashCode() : 0);
|
result = 31 * result + (description != null ? description.hashCode() : 0);
|
||||||
result = 31 * result + pictureType;
|
|
||||||
result = 31 * result + Arrays.hashCode(pictureData);
|
result = 31 * result + Arrays.hashCode(pictureData);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
dest.writeString(id);
|
|
||||||
dest.writeString(mimeType);
|
dest.writeString(mimeType);
|
||||||
dest.writeString(description);
|
dest.writeString(description);
|
||||||
dest.writeInt(pictureType);
|
dest.writeInt(pictureType);
|
||||||
dest.writeByteArray(pictureData);
|
dest.writeByteArray(pictureData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Parcelable.Creator<ApicFrame> CREATOR =
|
public static final Parcelable.Creator<ApicFrame> CREATOR = new Parcelable.Creator<ApicFrame>() {
|
||||||
new Parcelable.Creator<ApicFrame>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApicFrame createFromParcel(Parcel in) {
|
public ApicFrame createFromParcel(Parcel in) {
|
||||||
return new ApicFrame(in);
|
return new ApicFrame(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApicFrame[] newArray(int size) {
|
public ApicFrame[] newArray(int size) {
|
||||||
return new ApicFrame[size];
|
return new ApicFrame[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,31 +26,32 @@ public final class BinaryFrame extends Id3Frame {
|
||||||
|
|
||||||
public final byte[] data;
|
public final byte[] data;
|
||||||
|
|
||||||
public BinaryFrame(String type, byte[] data) {
|
public BinaryFrame(String id, byte[] data) {
|
||||||
super(type);
|
super(id);
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BinaryFrame(Parcel in) {
|
/* package */ BinaryFrame(Parcel in) {
|
||||||
super(in);
|
super(in.readString());
|
||||||
data = in.createByteArray();
|
data = in.createByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object obj) {
|
||||||
if (this == o) return true;
|
if (this == obj) {
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
return true;
|
||||||
|
}
|
||||||
BinaryFrame that = (BinaryFrame) o;
|
if (obj == null || getClass() != obj.getClass()) {
|
||||||
|
|
||||||
if (id != null ? !id.equals(that.id) : that.id != null)
|
|
||||||
return false;
|
return false;
|
||||||
return Arrays.equals(data, that.data);
|
}
|
||||||
|
BinaryFrame other = (BinaryFrame) obj;
|
||||||
|
return id.equals(other.id) && Arrays.equals(data, other.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = id != null ? id.hashCode() : 0;
|
int result = 17;
|
||||||
|
result = 31 * result + id.hashCode();
|
||||||
result = 31 * result + Arrays.hashCode(data);
|
result = 31 * result + Arrays.hashCode(data);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,43 +17,51 @@ package com.google.android.exoplayer2.metadata.id3;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
import com.google.android.exoplayer2.util.Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comment ID3 frame.
|
* Comment ID3 frame.
|
||||||
*/
|
*/
|
||||||
public final class CommentFrame extends Id3Frame {
|
public final class CommentFrame extends Id3Frame {
|
||||||
|
|
||||||
|
public static final String ID = "COMM";
|
||||||
|
|
||||||
public final String language;
|
public final String language;
|
||||||
|
public final String description;
|
||||||
public final String text;
|
public final String text;
|
||||||
|
|
||||||
public CommentFrame(String language, String description, String text) {
|
public CommentFrame(String language, String description, String text) {
|
||||||
super(description);
|
super(ID);
|
||||||
this.language = language;
|
this.language = language;
|
||||||
|
this.description = description;
|
||||||
this.text = text;
|
this.text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommentFrame(Parcel in) {
|
/* package */ CommentFrame(Parcel in) {
|
||||||
super(in);
|
super(ID);
|
||||||
language = in.readString();
|
language = in.readString();
|
||||||
|
description = in.readString();
|
||||||
text = in.readString();
|
text = in.readString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object obj) {
|
||||||
if (this == o) return true;
|
if (this == obj) {
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
return true;
|
||||||
|
}
|
||||||
CommentFrame that = (CommentFrame) o;
|
if (obj == null || getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
if (id != null ? !id.equals(that.id) : that.id != null) return false;
|
}
|
||||||
if (language != null ? !language.equals(that.language) : that.language != null) return false;
|
CommentFrame other = (CommentFrame) obj;
|
||||||
return text != null ? text.equals(that.text) : that.text == null;
|
return Util.areEqual(description, other.description) && Util.areEqual(language, other.language)
|
||||||
|
&& Util.areEqual(text, other.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = id != null ? id.hashCode() : 0;
|
int result = 17;
|
||||||
result = 31 * result + (language != null ? language.hashCode() : 0);
|
result = 31 * result + (language != null ? language.hashCode() : 0);
|
||||||
|
result = 31 * result + (description != null ? description.hashCode() : 0);
|
||||||
result = 31 * result + (text != null ? text.hashCode() : 0);
|
result = 31 * result + (text != null ? text.hashCode() : 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ package com.google.android.exoplayer2.metadata.id3;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
import com.google.android.exoplayer2.util.Util;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -39,8 +40,8 @@ public final class GeobFrame extends Id3Frame {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeobFrame(Parcel in) {
|
/* package */ GeobFrame(Parcel in) {
|
||||||
super(in);
|
super(ID);
|
||||||
mimeType = in.readString();
|
mimeType = in.readString();
|
||||||
filename = in.readString();
|
filename = in.readString();
|
||||||
description = in.readString();
|
description = in.readString();
|
||||||
|
|
@ -48,25 +49,21 @@ public final class GeobFrame extends Id3Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object obj) {
|
||||||
if (this == o) return true;
|
if (this == obj) {
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
return true;
|
||||||
|
}
|
||||||
GeobFrame that = (GeobFrame) o;
|
if (obj == null || getClass() != obj.getClass()) {
|
||||||
|
|
||||||
if (id != null ? !id.equals(that.id) : that.id != null) return false;
|
|
||||||
if (mimeType != null ? !mimeType.equals(that.mimeType) : that.mimeType != null)
|
|
||||||
return false;
|
return false;
|
||||||
if (filename != null ? !filename.equals(that.filename) : that.filename != null)
|
}
|
||||||
return false;
|
GeobFrame other = (GeobFrame) obj;
|
||||||
if (description != null ? !description.equals(that.description) : that.description != null)
|
return Util.areEqual(mimeType, other.mimeType) && Util.areEqual(filename, other.filename)
|
||||||
return false;
|
&& Util.areEqual(description, other.description) && Arrays.equals(data, other.data);
|
||||||
return Arrays.equals(data, that.data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = id != null ? id.hashCode() : 0;
|
int result = 17;
|
||||||
result = 31 * result + (mimeType != null ? mimeType.hashCode() : 0);
|
result = 31 * result + (mimeType != null ? mimeType.hashCode() : 0);
|
||||||
result = 31 * result + (filename != null ? filename.hashCode() : 0);
|
result = 31 * result + (filename != null ? filename.hashCode() : 0);
|
||||||
result = 31 * result + (description != null ? description.hashCode() : 0);
|
result = 31 * result + (description != null ? description.hashCode() : 0);
|
||||||
|
|
@ -76,26 +73,24 @@ public final class GeobFrame extends Id3Frame {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
dest.writeString(id);
|
|
||||||
dest.writeString(mimeType);
|
dest.writeString(mimeType);
|
||||||
dest.writeString(filename);
|
dest.writeString(filename);
|
||||||
dest.writeString(description);
|
dest.writeString(description);
|
||||||
dest.writeByteArray(data);
|
dest.writeByteArray(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Parcelable.Creator<GeobFrame> CREATOR =
|
public static final Parcelable.Creator<GeobFrame> CREATOR = new Parcelable.Creator<GeobFrame>() {
|
||||||
new Parcelable.Creator<GeobFrame>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeobFrame createFromParcel(Parcel in) {
|
public GeobFrame createFromParcel(Parcel in) {
|
||||||
return new GeobFrame(in);
|
return new GeobFrame(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeobFrame[] newArray(int size) {
|
public GeobFrame[] newArray(int size) {
|
||||||
return new GeobFrame[size];
|
return new GeobFrame[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -345,8 +345,8 @@ public final class Id3Decoder implements MetadataDecoder<Metadata> {
|
||||||
return new TextInformationFrame(id, description);
|
return new TextInformationFrame(id, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CommentFrame decodeCommentFrame(ParsableByteArray id3Data,
|
private static CommentFrame decodeCommentFrame(ParsableByteArray id3Data, int frameSize)
|
||||||
int frameSize) throws UnsupportedEncodingException {
|
throws UnsupportedEncodingException {
|
||||||
int encoding = id3Data.readUnsignedByte();
|
int encoding = id3Data.readUnsignedByte();
|
||||||
String charset = getCharsetName(encoding);
|
String charset = getCharsetName(encoding);
|
||||||
|
|
||||||
|
|
@ -360,11 +360,11 @@ public final class Id3Decoder implements MetadataDecoder<Metadata> {
|
||||||
int descriptionEndIndex = indexOfEos(data, 0, encoding);
|
int descriptionEndIndex = indexOfEos(data, 0, encoding);
|
||||||
String description = new String(data, 0, descriptionEndIndex, charset);
|
String description = new String(data, 0, descriptionEndIndex, charset);
|
||||||
|
|
||||||
int valueStartIndex = descriptionEndIndex + delimiterLength(encoding);
|
int textStartIndex = descriptionEndIndex + delimiterLength(encoding);
|
||||||
int valueEndIndex = indexOfEos(data, valueStartIndex, encoding);
|
int textEndIndex = indexOfEos(data, textStartIndex, encoding);
|
||||||
String value = new String(data, valueStartIndex, valueEndIndex - valueStartIndex, charset);
|
String text = new String(data, textStartIndex, textEndIndex - textStartIndex, charset);
|
||||||
|
|
||||||
return new CommentFrame(language, description, value);
|
return new CommentFrame(language, description, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BinaryFrame decodeBinaryFrame(ParsableByteArray id3Data, int frameSize,
|
private static BinaryFrame decodeBinaryFrame(ParsableByteArray id3Data, int frameSize,
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package com.google.android.exoplayer2.metadata.id3;
|
package com.google.android.exoplayer2.metadata.id3;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
import com.google.android.exoplayer2.util.Assertions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for ID3 frames.
|
* Base class for ID3 frames.
|
||||||
|
|
@ -29,11 +29,7 @@ public abstract class Id3Frame implements Parcelable {
|
||||||
public final String id;
|
public final String id;
|
||||||
|
|
||||||
public Id3Frame(String id) {
|
public Id3Frame(String id) {
|
||||||
this.id = id;
|
this.id = Assertions.checkNotNull(id);
|
||||||
}
|
|
||||||
|
|
||||||
protected Id3Frame(Parcel in) {
|
|
||||||
id = in.readString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ package com.google.android.exoplayer2.metadata.id3;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
import com.google.android.exoplayer2.util.Util;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -35,27 +36,27 @@ public final class PrivFrame extends Id3Frame {
|
||||||
this.privateData = privateData;
|
this.privateData = privateData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrivFrame(Parcel in) {
|
/* package */ PrivFrame(Parcel in) {
|
||||||
super(in);
|
super(ID);
|
||||||
owner = in.readString();
|
owner = in.readString();
|
||||||
privateData = in.createByteArray();
|
privateData = in.createByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object obj) {
|
||||||
if (this == o) return true;
|
if (this == obj) {
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
return true;
|
||||||
|
}
|
||||||
PrivFrame that = (PrivFrame) o;
|
if (obj == null || getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
if (id != null ? !id.equals(that.id) : that.id != null) return false;
|
}
|
||||||
if (owner != null ? !owner.equals(that.owner) : that.owner != null) return false;
|
PrivFrame other = (PrivFrame) obj;
|
||||||
return Arrays.equals(privateData, that.privateData);
|
return Util.areEqual(owner, other.owner) && Arrays.equals(privateData, other.privateData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = id != null ? id.hashCode() : 0;
|
int result = 17;
|
||||||
result = 31 * result + (owner != null ? owner.hashCode() : 0);
|
result = 31 * result + (owner != null ? owner.hashCode() : 0);
|
||||||
result = 31 * result + Arrays.hashCode(privateData);
|
result = 31 * result + Arrays.hashCode(privateData);
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -63,24 +64,22 @@ public final class PrivFrame extends Id3Frame {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
dest.writeString(id);
|
|
||||||
dest.writeString(owner);
|
dest.writeString(owner);
|
||||||
dest.writeByteArray(privateData);
|
dest.writeByteArray(privateData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Parcelable.Creator<PrivFrame> CREATOR =
|
public static final Parcelable.Creator<PrivFrame> CREATOR = new Parcelable.Creator<PrivFrame>() {
|
||||||
new Parcelable.Creator<PrivFrame>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PrivFrame createFromParcel(Parcel in) {
|
public PrivFrame createFromParcel(Parcel in) {
|
||||||
return new PrivFrame(in);
|
return new PrivFrame(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PrivFrame[] newArray(int size) {
|
public PrivFrame[] newArray(int size) {
|
||||||
return new PrivFrame[size];
|
return new PrivFrame[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ package com.google.android.exoplayer2.metadata.id3;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
import com.google.android.exoplayer2.util.Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Text information ("T000" - "TZZZ", excluding "TXXX") ID3 frame.
|
* Text information ("T000" - "TZZZ", excluding "TXXX") ID3 frame.
|
||||||
|
|
@ -30,25 +31,27 @@ public final class TextInformationFrame extends Id3Frame {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextInformationFrame(Parcel in) {
|
/* package */ TextInformationFrame(Parcel in) {
|
||||||
super(in);
|
super(in.readString());
|
||||||
description = in.readString();
|
description = in.readString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object obj) {
|
||||||
if (this == o) return true;
|
if (this == obj) {
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
return true;
|
||||||
|
}
|
||||||
TextInformationFrame that = (TextInformationFrame) o;
|
if (obj == null || getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
if (id != null ? !id.equals(that.id) : that.id != null) return false;
|
}
|
||||||
return description != null ? description.equals(that.description) : that.description == null;
|
TextInformationFrame other = (TextInformationFrame) obj;
|
||||||
|
return id.equals(other.id) && Util.areEqual(description, other.description);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = id != null ? id.hashCode() : 0;
|
int result = 17;
|
||||||
|
result = 31 * result + id.hashCode();
|
||||||
result = 31 * result + (description != null ? description.hashCode() : 0);
|
result = 31 * result + (description != null ? description.hashCode() : 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ package com.google.android.exoplayer2.metadata.id3;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
import com.google.android.exoplayer2.util.Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TXXX (User defined text information) ID3 frame.
|
* TXXX (User defined text information) ID3 frame.
|
||||||
|
|
@ -34,28 +35,27 @@ public final class TxxxFrame extends Id3Frame {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TxxxFrame(Parcel in) {
|
/* package */ TxxxFrame(Parcel in) {
|
||||||
super(in);
|
super(ID);
|
||||||
description = in.readString();
|
description = in.readString();
|
||||||
value = in.readString();
|
value = in.readString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object obj) {
|
||||||
if (this == o) return true;
|
if (this == obj) {
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
return true;
|
||||||
|
}
|
||||||
TxxxFrame that = (TxxxFrame) o;
|
if (obj == null || getClass() != obj.getClass()) {
|
||||||
|
|
||||||
if (id != null ? !id.equals(that.id) : that.id != null) return false;
|
|
||||||
if (description != null ? !description.equals(that.description) : that.description != null)
|
|
||||||
return false;
|
return false;
|
||||||
return value != null ? value.equals(that.value) : that.value == null;
|
}
|
||||||
|
TxxxFrame other = (TxxxFrame) obj;
|
||||||
|
return Util.areEqual(description, other.description) && Util.areEqual(value, other.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = id != null ? id.hashCode() : 0;
|
int result = 17;
|
||||||
result = 31 * result + (description != null ? description.hashCode() : 0);
|
result = 31 * result + (description != null ? description.hashCode() : 0);
|
||||||
result = 31 * result + (value != null ? value.hashCode() : 0);
|
result = 31 * result + (value != null ? value.hashCode() : 0);
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -63,24 +63,22 @@ public final class TxxxFrame extends Id3Frame {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
dest.writeString(id);
|
|
||||||
dest.writeString(description);
|
dest.writeString(description);
|
||||||
dest.writeString(value);
|
dest.writeString(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Parcelable.Creator<TxxxFrame> CREATOR =
|
public static final Parcelable.Creator<TxxxFrame> CREATOR = new Parcelable.Creator<TxxxFrame>() {
|
||||||
new Parcelable.Creator<TxxxFrame>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TxxxFrame createFromParcel(Parcel in) {
|
public TxxxFrame createFromParcel(Parcel in) {
|
||||||
return new TxxxFrame(in);
|
return new TxxxFrame(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TxxxFrame[] newArray(int size) {
|
public TxxxFrame[] newArray(int size) {
|
||||||
return new TxxxFrame[size];
|
return new TxxxFrame[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue