added attribute parsin

parent ce0b5e4c
...@@ -985,17 +985,19 @@ public class DashManifestParser extends DefaultHandler ...@@ -985,17 +985,19 @@ public class DashManifestParser extends DefaultHandler
String title = null; String title = null;
String source = null; String source = null;
String copyright = null; String copyright = null;
String moreInformationURL = parseString(xpp, "moreInformationURL", null);
String lang = parseString(xpp, "lang", null);
do { do {
xpp.next(); xpp.next();
if (XmlPullParserUtil.isStartTag(xpp, "Title")) { if (XmlPullParserUtil.isStartTag(xpp, "Title")) {
title = xpp.getText(); title = xpp.nextText();
} else if (XmlPullParserUtil.isStartTag(xpp, "Source")) { } else if (XmlPullParserUtil.isStartTag(xpp, "Source")) {
source = xpp.getText(); source = xpp.nextText();
} else if (XmlPullParserUtil.isStartTag(xpp, "Copyright")) { } else if (XmlPullParserUtil.isStartTag(xpp, "Copyright")) {
copyright = xpp.getText(); copyright = xpp.nextText();
} }
} while (!XmlPullParserUtil.isEndTag(xpp, "ProgramInformation")); } while (!XmlPullParserUtil.isEndTag(xpp, "ProgramInformation"));
return new ProgramInformation(title, source, copyright); return new ProgramInformation(title, source, copyright, moreInformationURL, lang);
} }
// AudioChannelConfiguration parsing. // AudioChannelConfiguration parsing.
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
*/ */
package com.google.android.exoplayer2.source.dash.manifest; package com.google.android.exoplayer2.source.dash.manifest;
import com.google.android.exoplayer2.util.Util;
public class ProgramInformation { public class ProgramInformation {
/** /**
* The title for the media presentation. * The title for the media presentation.
...@@ -31,9 +33,45 @@ public class ProgramInformation { ...@@ -31,9 +33,45 @@ public class ProgramInformation {
*/ */
public final String copyright; 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.title = title;
this.source = source; this.source = source;
this.copyright = copyright; 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;
} }
} }
...@@ -9,8 +9,11 @@ ...@@ -9,8 +9,11 @@
xmlns="urn:mpeg:DASH:schema:MPD:2011" xmlns="urn:mpeg:DASH:schema:MPD:2011"
xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd"
yt:earliestMediaSequence="1266404" > yt:earliestMediaSequence="1266404" >
<ProgramInformation> <ProgramInformation lang="enUs"
<scte214:ContentIdentifier type="URN" value="5939026565177792163" /> moreInformationURL="www.example.com">
<Title>MediaTitle</Title>
<Source>MediaSource</Source>
<Copyright>MediaCopyright</Copyright>
</ProgramInformation> </ProgramInformation>
<Period start="PT6462826.784S" > <Period start="PT6462826.784S" >
<SegmentList <SegmentList
......
...@@ -158,9 +158,8 @@ public class DashManifestParserTest { ...@@ -158,9 +158,8 @@ public class DashManifestParserTest {
DashManifestParser parser = new DashManifestParser(); DashManifestParser parser = new DashManifestParser();
DashManifest mpd = parser.parse(Uri.parse("Https://example.com/test.mpd"), DashManifest mpd = parser.parse(Uri.parse("Https://example.com/test.mpd"),
TestUtil.getInputStream(RuntimeEnvironment.application, SAMPLE_MPD_1)); TestUtil.getInputStream(RuntimeEnvironment.application, SAMPLE_MPD_1));
List<byte[]> list = new ArrayList<>(); ProgramInformation programInformation = new ProgramInformation("MediaTitle", "MediaSource",
list.add("<scte214:ContentIdentifier type=\"URN\" value=\"5939026565177792163\" />".getBytes()); "MediaCopyright", "www.example.com", "enUs");
ProgramInformation programInformation = new ProgramInformation("", "", "", list);
assertThat(programInformation).isEqualTo(mpd.programInformation); assertThat(programInformation).isEqualTo(mpd.programInformation);
} }
......
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