Search in sources :

Example 11 with VideoSize

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);
    }
}
Also used : VideoSize(androidx.media3.common.VideoSize)

Example 12 with VideoSize

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);
}
Also used : MotionPhotoMetadata(androidx.media3.extractor.metadata.mp4.MotionPhotoMetadata) MediaItem(androidx.media3.common.MediaItem) TrackGroupArray(androidx.media3.common.TrackGroupArray) Test(org.junit.Test)

Example 13 with VideoSize

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);
}
Also used : Bundle(android.os.Bundle) VideoSize(androidx.media3.common.VideoSize) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Aggregations

VideoSize (androidx.media3.common.VideoSize)9 Nullable (androidx.annotation.Nullable)5 Test (org.junit.Test)5 Format (androidx.media3.common.Format)3 Bundle (android.os.Bundle)2 MediaItem (androidx.media3.common.MediaItem)2 PositionInfo (androidx.media3.common.Player.PositionInfo)2 DrmSessionEventListener (androidx.media3.exoplayer.drm.DrmSessionEventListener)2 DefaultAllocator (androidx.media3.exoplayer.upstream.DefaultAllocator)2 FakeSampleStream (androidx.media3.test.utils.FakeSampleStream)2 SuppressLint (android.annotation.SuppressLint)1 SurfaceTexture (android.graphics.SurfaceTexture)1 CodecCapabilities (android.media.MediaCodecInfo.CodecCapabilities)1 CodecProfileLevel (android.media.MediaCodecInfo.CodecProfileLevel)1 MediaFormat (android.media.MediaFormat)1 Handler (android.os.Handler)1 Looper (android.os.Looper)1 SystemClock (android.os.SystemClock)1 Surface (android.view.Surface)1 TextureView (android.view.TextureView)1