Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ce0b5e4c
authored
Oct 11, 2018
by
Lieblich, Jonathan
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
removed custom element parsing
parent
e42786d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
70 deletions
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/ProgramInformation.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java
View file @
ce0b5e4c
...
...
@@ -982,10 +982,9 @@ public class DashManifestParser extends DefaultHandler
}
protected
ProgramInformation
parseProgramInformation
(
XmlPullParser
xpp
)
throws
IOException
,
XmlPullParserException
{
String
title
=
""
;
String
source
=
""
;
String
copyright
=
""
;
List
<
byte
[]>
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.
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/ProgramInformation.java
View file @
ce0b5e4c
/*
* 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
<
byte
[]>
customEvents
;
public
ProgramInformation
(
String
title
,
String
source
,
String
copyright
,
List
<
byte
[]>
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
<
byte
[]>
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
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment