-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for passing creation time via InAppMuxer
PiperOrigin-RevId: 538175466 (cherry picked from commit 7e14811)
- Loading branch information
1 parent
d4e0a8d
commit f1d285e
Showing
118 changed files
with
711 additions
and
109 deletions.
There are no files selected for viewing
91 changes: 91 additions & 0 deletions
91
libraries/container/src/main/java/androidx/media3/container/CreationTime.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* Copyright 2023 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 androidx.media3.container; | ||
|
||
import android.os.Parcel; | ||
import android.os.Parcelable; | ||
import androidx.annotation.Nullable; | ||
import androidx.media3.common.Metadata; | ||
import androidx.media3.common.util.UnstableApi; | ||
import com.google.common.primitives.Longs; | ||
|
||
/** Stores creation time. */ | ||
@UnstableApi | ||
public final class CreationTime implements Metadata.Entry { | ||
public final long timestampMs; | ||
|
||
/** | ||
* Creates an instance. | ||
* | ||
* @param timestampMs The creation time UTC in milliseconds since the Unix epoch. | ||
*/ | ||
public CreationTime(long timestampMs) { | ||
this.timestampMs = timestampMs; | ||
} | ||
|
||
private CreationTime(Parcel in) { | ||
this.timestampMs = in.readLong(); | ||
} | ||
|
||
@Override | ||
public boolean equals(@Nullable Object obj) { | ||
if (this == obj) { | ||
return true; | ||
} | ||
if (!(obj instanceof CreationTime)) { | ||
return false; | ||
} | ||
|
||
return timestampMs == ((CreationTime) obj).timestampMs; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Longs.hashCode(timestampMs); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
long unsetCreationTime = -2_082_844_800_000L; | ||
return "Creation time: " + (timestampMs == unsetCreationTime ? "unset" : timestampMs); | ||
} | ||
|
||
// Parcelable implementation. | ||
|
||
@Override | ||
public int describeContents() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void writeToParcel(Parcel dest, int flags) { | ||
dest.writeLong(timestampMs); | ||
} | ||
|
||
public static final Parcelable.Creator<CreationTime> CREATOR = | ||
new Parcelable.Creator<CreationTime>() { | ||
|
||
@Override | ||
public CreationTime createFromParcel(Parcel in) { | ||
return new CreationTime(in); | ||
} | ||
|
||
@Override | ||
public CreationTime[] newArray(int size) { | ||
return new CreationTime[size]; | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.