diff --git a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java index 1bbcab690b..9938f8564c 100644 --- a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java +++ b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java @@ -985,17 +985,19 @@ public class DashManifestParser extends DefaultHandler String title = null; String source = null; String copyright = null; + String moreInformationURL = parseString(xpp, "moreInformationURL", null); + String lang = parseString(xpp, "lang", null); do { xpp.next(); if (XmlPullParserUtil.isStartTag(xpp, "Title")) { - title = xpp.getText(); + title = xpp.nextText(); } else if (XmlPullParserUtil.isStartTag(xpp, "Source")) { - source = xpp.getText(); + source = xpp.nextText(); } else if (XmlPullParserUtil.isStartTag(xpp, "Copyright")) { - copyright = xpp.getText(); + copyright = xpp.nextText(); } } while (!XmlPullParserUtil.isEndTag(xpp, "ProgramInformation")); - return new ProgramInformation(title, source, copyright); + return new ProgramInformation(title, source, copyright, moreInformationURL, lang); } // AudioChannelConfiguration parsing. diff --git a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/ProgramInformation.java b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/ProgramInformation.java index faf938e3df..d3fc909ef8 100644 --- a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/ProgramInformation.java +++ b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/ProgramInformation.java @@ -15,6 +15,8 @@ */ package com.google.android.exoplayer2.source.dash.manifest; +import com.google.android.exoplayer2.util.Util; + public class ProgramInformation { /** * The title for the media presentation. @@ -31,9 +33,45 @@ public class ProgramInformation { */ public final String copyright; - public ProgramInformation(String title, String source, String copyright) { + /** + * A URL that provides more information about the media presentation. + */ + public final String moreInformationURL; + + /** + * Declares the language code(s) for this ProgramInformation. + */ + public final String lang; + + public ProgramInformation(String title, String source, String copyright, String moreInformationURL, String lang) { this.title = title; this.source = source; this.copyright = copyright; + this.moreInformationURL = moreInformationURL; + this.lang = lang; + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof ProgramInformation)) { + return false; + } + ProgramInformation other = (ProgramInformation) obj; + return Util.areEqual(this.title, other.title) + && Util.areEqual(this.source, other.source) + && Util.areEqual(this.copyright, other.copyright) + && Util.areEqual(this.moreInformationURL, other.moreInformationURL) + && Util.areEqual(this.lang, other.lang); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (title != null ? title.hashCode() : 0); + result = 31 * result + (source != null ? source.hashCode() : 0); + result = 31 * result + (copyright != null ? copyright.hashCode() : 0); + result = 31 * result + (moreInformationURL != null ? moreInformationURL.hashCode() : 0); + result = 31 * result + (lang != null ? lang.hashCode() : 0); + return result; } } diff --git a/library/dash/src/test/assets/sample_mpd_1 b/library/dash/src/test/assets/sample_mpd_1 index e75c1234c0..ccd3ab4dd6 100644 --- a/library/dash/src/test/assets/sample_mpd_1 +++ b/library/dash/src/test/assets/sample_mpd_1 @@ -9,8 +9,11 @@ xmlns="urn:mpeg:DASH:schema:MPD:2011" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd" yt:earliestMediaSequence="1266404" > - - + + MediaTitle + MediaSource + MediaCopyright list = new ArrayList<>(); - list.add("".getBytes()); - ProgramInformation programInformation = new ProgramInformation("", "", "", list); + ProgramInformation programInformation = new ProgramInformation("MediaTitle", "MediaSource", + "MediaCopyright", "www.example.com", "enUs"); assertThat(programInformation).isEqualTo(mpd.programInformation); }