mirror of
https://github.com/androidx/media.git
synced 2025-05-09 16:40:55 +08:00
Remove FileUtil.java class
PiperOrigin-RevId: 608556329
This commit is contained in:
parent
f1c21f6c07
commit
063fbc7b84
@ -1,45 +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
|
|
||||||
*
|
|
||||||
* https://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.test.utils;
|
|
||||||
|
|
||||||
import static androidx.media3.test.utils.TestUtil.retrieveTrackFormat;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.media3.common.C;
|
|
||||||
import androidx.media3.common.ColorInfo;
|
|
||||||
import androidx.media3.common.Format;
|
|
||||||
import androidx.media3.common.util.UnstableApi;
|
|
||||||
|
|
||||||
/** Utilities for accessing details of media files. */
|
|
||||||
@UnstableApi
|
|
||||||
public final class FileUtil {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns {@link C.ColorTransfer} information from the media file, or {@link
|
|
||||||
* C#COLOR_TRANSFER_SDR} if the information can not be found.
|
|
||||||
*/
|
|
||||||
public static @C.ColorTransfer int retrieveColorTransfer(Context context, String filePath) {
|
|
||||||
Format videoTrackFormat = retrieveTrackFormat(context, filePath, C.TRACK_TYPE_VIDEO);
|
|
||||||
@Nullable ColorInfo colorInfo = videoTrackFormat.colorInfo;
|
|
||||||
return colorInfo == null || colorInfo.colorTransfer == Format.NO_VALUE
|
|
||||||
? C.COLOR_TRANSFER_SDR
|
|
||||||
: colorInfo.colorTransfer;
|
|
||||||
}
|
|
||||||
|
|
||||||
private FileUtil() {}
|
|
||||||
}
|
|
@ -16,7 +16,7 @@
|
|||||||
package androidx.media3.transformer.mh;
|
package androidx.media3.transformer.mh;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Util.SDK_INT;
|
import static androidx.media3.common.util.Util.SDK_INT;
|
||||||
import static androidx.media3.test.utils.FileUtil.retrieveColorTransfer;
|
import static androidx.media3.test.utils.TestUtil.retrieveTrackFormat;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10;
|
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT;
|
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_720P_4_SECOND_HDR10;
|
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_720P_4_SECOND_HDR10;
|
||||||
@ -87,7 +87,10 @@ public class ForceInterpretHdrVideoAsSdrTest {
|
|||||||
.run(testId, composition);
|
.run(testId, composition);
|
||||||
|
|
||||||
@C.ColorTransfer
|
@C.ColorTransfer
|
||||||
int actualColorTransfer = retrieveColorTransfer(context, exportTestResult.filePath);
|
int actualColorTransfer =
|
||||||
|
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
|
||||||
|
.colorInfo
|
||||||
|
.colorTransfer;
|
||||||
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +131,10 @@ public class ForceInterpretHdrVideoAsSdrTest {
|
|||||||
.run(testId, composition);
|
.run(testId, composition);
|
||||||
|
|
||||||
@C.ColorTransfer
|
@C.ColorTransfer
|
||||||
int actualColorTransfer = retrieveColorTransfer(context, exportTestResult.filePath);
|
int actualColorTransfer =
|
||||||
|
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
|
||||||
|
.colorInfo
|
||||||
|
.colorTransfer;
|
||||||
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ package androidx.media3.transformer.mh;
|
|||||||
|
|
||||||
import static androidx.media3.common.MimeTypes.VIDEO_H265;
|
import static androidx.media3.common.MimeTypes.VIDEO_H265;
|
||||||
import static androidx.media3.common.util.Assertions.checkState;
|
import static androidx.media3.common.util.Assertions.checkState;
|
||||||
import static androidx.media3.test.utils.FileUtil.retrieveColorTransfer;
|
import static androidx.media3.test.utils.TestUtil.retrieveTrackFormat;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.FORCE_TRANSCODE_VIDEO_EFFECTS;
|
import static androidx.media3.transformer.AndroidTestUtil.FORCE_TRANSCODE_VIDEO_EFFECTS;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10;
|
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT;
|
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT;
|
||||||
@ -88,7 +88,10 @@ public final class HdrEditingTest {
|
|||||||
.build()
|
.build()
|
||||||
.run(testId, mediaItem);
|
.run(testId, mediaItem);
|
||||||
@C.ColorTransfer
|
@C.ColorTransfer
|
||||||
int actualColorTransfer = retrieveColorTransfer(context, exportTestResult.filePath);
|
int actualColorTransfer =
|
||||||
|
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
|
||||||
|
.colorInfo
|
||||||
|
.colorTransfer;
|
||||||
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_ST2084);
|
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_ST2084);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +122,10 @@ public final class HdrEditingTest {
|
|||||||
.build()
|
.build()
|
||||||
.run(testId, mediaItem);
|
.run(testId, mediaItem);
|
||||||
@C.ColorTransfer
|
@C.ColorTransfer
|
||||||
int actualColorTransfer = retrieveColorTransfer(context, exportTestResult.filePath);
|
int actualColorTransfer =
|
||||||
|
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
|
||||||
|
.colorInfo
|
||||||
|
.colorTransfer;
|
||||||
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_HLG);
|
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_HLG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +154,10 @@ public final class HdrEditingTest {
|
|||||||
.build()
|
.build()
|
||||||
.run(testId, editedMediaItem);
|
.run(testId, editedMediaItem);
|
||||||
@C.ColorTransfer
|
@C.ColorTransfer
|
||||||
int actualColorTransfer = retrieveColorTransfer(context, exportTestResult.filePath);
|
int actualColorTransfer =
|
||||||
|
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
|
||||||
|
.colorInfo
|
||||||
|
.colorTransfer;
|
||||||
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_ST2084);
|
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_ST2084);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +186,10 @@ public final class HdrEditingTest {
|
|||||||
.build()
|
.build()
|
||||||
.run(testId, editedMediaItem);
|
.run(testId, editedMediaItem);
|
||||||
@C.ColorTransfer
|
@C.ColorTransfer
|
||||||
int actualColorTransfer = retrieveColorTransfer(context, exportTestResult.filePath);
|
int actualColorTransfer =
|
||||||
|
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
|
||||||
|
.colorInfo
|
||||||
|
.colorTransfer;
|
||||||
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_HLG);
|
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_HLG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +218,10 @@ public final class HdrEditingTest {
|
|||||||
.build()
|
.build()
|
||||||
.run(testId, editedMediaItem);
|
.run(testId, editedMediaItem);
|
||||||
@C.ColorTransfer
|
@C.ColorTransfer
|
||||||
int actualColorTransfer = retrieveColorTransfer(context, exportTestResult.filePath);
|
int actualColorTransfer =
|
||||||
|
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
|
||||||
|
.colorInfo
|
||||||
|
.colorTransfer;
|
||||||
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_HLG);
|
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_HLG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +271,10 @@ public final class HdrEditingTest {
|
|||||||
.run(testId, editedMediaItem);
|
.run(testId, editedMediaItem);
|
||||||
assertThat(isToneMappingFallbackApplied.get()).isTrue();
|
assertThat(isToneMappingFallbackApplied.get()).isTrue();
|
||||||
@C.ColorTransfer
|
@C.ColorTransfer
|
||||||
int actualColorTransfer = retrieveColorTransfer(context, exportTestResult.filePath);
|
int actualColorTransfer =
|
||||||
|
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
|
||||||
|
.colorInfo
|
||||||
|
.colorTransfer;
|
||||||
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
||||||
} catch (ExportException exception) {
|
} catch (ExportException exception) {
|
||||||
if (exception.getCause() != null) {
|
if (exception.getCause() != null) {
|
||||||
@ -317,7 +335,10 @@ public final class HdrEditingTest {
|
|||||||
.run(testId, editedMediaItem);
|
.run(testId, editedMediaItem);
|
||||||
assertThat(isToneMappingFallbackApplied.get()).isTrue();
|
assertThat(isToneMappingFallbackApplied.get()).isTrue();
|
||||||
@C.ColorTransfer
|
@C.ColorTransfer
|
||||||
int actualColorTransfer = retrieveColorTransfer(context, exportTestResult.filePath);
|
int actualColorTransfer =
|
||||||
|
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
|
||||||
|
.colorInfo
|
||||||
|
.colorTransfer;
|
||||||
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
||||||
} catch (ExportException exception) {
|
} catch (ExportException exception) {
|
||||||
if (exception.getCause() != null) {
|
if (exception.getCause() != null) {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.transformer.mh;
|
package androidx.media3.transformer.mh;
|
||||||
|
|
||||||
import static androidx.media3.test.utils.FileUtil.retrieveColorTransfer;
|
import static androidx.media3.test.utils.TestUtil.retrieveTrackFormat;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.FORCE_TRANSCODE_VIDEO_EFFECTS;
|
import static androidx.media3.transformer.AndroidTestUtil.FORCE_TRANSCODE_VIDEO_EFFECTS;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10;
|
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT;
|
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT;
|
||||||
@ -92,7 +92,10 @@ public class ToneMapHdrToSdrUsingMediaCodecTest {
|
|||||||
.build()
|
.build()
|
||||||
.run(testId, composition);
|
.run(testId, composition);
|
||||||
@C.ColorTransfer
|
@C.ColorTransfer
|
||||||
int actualColorTransfer = retrieveColorTransfer(context, exportTestResult.filePath);
|
int actualColorTransfer =
|
||||||
|
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
|
||||||
|
.colorInfo
|
||||||
|
.colorTransfer;
|
||||||
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
||||||
} catch (ExportException exception) {
|
} catch (ExportException exception) {
|
||||||
if (exception.getCause() != null
|
if (exception.getCause() != null
|
||||||
@ -152,7 +155,10 @@ public class ToneMapHdrToSdrUsingMediaCodecTest {
|
|||||||
.build()
|
.build()
|
||||||
.run(testId, composition);
|
.run(testId, composition);
|
||||||
@C.ColorTransfer
|
@C.ColorTransfer
|
||||||
int actualColorTransfer = retrieveColorTransfer(context, exportTestResult.filePath);
|
int actualColorTransfer =
|
||||||
|
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
|
||||||
|
.colorInfo
|
||||||
|
.colorTransfer;
|
||||||
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
||||||
} catch (ExportException exception) {
|
} catch (ExportException exception) {
|
||||||
if (exception.getCause() != null
|
if (exception.getCause() != null
|
||||||
@ -213,7 +219,10 @@ public class ToneMapHdrToSdrUsingMediaCodecTest {
|
|||||||
.build()
|
.build()
|
||||||
.run(testId, composition);
|
.run(testId, composition);
|
||||||
@C.ColorTransfer
|
@C.ColorTransfer
|
||||||
int actualColorTransfer = retrieveColorTransfer(context, exportTestResult.filePath);
|
int actualColorTransfer =
|
||||||
|
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
|
||||||
|
.colorInfo
|
||||||
|
.colorTransfer;
|
||||||
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
||||||
} catch (ExportException exception) {
|
} catch (ExportException exception) {
|
||||||
if (exception.getCause() != null
|
if (exception.getCause() != null
|
||||||
@ -274,7 +283,10 @@ public class ToneMapHdrToSdrUsingMediaCodecTest {
|
|||||||
.build()
|
.build()
|
||||||
.run(testId, composition);
|
.run(testId, composition);
|
||||||
@C.ColorTransfer
|
@C.ColorTransfer
|
||||||
int actualColorTransfer = retrieveColorTransfer(context, exportTestResult.filePath);
|
int actualColorTransfer =
|
||||||
|
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
|
||||||
|
.colorInfo
|
||||||
|
.colorTransfer;
|
||||||
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
||||||
} catch (ExportException exception) {
|
} catch (ExportException exception) {
|
||||||
if (exception.getCause() != null
|
if (exception.getCause() != null
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.transformer.mh;
|
package androidx.media3.transformer.mh;
|
||||||
|
|
||||||
import static androidx.media3.test.utils.FileUtil.retrieveColorTransfer;
|
import static androidx.media3.test.utils.TestUtil.retrieveTrackFormat;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10;
|
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT;
|
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_720P_4_SECOND_HDR10;
|
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_720P_4_SECOND_HDR10;
|
||||||
@ -94,7 +94,10 @@ public class ToneMapHdrToSdrUsingOpenGlTest {
|
|||||||
.build()
|
.build()
|
||||||
.run(testId, composition);
|
.run(testId, composition);
|
||||||
@C.ColorTransfer
|
@C.ColorTransfer
|
||||||
int actualColorTransfer = retrieveColorTransfer(context, exportTestResult.filePath);
|
int actualColorTransfer =
|
||||||
|
retrieveTrackFormat(context, exportTestResult.filePath, C.TRACK_TYPE_VIDEO)
|
||||||
|
.colorInfo
|
||||||
|
.colorTransfer;
|
||||||
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
assertThat(actualColorTransfer).isEqualTo(C.COLOR_TRANSFER_SDR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user