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
ef2f8b7a
authored
Mar 19, 2021
by
kimvde
Committed by
Ian Baker
Mar 24, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
JpegExtractor: read GContainer and GContainerItem XMP prefixes
#minor-release PiperOrigin-RevId: 363859522
parent
adffd431
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
8 deletions
RELEASENOTES.md
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/jpeg/XmpMotionPhotoDescriptionParser.java
RELEASENOTES.md
View file @
ef2f8b7a
...
...
@@ -42,6 +42,9 @@
*
Fix container type detection for segments with incorrect file extension
or HTTP Content-Type
(
[
#8733
](
https://github.com/google/ExoPlayer/issues/8733
)
).
*
Extractors:
*
Add support for
`GContainer`
and
`GContainerItem`
XMP namespace prefixes
in JPEG motion photo parsing.
*
Remove deprecated symbols:
*
Remove
`Player.DefaultEventListener`
. Use
`Player.EventListener`
instead.
...
...
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/jpeg/XmpMotionPhotoDescriptionParser.java
View file @
ef2f8b7a
...
...
@@ -100,7 +100,9 @@ import org.xmlpull.v1.XmlPullParserFactory;
parseMotionPhotoPresentationTimestampUsFromDescription
(
xpp
);
containerItems
=
parseMicroVideoOffsetFromDescription
(
xpp
);
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"Container:Directory"
))
{
containerItems
=
parseMotionPhotoV1Directory
(
xpp
);
containerItems
=
parseMotionPhotoV1Directory
(
xpp
,
"Container"
,
"Item"
);
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"GContainer:Directory"
))
{
containerItems
=
parseMotionPhotoV1Directory
(
xpp
,
"GContainer"
,
"GContainerItem"
);
}
}
while
(!
XmlPullParserUtil
.
isEndTag
(
xpp
,
"x:xmpmeta"
));
if
(
containerItems
.
isEmpty
())
{
...
...
@@ -154,16 +156,23 @@ import org.xmlpull.v1.XmlPullParserFactory;
}
private
static
ImmutableList
<
MotionPhotoDescription
.
ContainerItem
>
parseMotionPhotoV1Directory
(
XmlPullParser
xpp
)
throws
XmlPullParserException
,
IOException
{
XmlPullParser
xpp
,
String
containerNamespacePrefix
,
String
itemNamespacePrefix
)
throws
XmlPullParserException
,
IOException
{
ImmutableList
.
Builder
<
MotionPhotoDescription
.
ContainerItem
>
containerItems
=
ImmutableList
.
builder
();
String
itemTagName
=
containerNamespacePrefix
+
":Item"
;
String
directoryTagName
=
containerNamespacePrefix
+
":Directory"
;
do
{
xpp
.
next
();
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"Container:Item"
))
{
@Nullable
String
mime
=
XmlPullParserUtil
.
getAttributeValue
(
xpp
,
"Item:Mime"
);
@Nullable
String
semantic
=
XmlPullParserUtil
.
getAttributeValue
(
xpp
,
"Item:Semantic"
);
@Nullable
String
length
=
XmlPullParserUtil
.
getAttributeValue
(
xpp
,
"Item:Length"
);
@Nullable
String
padding
=
XmlPullParserUtil
.
getAttributeValue
(
xpp
,
"Item:Padding"
);
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
itemTagName
))
{
String
mimeAttributeName
=
itemNamespacePrefix
+
":Mime"
;
String
semanticAttributeName
=
itemNamespacePrefix
+
":Semantic"
;
String
lengthAttributeName
=
itemNamespacePrefix
+
":Length"
;
String
paddinghAttributeName
=
itemNamespacePrefix
+
":Padding"
;
@Nullable
String
mime
=
XmlPullParserUtil
.
getAttributeValue
(
xpp
,
mimeAttributeName
);
@Nullable
String
semantic
=
XmlPullParserUtil
.
getAttributeValue
(
xpp
,
semanticAttributeName
);
@Nullable
String
length
=
XmlPullParserUtil
.
getAttributeValue
(
xpp
,
lengthAttributeName
);
@Nullable
String
padding
=
XmlPullParserUtil
.
getAttributeValue
(
xpp
,
paddinghAttributeName
);
if
(
mime
==
null
||
semantic
==
null
)
{
// Required values are missing.
return
ImmutableList
.
of
();
...
...
@@ -175,7 +184,7 @@ import org.xmlpull.v1.XmlPullParserFactory;
length
!=
null
?
Long
.
parseLong
(
length
)
:
0
,
padding
!=
null
?
Long
.
parseLong
(
padding
)
:
0
));
}
}
while
(!
XmlPullParserUtil
.
isEndTag
(
xpp
,
"Container:Directory"
));
}
while
(!
XmlPullParserUtil
.
isEndTag
(
xpp
,
directoryTagName
));
return
containerItems
.
build
();
}
...
...
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