Remove duplicate Mp4Location class

PiperOrigin-RevId: 609313551
This commit is contained in:
sheenachhabra 2024-02-22 03:37:36 -08:00 committed by Copybara-Service
parent 9046f2edb6
commit 41886434ad
5 changed files with 8 additions and 32 deletions

View File

@ -32,6 +32,7 @@ import androidx.media3.common.ColorInfo;
import androidx.media3.common.Format;
import androidx.media3.common.MimeTypes;
import androidx.media3.common.util.Util;
import androidx.media3.container.Mp4LocationData;
import androidx.media3.container.NalUnitUtil;
import androidx.media3.muxer.FragmentedMp4Writer.SampleMetadata;
import com.google.common.collect.ImmutableList;
@ -360,7 +361,7 @@ import java.util.Locale;
*
* <p>This box contains user data like location info.
*/
public static ByteBuffer udta(@Nullable Mp4Location location) {
public static ByteBuffer udta(@Nullable Mp4LocationData location) {
// We can just omit the entire box if there is no location info available.
if (location == null) {
return ByteBuffer.allocate(0);

View File

@ -18,6 +18,7 @@ package androidx.media3.muxer;
import static androidx.media3.common.util.Assertions.checkState;
import static androidx.media3.container.Mp4TimestampData.unixTimeToMp4TimeSeconds;
import androidx.media3.container.Mp4LocationData;
import androidx.media3.container.Mp4TimestampData;
import java.nio.ByteBuffer;
import java.util.LinkedHashMap;
@ -27,7 +28,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/** Collects and provides metadata: location, FPS, XMP data, etc. */
/* package */ final class MetadataCollector {
public int orientation;
public @MonotonicNonNull Mp4Location location;
public @MonotonicNonNull Mp4LocationData locationData;
public Map<String, Object> metadataPairs;
public Mp4TimestampData timestampData;
public @MonotonicNonNull ByteBuffer xmpData;
@ -52,7 +53,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
public void setLocation(float latitude, float longitude) {
location = new Mp4Location(latitude, longitude);
locationData = new Mp4LocationData(latitude, longitude);
}
public void setCaptureFps(float captureFps) {

View File

@ -1,27 +0,0 @@
/*
* Copyright 2022 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.muxer;
/** Stores location data. */
/* package */ final class Mp4Location {
public final float latitude;
public final float longitude;
public Mp4Location(float latitude, float longitude) {
this.latitude = latitude;
this.longitude = longitude;
}
}

View File

@ -178,7 +178,7 @@ import org.checkerframework.checker.nullness.qual.PolyNull;
ByteBuffer mvhdBox =
Boxes.mvhd(
nextTrackId, creationTimestampSeconds, modificationTimestampSeconds, videoDurationUs);
ByteBuffer udtaBox = Boxes.udta(metadataCollector.location);
ByteBuffer udtaBox = Boxes.udta(metadataCollector.locationData);
ByteBuffer metaBox =
metadataCollector.metadataPairs.isEmpty()
? ByteBuffer.allocate(0)

View File

@ -30,6 +30,7 @@ import android.media.MediaCodec;
import androidx.media3.common.C;
import androidx.media3.common.ColorInfo;
import androidx.media3.common.Format;
import androidx.media3.container.Mp4LocationData;
import androidx.media3.muxer.FragmentedMp4Writer.SampleMetadata;
import androidx.media3.test.utils.DumpFileAsserts;
import androidx.media3.test.utils.DumpableMp4Box;
@ -162,7 +163,7 @@ public class BoxesTest {
@Test
public void createUdtaBox_matchesExpected() throws IOException {
Mp4Location mp4Location = new Mp4Location(33.0f, -120f);
Mp4LocationData mp4Location = new Mp4LocationData(33.0f, -120f);
ByteBuffer udtaBox = Boxes.udta(mp4Location);