From ce0b5e4c445b96ca4a62bab722f34a29c844d9e7 Mon Sep 17 00:00:00 2001 From: "Lieblich, Jonathan" Date: Thu, 11 Oct 2018 16:25:21 -0600 Subject: [PATCH] removed custom element parsing --- .../dash/manifest/DashManifestParser.java | 28 ++------- .../dash/manifest/ProgramInformation.java | 62 +++++-------------- 2 files changed, 21 insertions(+), 69 deletions(-) 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 ce629f6509..1bbcab690b 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 @@ -982,10 +982,9 @@ public class DashManifestParser extends DefaultHandler } protected ProgramInformation parseProgramInformation(XmlPullParser xpp) throws IOException, XmlPullParserException { - String title = ""; - String source = ""; - String copyright = ""; - List customEvents = new ArrayList<>(); + String title = null; + String source = null; + String copyright = null; do { xpp.next(); if (XmlPullParserUtil.isStartTag(xpp, "Title")) { @@ -994,28 +993,9 @@ public class DashManifestParser extends DefaultHandler source = xpp.getText(); } else if (XmlPullParserUtil.isStartTag(xpp, "Copyright")) { copyright = xpp.getText(); - } else { - byte[] customElement = parseCustomElement(xpp, new ByteArrayOutputStream(512)); - if (customElement.length > 0) { - customEvents.add(customElement); - } } } while (!XmlPullParserUtil.isEndTag(xpp, "ProgramInformation")); - return new ProgramInformation(title, source, copyright, customEvents); - } - - private byte[] parseCustomElement(XmlPullParser xpp, ByteArrayOutputStream outputStream) throws IOException, XmlPullParserException { - XmlSerializer serializer = Xml.newSerializer(); - serializer.setOutput(outputStream, C.UTF8_NAME); - if (xpp.getEventType() == XmlPullParser.START_TAG) { - serializer.startTag(xpp.getNamespace(), xpp.getName()); - for (int i = 0; i < xpp.getAttributeCount(); i++) { - serializer.attribute(xpp.getAttributeNamespace(i), xpp.getAttributeName(i), xpp.getAttributeValue(i)); - } - serializer.endTag(xpp.getNamespace(), xpp.getName()); - } - serializer.flush(); - return outputStream.toByteArray(); + return new ProgramInformation(title, source, copyright); } // 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 7d162336bc..faf938e3df 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 @@ -1,8 +1,20 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.google.android.exoplayer2.source.dash.manifest; -import java.util.Arrays; -import java.util.List; - public class ProgramInformation { /** * The title for the media presentation. @@ -19,49 +31,9 @@ public class ProgramInformation { */ public final String copyright; - /** - * A list of custom elements. - */ - public final List customEvents; - - public ProgramInformation(String title, String source, String copyright, List customEvents) { + public ProgramInformation(String title, String source, String copyright) { this.title = title; this.source = source; this.copyright = copyright; - this.customEvents = customEvents; } - - @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); - for (int i = 0; i < customEvents.size(); i++) { - result = 31 * result + Arrays.hashCode(customEvents.get(i)); - } - return result; - } - - @Override - public boolean equals(Object obj) { - return obj instanceof ProgramInformation - && ((ProgramInformation)obj).title.equals(this.title) - && ((ProgramInformation)obj).source.equals(this.source) - && ((ProgramInformation)obj).copyright.equals(this.copyright) - && validateEvents(((ProgramInformation)obj).customEvents); - } - - private boolean validateEvents(List customEvents) { - for (int i = 0; i < customEvents.size() && i < this.customEvents.size(); i++) { - byte[] comparator = customEvents.get(i); - byte[] current = this.customEvents.get(i); - for (int j = 0; j < comparator.length && j < current.length; j++) { - if (current[j] != comparator[j]) { - return false; - } - } - } - return true; - } -} \ No newline at end of file +}