use of androidx.media3.common.VideoSize in project media by androidx.
the class DecoderVideoRenderer method maybeNotifyVideoSizeChanged.
private void maybeNotifyVideoSizeChanged(int width, int height) {
if (reportedVideoSize == null || reportedVideoSize.width != width || reportedVideoSize.height != height) {
reportedVideoSize = new VideoSize(width, height);
eventDispatcher.videoSizeChanged(reportedVideoSize);
}
}
use of androidx.media3.common.VideoSize in project media by androidx.
the class MetadataRetrieverTest method retrieveMetadata_heicMotionPhoto_outputsExpectedMetadata.
@Test
public void retrieveMetadata_heicMotionPhoto_outputsExpectedMetadata() throws Exception {
MediaItem mediaItem = MediaItem.fromUri(Uri.parse("asset://android_asset/media/mp4/sample_MP.heic"));
MotionPhotoMetadata expectedMotionPhotoMetadata = new MotionPhotoMetadata(/* photoStartPosition= */
0, /* photoSize= */
28_853, /* photoPresentationTimestampUs= */
C.TIME_UNSET, /* videoStartPosition= */
28_869, /* videoSize= */
28_803);
ListenableFuture<TrackGroupArray> trackGroupsFuture = retrieveMetadata(context, mediaItem, clock);
ShadowLooper.idleMainLooper();
TrackGroupArray trackGroups = trackGroupsFuture.get(TEST_TIMEOUT_SEC, TimeUnit.SECONDS);
assertThat(trackGroups.length).isEqualTo(1);
assertThat(trackGroups.get(0).length).isEqualTo(1);
assertThat(trackGroups.get(0).getFormat(0).metadata.length()).isEqualTo(1);
assertThat(trackGroups.get(0).getFormat(0).metadata.get(0)).isEqualTo(expectedMotionPhotoMetadata);
}
use of androidx.media3.common.VideoSize in project media by androidx.
the class MediaControllerTest method getVideoSize_returnsVideoSizeOfPlayerInSession.
@Test
public void getVideoSize_returnsVideoSizeOfPlayerInSession() throws Exception {
VideoSize testVideoSize = new VideoSize(/* width= */
100, /* height= */
42, /* unappliedRotationDegrees= */
90, /* pixelWidthHeightRatio= */
1.2f);
Bundle playerConfig = new RemoteMediaSession.MockPlayerConfigBuilder().setVideoSize(testVideoSize).build();
remoteSession.setPlayer(playerConfig);
MediaController controller = controllerTestRule.createController(remoteSession.getToken());
VideoSize videoSize = threadTestRule.getHandler().postAndSync(controller::getVideoSize);
assertThat(videoSize).isEqualTo(testVideoSize);
}
Aggregations