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
021d725c
authored
Oct 19, 2020
by
kimvde
Committed by
Oliver Woodman
Oct 20, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add motion photo metadata entry
PiperOrigin-RevId: 337863184
parent
2ada01c1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
186 additions
and
2 deletions
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/MdtaMetadataEntry.java → library/common/src/main/java/com/google/android/exoplayer2/metadata/mp4/MdtaMetadataEntry.java
library/common/src/main/java/com/google/android/exoplayer2/metadata/mp4/MotionPhoto.java
library/common/src/main/java/com/google/android/exoplayer2/metadata/mp4/package-info.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/mp4/MdtaMetadataEntryTest.java → library/common/src/test/java/com/google/android/exoplayer2/metadata/mp4/MdtaMetadataEntryTest.java
library/common/src/test/java/com/google/android/exoplayer2/metadata/mp4/MotionPhotoTest.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/MetadataUtil.java
library/
extractor/src/main/java/com/google/android/exoplayer2/extractor
/mp4/MdtaMetadataEntry.java
→
library/
common/src/main/java/com/google/android/exoplayer2/metadata
/mp4/MdtaMetadataEntry.java
View file @
021d725c
...
...
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
google
.
android
.
exoplayer2
.
extractor
.
mp4
;
package
com
.
google
.
android
.
exoplayer2
.
metadata
.
mp4
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
...
...
library/common/src/main/java/com/google/android/exoplayer2/metadata/mp4/MotionPhoto.java
0 → 100644
View file @
021d725c
/*
* Copyright 2020 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
.
metadata
.
mp4
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.metadata.Metadata
;
/** Metadata of a motion photo file. */
public
final
class
MotionPhoto
implements
Metadata
.
Entry
{
/** The start offset of the photo data, in bytes. */
public
final
int
photoStartPosition
;
/** The size of the photo data, in bytes. */
public
final
int
photoSize
;
/** The start offset of the video data, in bytes. */
public
final
int
videoStartPosition
;
/** The size of the video data, in bytes. */
public
final
int
videoSize
;
/** Creates an instance. */
public
MotionPhoto
(
int
photoStartPosition
,
int
photoSize
,
int
videoStartPosition
,
int
videoSize
)
{
this
.
photoStartPosition
=
photoStartPosition
;
this
.
photoSize
=
photoSize
;
this
.
videoStartPosition
=
videoStartPosition
;
this
.
videoSize
=
videoSize
;
}
private
MotionPhoto
(
Parcel
in
)
{
photoStartPosition
=
in
.
readInt
();
photoSize
=
in
.
readInt
();
videoStartPosition
=
in
.
readInt
();
videoSize
=
in
.
readInt
();
}
@Override
public
boolean
equals
(
@Nullable
Object
obj
)
{
if
(
this
==
obj
)
{
return
true
;
}
if
(
obj
==
null
||
getClass
()
!=
obj
.
getClass
())
{
return
false
;
}
MotionPhoto
other
=
(
MotionPhoto
)
obj
;
return
photoStartPosition
==
other
.
photoStartPosition
&&
photoSize
==
other
.
photoSize
&&
videoStartPosition
==
other
.
videoStartPosition
&&
videoSize
==
other
.
videoSize
;
}
@Override
public
int
hashCode
()
{
int
result
=
17
;
result
=
31
*
result
+
photoStartPosition
;
result
=
31
*
result
+
photoSize
;
result
=
31
*
result
+
videoStartPosition
;
result
=
31
*
result
+
videoSize
;
return
result
;
}
@Override
public
String
toString
()
{
return
"Motion photo: photoStartPosition="
+
photoStartPosition
+
", photoSize="
+
photoSize
+
", videoStartPosition="
+
videoStartPosition
+
", videoSize="
+
videoSize
;
}
// Parcelable implementation.
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeInt
(
photoStartPosition
);
dest
.
writeInt
(
photoSize
);
dest
.
writeInt
(
videoStartPosition
);
dest
.
writeInt
(
videoSize
);
}
@Override
public
int
describeContents
()
{
return
0
;
}
public
static
final
Parcelable
.
Creator
<
MotionPhoto
>
CREATOR
=
new
Parcelable
.
Creator
<
MotionPhoto
>()
{
@Override
public
MotionPhoto
createFromParcel
(
Parcel
in
)
{
return
new
MotionPhoto
(
in
);
}
@Override
public
MotionPhoto
[]
newArray
(
int
size
)
{
return
new
MotionPhoto
[
size
];
}
};
}
library/common/src/main/java/com/google/android/exoplayer2/metadata/mp4/package-info.java
0 → 100644
View file @
021d725c
/*
* Copyright 2020 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.
*/
@NonNullApi
package
com
.
google
.
android
.
exoplayer2
.
metadata
.
mp4
;
import
com.google.android.exoplayer2.util.NonNullApi
;
library/
extractor/src/test/java/com/google/android/exoplayer2/extractor
/mp4/MdtaMetadataEntryTest.java
→
library/
common/src/test/java/com/google/android/exoplayer2/metadata
/mp4/MdtaMetadataEntryTest.java
View file @
021d725c
...
...
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
google
.
android
.
exoplayer2
.
extractor
.
mp4
;
package
com
.
google
.
android
.
exoplayer2
.
metadata
.
mp4
;
import
static
com
.
google
.
common
.
truth
.
Truth
.
assertThat
;
...
...
library/common/src/test/java/com/google/android/exoplayer2/metadata/mp4/MotionPhotoTest.java
0 → 100644
View file @
021d725c
/*
* Copyright 2020 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
.
metadata
.
mp4
;
import
static
com
.
google
.
common
.
truth
.
Truth
.
assertThat
;
import
android.os.Parcel
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
/** Test for {@link MotionPhoto}. */
@RunWith
(
AndroidJUnit4
.
class
)
public
class
MotionPhotoTest
{
@Test
public
void
parcelable
()
{
MotionPhoto
motionPhotoToParcel
=
new
MotionPhoto
(
/* photoStartPosition= */
0
,
/* photoSize= */
10
,
/* videoStartPosition= */
15
,
/* videoSize= */
35
);
Parcel
parcel
=
Parcel
.
obtain
();
motionPhotoToParcel
.
writeToParcel
(
parcel
,
/* flags= */
0
);
parcel
.
setDataPosition
(
0
);
MotionPhoto
motionPhotoFromParcel
=
MotionPhoto
.
CREATOR
.
createFromParcel
(
parcel
);
assertThat
(
motionPhotoFromParcel
).
isEqualTo
(
motionPhotoToParcel
);
parcel
.
recycle
();
}
}
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/MetadataUtil.java
View file @
021d725c
...
...
@@ -28,6 +28,7 @@ import com.google.android.exoplayer2.metadata.id3.CommentFrame;
import
com.google.android.exoplayer2.metadata.id3.Id3Frame
;
import
com.google.android.exoplayer2.metadata.id3.InternalFrame
;
import
com.google.android.exoplayer2.metadata.id3.TextInformationFrame
;
import
com.google.android.exoplayer2.metadata.mp4.MdtaMetadataEntry
;
import
com.google.android.exoplayer2.util.Log
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
java.util.ArrayList
;
...
...
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