From 232246240415443ff8d3a8cd5930273b4085ddaa Mon Sep 17 00:00:00 2001 From: tonihei Date: Mon, 26 Jun 2023 13:26:35 +0000 Subject: [PATCH] Do not trim audio samples by changing their timestamp MP4 edit lists sometimes ask to start playback between two samples. If this happens, we currently change the timestamp of the first sample to zero to trim it (e.g. to display the first frame for a slightly shorter period of time). However, we can't do this to audio samples are they have an inherent duration and trimming them this way is not possible. #minor-release PiperOrigin-RevId: 543420218 --- .../java/androidx/media3/cast/CastPlayer.java | 1 + .../androidx/media3/cast/CastTimeline.java | 4 + .../androidx/media3/common/AdOverlayInfo.java | 6 + .../media3/common/AdPlaybackState.java | 15 ++ .../media3/common/AudioAttributes.java | 4 + .../androidx/media3/common/AuxEffectInfo.java | 1 + .../main/java/androidx/media3/common/C.java | 185 ++++++++++++++++++ .../androidx/media3/common/DeviceInfo.java | 5 + .../androidx/media3/common/DrmInitData.java | 3 + .../androidx/media3/common/FileTypes.java | 18 ++ .../java/androidx/media3/common/Format.java | 24 +++ .../androidx/media3/common/FrameInfo.java | 3 + .../common/IllegalSeekPositionException.java | 2 + .../androidx/media3/common/MediaItem.java | 10 + .../androidx/media3/common/MediaMetadata.java | 73 +++++++ .../java/androidx/media3/common/Metadata.java | 1 + .../androidx/media3/common/MimeTypes.java | 2 + .../media3/common/ParserException.java | 1 + .../media3/common/PlaybackException.java | 29 +++ .../java/androidx/media3/common/Player.java | 83 ++++++++ .../media3/common/SimpleBasePlayer.java | 55 ++++++ .../androidx/media3/common/StreamKey.java | 2 + .../androidx/media3/common/SurfaceInfo.java | 3 + .../java/androidx/media3/common/Timeline.java | 1 + .../androidx/media3/common/TrackGroup.java | 2 + .../media3/common/TrackSelectionOverride.java | 1 + .../common/TrackSelectionParameters.java | 27 +++ .../java/androidx/media3/common/Tracks.java | 1 + .../media3/common/VideoFrameProcessor.java | 3 + .../common/audio/AudioProcessingPipeline.java | 4 + .../media3/common/audio/AudioProcessor.java | 3 + .../common/audio/BaseAudioProcessor.java | 1 + .../audio/SpeedChangingAudioProcessor.java | 1 + .../androidx/media3/common/text/CueGroup.java | 1 + .../media3/common/util/EGLSurfaceTexture.java | 2 + .../media3/common/util/GlProgram.java | 2 + .../java/androidx/media3/common/util/Log.java | 5 + .../media3/common/util/NotificationUtil.java | 6 + .../media3/common/util/RepeatModeUtil.java | 3 + .../androidx/media3/common/util/UriUtil.java | 4 + .../media3/container/MdtaMetadataEntry.java | 5 + .../media3/container/Mp4TimestampData.java | 2 + .../media3/container/NalUnitUtil.java | 7 + .../media3/database/VersionTable.java | 4 + .../androidx/media3/datasource/DataSpec.java | 7 + .../datasource/DefaultHttpDataSource.java | 1 + .../media3/datasource/HttpDataSource.java | 2 + .../datasource/cache/CacheDataSink.java | 1 + .../datasource/cache/CacheDataSource.java | 1 + .../media3/datasource/cache/CacheSpan.java | 5 + .../datasource/cache/CachedContent.java | 4 + .../datasource/cache/CachedContentIndex.java | 3 + .../datasource/cache/ContentMetadata.java | 2 + .../media3/datasource/cache/SimpleCache.java | 1 + .../datasource/cronet/CronetDataSource.java | 1 + .../androidx/media3/decoder/CryptoInfo.java | 7 + .../media3/decoder/DecoderInputBuffer.java | 4 + .../decoder/VideoDecoderOutputBuffer.java | 2 + .../decoder/av1/Libgav1VideoRenderer.java | 2 + .../decoder/ffmpeg/FfmpegAudioRenderer.java | 1 + .../media3/decoder/midi/MidiDecoder.java | 4 + .../media3/decoder/midi/MidiRenderer.java | 1 + .../media3/decoder/midi/TrackEvent.java | 1 + .../decoder/opus/LibopusAudioRenderer.java | 2 + .../decoder/vp9/LibvpxVideoRenderer.java | 2 + ...FrameProcessorVideoFrameRenderingTest.java | 2 + .../media3/effect/DefaultShaderProgram.java | 7 + .../effect/DefaultVideoFrameProcessor.java | 1 + .../media3/effect/ExternalTextureManager.java | 1 + .../androidx/media3/effect/HslAdjustment.java | 2 + .../media3/effect/OverlaySettings.java | 1 + .../androidx/media3/effect/Presentation.java | 3 + .../androidx/media3/effect/RgbFilter.java | 1 + .../effect/ScaleAndRotateTransformation.java | 2 + .../media3/exoplayer/AudioFocusManager.java | 12 ++ .../media3/exoplayer/DecoderCounters.java | 11 ++ .../exoplayer/DecoderReuseEvaluation.java | 19 ++ .../exoplayer/DefaultRenderersFactory.java | 3 + .../exoplayer/ExoPlaybackException.java | 4 + .../media3/exoplayer/ExoPlayerImpl.java | 1 + .../exoplayer/ExoPlayerImplInternal.java | 2 + .../media3/exoplayer/ExoTimeoutException.java | 3 + .../media3/exoplayer/MediaPeriodHolder.java | 5 + .../media3/exoplayer/MediaPeriodInfo.java | 8 + .../media3/exoplayer/PlaybackInfo.java | 17 ++ .../androidx/media3/exoplayer/Renderer.java | 18 ++ .../exoplayer/RendererCapabilities.java | 22 +++ .../media3/exoplayer/SeekParameters.java | 5 + .../analytics/AnalyticsListener.java | 62 ++++++ .../exoplayer/analytics/PlaybackStats.java | 52 +++++ .../exoplayer/audio/AudioOffloadSupport.java | 4 + .../media3/exoplayer/audio/AudioSink.java | 10 + .../exoplayer/audio/AudioTimestampPoller.java | 7 + .../audio/AudioTrackPositionTracker.java | 4 + .../exoplayer/audio/DecoderAudioRenderer.java | 4 + .../exoplayer/audio/DefaultAudioSink.java | 9 + .../DefaultAudioTrackBufferSizeProvider.java | 10 + .../audio/MediaCodecAudioRenderer.java | 2 + .../audio/SilenceSkippingAudioProcessor.java | 5 + .../drm/DefaultDrmSessionManager.java | 6 + .../media3/exoplayer/drm/DrmSession.java | 5 + .../drm/DrmSessionEventListener.java | 1 + .../media3/exoplayer/drm/DrmUtil.java | 2 + .../media3/exoplayer/drm/ExoMediaDrm.java | 8 + .../exoplayer/drm/FrameworkCryptoConfig.java | 2 + .../drm/MediaDrmCallbackException.java | 3 + .../drm/UnsupportedDrmException.java | 2 + .../media3/exoplayer/drm/WidevineUtil.java | 1 + .../exoplayer/mediacodec/BatchBuffer.java | 1 + .../mediacodec/MediaCodecAdapter.java | 5 + .../exoplayer/mediacodec/MediaCodecInfo.java | 2 + .../mediacodec/MediaCodecRenderer.java | 12 ++ .../media3/exoplayer/offline/Download.java | 15 ++ .../exoplayer/offline/DownloadManager.java | 2 + .../exoplayer/offline/DownloadRequest.java | 6 + .../exoplayer/scheduler/Requirements.java | 4 + .../exoplayer/source/ClippingMediaSource.java | 3 + .../exoplayer/source/LoadEventInfo.java | 6 + .../exoplayer/source/MediaLoadData.java | 6 + .../source/MediaSourceEventListener.java | 1 + .../exoplayer/source/MergingMediaSource.java | 1 + .../exoplayer/source/SampleDataQueue.java | 3 + .../media3/exoplayer/source/SampleStream.java | 3 + .../exoplayer/source/ads/AdsMediaSource.java | 4 + .../source/chunk/BaseMediaChunk.java | 1 + .../media3/exoplayer/source/chunk/Chunk.java | 7 + .../media3/exoplayer/text/TextRenderer.java | 3 + .../AdaptiveTrackSelection.java | 1 + .../trackselection/BaseTrackSelection.java | 4 + .../trackselection/DefaultTrackSelector.java | 14 ++ .../trackselection/ExoTrackSelection.java | 2 + .../trackselection/MappingTrackSelector.java | 4 + .../trackselection/TrackSelection.java | 2 + .../trackselection/TrackSelectorResult.java | 4 + .../upstream/CachedRegionTracker.java | 2 + .../exoplayer/upstream/CmcdConfiguration.java | 2 + .../media3/exoplayer/upstream/CmcdLog.java | 5 + .../upstream/DefaultBandwidthMeter.java | 5 + .../DefaultLoadErrorHandlingPolicy.java | 4 + .../upstream/LoadErrorHandlingPolicy.java | 8 + .../media3/exoplayer/upstream/Loader.java | 3 + .../exoplayer/upstream/ParsingLoadable.java | 2 + .../ExperimentalBandwidthMeter.java | 5 + ...dingWeightedAverageBandwidthStatistic.java | 2 + .../exoplayer/video/DecoderVideoRenderer.java | 3 + .../video/FixedFrameRateEstimator.java | 4 + .../video/MediaCodecVideoRenderer.java | 3 + .../video/VideoFrameReleaseHelper.java | 4 + .../exoplayer/video/spherical/Projection.java | 10 + .../offline/DownloadManagerTest.java | 3 + .../exoplayer/source/SampleQueueTest.java | 1 + .../exoplayer/dash/DashMediaSource.java | 2 + .../exoplayer/dash/manifest/BaseUrl.java | 5 + .../exoplayer/dash/manifest/Descriptor.java | 2 + .../dash/manifest/Representation.java | 7 + .../manifest/ServiceDescriptionElement.java | 4 + .../media3/exoplayer/hls/HlsChunkSource.java | 2 + .../media3/exoplayer/hls/HlsManifest.java | 1 + .../media3/exoplayer/hls/HlsMediaSource.java | 1 + .../exoplayer/hls/HlsTrackMetadataEntry.java | 2 + .../hls/playlist/HlsMediaPlaylist.java | 36 ++++ .../hls/playlist/HlsMultivariantPlaylist.java | 8 + .../exoplayer/hls/playlist/HlsPlaylist.java | 2 + .../media3/exoplayer/ima/AdTagLoader.java | 16 ++ .../media3/exoplayer/ima/ImaUtil.java | 6 + .../exoplayer/rtsp/MediaDescription.java | 15 ++ .../exoplayer/rtsp/RtpDataLoadable.java | 1 + .../media3/exoplayer/rtsp/RtpPacket.java | 4 + .../exoplayer/rtsp/RtpPayloadFormat.java | 4 + .../rtsp/RtspAuthenticationInfo.java | 4 + .../media3/exoplayer/rtsp/RtspClient.java | 5 + .../exoplayer/rtsp/RtspDescribeResponse.java | 2 + .../media3/exoplayer/rtsp/RtspMediaTrack.java | 7 + .../exoplayer/rtsp/RtspMessageUtil.java | 2 + .../exoplayer/rtsp/RtspOptionsResponse.java | 1 + .../exoplayer/rtsp/RtspPlayResponse.java | 2 + .../media3/exoplayer/rtsp/RtspRequest.java | 3 + .../media3/exoplayer/rtsp/RtspResponse.java | 2 + .../exoplayer/rtsp/RtspSessionTiming.java | 1 + .../exoplayer/rtsp/RtspSetupResponse.java | 2 + .../exoplayer/rtsp/RtspTrackTiming.java | 2 + .../exoplayer/rtsp/SessionDescription.java | 18 ++ .../exoplayer/rtsp/reader/RtpAacReader.java | 1 + .../exoplayer/rtsp/reader/RtpAc3Reader.java | 2 + .../exoplayer/rtsp/reader/RtpAmrReader.java | 1 + .../exoplayer/rtsp/reader/RtpH263Reader.java | 1 + .../exoplayer/rtsp/reader/RtpH264Reader.java | 2 + .../exoplayer/rtsp/reader/RtpH265Reader.java | 5 + .../exoplayer/rtsp/reader/RtpMp4aReader.java | 1 + .../exoplayer/rtsp/reader/RtpVp8Reader.java | 2 + .../exoplayer/rtsp/reader/RtpVp9Reader.java | 2 + .../exoplayer/rtsp/RtpPacketStreamDump.java | 5 + .../media3/exoplayer/rtsp/RtspServer.java | 1 + .../smoothstreaming/SsMediaSource.java | 1 + .../androidx/media3/extractor/AacUtil.java | 10 + .../androidx/media3/extractor/Ac3Util.java | 20 ++ .../androidx/media3/extractor/Ac4Util.java | 7 + .../media3/extractor/BinarySearchSeeker.java | 4 + .../media3/extractor/DolbyVisionConfig.java | 2 + .../androidx/media3/extractor/DtsUtil.java | 3 + .../androidx/media3/extractor/Extractor.java | 2 + .../media3/extractor/FlacStreamMetadata.java | 12 ++ .../media3/extractor/MpegAudioUtil.java | 6 + .../androidx/media3/extractor/SeekMap.java | 1 + .../media3/extractor/TrackOutput.java | 2 + .../androidx/media3/extractor/VorbisUtil.java | 9 + .../androidx/media3/extractor/WavUtil.java | 10 + .../media3/extractor/amr/AmrExtractor.java | 3 + .../media3/extractor/avi/ChunkReader.java | 1 + .../media3/extractor/flac/FlacConstants.java | 7 + .../jpeg/MotionPhotoDescription.java | 4 + .../metadata/dvbsi/AppInfoTable.java | 1 + .../metadata/dvbsi/AppInfoTableDecoder.java | 1 + .../extractor/metadata/flac/PictureFrame.java | 7 + .../extractor/metadata/icy/IcyHeaders.java | 4 + .../extractor/metadata/icy/IcyInfo.java | 2 + .../extractor/metadata/id3/ChapterFrame.java | 2 + .../extractor/metadata/id3/Id3Decoder.java | 1 + .../extractor/metadata/id3/PrivFrame.java | 1 + .../metadata/mp4/MotionPhotoMetadata.java | 4 + .../metadata/mp4/SlowMotionData.java | 2 + .../metadata/mp4/SmtaMetadataEntry.java | 1 + .../metadata/scte35/PrivateCommand.java | 2 + .../metadata/scte35/SpliceInsertCommand.java | 12 ++ .../scte35/SpliceScheduleCommand.java | 10 + .../metadata/scte35/TimeSignalCommand.java | 1 + .../media3/extractor/mkv/EbmlProcessor.java | 6 + .../extractor/mkv/MatroskaExtractor.java | 16 ++ .../media3/extractor/mp3/Mp3Extractor.java | 5 + .../media3/extractor/mp3/XingSeeker.java | 2 + .../media3/extractor/mp4/AtomParsers.java | 11 +- .../extractor/mp4/FragmentedMp4Extractor.java | 3 + .../media3/extractor/mp4/Mp4Extractor.java | 3 + .../media3/extractor/mp4/SefReader.java | 2 + .../media3/extractor/mp4/Sniffer.java | 1 + .../androidx/media3/extractor/mp4/Track.java | 2 + .../media3/extractor/mp4/TrackFragment.java | 17 ++ .../extractor/mp4/TrackSampleTable.java | 7 + .../media3/extractor/ogg/OggPageHeader.java | 2 + .../extractor/text/SubtitleExtractor.java | 5 + .../extractor/text/cea/Cea608Decoder.java | 3 + .../extractor/text/cea/Cea708Decoder.java | 1 + .../media3/extractor/text/ssa/SsaDecoder.java | 1 + .../media3/extractor/text/ssa/SsaStyle.java | 1 + .../text/webvtt/WebvttCueParser.java | 1 + .../media3/extractor/ts/AdtsExtractor.java | 4 + .../ts/DefaultTsPayloadReaderFactory.java | 6 + .../media3/extractor/ts/H263Reader.java | 1 + .../media3/extractor/ts/TsExtractor.java | 2 + .../media3/extractor/ts/TsPayloadReader.java | 2 + .../media3/extractor/wav/WavExtractor.java | 10 + .../media3/extractor/wav/WavFormat.java | 6 + .../media3/extractor/wav/WavHeaderReader.java | 1 + .../media3/extractor/mp3/XingSeekerTest.java | 2 + .../java/androidx/media3/muxer/Mp4Muxer.java | 2 + .../media3/session/ConnectionRequest.java | 1 + .../media3/session/ConnectionState.java | 1 + .../DefaultMediaNotificationProvider.java | 2 + .../media3/session/LibraryResult.java | 1 + .../media3/session/MediaController.java | 3 + .../androidx/media3/session/MediaSession.java | 4 + .../androidx/media3/session/MediaUtils.java | 1 + .../androidx/media3/session/PlayerInfo.java | 4 + .../media3/session/SessionTokenImplBase.java | 1 + .../DefaultMediaNotificationProviderTest.java | 3 + .../extractordumps/mp4/sample_opus.mp4.0.dump | 2 +- .../mp4/sample_opus.mp4.unknown_length.dump | 2 +- .../session/MockMediaLibraryService.java | 2 + .../androidx/media3/session/MockPlayer.java | 47 +++++ .../media3/test/utils/ActionSchedule.java | 1 + .../media3/test/utils/DumpFileAsserts.java | 3 + .../media3/test/utils/ExtractorAsserts.java | 4 + .../media3/test/utils/FakeDataSet.java | 1 + .../media3/test/utils/FakeExoMediaDrm.java | 2 + .../media3/test/utils/FakeRenderer.java | 1 + .../utils/VideoFrameProcessorTestRunner.java | 1 + .../media3/transformer/AndroidTestUtil.java | 1 + .../media3/transformer/ExportTestResult.java | 6 + .../TransformerMixedInputEndToEndTest.java | 1 + ...oFrameProcessorTextureOutputPixelTest.java | 2 + .../ToneMapHdrToSdrUsingOpenGlPixelTest.java | 2 + .../media3/transformer/AssetLoader.java | 2 + .../media3/transformer/Composition.java | 4 + .../DefaultAssetLoaderFactory.java | 1 + .../media3/transformer/DefaultCodec.java | 1 + .../transformer/DefaultEncoderFactory.java | 1 + .../media3/transformer/DefaultMuxer.java | 1 + .../media3/transformer/EditedMediaItem.java | 6 + .../transformer/EditedMediaItemSequence.java | 1 + .../androidx/media3/transformer/Effects.java | 1 + .../media3/transformer/ExportException.java | 14 ++ .../media3/transformer/ExportResult.java | 11 ++ .../transformer/SefSlowMotionFlattener.java | 15 ++ .../transformer/SequenceAssetLoader.java | 2 + .../transformer/TransformationException.java | 13 ++ .../transformer/TransformationRequest.java | 7 + .../transformer/TransformationResult.java | 11 ++ .../media3/transformer/Transformer.java | 5 + .../transformer/TransformerInternal.java | 3 + .../transformer/VideoEncoderSettings.java | 8 + .../transformer/VideoSamplePipeline.java | 1 + .../media3/ui/AspectRatioFrameLayout.java | 4 + .../media3/ui/CaptionStyleCompat.java | 5 + .../androidx/media3/ui/DefaultTimeBar.java | 14 ++ .../media3/ui/LegacyPlayerControlView.java | 3 + .../androidx/media3/ui/PlayerControlView.java | 5 + .../media3/ui/PlayerNotificationManager.java | 8 + .../java/androidx/media3/ui/PlayerView.java | 5 + 308 files changed, 1920 insertions(+), 3 deletions(-) diff --git a/libraries/cast/src/main/java/androidx/media3/cast/CastPlayer.java b/libraries/cast/src/main/java/androidx/media3/cast/CastPlayer.java index 5481c2d022..f775c1c0ce 100644 --- a/libraries/cast/src/main/java/androidx/media3/cast/CastPlayer.java +++ b/libraries/cast/src/main/java/androidx/media3/cast/CastPlayer.java @@ -726,6 +726,7 @@ public final class CastPlayer extends BasePlayer { /** This method is not supported and does nothing. */ @Override public void setVideoTextureView(@Nullable TextureView textureView) {} + /** This method is not supported and does nothing. */ @Override public void clearVideoTextureView(@Nullable TextureView textureView) {} diff --git a/libraries/cast/src/main/java/androidx/media3/cast/CastTimeline.java b/libraries/cast/src/main/java/androidx/media3/cast/CastTimeline.java index 7cf90c5a4d..1621c7de7f 100644 --- a/libraries/cast/src/main/java/androidx/media3/cast/CastTimeline.java +++ b/libraries/cast/src/main/java/androidx/media3/cast/CastTimeline.java @@ -43,14 +43,18 @@ import java.util.Arrays; /** The duration of the item in microseconds, or {@link C#TIME_UNSET} if unknown. */ public final long durationUs; + /** * The default start position of the item in microseconds, or {@link C#TIME_UNSET} if unknown. */ public final long defaultPositionUs; + /** Whether the item is live content, or {@code false} if unknown. */ public final boolean isLive; + /** The original media item that has been set or added to the playlist. */ public final MediaItem mediaItem; + /** The {@linkplain MediaInfo#getContentId() content ID} of the cast media queue item. */ public final String contentId; diff --git a/libraries/common/src/main/java/androidx/media3/common/AdOverlayInfo.java b/libraries/common/src/main/java/androidx/media3/common/AdOverlayInfo.java index e411912a9b..268ce25be7 100644 --- a/libraries/common/src/main/java/androidx/media3/common/AdOverlayInfo.java +++ b/libraries/common/src/main/java/androidx/media3/common/AdOverlayInfo.java @@ -45,12 +45,16 @@ public final class AdOverlayInfo { @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @IntDef({PURPOSE_CONTROLS, PURPOSE_CLOSE_AD, PURPOSE_OTHER, PURPOSE_NOT_VISIBLE}) public @interface Purpose {} + /** Purpose for playback controls overlaying the player. */ public static final int PURPOSE_CONTROLS = 1; + /** Purpose for ad close buttons overlaying the player. */ public static final int PURPOSE_CLOSE_AD = 2; + /** Purpose for other overlays. */ public static final int PURPOSE_OTHER = 3; + /** Purpose for overlays that are not visible. */ public static final int PURPOSE_NOT_VISIBLE = 4; @@ -94,8 +98,10 @@ public final class AdOverlayInfo { /** The overlay view. */ public final View view; + /** The purpose of the overlay view. */ public final @Purpose int purpose; + /** An optional, detailed reason that the overlay view is needed. */ @Nullable public final String reasonDetail; diff --git a/libraries/common/src/main/java/androidx/media3/common/AdPlaybackState.java b/libraries/common/src/main/java/androidx/media3/common/AdPlaybackState.java index e481e2de2c..2e5c97b4df 100644 --- a/libraries/common/src/main/java/androidx/media3/common/AdPlaybackState.java +++ b/libraries/common/src/main/java/androidx/media3/common/AdPlaybackState.java @@ -62,8 +62,10 @@ public final class AdPlaybackState implements Bundleable { * C#TIME_END_OF_SOURCE} to indicate a postroll ad. */ public final long timeUs; + /** The number of ads in the ad group, or {@link C#LENGTH_UNSET} if unknown. */ public final int count; + /** * The original number of ads in the ad group in case the ad group is only partially available, * or {@link C#LENGTH_UNSET} if unknown. An ad can be partially available when a server side @@ -71,17 +73,22 @@ public final class AdPlaybackState implements Bundleable { * missing. */ public final int originalCount; + /** The URI of each ad in the ad group. */ public final @NullableType Uri[] uris; + /** The state of each ad in the ad group. */ public final @AdState int[] states; + /** The durations of each ad in the ad group, in microseconds. */ public final long[] durationsUs; + /** * The offset in microseconds which should be added to the content stream when resuming playback * after the ad group. */ public final long contentResumeOffsetUs; + /** Whether this ad group is server-side inserted and part of the content stream. */ public final boolean isServerSideInserted; @@ -535,14 +542,19 @@ public final class AdPlaybackState implements Bundleable { AD_STATE_ERROR, }) public @interface AdState {} + /** State for an ad that does not yet have a URL. */ public static final int AD_STATE_UNAVAILABLE = 0; + /** State for an ad that has a URL but has not yet been played. */ public static final int AD_STATE_AVAILABLE = 1; + /** State for an ad that was skipped. */ public static final int AD_STATE_SKIPPED = 2; + /** State for an ad that was played in full. */ public static final int AD_STATE_PLAYED = 3; + /** State for an ad that could not be loaded. */ public static final int AD_STATE_ERROR = 4; @@ -564,12 +576,15 @@ public final class AdPlaybackState implements Bundleable { /** The number of ad groups. */ public final int adGroupCount; + /** The position offset in the first unplayed ad at which to begin playback, in microseconds. */ public final long adResumePositionUs; + /** * The duration of the content period in microseconds, if known. {@link C#TIME_UNSET} otherwise. */ public final long contentDurationUs; + /** * The number of ad groups that have been removed. Ad groups with indices between {@code 0} * (inclusive) and {@code removedAdGroupCount} (exclusive) will be empty and must not be modified diff --git a/libraries/common/src/main/java/androidx/media3/common/AudioAttributes.java b/libraries/common/src/main/java/androidx/media3/common/AudioAttributes.java index 6406baf87a..ef163dc441 100644 --- a/libraries/common/src/main/java/androidx/media3/common/AudioAttributes.java +++ b/libraries/common/src/main/java/androidx/media3/common/AudioAttributes.java @@ -131,12 +131,16 @@ public final class AudioAttributes implements Bundleable { /** The {@link C.AudioContentType}. */ public final @C.AudioContentType int contentType; + /** The {@link C.AudioFlags}. */ public final @C.AudioFlags int flags; + /** The {@link C.AudioUsage}. */ public final @C.AudioUsage int usage; + /** The {@link C.AudioAllowedCapturePolicy}. */ public final @C.AudioAllowedCapturePolicy int allowedCapturePolicy; + /** The {@link C.SpatializationBehavior}. */ public final @C.SpatializationBehavior int spatializationBehavior; diff --git a/libraries/common/src/main/java/androidx/media3/common/AuxEffectInfo.java b/libraries/common/src/main/java/androidx/media3/common/AuxEffectInfo.java index a94f1afcaf..d46158c46c 100644 --- a/libraries/common/src/main/java/androidx/media3/common/AuxEffectInfo.java +++ b/libraries/common/src/main/java/androidx/media3/common/AuxEffectInfo.java @@ -41,6 +41,7 @@ public final class AuxEffectInfo { * @see android.media.AudioTrack#attachAuxEffect(int) */ public final int effectId; + /** * The send level for the effect. * diff --git a/libraries/common/src/main/java/androidx/media3/common/C.java b/libraries/common/src/main/java/androidx/media3/common/C.java index ed3fb91c0a..86d37542d3 100644 --- a/libraries/common/src/main/java/androidx/media3/common/C.java +++ b/libraries/common/src/main/java/androidx/media3/common/C.java @@ -120,12 +120,16 @@ public final class C { CRYPTO_TYPE_FRAMEWORK, }) public @interface CryptoType {} + /** No crypto. */ public static final int CRYPTO_TYPE_NONE = 0; + /** An unsupported crypto type. */ public static final int CRYPTO_TYPE_UNSUPPORTED = 1; + /** Framework crypto in which a {@link MediaCodec} is configured with a {@link MediaCrypto}. */ public static final int CRYPTO_TYPE_FRAMEWORK = 2; + /** * Applications or extensions may define custom {@code CRYPTO_TYPE_*} constants greater than or * equal to this value. @@ -142,10 +146,13 @@ public final class C { @IntDef({CRYPTO_MODE_UNENCRYPTED, CRYPTO_MODE_AES_CTR, CRYPTO_MODE_AES_CBC}) @UnstableApi public @interface CryptoMode {} + /** See {@link MediaCodec#CRYPTO_MODE_UNENCRYPTED}. */ @UnstableApi public static final int CRYPTO_MODE_UNENCRYPTED = MediaCodec.CRYPTO_MODE_UNENCRYPTED; + /** See {@link MediaCodec#CRYPTO_MODE_AES_CTR}. */ @UnstableApi public static final int CRYPTO_MODE_AES_CTR = MediaCodec.CRYPTO_MODE_AES_CTR; + /** See {@link MediaCodec#CRYPTO_MODE_AES_CBC}. */ @UnstableApi public static final int CRYPTO_MODE_AES_CBC = MediaCodec.CRYPTO_MODE_AES_CBC; @@ -217,50 +224,73 @@ public final class C { ENCODING_PCM_FLOAT }) public @interface PcmEncoding {} + /** See {@link AudioFormat#ENCODING_INVALID}. */ @UnstableApi public static final int ENCODING_INVALID = AudioFormat.ENCODING_INVALID; + /** See {@link AudioFormat#ENCODING_PCM_8BIT}. */ @UnstableApi public static final int ENCODING_PCM_8BIT = AudioFormat.ENCODING_PCM_8BIT; + /** See {@link AudioFormat#ENCODING_PCM_16BIT}. */ @UnstableApi public static final int ENCODING_PCM_16BIT = AudioFormat.ENCODING_PCM_16BIT; + /** Like {@link #ENCODING_PCM_16BIT}, but with the bytes in big endian order. */ @UnstableApi public static final int ENCODING_PCM_16BIT_BIG_ENDIAN = 0x10000000; + /** PCM encoding with 24 bits per sample. */ @UnstableApi public static final int ENCODING_PCM_24BIT = 0x20000000; + /** PCM encoding with 32 bits per sample. */ @UnstableApi public static final int ENCODING_PCM_32BIT = 0x30000000; + /** See {@link AudioFormat#ENCODING_PCM_FLOAT}. */ @UnstableApi public static final int ENCODING_PCM_FLOAT = AudioFormat.ENCODING_PCM_FLOAT; + /** See {@link AudioFormat#ENCODING_MP3}. */ @UnstableApi public static final int ENCODING_MP3 = AudioFormat.ENCODING_MP3; + /** See {@link AudioFormat#ENCODING_AAC_LC}. */ @UnstableApi public static final int ENCODING_AAC_LC = AudioFormat.ENCODING_AAC_LC; + /** See {@link AudioFormat#ENCODING_AAC_HE_V1}. */ @UnstableApi public static final int ENCODING_AAC_HE_V1 = AudioFormat.ENCODING_AAC_HE_V1; + /** See {@link AudioFormat#ENCODING_AAC_HE_V2}. */ @UnstableApi public static final int ENCODING_AAC_HE_V2 = AudioFormat.ENCODING_AAC_HE_V2; + /** See {@link AudioFormat#ENCODING_AAC_XHE}. */ @UnstableApi public static final int ENCODING_AAC_XHE = AudioFormat.ENCODING_AAC_XHE; + /** See {@link AudioFormat#ENCODING_AAC_ELD}. */ @UnstableApi public static final int ENCODING_AAC_ELD = AudioFormat.ENCODING_AAC_ELD; + /** AAC Error Resilient Bit-Sliced Arithmetic Coding. */ @UnstableApi public static final int ENCODING_AAC_ER_BSAC = 0x40000000; + /** See {@link AudioFormat#ENCODING_AC3}. */ @UnstableApi public static final int ENCODING_AC3 = AudioFormat.ENCODING_AC3; + /** See {@link AudioFormat#ENCODING_E_AC3}. */ @UnstableApi public static final int ENCODING_E_AC3 = AudioFormat.ENCODING_E_AC3; + /** See {@link AudioFormat#ENCODING_E_AC3_JOC}. */ @UnstableApi public static final int ENCODING_E_AC3_JOC = AudioFormat.ENCODING_E_AC3_JOC; + /** See {@link AudioFormat#ENCODING_AC4}. */ @UnstableApi public static final int ENCODING_AC4 = AudioFormat.ENCODING_AC4; + /** See {@link AudioFormat#ENCODING_DTS}. */ @UnstableApi public static final int ENCODING_DTS = AudioFormat.ENCODING_DTS; + /** See {@link AudioFormat#ENCODING_DTS_HD}. */ @UnstableApi public static final int ENCODING_DTS_HD = AudioFormat.ENCODING_DTS_HD; + // TODO(internal b/283949283): Use AudioFormat.ENCODING_DTS_UHD_P2 when Android 14 is released. @UnstableApi public static final int ENCODING_DTS_UHD_P2 = 0x0000001e; + /** See {@link AudioFormat#ENCODING_DOLBY_TRUEHD}. */ @UnstableApi public static final int ENCODING_DOLBY_TRUEHD = AudioFormat.ENCODING_DOLBY_TRUEHD; + /** See {@link AudioFormat#ENCODING_OPUS}. */ @UnstableApi public static final int ENCODING_OPUS = AudioFormat.ENCODING_OPUS; @@ -277,6 +307,7 @@ public final class C { /** See {@link AudioAttributes#SPATIALIZATION_BEHAVIOR_AUTO}. */ public static final int SPATIALIZATION_BEHAVIOR_AUTO = AudioAttributes.SPATIALIZATION_BEHAVIOR_AUTO; + /** See {@link AudioAttributes#SPATIALIZATION_BEHAVIOR_NEVER}. */ public static final int SPATIALIZATION_BEHAVIOR_NEVER = AudioAttributes.SPATIALIZATION_BEHAVIOR_NEVER; @@ -305,20 +336,28 @@ public final class C { STREAM_TYPE_DEFAULT }) public @interface StreamType {} + /** See {@link AudioManager#STREAM_ALARM}. */ @UnstableApi public static final int STREAM_TYPE_ALARM = AudioManager.STREAM_ALARM; + /** See {@link AudioManager#STREAM_DTMF}. */ @UnstableApi public static final int STREAM_TYPE_DTMF = AudioManager.STREAM_DTMF; + /** See {@link AudioManager#STREAM_MUSIC}. */ @UnstableApi public static final int STREAM_TYPE_MUSIC = AudioManager.STREAM_MUSIC; + /** See {@link AudioManager#STREAM_NOTIFICATION}. */ @UnstableApi public static final int STREAM_TYPE_NOTIFICATION = AudioManager.STREAM_NOTIFICATION; + /** See {@link AudioManager#STREAM_RING}. */ @UnstableApi public static final int STREAM_TYPE_RING = AudioManager.STREAM_RING; + /** See {@link AudioManager#STREAM_SYSTEM}. */ @UnstableApi public static final int STREAM_TYPE_SYSTEM = AudioManager.STREAM_SYSTEM; + /** See {@link AudioManager#STREAM_VOICE_CALL}. */ @UnstableApi public static final int STREAM_TYPE_VOICE_CALL = AudioManager.STREAM_VOICE_CALL; + /** The default stream type used by audio renderers. Equal to {@link #STREAM_TYPE_MUSIC}. */ @UnstableApi public static final int STREAM_TYPE_DEFAULT = STREAM_TYPE_MUSIC; @@ -341,15 +380,20 @@ public final class C { VOLUME_FLAG_VIBRATE, }) public @interface VolumeFlags {} + /** See {@link AudioManager#FLAG_SHOW_UI}. */ public static final int VOLUME_FLAG_SHOW_UI = AudioManager.FLAG_SHOW_UI; + /** See {@link AudioManager#FLAG_ALLOW_RINGER_MODES}. */ public static final int VOLUME_FLAG_ALLOW_RINGER_MODES = AudioManager.FLAG_ALLOW_RINGER_MODES; + /** See {@link AudioManager#FLAG_PLAY_SOUND}. */ public static final int VOLUME_FLAG_PLAY_SOUND = AudioManager.FLAG_PLAY_SOUND; + /** See {@link AudioManager#FLAG_REMOVE_SOUND_AND_VIBRATE}. */ public static final int VOLUME_FLAG_REMOVE_SOUND_AND_VIBRATE = AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE; + /** See {@link AudioManager#FLAG_VIBRATE}. */ public static final int VOLUME_FLAG_VIBRATE = AudioManager.FLAG_VIBRATE; @@ -377,34 +421,44 @@ public final class C { AUDIO_CONTENT_TYPE_UNKNOWN }) public @interface AudioContentType {} + /** See {@link AudioAttributes#CONTENT_TYPE_MOVIE}. */ public static final int AUDIO_CONTENT_TYPE_MOVIE = AudioAttributes.CONTENT_TYPE_MOVIE; + /** * @deprecated Use {@link #AUDIO_CONTENT_TYPE_MOVIE} instead. */ @UnstableApi @Deprecated public static final int CONTENT_TYPE_MOVIE = AUDIO_CONTENT_TYPE_MOVIE; + /** See {@link AudioAttributes#CONTENT_TYPE_MUSIC}. */ public static final int AUDIO_CONTENT_TYPE_MUSIC = AudioAttributes.CONTENT_TYPE_MUSIC; + /** * @deprecated Use {@link #AUDIO_CONTENT_TYPE_MUSIC} instead. */ @UnstableApi @Deprecated public static final int CONTENT_TYPE_MUSIC = AUDIO_CONTENT_TYPE_MUSIC; + /** See {@link AudioAttributes#CONTENT_TYPE_SONIFICATION}. */ public static final int AUDIO_CONTENT_TYPE_SONIFICATION = AudioAttributes.CONTENT_TYPE_SONIFICATION; + /** * @deprecated Use {@link #AUDIO_CONTENT_TYPE_SONIFICATION} instead. */ @UnstableApi @Deprecated public static final int CONTENT_TYPE_SONIFICATION = AUDIO_CONTENT_TYPE_SONIFICATION; + /** See {@link AudioAttributes#CONTENT_TYPE_SPEECH}. */ public static final int AUDIO_CONTENT_TYPE_SPEECH = AudioAttributes.CONTENT_TYPE_SPEECH; + /** * @deprecated Use {@link #AUDIO_CONTENT_TYPE_SPEECH} instead. */ @UnstableApi @Deprecated public static final int CONTENT_TYPE_SPEECH = AUDIO_CONTENT_TYPE_SPEECH; + /** See {@link AudioAttributes#CONTENT_TYPE_UNKNOWN}. */ public static final int AUDIO_CONTENT_TYPE_UNKNOWN = AudioAttributes.CONTENT_TYPE_UNKNOWN; + /** * @deprecated Use {@link #AUDIO_CONTENT_TYPE_UNKNOWN} instead. */ @@ -426,6 +480,7 @@ public final class C { flag = true, value = {FLAG_AUDIBILITY_ENFORCED}) public @interface AudioFlags {} + /** See {@link android.media.AudioAttributes#FLAG_AUDIBILITY_ENFORCED}. */ public static final int FLAG_AUDIBILITY_ENFORCED = android.media.AudioAttributes.FLAG_AUDIBILITY_ENFORCED; @@ -464,45 +519,61 @@ public final class C { USAGE_VOICE_COMMUNICATION_SIGNALLING }) public @interface AudioUsage {} + /** See {@link android.media.AudioAttributes#USAGE_ALARM}. */ public static final int USAGE_ALARM = android.media.AudioAttributes.USAGE_ALARM; + /** See {@link android.media.AudioAttributes#USAGE_ASSISTANCE_ACCESSIBILITY}. */ public static final int USAGE_ASSISTANCE_ACCESSIBILITY = android.media.AudioAttributes.USAGE_ASSISTANCE_ACCESSIBILITY; + /** See {@link android.media.AudioAttributes#USAGE_ASSISTANCE_NAVIGATION_GUIDANCE}. */ public static final int USAGE_ASSISTANCE_NAVIGATION_GUIDANCE = android.media.AudioAttributes.USAGE_ASSISTANCE_NAVIGATION_GUIDANCE; + /** See {@link android.media.AudioAttributes#USAGE_ASSISTANCE_SONIFICATION}. */ public static final int USAGE_ASSISTANCE_SONIFICATION = android.media.AudioAttributes.USAGE_ASSISTANCE_SONIFICATION; + /** See {@link android.media.AudioAttributes#USAGE_ASSISTANT}. */ public static final int USAGE_ASSISTANT = android.media.AudioAttributes.USAGE_ASSISTANT; + /** See {@link android.media.AudioAttributes#USAGE_GAME}. */ public static final int USAGE_GAME = android.media.AudioAttributes.USAGE_GAME; + /** See {@link android.media.AudioAttributes#USAGE_MEDIA}. */ public static final int USAGE_MEDIA = android.media.AudioAttributes.USAGE_MEDIA; + /** See {@link android.media.AudioAttributes#USAGE_NOTIFICATION}. */ public static final int USAGE_NOTIFICATION = android.media.AudioAttributes.USAGE_NOTIFICATION; + /** See {@link android.media.AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_DELAYED}. */ public static final int USAGE_NOTIFICATION_COMMUNICATION_DELAYED = android.media.AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_DELAYED; + /** See {@link android.media.AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_INSTANT}. */ public static final int USAGE_NOTIFICATION_COMMUNICATION_INSTANT = android.media.AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_INSTANT; + /** See {@link android.media.AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_REQUEST}. */ public static final int USAGE_NOTIFICATION_COMMUNICATION_REQUEST = android.media.AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_REQUEST; + /** See {@link android.media.AudioAttributes#USAGE_NOTIFICATION_EVENT}. */ public static final int USAGE_NOTIFICATION_EVENT = android.media.AudioAttributes.USAGE_NOTIFICATION_EVENT; + /** See {@link android.media.AudioAttributes#USAGE_NOTIFICATION_RINGTONE}. */ public static final int USAGE_NOTIFICATION_RINGTONE = android.media.AudioAttributes.USAGE_NOTIFICATION_RINGTONE; + /** See {@link android.media.AudioAttributes#USAGE_UNKNOWN}. */ public static final int USAGE_UNKNOWN = android.media.AudioAttributes.USAGE_UNKNOWN; + /** See {@link android.media.AudioAttributes#USAGE_VOICE_COMMUNICATION}. */ public static final int USAGE_VOICE_COMMUNICATION = android.media.AudioAttributes.USAGE_VOICE_COMMUNICATION; + /** See {@link android.media.AudioAttributes#USAGE_VOICE_COMMUNICATION_SIGNALLING}. */ public static final int USAGE_VOICE_COMMUNICATION_SIGNALLING = android.media.AudioAttributes.USAGE_VOICE_COMMUNICATION_SIGNALLING; @@ -518,10 +589,13 @@ public final class C { @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @IntDef({ALLOW_CAPTURE_BY_ALL, ALLOW_CAPTURE_BY_NONE, ALLOW_CAPTURE_BY_SYSTEM}) public @interface AudioAllowedCapturePolicy {} + /** See {@link android.media.AudioAttributes#ALLOW_CAPTURE_BY_ALL}. */ public static final int ALLOW_CAPTURE_BY_ALL = AudioAttributes.ALLOW_CAPTURE_BY_ALL; + /** See {@link android.media.AudioAttributes#ALLOW_CAPTURE_BY_NONE}. */ public static final int ALLOW_CAPTURE_BY_NONE = AudioAttributes.ALLOW_CAPTURE_BY_NONE; + /** See {@link android.media.AudioAttributes#ALLOW_CAPTURE_BY_SYSTEM}. */ public static final int ALLOW_CAPTURE_BY_SYSTEM = AudioAttributes.ALLOW_CAPTURE_BY_SYSTEM; @@ -547,19 +621,26 @@ public final class C { BUFFER_FLAG_DECODE_ONLY }) public @interface BufferFlags {} + /** Indicates that a buffer holds a synchronization sample. */ @UnstableApi public static final int BUFFER_FLAG_KEY_FRAME = MediaCodec.BUFFER_FLAG_KEY_FRAME; + /** Flag for empty buffers that signal that the end of the stream was reached. */ @UnstableApi public static final int BUFFER_FLAG_END_OF_STREAM = MediaCodec.BUFFER_FLAG_END_OF_STREAM; + /** Indicates that a buffer is known to contain the first media sample of the stream. */ @UnstableApi public static final int BUFFER_FLAG_FIRST_SAMPLE = 1 << 27; // 0x08000000 + /** Indicates that a buffer has supplemental data. */ @UnstableApi public static final int BUFFER_FLAG_HAS_SUPPLEMENTAL_DATA = 1 << 28; // 0x10000000 + /** Indicates that a buffer is known to contain the last media sample of the stream. */ @UnstableApi public static final int BUFFER_FLAG_LAST_SAMPLE = 1 << 29; // 0x20000000 + /** Indicates that a buffer is (at least partially) encrypted. */ @UnstableApi public static final int BUFFER_FLAG_ENCRYPTED = 1 << 30; // 0x40000000 + /** Indicates that a buffer should be decoded but not rendered. */ @UnstableApi public static final int BUFFER_FLAG_DECODE_ONLY = 1 << 31; // 0x80000000 @@ -573,10 +654,13 @@ public final class C { @Target(TYPE_USE) @IntDef(value = {VIDEO_OUTPUT_MODE_NONE, VIDEO_OUTPUT_MODE_YUV, VIDEO_OUTPUT_MODE_SURFACE_YUV}) public @interface VideoOutputMode {} + /** Video decoder output mode is not set. */ @UnstableApi public static final int VIDEO_OUTPUT_MODE_NONE = -1; + /** Video decoder output mode that outputs raw 4:2:0 YUV planes. */ @UnstableApi public static final int VIDEO_OUTPUT_MODE_YUV = 0; + /** Video decoder output mode that renders 4:2:0 YUV planes directly to a surface. */ @UnstableApi public static final int VIDEO_OUTPUT_MODE_SURFACE_YUV = 1; @@ -598,14 +682,17 @@ public final class C { VIDEO_SCALING_MODE_DEFAULT }) public @interface VideoScalingMode {} + /** See {@link MediaCodec#VIDEO_SCALING_MODE_SCALE_TO_FIT}. */ @UnstableApi public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT = MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT; + /** See {@link MediaCodec#VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING}. */ @UnstableApi public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING = MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING; + /** A default video scaling mode for {@link MediaCodec}-based renderers. */ @UnstableApi public static final int VIDEO_SCALING_MODE_DEFAULT = VIDEO_SCALING_MODE_SCALE_TO_FIT; @@ -618,11 +705,13 @@ public final class C { @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @IntDef({VIDEO_CHANGE_FRAME_RATE_STRATEGY_OFF, VIDEO_CHANGE_FRAME_RATE_STRATEGY_ONLY_IF_SEAMLESS}) public @interface VideoChangeFrameRateStrategy {} + /** * Strategy to never call {@link Surface#setFrameRate}. Use this strategy if you prefer to call * {@link Surface#setFrameRate} directly from application code. */ @UnstableApi public static final int VIDEO_CHANGE_FRAME_RATE_STRATEGY_OFF = Integer.MIN_VALUE; + /** * Strategy to call {@link Surface#setFrameRate} with {@link * Surface#CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS} when the output frame rate is known. @@ -644,9 +733,11 @@ public final class C { flag = true, value = {SELECTION_FLAG_DEFAULT, SELECTION_FLAG_FORCED, SELECTION_FLAG_AUTOSELECT}) public @interface SelectionFlags {} + // LINT.IfChange(selection_flags) /** Indicates that the track should be selected if user preferences do not state otherwise. */ public static final int SELECTION_FLAG_DEFAULT = 1; + /** * Indicates that the track should be selected if its language matches the language of the * selected audio track and user preferences do not state otherwise. Only applies to text tracks. @@ -657,6 +748,7 @@ public final class C { * for more info. */ public static final int SELECTION_FLAG_FORCED = 1 << 1; // 2 + /** * Indicates that the player may choose to play the track in absence of an explicit user * preference. @@ -690,32 +782,42 @@ public final class C { CONTENT_TYPE_OTHER }) public @interface ContentType {} + /** Value representing a DASH manifest. */ public static final int CONTENT_TYPE_DASH = 0; + /** * @deprecated Use {@link #CONTENT_TYPE_DASH} instead. */ @Deprecated @UnstableApi public static final int TYPE_DASH = CONTENT_TYPE_DASH; + /** Value representing a Smooth Streaming manifest. */ public static final int CONTENT_TYPE_SS = 1; + /** * @deprecated Use {@link #CONTENT_TYPE_SS} instead. */ @Deprecated @UnstableApi public static final int TYPE_SS = CONTENT_TYPE_SS; + /** Value representing an HLS manifest. */ public static final int CONTENT_TYPE_HLS = 2; + /** * @deprecated Use {@link #CONTENT_TYPE_HLS} instead. */ @Deprecated @UnstableApi public static final int TYPE_HLS = CONTENT_TYPE_HLS; + /** Value representing an RTSP stream. */ public static final int CONTENT_TYPE_RTSP = 3; + /** * @deprecated Use {@link #CONTENT_TYPE_RTSP} instead. */ @Deprecated @UnstableApi public static final int TYPE_RTSP = CONTENT_TYPE_RTSP; + /** Value representing files other than DASH, HLS or Smooth Streaming manifests, or RTSP URIs. */ public static final int CONTENT_TYPE_OTHER = 4; + /** * @deprecated Use {@link #CONTENT_TYPE_OTHER} instead. */ @@ -723,14 +825,18 @@ public final class C { /** A return value for methods where the end of an input was encountered. */ @UnstableApi public static final int RESULT_END_OF_INPUT = -1; + /** * A return value for methods where the length of parsed data exceeds the maximum length allowed. */ @UnstableApi public static final int RESULT_MAX_LENGTH_EXCEEDED = -2; + /** A return value for methods where nothing was read. */ @UnstableApi public static final int RESULT_NOTHING_READ = -3; + /** A return value for methods where a buffer was read. */ @UnstableApi public static final int RESULT_BUFFER_READ = -4; + /** A return value for methods where a format was read. */ @UnstableApi public static final int RESULT_FORMAT_READ = -5; @@ -758,24 +864,33 @@ public final class C { DATA_TYPE_MEDIA_PROGRESSIVE_LIVE }) public @interface DataType {} + /** A data type constant for data of unknown or unspecified type. */ @UnstableApi public static final int DATA_TYPE_UNKNOWN = 0; + /** A data type constant for media, typically containing media samples. */ @UnstableApi public static final int DATA_TYPE_MEDIA = 1; + /** A data type constant for media, typically containing only initialization data. */ @UnstableApi public static final int DATA_TYPE_MEDIA_INITIALIZATION = 2; + /** A data type constant for drm or encryption data. */ @UnstableApi public static final int DATA_TYPE_DRM = 3; + /** A data type constant for a manifest file. */ @UnstableApi public static final int DATA_TYPE_MANIFEST = 4; + /** A data type constant for time synchronization data. */ @UnstableApi public static final int DATA_TYPE_TIME_SYNCHRONIZATION = 5; + /** A data type constant for ads loader data. */ @UnstableApi public static final int DATA_TYPE_AD = 6; + /** * A data type constant for live progressive media streams, typically containing media samples. */ @UnstableApi public static final int DATA_TYPE_MEDIA_PROGRESSIVE_LIVE = 7; + /** * Applications or extensions may define custom {@code DATA_TYPE_*} constants greater than or * equal to this value. @@ -806,24 +921,34 @@ public final class C { TRACK_TYPE_NONE, }) public @interface TrackType {} + /** A type constant for a fake or empty track. */ public static final int TRACK_TYPE_NONE = -2; + /** A type constant for tracks of unknown type. */ public static final int TRACK_TYPE_UNKNOWN = -1; + /** A type constant for tracks of some default type, where the type itself is unknown. */ public static final int TRACK_TYPE_DEFAULT = 0; + /** A type constant for audio tracks. */ public static final int TRACK_TYPE_AUDIO = 1; + /** A type constant for video tracks. */ public static final int TRACK_TYPE_VIDEO = 2; + /** A type constant for text tracks. */ public static final int TRACK_TYPE_TEXT = 3; + /** A type constant for image tracks. */ public static final int TRACK_TYPE_IMAGE = 4; + /** A type constant for metadata tracks. */ public static final int TRACK_TYPE_METADATA = 5; + /** A type constant for camera motion tracks. */ public static final int TRACK_TYPE_CAMERA_MOTION = 6; + /** * Applications or extensions may define custom {@code TRACK_TYPE_*} constants greater than or * equal to this value. @@ -850,16 +975,22 @@ public final class C { SELECTION_REASON_TRICK_PLAY }) public @interface SelectionReason {} + /** A selection reason constant for selections whose reasons are unknown or unspecified. */ @UnstableApi public static final int SELECTION_REASON_UNKNOWN = 0; + /** A selection reason constant for an initial track selection. */ @UnstableApi public static final int SELECTION_REASON_INITIAL = 1; + /** A selection reason constant for an manual (i.e. user initiated) track selection. */ @UnstableApi public static final int SELECTION_REASON_MANUAL = 2; + /** A selection reason constant for an adaptive track selection. */ @UnstableApi public static final int SELECTION_REASON_ADAPTIVE = 3; + /** A selection reason constant for a trick play track selection. */ @UnstableApi public static final int SELECTION_REASON_TRICK_PLAY = 4; + /** * Applications or extensions may define custom {@code SELECTION_REASON_*} constants greater than * or equal to this value. @@ -871,6 +1002,7 @@ public final class C { /** A default seek back increment, in milliseconds. */ public static final long DEFAULT_SEEK_BACK_INCREMENT_MS = 5_000; + /** A default seek forward increment, in milliseconds. */ public static final long DEFAULT_SEEK_FORWARD_INCREMENT_MS = 15_000; @@ -952,12 +1084,16 @@ public final class C { STEREO_MODE_STEREO_MESH }) public @interface StereoMode {} + /** Indicates Monoscopic stereo layout, used with 360/3D/VR videos. */ @UnstableApi public static final int STEREO_MODE_MONO = 0; + /** Indicates Top-Bottom stereo layout, used with 360/3D/VR videos. */ @UnstableApi public static final int STEREO_MODE_TOP_BOTTOM = 1; + /** Indicates Left-Right stereo layout, used with 360/3D/VR videos. */ @UnstableApi public static final int STEREO_MODE_LEFT_RIGHT = 2; + /** * Indicates a stereo layout where the left and right eyes have separate meshes, used with * 360/3D/VR videos. @@ -975,10 +1111,13 @@ public final class C { @Target(TYPE_USE) @IntDef({Format.NO_VALUE, COLOR_SPACE_BT601, COLOR_SPACE_BT709, COLOR_SPACE_BT2020}) public @interface ColorSpace {} + /** See {@link MediaFormat#COLOR_STANDARD_BT601_PAL}. */ @UnstableApi public static final int COLOR_SPACE_BT601 = MediaFormat.COLOR_STANDARD_BT601_PAL; + /** See {@link MediaFormat#COLOR_STANDARD_BT709}. */ @UnstableApi public static final int COLOR_SPACE_BT709 = MediaFormat.COLOR_STANDARD_BT709; + /** See {@link MediaFormat#COLOR_STANDARD_BT2020}. */ @UnstableApi public static final int COLOR_SPACE_BT2020 = MediaFormat.COLOR_STANDARD_BT2020; @@ -1002,10 +1141,13 @@ public final class C { COLOR_TRANSFER_HLG }) public @interface ColorTransfer {} + /** See {@link MediaFormat#COLOR_TRANSFER_LINEAR}. */ @UnstableApi public static final int COLOR_TRANSFER_LINEAR = MediaFormat.COLOR_TRANSFER_LINEAR; + /** See {@link MediaFormat#COLOR_TRANSFER_SDR_VIDEO}. The SMPTE 170M transfer function. */ @UnstableApi public static final int COLOR_TRANSFER_SDR = MediaFormat.COLOR_TRANSFER_SDR_VIDEO; + /** * See {@link android.hardware.DataSpace#TRANSFER_SRGB}. The standard RGB transfer function, used * for some SDR use-cases like image input. @@ -1013,13 +1155,16 @@ public final class C { // Value sourced from ordering here: // https://cs.android.com/android/platform/superproject/+/master:frameworks/native/headers/media_plugin/media/hardware/VideoAPI.h;drc=55e9bd7c487ee235631f302ab8626776547ac913;l=138. @UnstableApi public static final int COLOR_TRANSFER_SRGB = 2; + /** * See {@link android.hardware.DataSpace#TRANSFER_GAMMA2_2}. The Gamma 2.2 transfer function, used * for some SDR use-cases like tone-mapping. */ @UnstableApi public static final int COLOR_TRANSFER_GAMMA_2_2 = 10; + /** See {@link MediaFormat#COLOR_TRANSFER_ST2084}. */ @UnstableApi public static final int COLOR_TRANSFER_ST2084 = MediaFormat.COLOR_TRANSFER_ST2084; + /** See {@link MediaFormat#COLOR_TRANSFER_HLG}. */ @UnstableApi public static final int COLOR_TRANSFER_HLG = MediaFormat.COLOR_TRANSFER_HLG; @@ -1034,8 +1179,10 @@ public final class C { @Target(TYPE_USE) @IntDef({Format.NO_VALUE, COLOR_RANGE_LIMITED, COLOR_RANGE_FULL}) public @interface ColorRange {} + /** See {@link MediaFormat#COLOR_RANGE_LIMITED}. */ @UnstableApi public static final int COLOR_RANGE_LIMITED = MediaFormat.COLOR_RANGE_LIMITED; + /** See {@link MediaFormat#COLOR_RANGE_FULL}. */ @UnstableApi public static final int COLOR_RANGE_FULL = MediaFormat.COLOR_RANGE_FULL; @@ -1052,12 +1199,16 @@ public final class C { PROJECTION_MESH }) public @interface Projection {} + /** Conventional rectangular projection. */ @UnstableApi public static final int PROJECTION_RECTANGULAR = 0; + /** Equirectangular spherical projection. */ @UnstableApi public static final int PROJECTION_EQUIRECTANGULAR = 1; + /** Cube map projection. */ @UnstableApi public static final int PROJECTION_CUBEMAP = 2; + /** 3-D mesh projection. */ @UnstableApi public static final int PROJECTION_MESH = 3; @@ -1101,29 +1252,40 @@ public final class C { NETWORK_TYPE_OTHER }) public @interface NetworkType {} + /** Unknown network type. */ @UnstableApi public static final int NETWORK_TYPE_UNKNOWN = 0; + /** No network connection. */ @UnstableApi public static final int NETWORK_TYPE_OFFLINE = 1; + /** Network type for a Wifi connection. */ @UnstableApi public static final int NETWORK_TYPE_WIFI = 2; + /** Network type for a 2G cellular connection. */ @UnstableApi public static final int NETWORK_TYPE_2G = 3; + /** Network type for a 3G cellular connection. */ @UnstableApi public static final int NETWORK_TYPE_3G = 4; + /** Network type for a 4G cellular connection. */ @UnstableApi public static final int NETWORK_TYPE_4G = 5; + /** Network type for a 5G stand-alone (SA) cellular connection. */ @UnstableApi public static final int NETWORK_TYPE_5G_SA = 9; + /** Network type for a 5G non-stand-alone (NSA) cellular connection. */ @UnstableApi public static final int NETWORK_TYPE_5G_NSA = 10; + /** * Network type for cellular connections which cannot be mapped to one of {@link * #NETWORK_TYPE_2G}, {@link #NETWORK_TYPE_3G}, or {@link #NETWORK_TYPE_4G}. */ @UnstableApi public static final int NETWORK_TYPE_CELLULAR_UNKNOWN = 6; + /** Network type for an Ethernet connection. */ @UnstableApi public static final int NETWORK_TYPE_ETHERNET = 7; + /** Network type for other connections which are not Wifi or cellular (e.g. VPN, Bluetooth). */ @UnstableApi public static final int NETWORK_TYPE_OTHER = 8; @@ -1138,12 +1300,14 @@ public final class C { @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @IntDef({WAKE_MODE_NONE, WAKE_MODE_LOCAL, WAKE_MODE_NETWORK}) public @interface WakeMode {} + /** * A wake mode that will not cause the player to hold any locks. * *

This is suitable for applications that do not play media with the screen off. */ public static final int WAKE_MODE_NONE = 0; + /** * A wake mode that will cause the player to hold a {@link android.os.PowerManager.WakeLock} * during playback. @@ -1152,6 +1316,7 @@ public final class C { * over wifi. */ public static final int WAKE_MODE_LOCAL = 1; + /** * A wake mode that will cause the player to hold a {@link android.os.PowerManager.WakeLock} and a * {@link android.net.wifi.WifiManager.WifiLock} during playback. @@ -1195,50 +1360,65 @@ public final class C { ROLE_FLAG_TRICK_PLAY }) public @interface RoleFlags {} + // LINT.IfChange(role_flags) /** Indicates a main track. */ public static final int ROLE_FLAG_MAIN = 1; + /** * Indicates an alternate track. For example a video track recorded from an different view point * than the main track(s). */ public static final int ROLE_FLAG_ALTERNATE = 1 << 1; + /** * Indicates a supplementary track, meaning the track has lower importance than the main track(s). * For example a video track that provides a visual accompaniment to a main audio track. */ public static final int ROLE_FLAG_SUPPLEMENTARY = 1 << 2; + /** Indicates the track contains commentary, for example from the director. */ public static final int ROLE_FLAG_COMMENTARY = 1 << 3; + /** * Indicates the track is in a different language from the original, for example dubbed audio or * translated captions. */ public static final int ROLE_FLAG_DUB = 1 << 4; + /** Indicates the track contains information about a current emergency. */ public static final int ROLE_FLAG_EMERGENCY = 1 << 5; + /** * Indicates the track contains captions. This flag may be set on video tracks to indicate the * presence of burned in captions. */ public static final int ROLE_FLAG_CAPTION = 1 << 6; + /** * Indicates the track contains subtitles. This flag may be set on video tracks to indicate the * presence of burned in subtitles. */ public static final int ROLE_FLAG_SUBTITLE = 1 << 7; + /** Indicates the track contains a visual sign-language interpretation of an audio track. */ public static final int ROLE_FLAG_SIGN = 1 << 8; + /** Indicates the track contains an audio or textual description of a video track. */ public static final int ROLE_FLAG_DESCRIBES_VIDEO = 1 << 9; + /** Indicates the track contains a textual description of music and sound. */ public static final int ROLE_FLAG_DESCRIBES_MUSIC_AND_SOUND = 1 << 10; + /** Indicates the track is designed for improved intelligibility of dialogue. */ public static final int ROLE_FLAG_ENHANCED_DIALOG_INTELLIGIBILITY = 1 << 11; + /** Indicates the track contains a transcription of spoken dialog. */ public static final int ROLE_FLAG_TRANSCRIBES_DIALOG = 1 << 12; + /** Indicates the track contains a text that has been edited for ease of reading. */ public static final int ROLE_FLAG_EASY_TO_READ = 1 << 13; + /** Indicates the track is intended for trick play. */ public static final int ROLE_FLAG_TRICK_PLAY = 1 << 14; @@ -1261,9 +1441,11 @@ public final class C { FORMAT_UNSUPPORTED_TYPE }) public @interface FormatSupport {} + // TODO(b/172315872) Renderer was a link. Link to equivalent concept or remove @code. /** The {@code Renderer} is capable of rendering the format. */ @UnstableApi public static final int FORMAT_HANDLED = 0b100; + /** * The {@code Renderer} is capable of rendering formats with the same MIME type, but the * properties of the format exceed the renderer's capabilities. There is a chance the renderer @@ -1275,6 +1457,7 @@ public final class C { * by the underlying H264 decoder. */ @UnstableApi public static final int FORMAT_EXCEEDS_CAPABILITIES = 0b011; + /** * The {@code Renderer} is capable of rendering formats with the same MIME type, but is not * capable of rendering the format because the format's drm protection is not supported. @@ -1284,6 +1467,7 @@ public final class C { * renderer only supports Widevine. */ @UnstableApi public static final int FORMAT_UNSUPPORTED_DRM = 0b010; + /** * The {@code Renderer} is a general purpose renderer for formats of the same top-level type, but * is not capable of rendering the format or any other format with the same MIME type because the @@ -1293,6 +1477,7 @@ public final class C { * matches audio/[subtype], but there does not exist a suitable decoder for [subtype]. */ @UnstableApi public static final int FORMAT_UNSUPPORTED_SUBTYPE = 0b001; + /** * The {@code Renderer} is not capable of rendering the format, either because it does not support * the format's top-level type, or because it's a specialized renderer for a different MIME type. diff --git a/libraries/common/src/main/java/androidx/media3/common/DeviceInfo.java b/libraries/common/src/main/java/androidx/media3/common/DeviceInfo.java index 62daf34a41..96607a9dd4 100644 --- a/libraries/common/src/main/java/androidx/media3/common/DeviceInfo.java +++ b/libraries/common/src/main/java/androidx/media3/common/DeviceInfo.java @@ -43,8 +43,10 @@ public final class DeviceInfo implements Bundleable { PLAYBACK_TYPE_REMOTE, }) public @interface PlaybackType {} + /** Playback happens on the local device (e.g. phone). */ public static final int PLAYBACK_TYPE_LOCAL = 0; + /** Playback happens outside of the device (e.g. a cast device). */ public static final int PLAYBACK_TYPE_REMOTE = 1; @@ -126,12 +128,15 @@ public final class DeviceInfo implements Bundleable { /** The type of playback. */ public final @PlaybackType int playbackType; + /** The minimum volume that the device supports. */ @IntRange(from = 0) public final int minVolume; + /** The maximum volume that the device supports, or {@code 0} if unspecified. */ @IntRange(from = 0) public final int maxVolume; + /** * The {@linkplain MediaRouter2.RoutingController#getId() routing controller id} of the associated * {@link MediaRouter2.RoutingController}, or null if unset or {@link #playbackType} is {@link diff --git a/libraries/common/src/main/java/androidx/media3/common/DrmInitData.java b/libraries/common/src/main/java/androidx/media3/common/DrmInitData.java index 65fe095828..4f942fa739 100644 --- a/libraries/common/src/main/java/androidx/media3/common/DrmInitData.java +++ b/libraries/common/src/main/java/androidx/media3/common/DrmInitData.java @@ -265,10 +265,13 @@ public final class DrmInitData implements Comparator, Parcelable { * applies to all schemes). */ public final UUID uuid; + /** The URL of the server to which license requests should be made. May be null if unknown. */ @Nullable public final String licenseServerUrl; + /** The mimeType of {@link #data}. */ public final String mimeType; + /** The initialization data. May be null for scheme support checks only. */ @Nullable public final byte[] data; diff --git a/libraries/common/src/main/java/androidx/media3/common/FileTypes.java b/libraries/common/src/main/java/androidx/media3/common/FileTypes.java index b4cd6c7497..ab06a48b89 100644 --- a/libraries/common/src/main/java/androidx/media3/common/FileTypes.java +++ b/libraries/common/src/main/java/androidx/media3/common/FileTypes.java @@ -47,40 +47,58 @@ public final class FileTypes { MIDI, AVI }) public @interface Type {} + /** Unknown file type. */ public static final int UNKNOWN = -1; + /** File type for the AC-3 and E-AC-3 formats. */ public static final int AC3 = 0; + /** File type for the AC-4 format. */ public static final int AC4 = 1; + /** File type for the ADTS format. */ public static final int ADTS = 2; + /** File type for the AMR format. */ public static final int AMR = 3; + /** File type for the FLAC format. */ public static final int FLAC = 4; + /** File type for the FLV format. */ public static final int FLV = 5; + /** File type for the Matroska and WebM formats. */ public static final int MATROSKA = 6; + /** File type for the MP3 format. */ public static final int MP3 = 7; + /** File type for the MP4 format. */ public static final int MP4 = 8; + /** File type for the Ogg format. */ public static final int OGG = 9; + /** File type for the MPEG-PS format. */ public static final int PS = 10; + /** File type for the MPEG-TS format. */ public static final int TS = 11; + /** File type for the WAV format. */ public static final int WAV = 12; + /** File type for the WebVTT format. */ public static final int WEBVTT = 13; + /** File type for the JPEG format. */ public static final int JPEG = 14; + /** File type for the MIDI format. */ public static final int MIDI = 15; + /** File type for the AVI format. */ public static final int AVI = 16; diff --git a/libraries/common/src/main/java/androidx/media3/common/Format.java b/libraries/common/src/main/java/androidx/media3/common/Format.java index d9e50851fd..3d440c5bd2 100644 --- a/libraries/common/src/main/java/androidx/media3/common/Format.java +++ b/libraries/common/src/main/java/androidx/media3/common/Format.java @@ -686,14 +686,19 @@ public final class Format implements Bundleable { /** An identifier for the format, or null if unknown or not applicable. */ @Nullable public final String id; + /** The human readable label, or null if unknown or not applicable. */ @Nullable public final String label; + /** The language as an IETF BCP 47 conformant tag, or null if unknown or not applicable. */ @Nullable public final String language; + /** Track selection flags. */ public final @C.SelectionFlags int selectionFlags; + /** Track role flags. */ public final @C.RoleFlags int roleFlags; + /** * The average bitrate in bits per second, or {@link #NO_VALUE} if unknown or not applicable. The * way in which this field is populated depends on the type of media to which the format @@ -716,6 +721,7 @@ public final class Format implements Bundleable { * */ @UnstableApi public final int averageBitrate; + /** * The peak bitrate in bits per second, or {@link #NO_VALUE} if unknown or not applicable. The way * in which this field is populated depends on the type of media to which the format corresponds: @@ -735,14 +741,17 @@ public final class Format implements Bundleable { * */ @UnstableApi public final int peakBitrate; + /** * The bitrate in bits per second. This is the peak bitrate if known, or else the average bitrate * if known, or else {@link Format#NO_VALUE}. Equivalent to: {@code peakBitrate != NO_VALUE ? * peakBitrate : averageBitrate}. */ @UnstableApi public final int bitrate; + /** Codecs of the format as described in RFC 6381, or null if unknown or not applicable. */ @Nullable public final String codecs; + /** Metadata, or null if unknown or not applicable. */ @UnstableApi @Nullable public final Metadata metadata; @@ -755,16 +764,19 @@ public final class Format implements Bundleable { /** The sample MIME type, or null if unknown or not applicable. */ @Nullable public final String sampleMimeType; + /** * The maximum size of a buffer of data (typically one sample), or {@link #NO_VALUE} if unknown or * not applicable. */ @UnstableApi public final int maxInputSize; + /** * Initialization data that must be provided to the decoder. Will not be null, but may be empty if * initialization data is not required. */ @UnstableApi public final List initializationData; + /** DRM initialization data if the stream is protected, or null otherwise. */ @UnstableApi @Nullable public final DrmInitData drmInitData; @@ -779,25 +791,32 @@ public final class Format implements Bundleable { /** The width of the video in pixels, or {@link #NO_VALUE} if unknown or not applicable. */ public final int width; + /** The height of the video in pixels, or {@link #NO_VALUE} if unknown or not applicable. */ public final int height; + /** The frame rate in frames per second, or {@link #NO_VALUE} if unknown or not applicable. */ public final float frameRate; + /** * The clockwise rotation that should be applied to the video for it to be rendered in the correct * orientation, or 0 if unknown or not applicable. Only 0, 90, 180 and 270 are supported. */ @UnstableApi public final int rotationDegrees; + /** The width to height ratio of pixels in the video, or 1.0 if unknown or not applicable. */ public final float pixelWidthHeightRatio; + /** The projection data for 360/VR video, or null if not applicable. */ @UnstableApi @Nullable public final byte[] projectionData; + /** * The stereo layout for 360/3D/VR video, or {@link #NO_VALUE} if not applicable. Valid stereo * modes are {@link C#STEREO_MODE_MONO}, {@link C#STEREO_MODE_TOP_BOTTOM}, {@link * C#STEREO_MODE_LEFT_RIGHT}, {@link C#STEREO_MODE_STEREO_MESH}. */ @UnstableApi public final @C.StereoMode int stereoMode; + /** The color metadata associated with the video, or null if not applicable. */ @UnstableApi @Nullable public final ColorInfo colorInfo; @@ -805,15 +824,19 @@ public final class Format implements Bundleable { /** The number of audio channels, or {@link #NO_VALUE} if unknown or not applicable. */ public final int channelCount; + /** The audio sampling rate in Hz, or {@link #NO_VALUE} if unknown or not applicable. */ public final int sampleRate; + /** The {@link C.PcmEncoding} for PCM audio. Set to {@link #NO_VALUE} for other media types. */ @UnstableApi public final @C.PcmEncoding int pcmEncoding; + /** * The number of frames to trim from the start of the decoded audio stream, or 0 if not * applicable. */ @UnstableApi public final int encoderDelay; + /** * The number of frames to trim from the end of the decoded audio stream, or 0 if not applicable. */ @@ -830,6 +853,7 @@ public final class Format implements Bundleable { * The number of horizontal tiles in an image, or {@link #NO_VALUE} if not known or applicable. */ @UnstableApi public final int tileCountHorizontal; + /** The number of vertical tiles in an image, or {@link #NO_VALUE} if not known or applicable. */ @UnstableApi public final int tileCountVertical; diff --git a/libraries/common/src/main/java/androidx/media3/common/FrameInfo.java b/libraries/common/src/main/java/androidx/media3/common/FrameInfo.java index 2e3fdf91b9..b8589e0118 100644 --- a/libraries/common/src/main/java/androidx/media3/common/FrameInfo.java +++ b/libraries/common/src/main/java/androidx/media3/common/FrameInfo.java @@ -97,10 +97,13 @@ public class FrameInfo { /** The width of the frame, in pixels. */ public final int width; + /** The height of the frame, in pixels. */ public final int height; + /** The ratio of width over height for each pixel. */ public final float pixelWidthHeightRatio; + /** * The offset that must be added to the frame presentation timestamp, in microseconds. * diff --git a/libraries/common/src/main/java/androidx/media3/common/IllegalSeekPositionException.java b/libraries/common/src/main/java/androidx/media3/common/IllegalSeekPositionException.java index 00b204fcc5..55ceb31861 100644 --- a/libraries/common/src/main/java/androidx/media3/common/IllegalSeekPositionException.java +++ b/libraries/common/src/main/java/androidx/media3/common/IllegalSeekPositionException.java @@ -26,8 +26,10 @@ public final class IllegalSeekPositionException extends IllegalStateException { /** The {@link Timeline} in which the seek was attempted. */ public final Timeline timeline; + /** The index of the window being seeked to. */ public final int windowIndex; + /** The seek position in the specified window. */ public final long positionMs; diff --git a/libraries/common/src/main/java/androidx/media3/common/MediaItem.java b/libraries/common/src/main/java/androidx/media3/common/MediaItem.java index f9868881df..cb0174f778 100644 --- a/libraries/common/src/main/java/androidx/media3/common/MediaItem.java +++ b/libraries/common/src/main/java/androidx/media3/common/MediaItem.java @@ -818,6 +818,7 @@ public final class MediaItem implements Bundleable { * @deprecated Use {@link #forcedSessionTrackTypes}. */ @UnstableApi @Deprecated public final ImmutableList<@C.TrackType Integer> sessionForClearTypes; + /** * The types of tracks for which to always use a DRM session even if the content is unencrypted. */ @@ -1114,6 +1115,7 @@ public final class MediaItem implements Bundleable { /** Optional subtitles to be sideloaded. */ public final ImmutableList subtitleConfigurations; + /** * @deprecated Use {@link #subtitleConfigurations} instead. */ @@ -1593,16 +1595,22 @@ public final class MediaItem implements Bundleable { /** The {@link Uri} to the subtitle file. */ public final Uri uri; + /** The optional MIME type of the subtitle file, or {@code null} if unspecified. */ @Nullable public final String mimeType; + /** The language. */ @Nullable public final String language; + /** The selection flags. */ public final @C.SelectionFlags int selectionFlags; + /** The role flags. */ public final @C.RoleFlags int roleFlags; + /** The label. */ @Nullable public final String label; + /** * The ID of the subtitles. This will be propagated to the {@link Format#id} of the subtitle * track created from this configuration. @@ -2165,6 +2173,7 @@ public final class MediaItem implements Bundleable { * boundaries. */ @Nullable public final LocalConfiguration localConfiguration; + /** * @deprecated Use {@link #localConfiguration} instead. */ @@ -2178,6 +2187,7 @@ public final class MediaItem implements Bundleable { /** The clipping properties. */ public final ClippingConfiguration clippingConfiguration; + /** * @deprecated Use {@link #clippingConfiguration} instead. */ diff --git a/libraries/common/src/main/java/androidx/media3/common/MediaMetadata.java b/libraries/common/src/main/java/androidx/media3/common/MediaMetadata.java index 9fb33087db..55070dc938 100644 --- a/libraries/common/src/main/java/androidx/media3/common/MediaMetadata.java +++ b/libraries/common/src/main/java/androidx/media3/common/MediaMetadata.java @@ -643,108 +643,143 @@ public final class MediaMetadata implements Bundleable { /** Media of undetermined type or a mix of multiple {@linkplain MediaType media types}. */ public static final int MEDIA_TYPE_MIXED = 0; + /** {@link MediaType} for music. */ public static final int MEDIA_TYPE_MUSIC = 1; + /** {@link MediaType} for an audio book chapter. */ public static final int MEDIA_TYPE_AUDIO_BOOK_CHAPTER = 2; + /** {@link MediaType} for a podcast episode. */ public static final int MEDIA_TYPE_PODCAST_EPISODE = 3; + /** {@link MediaType} for a radio station. */ public static final int MEDIA_TYPE_RADIO_STATION = 4; + /** {@link MediaType} for news. */ public static final int MEDIA_TYPE_NEWS = 5; + /** {@link MediaType} for a video. */ public static final int MEDIA_TYPE_VIDEO = 6; + /** {@link MediaType} for a movie trailer. */ public static final int MEDIA_TYPE_TRAILER = 7; + /** {@link MediaType} for a movie. */ public static final int MEDIA_TYPE_MOVIE = 8; + /** {@link MediaType} for a TV show. */ public static final int MEDIA_TYPE_TV_SHOW = 9; + /** * {@link MediaType} for a group of items (e.g., {@link #MEDIA_TYPE_MUSIC music}) belonging to an * album. */ public static final int MEDIA_TYPE_ALBUM = 10; + /** * {@link MediaType} for a group of items (e.g., {@link #MEDIA_TYPE_MUSIC music}) from the same * artist. */ public static final int MEDIA_TYPE_ARTIST = 11; + /** * {@link MediaType} for a group of items (e.g., {@link #MEDIA_TYPE_MUSIC music}) of the same * genre. */ public static final int MEDIA_TYPE_GENRE = 12; + /** * {@link MediaType} for a group of items (e.g., {@link #MEDIA_TYPE_MUSIC music}) forming a * playlist. */ public static final int MEDIA_TYPE_PLAYLIST = 13; + /** * {@link MediaType} for a group of items (e.g., {@link #MEDIA_TYPE_MUSIC music}) from the same * year. */ public static final int MEDIA_TYPE_YEAR = 14; + /** * {@link MediaType} for a group of items forming an audio book. Items in this group are typically * of type {@link #MEDIA_TYPE_AUDIO_BOOK_CHAPTER}. */ public static final int MEDIA_TYPE_AUDIO_BOOK = 15; + /** * {@link MediaType} for a group of items belonging to a podcast. Items in this group are * typically of type {@link #MEDIA_TYPE_PODCAST_EPISODE}. */ public static final int MEDIA_TYPE_PODCAST = 16; + /** * {@link MediaType} for a group of items that are part of a TV channel. Items in this group are * typically of type {@link #MEDIA_TYPE_TV_SHOW}, {@link #MEDIA_TYPE_TV_SERIES} or {@link * #MEDIA_TYPE_MOVIE}. */ public static final int MEDIA_TYPE_TV_CHANNEL = 17; + /** * {@link MediaType} for a group of items that are part of a TV series. Items in this group are * typically of type {@link #MEDIA_TYPE_TV_SHOW} or {@link #MEDIA_TYPE_TV_SEASON}. */ public static final int MEDIA_TYPE_TV_SERIES = 18; + /** * {@link MediaType} for a group of items that are part of a TV series. Items in this group are * typically of type {@link #MEDIA_TYPE_TV_SHOW}. */ public static final int MEDIA_TYPE_TV_SEASON = 19; + /** {@link MediaType} for a folder with mixed or undetermined content. */ public static final int MEDIA_TYPE_FOLDER_MIXED = 20; + /** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_ALBUM albums}. */ public static final int MEDIA_TYPE_FOLDER_ALBUMS = 21; + /** {@link MediaType} for a folder containing {@linkplain #FIELD_ARTIST artists}. */ public static final int MEDIA_TYPE_FOLDER_ARTISTS = 22; + /** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_GENRE genres}. */ public static final int MEDIA_TYPE_FOLDER_GENRES = 23; + /** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_PLAYLIST playlists}. */ public static final int MEDIA_TYPE_FOLDER_PLAYLISTS = 24; + /** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_YEAR years}. */ public static final int MEDIA_TYPE_FOLDER_YEARS = 25; + /** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_AUDIO_BOOK audio books}. */ public static final int MEDIA_TYPE_FOLDER_AUDIO_BOOKS = 26; + /** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_PODCAST podcasts}. */ public static final int MEDIA_TYPE_FOLDER_PODCASTS = 27; + /** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_TV_CHANNEL TV channels}. */ public static final int MEDIA_TYPE_FOLDER_TV_CHANNELS = 28; + /** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_TV_SERIES TV series}. */ public static final int MEDIA_TYPE_FOLDER_TV_SERIES = 29; + /** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_TV_SHOW TV shows}. */ public static final int MEDIA_TYPE_FOLDER_TV_SHOWS = 30; + /** * {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_RADIO_STATION radio * stations}. */ public static final int MEDIA_TYPE_FOLDER_RADIO_STATIONS = 31; + /** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_NEWS news}. */ public static final int MEDIA_TYPE_FOLDER_NEWS = 32; + /** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_VIDEO videos}. */ public static final int MEDIA_TYPE_FOLDER_VIDEOS = 33; + /** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_TRAILER movie trailers}. */ public static final int MEDIA_TYPE_FOLDER_TRAILERS = 34; + /** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_MOVIE movies}. */ public static final int MEDIA_TYPE_FOLDER_MOVIES = 35; @@ -787,6 +822,7 @@ public final class MediaMetadata implements Bundleable { * @deprecated Use {@link #isBrowsable} set to false instead. */ @Deprecated public static final int FOLDER_TYPE_NONE = -1; + /** * Type for a folder containing media of mixed types. * @@ -794,12 +830,14 @@ public final class MediaMetadata implements Bundleable { * #MEDIA_TYPE_FOLDER_MIXED} instead. */ @Deprecated public static final int FOLDER_TYPE_MIXED = 0; + /** * Type for a folder containing only playable media. * * @deprecated Use {@link #isBrowsable} set to true instead. */ @Deprecated public static final int FOLDER_TYPE_TITLES = 1; + /** * Type for a folder containing media categorized by album. * @@ -807,6 +845,7 @@ public final class MediaMetadata implements Bundleable { * #MEDIA_TYPE_FOLDER_ALBUMS} instead. */ @Deprecated public static final int FOLDER_TYPE_ALBUMS = 2; + /** * Type for a folder containing media categorized by artist. * @@ -814,6 +853,7 @@ public final class MediaMetadata implements Bundleable { * #MEDIA_TYPE_FOLDER_ARTISTS} instead. */ @Deprecated public static final int FOLDER_TYPE_ARTISTS = 3; + /** * Type for a folder containing media categorized by genre. * @@ -821,6 +861,7 @@ public final class MediaMetadata implements Bundleable { * #MEDIA_TYPE_FOLDER_GENRES} instead. */ @Deprecated public static final int FOLDER_TYPE_GENRES = 4; + /** * Type for a folder containing a playlist. * @@ -828,6 +869,7 @@ public final class MediaMetadata implements Bundleable { * #MEDIA_TYPE_FOLDER_PLAYLISTS} instead. */ @Deprecated public static final int FOLDER_TYPE_PLAYLISTS = 5; + /** * Type for a folder containing media categorized by year. * @@ -910,36 +952,50 @@ public final class MediaMetadata implements Bundleable { /** Optional title. */ @Nullable public final CharSequence title; + /** Optional artist. */ @Nullable public final CharSequence artist; + /** Optional album title. */ @Nullable public final CharSequence albumTitle; + /** Optional album artist. */ @Nullable public final CharSequence albumArtist; + /** Optional display title. */ @Nullable public final CharSequence displayTitle; + /** * Optional subtitle. * *

This is the secondary title of the media, unrelated to closed captions. */ @Nullable public final CharSequence subtitle; + /** Optional description. */ @Nullable public final CharSequence description; + /** Optional user {@link Rating}. */ @Nullable public final Rating userRating; + /** Optional overall {@link Rating}. */ @Nullable public final Rating overallRating; + /** Optional artwork data as a compressed byte array. */ @Nullable public final byte[] artworkData; + /** Optional {@link PictureType} of the artwork data. */ @Nullable public final @PictureType Integer artworkDataType; + /** Optional artwork {@link Uri}. */ @Nullable public final Uri artworkUri; + /** Optional track number. */ @Nullable public final Integer trackNumber; + /** Optional total number of tracks. */ @Nullable public final Integer totalTrackCount; + /** * Optional {@link FolderType}. * @@ -950,22 +1006,28 @@ public final class MediaMetadata implements Bundleable { @Deprecated @Nullable public final @FolderType Integer folderType; + /** Optional boolean to indicate that the media is a browsable folder. */ @Nullable public final Boolean isBrowsable; + /** Optional boolean to indicate that the media is playable. */ @Nullable public final Boolean isPlayable; + /** * @deprecated Use {@link #recordingYear} instead. */ @UnstableApi @Deprecated @Nullable public final Integer year; + /** Optional year of the recording date. */ @Nullable public final Integer recordingYear; + /** * Optional month of the recording date. * *

Note that there is no guarantee that the month and day are a valid combination. */ @Nullable public final Integer recordingMonth; + /** * Optional day of the recording date. * @@ -975,34 +1037,45 @@ public final class MediaMetadata implements Bundleable { /** Optional year of the release date. */ @Nullable public final Integer releaseYear; + /** * Optional month of the release date. * *

Note that there is no guarantee that the month and day are a valid combination. */ @Nullable public final Integer releaseMonth; + /** * Optional day of the release date. * *

Note that there is no guarantee that the month and day are a valid combination. */ @Nullable public final Integer releaseDay; + /** Optional writer. */ @Nullable public final CharSequence writer; + /** Optional composer. */ @Nullable public final CharSequence composer; + /** Optional conductor. */ @Nullable public final CharSequence conductor; + /** Optional disc number. */ @Nullable public final Integer discNumber; + /** Optional total number of discs. */ @Nullable public final Integer totalDiscCount; + /** Optional genre. */ @Nullable public final CharSequence genre; + /** Optional compilation. */ @Nullable public final CharSequence compilation; + /** Optional name of the station streaming the media. */ @Nullable public final CharSequence station; + /** Optional {@link MediaType}. */ @Nullable public final @MediaType Integer mediaType; diff --git a/libraries/common/src/main/java/androidx/media3/common/Metadata.java b/libraries/common/src/main/java/androidx/media3/common/Metadata.java index 201d9b1296..fe98e139b1 100644 --- a/libraries/common/src/main/java/androidx/media3/common/Metadata.java +++ b/libraries/common/src/main/java/androidx/media3/common/Metadata.java @@ -59,6 +59,7 @@ public final class Metadata implements Parcelable { } private final Entry[] entries; + /** * The presentation time of the metadata, in microseconds. * diff --git a/libraries/common/src/main/java/androidx/media3/common/MimeTypes.java b/libraries/common/src/main/java/androidx/media3/common/MimeTypes.java index 0bc1172c40..ee09e81c05 100644 --- a/libraries/common/src/main/java/androidx/media3/common/MimeTypes.java +++ b/libraries/common/src/main/java/androidx/media3/common/MimeTypes.java @@ -131,6 +131,7 @@ public final class MimeTypes { public static final String APPLICATION_TX3G = BASE_TYPE_APPLICATION + "/x-quicktime-tx3g"; public static final String APPLICATION_MP4VTT = BASE_TYPE_APPLICATION + "/x-mp4-vtt"; public static final String APPLICATION_MP4CEA608 = BASE_TYPE_APPLICATION + "/x-mp4-cea-608"; + /** * @deprecated RawCC is a Google-internal subtitle format that isn't supported by this version of * Media3. There is no replacement for this value. @@ -738,6 +739,7 @@ public final class MimeTypes { /* package */ static final class Mp4aObjectType { /** The Object Type Indication of the MP4A codec. */ public final int objectTypeIndication; + /** The Audio Object Type Indication of the MP4A codec, or 0 if it is absent. */ public final int audioObjectTypeIndication; diff --git a/libraries/common/src/main/java/androidx/media3/common/ParserException.java b/libraries/common/src/main/java/androidx/media3/common/ParserException.java index 0d623a20e6..5ae5e46900 100644 --- a/libraries/common/src/main/java/androidx/media3/common/ParserException.java +++ b/libraries/common/src/main/java/androidx/media3/common/ParserException.java @@ -95,6 +95,7 @@ public class ParserException extends IOException { * false when a parser encounters a legal condition which it does not support. */ public final boolean contentIsMalformed; + /** The {@link DataType data type} of the parsed bitstream. */ public final int dataType; diff --git a/libraries/common/src/main/java/androidx/media3/common/PlaybackException.java b/libraries/common/src/main/java/androidx/media3/common/PlaybackException.java index 57e4b5dc1c..26dba9755c 100644 --- a/libraries/common/src/main/java/androidx/media3/common/PlaybackException.java +++ b/libraries/common/src/main/java/androidx/media3/common/PlaybackException.java @@ -95,15 +95,19 @@ public class PlaybackException extends Exception implements Bundleable { /** Caused by an error whose cause could not be identified. */ public static final int ERROR_CODE_UNSPECIFIED = 1000; + /** * Caused by an unidentified error in a remote Player, which is a Player that runs on a different * host or process. */ public static final int ERROR_CODE_REMOTE_ERROR = 1001; + /** Caused by the loading position falling behind the sliding window of available live content. */ public static final int ERROR_CODE_BEHIND_LIVE_WINDOW = 1002; + /** Caused by a generic timeout. */ public static final int ERROR_CODE_TIMEOUT = 1003; + /** * Caused by a failed runtime check. * @@ -116,6 +120,7 @@ public class PlaybackException extends Exception implements Bundleable { /** Caused by an Input/Output error which could not be identified. */ public static final int ERROR_CODE_IO_UNSPECIFIED = 2000; + /** * Caused by a network connection failure. * @@ -130,8 +135,10 @@ public class PlaybackException extends Exception implements Bundleable { * */ public static final int ERROR_CODE_IO_NETWORK_CONNECTION_FAILED = 2001; + /** Caused by a network timeout, meaning the server is taking too long to fulfill a request. */ public static final int ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT = 2002; + /** * Caused by a server returning a resource with an invalid "Content-Type" HTTP header value. * @@ -139,15 +146,19 @@ public class PlaybackException extends Exception implements Bundleable { * returns a paywall HTML page, with content type "text/html". */ public static final int ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE = 2003; + /** Caused by an HTTP server returning an unexpected HTTP response status code. */ public static final int ERROR_CODE_IO_BAD_HTTP_STATUS = 2004; + /** Caused by a non-existent file. */ public static final int ERROR_CODE_IO_FILE_NOT_FOUND = 2005; + /** * Caused by lack of permission to perform an IO operation. For example, lack of permission to * access internet or external storage. */ public static final int ERROR_CODE_IO_NO_PERMISSION = 2006; + /** * Caused by the player trying to access cleartext HTTP traffic (meaning http:// rather than * https://) when the app's Network Security Configuration does not permit it. @@ -157,6 +168,7 @@ public class PlaybackException extends Exception implements Bundleable { * corresponding troubleshooting topic. */ public static final int ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED = 2007; + /** Caused by reading data out of the data bound. */ public static final int ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE = 2008; @@ -164,16 +176,19 @@ public class PlaybackException extends Exception implements Bundleable { /** Caused by a parsing error associated with a media container format bitstream. */ public static final int ERROR_CODE_PARSING_CONTAINER_MALFORMED = 3001; + /** * Caused by a parsing error associated with a media manifest. Examples of a media manifest are a * DASH or a SmoothStreaming manifest, or an HLS playlist. */ public static final int ERROR_CODE_PARSING_MANIFEST_MALFORMED = 3002; + /** * Caused by attempting to extract a file with an unsupported media container format, or an * unsupported media container feature. */ public static final int ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED = 3003; + /** * Caused by an unsupported feature in a media manifest. Examples of a media manifest are a DASH * or a SmoothStreaming manifest, or an HLS playlist. @@ -184,12 +199,16 @@ public class PlaybackException extends Exception implements Bundleable { /** Caused by a decoder initialization failure. */ public static final int ERROR_CODE_DECODER_INIT_FAILED = 4001; + /** Caused by a decoder query failure. */ public static final int ERROR_CODE_DECODER_QUERY_FAILED = 4002; + /** Caused by a failure while trying to decode media samples. */ public static final int ERROR_CODE_DECODING_FAILED = 4003; + /** Caused by trying to decode content whose format exceeds the capabilities of the device. */ public static final int ERROR_CODE_DECODING_FORMAT_EXCEEDS_CAPABILITIES = 4004; + /** Caused by trying to decode content whose format is not supported. */ public static final int ERROR_CODE_DECODING_FORMAT_UNSUPPORTED = 4005; @@ -197,6 +216,7 @@ public class PlaybackException extends Exception implements Bundleable { /** Caused by an AudioTrack initialization failure. */ public static final int ERROR_CODE_AUDIO_TRACK_INIT_FAILED = 5001; + /** Caused by an AudioTrack write operation failure. */ public static final int ERROR_CODE_AUDIO_TRACK_WRITE_FAILED = 5002; @@ -204,13 +224,16 @@ public class PlaybackException extends Exception implements Bundleable { /** Caused by an unspecified error related to DRM protection. */ public static final int ERROR_CODE_DRM_UNSPECIFIED = 6000; + /** * Caused by a chosen DRM protection scheme not being supported by the device. Examples of DRM * protection schemes are ClearKey and Widevine. */ public static final int ERROR_CODE_DRM_SCHEME_UNSUPPORTED = 6001; + /** Caused by a failure while provisioning the device. */ public static final int ERROR_CODE_DRM_PROVISIONING_FAILED = 6002; + /** * Caused by attempting to play incompatible DRM-protected content. * @@ -218,14 +241,19 @@ public class PlaybackException extends Exception implements Bundleable { * (like Widevine) for which there is no corresponding license acquisition data (like a pssh box). */ public static final int ERROR_CODE_DRM_CONTENT_ERROR = 6003; + /** Caused by a failure while trying to obtain a license. */ public static final int ERROR_CODE_DRM_LICENSE_ACQUISITION_FAILED = 6004; + /** Caused by an operation being disallowed by a license policy. */ public static final int ERROR_CODE_DRM_DISALLOWED_OPERATION = 6005; + /** Caused by an error in the DRM system. */ public static final int ERROR_CODE_DRM_SYSTEM_ERROR = 6006; + /** Caused by the device having revoked DRM privileges. */ public static final int ERROR_CODE_DRM_DEVICE_REVOKED = 6007; + /** Caused by an expired DRM license being loaded into an open DRM session. */ public static final int ERROR_CODE_DRM_LICENSE_EXPIRED = 6008; @@ -233,6 +261,7 @@ public class PlaybackException extends Exception implements Bundleable { /** Caused by a failure when initializing a {@link VideoFrameProcessor}. */ @UnstableApi public static final int ERROR_CODE_VIDEO_FRAME_PROCESSOR_INIT_FAILED = 7000; + /** Caused by a failure when processing a video frame. */ @UnstableApi public static final int ERROR_CODE_VIDEO_FRAME_PROCESSING_FAILED = 7001; diff --git a/libraries/common/src/main/java/androidx/media3/common/Player.java b/libraries/common/src/main/java/androidx/media3/common/Player.java index 71cfae550d..b4b7d5604e 100644 --- a/libraries/common/src/main/java/androidx/media3/common/Player.java +++ b/libraries/common/src/main/java/androidx/media3/common/Player.java @@ -247,22 +247,29 @@ public interface Player { * The UID of the window, or {@code null} if the timeline is {@link Timeline#isEmpty() empty}. */ @Nullable public final Object windowUid; + /** * @deprecated Use {@link #mediaItemIndex} instead. */ @UnstableApi @Deprecated public final int windowIndex; + /** The media item index. */ public final int mediaItemIndex; + /** The media item, or {@code null} if the timeline is {@link Timeline#isEmpty() empty}. */ @UnstableApi @Nullable public final MediaItem mediaItem; + /** * The UID of the period, or {@code null} if the timeline is {@link Timeline#isEmpty() empty}. */ @Nullable public final Object periodUid; + /** The period index. */ public final int periodIndex; + /** The playback position, in milliseconds. */ public final long positionMs; + /** * The content position, in milliseconds. * @@ -270,10 +277,12 @@ public interface Player { * #positionMs}. */ public final long contentPositionMs; + /** * The ad group index if the playback position is within an ad, {@link C#INDEX_UNSET} otherwise. */ public final int adGroupIndex; + /** * The index of the ad within the ad group if the playback position is within an ad, {@link * C#INDEX_UNSET} otherwise. @@ -1160,22 +1169,26 @@ public interface Player { @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @IntDef({STATE_IDLE, STATE_BUFFERING, STATE_READY, STATE_ENDED}) @interface State {} + /** * The player is idle, meaning it holds only limited resources. The player must be {@link * #prepare() prepared} before it will play the media. */ int STATE_IDLE = 1; + /** * The player is not able to immediately play the media, but is doing work toward being able to do * so. This state typically occurs when the player needs to buffer more data before playback can * start. */ int STATE_BUFFERING = 2; + /** * The player is able to immediately play from its current position. The player will be playing if * {@link #getPlayWhenReady()} is true, and paused otherwise. */ int STATE_READY = 3; + /** The player has finished playing the media. */ int STATE_ENDED = 4; @@ -1202,16 +1215,22 @@ public interface Player { PLAY_WHEN_READY_CHANGE_REASON_SUPPRESSED_TOO_LONG }) @interface PlayWhenReadyChangeReason {} + /** Playback has been started or paused by a call to {@link #setPlayWhenReady(boolean)}. */ int PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST = 1; + /** Playback has been paused because of a loss of audio focus. */ int PLAY_WHEN_READY_CHANGE_REASON_AUDIO_FOCUS_LOSS = 2; + /** Playback has been paused to avoid becoming noisy. */ int PLAY_WHEN_READY_CHANGE_REASON_AUDIO_BECOMING_NOISY = 3; + /** Playback has been started or paused because of a remote change. */ int PLAY_WHEN_READY_CHANGE_REASON_REMOTE = 4; + /** Playback has been paused at the end of a media item. */ int PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM = 5; + /** * Playback has been paused because playback has been {@linkplain #getPlaybackSuppressionReason() * suppressed} too long. @@ -1237,14 +1256,18 @@ public interface Player { PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_OUTPUT }) @interface PlaybackSuppressionReason {} + /** Playback is not suppressed. */ int PLAYBACK_SUPPRESSION_REASON_NONE = 0; + /** Playback is suppressed due to transient audio focus loss. */ int PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS = 1; + /** * @deprecated Use {@link #PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_OUTPUT} instead. */ @Deprecated int PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_ROUTE = 2; + /** * Playback is suppressed due to attempt to play on an unsuitable audio output (e.g. attempt to * play on built-in speaker on a Wear OS device). @@ -1262,12 +1285,14 @@ public interface Player { @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @IntDef({REPEAT_MODE_OFF, REPEAT_MODE_ONE, REPEAT_MODE_ALL}) @interface RepeatMode {} + /** * Normal playback without repetition. "Previous" and "Next" actions move to the previous and next * {@link MediaItem} respectively, and do nothing when there is no previous or next {@link * MediaItem} to move to. */ int REPEAT_MODE_OFF = 0; + /** * Repeats the currently playing {@link MediaItem} infinitely during ongoing playback. "Previous" * and "Next" actions behave as they do in {@link #REPEAT_MODE_OFF}, moving to the previous and @@ -1275,6 +1300,7 @@ public interface Player { * MediaItem} to move to. */ int REPEAT_MODE_ONE = 1; + /** * Repeats the entire timeline infinitely. "Previous" and "Next" actions behave as they do in * {@link #REPEAT_MODE_OFF}, but with looping at the ends so that "Previous" when playing the @@ -1303,6 +1329,7 @@ public interface Player { DISCONTINUITY_REASON_INTERNAL }) @interface DiscontinuityReason {} + /** * Automatic playback transition from one period in the timeline to the next. The period index may * be the same as it was before the discontinuity in case the current period is repeated. @@ -1312,17 +1339,22 @@ public interface Player { * control the same playback on a remote device). */ int DISCONTINUITY_REASON_AUTO_TRANSITION = 0; + /** Seek within the current period or to another period. */ int DISCONTINUITY_REASON_SEEK = 1; + /** * Seek adjustment due to being unable to seek to the requested position or because the seek was * permitted to be inexact. */ int DISCONTINUITY_REASON_SEEK_ADJUSTMENT = 2; + /** Discontinuity introduced by a skipped period (for instance a skipped ad). */ int DISCONTINUITY_REASON_SKIP = 3; + /** Discontinuity caused by the removal of the current period from the {@link Timeline}. */ int DISCONTINUITY_REASON_REMOVE = 4; + /** Discontinuity introduced internally (e.g. by the source). */ int DISCONTINUITY_REASON_INTERNAL = 5; @@ -1337,8 +1369,10 @@ public interface Player { @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @IntDef({TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, TIMELINE_CHANGE_REASON_SOURCE_UPDATE}) @interface TimelineChangeReason {} + /** Timeline changed as a result of a change of the playlist items or the order of the items. */ int TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED = 0; + /** * Timeline changed as a result of a source update (e.g. result of a dynamic update by the played * media). @@ -1365,8 +1399,10 @@ public interface Player { MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED }) @interface MediaItemTransitionReason {} + /** The media item has been repeated. */ int MEDIA_ITEM_TRANSITION_REASON_REPEAT = 0; + /** * Playback has automatically transitioned to the next media item. * @@ -1374,8 +1410,10 @@ public interface Player { * can control the same playback on a remote device). */ int MEDIA_ITEM_TRANSITION_REASON_AUTO = 1; + /** A seek to another media item has occurred. */ int MEDIA_ITEM_TRANSITION_REASON_SEEK = 2; + /** * The current media item has changed because of a change in the playlist. This can either be if * the media item previously being played has been removed, or when the playlist becomes non-empty @@ -1427,72 +1465,103 @@ public interface Player { EVENT_DEVICE_VOLUME_CHANGED }) @interface Event {} + /** {@link #getCurrentTimeline()} changed. */ int EVENT_TIMELINE_CHANGED = 0; + /** {@link #getCurrentMediaItem()} changed or the player started repeating the current item. */ int EVENT_MEDIA_ITEM_TRANSITION = 1; + /** {@link #getCurrentTracks()} changed. */ int EVENT_TRACKS_CHANGED = 2; + /** {@link #isLoading()} ()} changed. */ int EVENT_IS_LOADING_CHANGED = 3; + /** {@link #getPlaybackState()} changed. */ int EVENT_PLAYBACK_STATE_CHANGED = 4; + /** {@link #getPlayWhenReady()} changed. */ int EVENT_PLAY_WHEN_READY_CHANGED = 5; + /** {@link #getPlaybackSuppressionReason()} changed. */ int EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED = 6; + /** {@link #isPlaying()} changed. */ int EVENT_IS_PLAYING_CHANGED = 7; + /** {@link #getRepeatMode()} changed. */ int EVENT_REPEAT_MODE_CHANGED = 8; + /** {@link #getShuffleModeEnabled()} changed. */ int EVENT_SHUFFLE_MODE_ENABLED_CHANGED = 9; + /** {@link #getPlayerError()} changed. */ int EVENT_PLAYER_ERROR = 10; + /** * A position discontinuity occurred. See {@link Listener#onPositionDiscontinuity(PositionInfo, * PositionInfo, int)}. */ int EVENT_POSITION_DISCONTINUITY = 11; + /** {@link #getPlaybackParameters()} changed. */ int EVENT_PLAYBACK_PARAMETERS_CHANGED = 12; + /** {@link #isCommandAvailable(int)} changed for at least one {@link Command}. */ int EVENT_AVAILABLE_COMMANDS_CHANGED = 13; + /** {@link #getMediaMetadata()} changed. */ int EVENT_MEDIA_METADATA_CHANGED = 14; + /** {@link #getPlaylistMetadata()} changed. */ int EVENT_PLAYLIST_METADATA_CHANGED = 15; + /** {@link #getSeekBackIncrement()} changed. */ int EVENT_SEEK_BACK_INCREMENT_CHANGED = 16; + /** {@link #getSeekForwardIncrement()} changed. */ int EVENT_SEEK_FORWARD_INCREMENT_CHANGED = 17; + /** {@link #getMaxSeekToPreviousPosition()} changed. */ int EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED = 18; + /** {@link #getTrackSelectionParameters()} changed. */ int EVENT_TRACK_SELECTION_PARAMETERS_CHANGED = 19; + /** {@link #getAudioAttributes()} changed. */ int EVENT_AUDIO_ATTRIBUTES_CHANGED = 20; + /** The audio session id was set. */ int EVENT_AUDIO_SESSION_ID = 21; + /** {@link #getVolume()} changed. */ int EVENT_VOLUME_CHANGED = 22; + /** Skipping silences in the audio stream is enabled or disabled. */ int EVENT_SKIP_SILENCE_ENABLED_CHANGED = 23; + /** The size of the surface onto which the video is being rendered changed. */ int EVENT_SURFACE_SIZE_CHANGED = 24; + /** {@link #getVideoSize()} changed. */ int EVENT_VIDEO_SIZE_CHANGED = 25; + /** * A frame is rendered for the first time since setting the surface, or since the renderer was * reset, or since the stream being rendered was changed. */ int EVENT_RENDERED_FIRST_FRAME = 26; + /** {@link #getCurrentCues()} changed. */ int EVENT_CUES = 27; + /** Metadata associated with the current playback time changed. */ int EVENT_METADATA = 28; + /** {@link #getDeviceInfo()} changed. */ int EVENT_DEVICE_INFO_CHANGED = 29; + /** {@link #getDeviceVolume()} changed. */ int EVENT_DEVICE_VOLUME_CHANGED = 30; @@ -1591,6 +1660,7 @@ public interface Player { COMMAND_RELEASE, }) @interface Command {} + /** * Command to start, pause or resume playback. * @@ -1636,6 +1706,7 @@ public interface Player { * #isCommandAvailable(int) available}. */ int COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM = 5; + /** * @deprecated Use {@link #COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM} instead. */ @@ -1648,11 +1719,13 @@ public interface Player { * {@linkplain #isCommandAvailable(int) available}. */ int COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM = 6; + /** * @deprecated Use {@link #COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM} instead. */ @UnstableApi @Deprecated int COMMAND_SEEK_TO_PREVIOUS_WINDOW = COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM; + /** * Command to seek to an earlier position in the current {@link MediaItem} or the default position * of the previous {@link MediaItem}. @@ -1661,6 +1734,7 @@ public interface Player { * #isCommandAvailable(int) available}. */ int COMMAND_SEEK_TO_PREVIOUS = 7; + /** * Command to seek to the default position of the next {@link MediaItem}. * @@ -1668,10 +1742,12 @@ public interface Player { * #isCommandAvailable(int) available}. */ int COMMAND_SEEK_TO_NEXT_MEDIA_ITEM = 8; + /** * @deprecated Use {@link #COMMAND_SEEK_TO_NEXT_MEDIA_ITEM} instead. */ @UnstableApi @Deprecated int COMMAND_SEEK_TO_NEXT_WINDOW = COMMAND_SEEK_TO_NEXT_MEDIA_ITEM; + /** * Command to seek to a later position in the current {@link MediaItem} or the default position of * the next {@link MediaItem}. @@ -1693,10 +1769,12 @@ public interface Player { * */ int COMMAND_SEEK_TO_MEDIA_ITEM = 10; + /** * @deprecated Use {@link #COMMAND_SEEK_TO_MEDIA_ITEM} instead. */ @UnstableApi @Deprecated int COMMAND_SEEK_TO_WINDOW = COMMAND_SEEK_TO_MEDIA_ITEM; + /** * Command to seek back by a fixed increment inside the current {@link MediaItem}. * @@ -1704,6 +1782,7 @@ public interface Player { * #isCommandAvailable(int) available}. */ int COMMAND_SEEK_BACK = 11; + /** * Command to seek forward by a fixed increment inside the current {@link MediaItem}. * @@ -1831,6 +1910,7 @@ public interface Player { * */ int COMMAND_SET_MEDIA_ITEM = 31; + /** * Command to change the {@linkplain MediaItem media items} in the playlist. * @@ -1897,6 +1977,7 @@ public interface Player { * @deprecated Use {@link #COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS} instead. */ @Deprecated int COMMAND_SET_DEVICE_VOLUME = 25; + /** * Command to set the device volume with volume flags. * @@ -1909,6 +1990,7 @@ public interface Player { * @deprecated Use {@link #COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS} instead. */ @Deprecated int COMMAND_ADJUST_DEVICE_VOLUME = 26; + /** * Command to increase and decrease the device volume and mute it with volume flags. * @@ -1964,6 +2046,7 @@ public interface Player { * #isCommandAvailable(int) available}. */ int COMMAND_GET_TRACKS = 30; + /** * Command to release the player. * diff --git a/libraries/common/src/main/java/androidx/media3/common/SimpleBasePlayer.java b/libraries/common/src/main/java/androidx/media3/common/SimpleBasePlayer.java index 92c79c68a8..52198d5829 100644 --- a/libraries/common/src/main/java/androidx/media3/common/SimpleBasePlayer.java +++ b/libraries/common/src/main/java/androidx/media3/common/SimpleBasePlayer.java @@ -772,105 +772,142 @@ public abstract class SimpleBasePlayer extends BasePlayer { /** The available {@link Commands}. */ public final Commands availableCommands; + /** Whether playback should proceed when ready and not suppressed. */ public final boolean playWhenReady; + /** The last reason for changing {@link #playWhenReady}. */ public final @PlayWhenReadyChangeReason int playWhenReadyChangeReason; + /** The {@linkplain Player.State state} of the player. */ public final @Player.State int playbackState; + /** The reason why playback is suppressed even if {@link #getPlayWhenReady()} is true. */ public final @PlaybackSuppressionReason int playbackSuppressionReason; + /** The last error that caused playback to fail, or null if there was no error. */ @Nullable public final PlaybackException playerError; + /** The {@link RepeatMode} used for playback. */ public final @RepeatMode int repeatMode; + /** Whether shuffling of media items is enabled. */ public final boolean shuffleModeEnabled; + /** Whether the player is currently loading its source. */ public final boolean isLoading; + /** The {@link Player#seekBack()} increment in milliseconds. */ public final long seekBackIncrementMs; + /** The {@link Player#seekForward()} increment in milliseconds. */ public final long seekForwardIncrementMs; + /** * The maximum position for which {@link #seekToPrevious()} seeks to the previous item, in * milliseconds. */ public final long maxSeekToPreviousPositionMs; + /** The currently active {@link PlaybackParameters}. */ public final PlaybackParameters playbackParameters; + /** The currently active {@link TrackSelectionParameters}. */ public final TrackSelectionParameters trackSelectionParameters; + /** The current {@link AudioAttributes}. */ public final AudioAttributes audioAttributes; + /** The current audio volume, with 0 being silence and 1 being unity gain (signal unchanged). */ @FloatRange(from = 0, to = 1.0) public final float volume; + /** The current video size. */ public final VideoSize videoSize; + /** The current {@linkplain CueGroup cues}. */ public final CueGroup currentCues; + /** The {@link DeviceInfo}. */ public final DeviceInfo deviceInfo; + /** The current device volume. */ @IntRange(from = 0) public final int deviceVolume; + /** Whether the device is muted. */ public final boolean isDeviceMuted; + /** The size of the surface onto which the video is being rendered. */ public final Size surfaceSize; + /** * Whether a frame has been rendered for the first time since setting the surface, a rendering * reset, or since the stream being rendered was changed. */ public final boolean newlyRenderedFirstFrame; + /** The most recent timed metadata. */ public final Metadata timedMetadata; + /** The media items in the playlist. */ public final ImmutableList playlist; + /** The {@link Timeline} derived from the {@link #playlist}. */ public final Timeline timeline; + /** The playlist {@link MediaMetadata}. */ public final MediaMetadata playlistMetadata; + /** * The current media item index, or {@link C#INDEX_UNSET} to assume the default first item of * the playlist is played. */ public final int currentMediaItemIndex; + /** The current ad group index, or {@link C#INDEX_UNSET} if no ad is playing. */ public final int currentAdGroupIndex; + /** The current ad index in the ad group, or {@link C#INDEX_UNSET} if no ad is playing. */ public final int currentAdIndexInAdGroup; + /** * The {@link PositionSupplier} for the current content playback position in milliseconds, or * {@link C#TIME_UNSET} to indicate the default start position. */ public final PositionSupplier contentPositionMsSupplier; + /** * The {@link PositionSupplier} for the current ad playback position in milliseconds. The value * is unused if no ad is playing. */ public final PositionSupplier adPositionMsSupplier; + /** * The {@link PositionSupplier} for the estimated position up to which the currently playing * content is buffered, in milliseconds, or {@link C#TIME_UNSET} to indicate the default start * position. */ public final PositionSupplier contentBufferedPositionMsSupplier; + /** * The {@link PositionSupplier} for the estimated position up to which the currently playing ad * is buffered, in milliseconds. The value is unused if no ad is playing. */ public final PositionSupplier adBufferedPositionMsSupplier; + /** The {@link PositionSupplier} for the estimated total buffered duration in milliseconds. */ public final PositionSupplier totalBufferedDurationMsSupplier; + /** Signals that a position discontinuity happened since the last update to the player. */ public final boolean hasPositionDiscontinuity; + /** * The {@linkplain Player.DiscontinuityReason reason} for the last position discontinuity. The * value is unused if {@link #hasPositionDiscontinuity} is {@code false}. */ public final @Player.DiscontinuityReason int positionDiscontinuityReason; + /** * The position, in milliseconds, in the current content or ad from which playback continued * after the discontinuity. The value is unused if {@link #hasPositionDiscontinuity} is {@code @@ -1524,10 +1561,13 @@ public abstract class SimpleBasePlayer extends BasePlayer { /** The unique identifier of this media item. */ public final Object uid; + /** The {@link Tracks} of this media item. */ public final Tracks tracks; + /** The {@link MediaItem}. */ public final MediaItem mediaItem; + /** * The {@link MediaMetadata}, including static data from the {@link MediaItem#mediaMetadata * MediaItem} and the media's {@link Format#metadata Format}, as well any dynamic metadata that @@ -1536,47 +1576,59 @@ public abstract class SimpleBasePlayer extends BasePlayer { * {@link Format#metadata Formats}. */ @Nullable public final MediaMetadata mediaMetadata; + /** The manifest of the media item, or null if not applicable. */ @Nullable public final Object manifest; + /** The active {@link MediaItem.LiveConfiguration}, or null if the media item is not live. */ @Nullable public final MediaItem.LiveConfiguration liveConfiguration; + /** * The start time of the live presentation, in milliseconds since the Unix epoch, or {@link * C#TIME_UNSET} if unknown or not applicable. */ public final long presentationStartTimeMs; + /** * The start time of the live window, in milliseconds since the Unix epoch, or {@link * C#TIME_UNSET} if unknown or not applicable. */ public final long windowStartTimeMs; + /** * The offset between {@link SystemClock#elapsedRealtime()} and the time since the Unix epoch * according to the clock of the media origin server, or {@link C#TIME_UNSET} if unknown or not * applicable. */ public final long elapsedRealtimeEpochOffsetMs; + /** Whether it's possible to seek within this media item. */ public final boolean isSeekable; + /** Whether this media item may change over time, for example a moving live window. */ public final boolean isDynamic; + /** * The default position relative to the start of the media item at which to begin playback, in * microseconds. */ public final long defaultPositionUs; + /** The duration of the media item, in microseconds, or {@link C#TIME_UNSET} if unknown. */ public final long durationUs; + /** * The position of the start of this media item relative to the start of the first period * belonging to it, in microseconds. */ public final long positionInFirstPeriodUs; + /** * Whether this media item contains placeholder information because the real information has yet * to be loaded. */ public final boolean isPlaceholder; + /** * The list of {@linkplain PeriodData periods} in this media item, or an empty list to assume a * single period without ads and the same duration as the media item. @@ -1861,16 +1913,19 @@ public abstract class SimpleBasePlayer extends BasePlayer { /** The unique identifier of the period within its media item. */ public final Object uid; + /** * The total duration of the period, in microseconds, or {@link C#TIME_UNSET} if unknown. Only * the last period in a media item can have an unknown duration. */ public final long durationUs; + /** * The {@link AdPlaybackState} of the period, or {@link AdPlaybackState#NONE} if there are no * ads. */ public final AdPlaybackState adPlaybackState; + /** * Whether this period contains placeholder information because the real information has yet to * be loaded. diff --git a/libraries/common/src/main/java/androidx/media3/common/StreamKey.java b/libraries/common/src/main/java/androidx/media3/common/StreamKey.java index 263909c9d7..599837ea57 100644 --- a/libraries/common/src/main/java/androidx/media3/common/StreamKey.java +++ b/libraries/common/src/main/java/androidx/media3/common/StreamKey.java @@ -41,8 +41,10 @@ public final class StreamKey implements Comparable, Parcelable, Bundl /** The period index. */ public final int periodIndex; + /** The group index. */ public final int groupIndex; + /** The stream index. */ public final int streamIndex; diff --git a/libraries/common/src/main/java/androidx/media3/common/SurfaceInfo.java b/libraries/common/src/main/java/androidx/media3/common/SurfaceInfo.java index 42477cc132..02d6462c5b 100644 --- a/libraries/common/src/main/java/androidx/media3/common/SurfaceInfo.java +++ b/libraries/common/src/main/java/androidx/media3/common/SurfaceInfo.java @@ -27,10 +27,13 @@ public final class SurfaceInfo { /** The {@link Surface}. */ public final Surface surface; + /** The width of frames rendered to the {@link #surface}, in pixels. */ public final int width; + /** The height of frames rendered to the {@link #surface}, in pixels. */ public final int height; + /** * A counter-clockwise rotation to apply to frames before rendering them to the {@link #surface}. * diff --git a/libraries/common/src/main/java/androidx/media3/common/Timeline.java b/libraries/common/src/main/java/androidx/media3/common/Timeline.java index 42844973cd..d92f586ccc 100644 --- a/libraries/common/src/main/java/androidx/media3/common/Timeline.java +++ b/libraries/common/src/main/java/androidx/media3/common/Timeline.java @@ -1188,6 +1188,7 @@ public abstract class Timeline implements Bundleable { Window window, Period period, int windowIndex, long windowPositionUs) { return getPeriodPositionUs(window, period, windowIndex, windowPositionUs); } + /** * @deprecated Use {@link #getPeriodPositionUs(Window, Period, int, long, long)} instead. */ diff --git a/libraries/common/src/main/java/androidx/media3/common/TrackGroup.java b/libraries/common/src/main/java/androidx/media3/common/TrackGroup.java index f13d3dca4a..6a19c28ea6 100644 --- a/libraries/common/src/main/java/androidx/media3/common/TrackGroup.java +++ b/libraries/common/src/main/java/androidx/media3/common/TrackGroup.java @@ -54,8 +54,10 @@ public final class TrackGroup implements Bundleable { /** The number of tracks in the group. */ @UnstableApi public final int length; + /** An identifier for the track group. */ @UnstableApi public final String id; + /** The type of tracks in the group. */ @UnstableApi public final @C.TrackType int type; diff --git a/libraries/common/src/main/java/androidx/media3/common/TrackSelectionOverride.java b/libraries/common/src/main/java/androidx/media3/common/TrackSelectionOverride.java index c40e88b654..f7b08bacb0 100644 --- a/libraries/common/src/main/java/androidx/media3/common/TrackSelectionOverride.java +++ b/libraries/common/src/main/java/androidx/media3/common/TrackSelectionOverride.java @@ -48,6 +48,7 @@ public final class TrackSelectionOverride implements Bundleable { /** The media {@link TrackGroup} whose {@link #trackIndices} are forced to be selected. */ public final TrackGroup mediaTrackGroup; + /** The indices of tracks in a {@link TrackGroup} to be selected. */ public final ImmutableList trackIndices; diff --git a/libraries/common/src/main/java/androidx/media3/common/TrackSelectionParameters.java b/libraries/common/src/main/java/androidx/media3/common/TrackSelectionParameters.java index 432335d0b6..3004654077 100644 --- a/libraries/common/src/main/java/androidx/media3/common/TrackSelectionParameters.java +++ b/libraries/common/src/main/java/androidx/media3/common/TrackSelectionParameters.java @@ -93,11 +93,13 @@ public class TrackSelectionParameters implements Bundleable { * selection, then no tracks will be selected. */ @UnstableApi public static final int AUDIO_OFFLOAD_MODE_PREFERENCE_REQUIRED = 2; + /** * The track selector will enable audio offload if the selected tracks and renderer capabilities * are compatible. */ @UnstableApi public static final int AUDIO_OFFLOAD_MODE_PREFERENCE_ENABLED = 1; + /** * The track selector will disable audio offload on the audio sink. Track selection will not take * into consideration whether or not a track is offload compatible. @@ -887,6 +889,7 @@ public class TrackSelectionParameters implements Bundleable { @UnstableApi @SuppressWarnings("deprecation") public static final TrackSelectionParameters DEFAULT_WITHOUT_CONTEXT = new Builder().build(); + /** * @deprecated This instance is not configured using {@link Context} constraints. Use {@link * #getDefaults(Context)} instead. @@ -909,6 +912,7 @@ public class TrackSelectionParameters implements Bundleable { * #viewportHeight} and {@link #viewportOrientationMayChange}) instead. */ public final int maxVideoWidth; + /** * Maximum allowed video height in pixels. The default value is {@link Integer#MAX_VALUE} (i.e. no * constraint). @@ -918,54 +922,66 @@ public class TrackSelectionParameters implements Bundleable { * #viewportHeight} and {@link #viewportOrientationMayChange}) instead. */ public final int maxVideoHeight; + /** * Maximum allowed video frame rate in hertz. The default value is {@link Integer#MAX_VALUE} (i.e. * no constraint). */ public final int maxVideoFrameRate; + /** * Maximum allowed video bitrate in bits per second. The default value is {@link * Integer#MAX_VALUE} (i.e. no constraint). */ public final int maxVideoBitrate; + /** Minimum allowed video width in pixels. The default value is 0 (i.e. no constraint). */ public final int minVideoWidth; + /** Minimum allowed video height in pixels. The default value is 0 (i.e. no constraint). */ public final int minVideoHeight; + /** Minimum allowed video frame rate in hertz. The default value is 0 (i.e. no constraint). */ public final int minVideoFrameRate; + /** * Minimum allowed video bitrate in bits per second. The default value is 0 (i.e. no constraint). */ public final int minVideoBitrate; + /** * Viewport width in pixels. Constrains video track selections for adaptive content so that only * tracks suitable for the viewport are selected. The default value is the physical width of the * primary display, in pixels. */ public final int viewportWidth; + /** * Viewport height in pixels. Constrains video track selections for adaptive content so that only * tracks suitable for the viewport are selected. The default value is the physical height of the * primary display, in pixels. */ public final int viewportHeight; + /** * Whether the viewport orientation may change during playback. Constrains video track selections * for adaptive content so that only tracks suitable for the viewport are selected. The default * value is {@code true}. */ public final boolean viewportOrientationMayChange; + /** * The preferred sample MIME types for video tracks in order of preference, or an empty list for * no preference. The default is an empty list. */ public final ImmutableList preferredVideoMimeTypes; + /** * The preferred {@link C.RoleFlags} for video tracks. {@code 0} selects the default track if * there is one, or the first track if there's no default. The default value is {@code 0}. */ public final @C.RoleFlags int preferredVideoRoleFlags; + // Audio /** * The preferred languages for audio and forced text tracks as IETF BCP 47 conformant tags in @@ -973,21 +989,25 @@ public class TrackSelectionParameters implements Bundleable { * default. The default value is an empty list. */ public final ImmutableList preferredAudioLanguages; + /** * The preferred {@link C.RoleFlags} for audio tracks. {@code 0} selects the default track if * there is one, or the first track if there's no default. The default value is {@code 0}. */ public final @C.RoleFlags int preferredAudioRoleFlags; + /** * Maximum allowed audio channel count. The default value is {@link Integer#MAX_VALUE} (i.e. no * constraint). */ public final int maxAudioChannelCount; + /** * Maximum allowed audio bitrate in bits per second. The default value is {@link * Integer#MAX_VALUE} (i.e. no constraint). */ public final int maxAudioBitrate; + /** * The preferred sample MIME types for audio tracks in order of preference, or an empty list for * no preference. The default is an empty list. @@ -999,12 +1019,14 @@ public class TrackSelectionParameters implements Bundleable { * #AUDIO_OFFLOAD_MODE_PREFERENCE_DISABLED}. */ public final @AudioOffloadModePreference int audioOffloadModePreference; + /** * A constraint on enabling offload. If {@code isGaplessSupportRequired}, then audio offload will * be enabled only if the device supports gapless transitions during offload or the selected audio * is not gapless. */ public final boolean isGaplessSupportRequired; + /** * A constraint on enabling offload. If {@code isSpeedChangeSupportRequired}, then audio offload * will be enabled only if the device supports changing playback speed during offload. @@ -1019,6 +1041,7 @@ public class TrackSelectionParameters implements Bundleable { * enabled. */ public final ImmutableList preferredTextLanguages; + /** * The preferred {@link C.RoleFlags} for text tracks. {@code 0} selects the default track if there * is one, or no track otherwise. The default value is {@code 0}, or {@link C#ROLE_FLAG_SUBTITLE} @@ -1026,23 +1049,27 @@ public class TrackSelectionParameters implements Bundleable { * is enabled. */ public final @C.RoleFlags int preferredTextRoleFlags; + /** * Bitmask of selection flags that are ignored for text track selections. See {@link * C.SelectionFlags}. The default value is {@code 0} (i.e., no flags are ignored). */ public final @C.SelectionFlags int ignoredTextSelectionFlags; + /** * Whether a text track with undetermined language should be selected if no track with {@link * #preferredTextLanguages} is available, or if {@link #preferredTextLanguages} is unset. The * default value is {@code false}. */ public final boolean selectUndeterminedTextLanguage; + // General /** * Whether to force selection of the single lowest bitrate audio and video tracks that comply with * all other constraints. The default value is {@code false}. */ public final boolean forceLowestBitrate; + /** * Whether to force selection of the highest bitrate audio and video tracks that comply with all * other constraints. The default value is {@code false}. diff --git a/libraries/common/src/main/java/androidx/media3/common/Tracks.java b/libraries/common/src/main/java/androidx/media3/common/Tracks.java index a932ac6924..86a73170df 100644 --- a/libraries/common/src/main/java/androidx/media3/common/Tracks.java +++ b/libraries/common/src/main/java/androidx/media3/common/Tracks.java @@ -374,6 +374,7 @@ public final class Tracks implements Bundleable { public int hashCode() { return groups.hashCode(); } + // Bundleable implementation. private static final String FIELD_TRACK_GROUPS = Util.intToStringMaxRadix(0); diff --git a/libraries/common/src/main/java/androidx/media3/common/VideoFrameProcessor.java b/libraries/common/src/main/java/androidx/media3/common/VideoFrameProcessor.java index 97145db344..4735371171 100644 --- a/libraries/common/src/main/java/androidx/media3/common/VideoFrameProcessor.java +++ b/libraries/common/src/main/java/androidx/media3/common/VideoFrameProcessor.java @@ -56,10 +56,13 @@ public interface VideoFrameProcessor { @Target(TYPE_USE) @IntDef({INPUT_TYPE_SURFACE, INPUT_TYPE_BITMAP, INPUT_TYPE_TEXTURE_ID}) @interface InputType {} + /** Input frames come from a {@link #getInputSurface surface}. */ int INPUT_TYPE_SURFACE = 1; + /** Input frames come from a {@link Bitmap}. */ int INPUT_TYPE_BITMAP = 2; + /** * Input frames come from a {@linkplain android.opengl.GLES10#GL_TEXTURE_2D traditional GLES * texture}. diff --git a/libraries/common/src/main/java/androidx/media3/common/audio/AudioProcessingPipeline.java b/libraries/common/src/main/java/androidx/media3/common/audio/AudioProcessingPipeline.java index 735b263dbc..346b21be97 100644 --- a/libraries/common/src/main/java/androidx/media3/common/audio/AudioProcessingPipeline.java +++ b/libraries/common/src/main/java/androidx/media3/common/audio/AudioProcessingPipeline.java @@ -71,6 +71,7 @@ public final class AudioProcessingPipeline { /** The {@link AudioProcessor} instances passed to {@link AudioProcessingPipeline}. */ private final ImmutableList audioProcessors; + /** * The processors that are {@linkplain AudioProcessor#isActive() active} based on the current * configuration. @@ -82,10 +83,13 @@ public final class AudioProcessingPipeline { * as {@link #activeAudioProcessors}. */ private ByteBuffer[] outputBuffers; + /** The {@link AudioFormat} currently being output by the pipeline. */ private AudioFormat outputAudioFormat; + /** The {@link AudioFormat} that will be output following a {@link #flush()}. */ private AudioFormat pendingOutputAudioFormat; + /** Whether input has ended, either due to configuration change or end of stream. */ private boolean inputEnded; diff --git a/libraries/common/src/main/java/androidx/media3/common/audio/AudioProcessor.java b/libraries/common/src/main/java/androidx/media3/common/audio/AudioProcessor.java index 46178edb28..681c6491c5 100644 --- a/libraries/common/src/main/java/androidx/media3/common/audio/AudioProcessor.java +++ b/libraries/common/src/main/java/androidx/media3/common/audio/AudioProcessor.java @@ -52,10 +52,13 @@ public interface AudioProcessor { /** The sample rate in Hertz. */ public final int sampleRate; + /** The number of interleaved channels. */ public final int channelCount; + /** The type of linear PCM encoding. */ public final @C.PcmEncoding int encoding; + /** The number of bytes used to represent one audio frame. */ public final int bytesPerFrame; diff --git a/libraries/common/src/main/java/androidx/media3/common/audio/BaseAudioProcessor.java b/libraries/common/src/main/java/androidx/media3/common/audio/BaseAudioProcessor.java index 0939e6fce2..2251c1e79e 100644 --- a/libraries/common/src/main/java/androidx/media3/common/audio/BaseAudioProcessor.java +++ b/libraries/common/src/main/java/androidx/media3/common/audio/BaseAudioProcessor.java @@ -31,6 +31,7 @@ public abstract class BaseAudioProcessor implements AudioProcessor { /** The current input audio format. */ protected AudioFormat inputAudioFormat; + /** The current output audio format. */ protected AudioFormat outputAudioFormat; diff --git a/libraries/common/src/main/java/androidx/media3/common/audio/SpeedChangingAudioProcessor.java b/libraries/common/src/main/java/androidx/media3/common/audio/SpeedChangingAudioProcessor.java index 13e8d1011a..ae418e294d 100644 --- a/libraries/common/src/main/java/androidx/media3/common/audio/SpeedChangingAudioProcessor.java +++ b/libraries/common/src/main/java/androidx/media3/common/audio/SpeedChangingAudioProcessor.java @@ -34,6 +34,7 @@ public final class SpeedChangingAudioProcessor extends BaseAudioProcessor { /** The speed provider that provides the speed for each timestamp. */ private final SpeedProvider speedProvider; + /** * The {@link SonicAudioProcessor} used to change the speed, when needed. If there is no speed * change required, the input buffer is copied to the output buffer and this processor is not diff --git a/libraries/common/src/main/java/androidx/media3/common/text/CueGroup.java b/libraries/common/src/main/java/androidx/media3/common/text/CueGroup.java index a77a75c66c..c8aa409d73 100644 --- a/libraries/common/src/main/java/androidx/media3/common/text/CueGroup.java +++ b/libraries/common/src/main/java/androidx/media3/common/text/CueGroup.java @@ -44,6 +44,7 @@ public final class CueGroup implements Bundleable { *

This list may be empty if the group represents a state with no cues. */ public final ImmutableList cues; + /** * The presentation time of the {@link #cues}, in microseconds. * diff --git a/libraries/common/src/main/java/androidx/media3/common/util/EGLSurfaceTexture.java b/libraries/common/src/main/java/androidx/media3/common/util/EGLSurfaceTexture.java index d764882e2e..9a885b2af2 100644 --- a/libraries/common/src/main/java/androidx/media3/common/util/EGLSurfaceTexture.java +++ b/libraries/common/src/main/java/androidx/media3/common/util/EGLSurfaceTexture.java @@ -56,8 +56,10 @@ public final class EGLSurfaceTexture implements SurfaceTexture.OnFrameAvailableL /** No secure EGL surface and context required. */ public static final int SECURE_MODE_NONE = 0; + /** Creating a surfaceless, secured EGL context. */ public static final int SECURE_MODE_SURFACELESS_CONTEXT = 1; + /** Creating a secure surface backed by a pixel buffer. */ public static final int SECURE_MODE_PROTECTED_PBUFFER = 2; diff --git a/libraries/common/src/main/java/androidx/media3/common/util/GlProgram.java b/libraries/common/src/main/java/androidx/media3/common/util/GlProgram.java index c2f8a6d798..e343a07e20 100644 --- a/libraries/common/src/main/java/androidx/media3/common/util/GlProgram.java +++ b/libraries/common/src/main/java/androidx/media3/common/util/GlProgram.java @@ -38,6 +38,7 @@ public final class GlProgram { // https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_YUV_target.txt private static final int GL_SAMPLER_EXTERNAL_2D_Y2Y_EXT = 0x8BE7; + /** The identifier of a compiled and linked GLSL shader program. */ private final int programId; @@ -367,6 +368,7 @@ public final class GlProgram { this.texIdValue = texId; this.texUnitIndex = texUnitIndex; } + /** Configures {@link #bind()} to use the specified {@code int} {@code value}. */ public void setInt(int value) { this.intValue = value; diff --git a/libraries/common/src/main/java/androidx/media3/common/util/Log.java b/libraries/common/src/main/java/androidx/media3/common/util/Log.java index 313ce33874..cead0186d8 100644 --- a/libraries/common/src/main/java/androidx/media3/common/util/Log.java +++ b/libraries/common/src/main/java/androidx/media3/common/util/Log.java @@ -45,14 +45,19 @@ public final class Log { @Target(TYPE_USE) @IntDef({LOG_LEVEL_ALL, LOG_LEVEL_INFO, LOG_LEVEL_WARNING, LOG_LEVEL_ERROR, LOG_LEVEL_OFF}) public @interface LogLevel {} + /** Log level to log all messages. */ public static final int LOG_LEVEL_ALL = 0; + /** Log level to only log informative, warning and error messages. */ public static final int LOG_LEVEL_INFO = 1; + /** Log level to only log warning and error messages. */ public static final int LOG_LEVEL_WARNING = 2; + /** Log level to only log error messages. */ public static final int LOG_LEVEL_ERROR = 3; + /** Log level to disable all logging. */ public static final int LOG_LEVEL_OFF = Integer.MAX_VALUE; diff --git a/libraries/common/src/main/java/androidx/media3/common/util/NotificationUtil.java b/libraries/common/src/main/java/androidx/media3/common/util/NotificationUtil.java index bfec3b4548..ea8a7f6f7d 100644 --- a/libraries/common/src/main/java/androidx/media3/common/util/NotificationUtil.java +++ b/libraries/common/src/main/java/androidx/media3/common/util/NotificationUtil.java @@ -54,26 +54,32 @@ public final class NotificationUtil { IMPORTANCE_HIGH }) public @interface Importance {} + /** * @see NotificationManager#IMPORTANCE_UNSPECIFIED */ public static final int IMPORTANCE_UNSPECIFIED = NotificationManager.IMPORTANCE_UNSPECIFIED; + /** * @see NotificationManager#IMPORTANCE_NONE */ public static final int IMPORTANCE_NONE = NotificationManager.IMPORTANCE_NONE; + /** * @see NotificationManager#IMPORTANCE_MIN */ public static final int IMPORTANCE_MIN = NotificationManager.IMPORTANCE_MIN; + /** * @see NotificationManager#IMPORTANCE_LOW */ public static final int IMPORTANCE_LOW = NotificationManager.IMPORTANCE_LOW; + /** * @see NotificationManager#IMPORTANCE_DEFAULT */ public static final int IMPORTANCE_DEFAULT = NotificationManager.IMPORTANCE_DEFAULT; + /** * @see NotificationManager#IMPORTANCE_HIGH */ diff --git a/libraries/common/src/main/java/androidx/media3/common/util/RepeatModeUtil.java b/libraries/common/src/main/java/androidx/media3/common/util/RepeatModeUtil.java index 4214e92dd9..2d03185988 100644 --- a/libraries/common/src/main/java/androidx/media3/common/util/RepeatModeUtil.java +++ b/libraries/common/src/main/java/androidx/media3/common/util/RepeatModeUtil.java @@ -46,10 +46,13 @@ public final class RepeatModeUtil { flag = true, value = {REPEAT_TOGGLE_MODE_NONE, REPEAT_TOGGLE_MODE_ONE, REPEAT_TOGGLE_MODE_ALL}) public @interface RepeatToggleModes {} + /** All repeat mode buttons disabled. */ public static final int REPEAT_TOGGLE_MODE_NONE = 0; + /** "Repeat One" button enabled. */ public static final int REPEAT_TOGGLE_MODE_ONE = 1; + /** "Repeat All" button enabled. */ public static final int REPEAT_TOGGLE_MODE_ALL = 1 << 1; // 2 diff --git a/libraries/common/src/main/java/androidx/media3/common/util/UriUtil.java b/libraries/common/src/main/java/androidx/media3/common/util/UriUtil.java index 82d4047baf..cbe64a9a54 100644 --- a/libraries/common/src/main/java/androidx/media3/common/util/UriUtil.java +++ b/libraries/common/src/main/java/androidx/media3/common/util/UriUtil.java @@ -25,6 +25,7 @@ public final class UriUtil { /** The length of arrays returned by {@link #getUriIndices(String)}. */ private static final int INDEX_COUNT = 4; + /** * An index into an array returned by {@link #getUriIndices(String)}. * @@ -33,6 +34,7 @@ public final class UriUtil { * including when the URI has no scheme. */ private static final int SCHEME_COLON = 0; + /** * An index into an array returned by {@link #getUriIndices(String)}. * @@ -42,6 +44,7 @@ public final class UriUtil { * authority part is non-empty (in this case the double-slash means the first segment is empty). */ private static final int PATH = 1; + /** * An index into an array returned by {@link #getUriIndices(String)}. * @@ -50,6 +53,7 @@ public final class UriUtil { * single '?' with no data. */ private static final int QUERY = 2; + /** * An index into an array returned by {@link #getUriIndices(String)}. * diff --git a/libraries/container/src/main/java/androidx/media3/container/MdtaMetadataEntry.java b/libraries/container/src/main/java/androidx/media3/container/MdtaMetadataEntry.java index 293fb565fb..9714f77eb9 100644 --- a/libraries/container/src/main/java/androidx/media3/container/MdtaMetadataEntry.java +++ b/libraries/container/src/main/java/androidx/media3/container/MdtaMetadataEntry.java @@ -35,17 +35,22 @@ public final class MdtaMetadataEntry implements Metadata.Entry { /** The type indicator for UTF-8 string. */ public static final int TYPE_INDICATOR_STRING = 1; + /** The type indicator for Float32. */ public static final int TYPE_INDICATOR_FLOAT32 = 23; + /** The type indicator for 32-bit signed integer. */ public static final int TYPE_INDICATOR_INT32 = 67; /** The metadata key name. */ public final String key; + /** The payload. The interpretation of the value depends on {@link #typeIndicator}. */ public final byte[] value; + /** The four byte locale indicator. */ public final int localeIndicator; + /** The four byte type indicator. */ public final int typeIndicator; diff --git a/libraries/container/src/main/java/androidx/media3/container/Mp4TimestampData.java b/libraries/container/src/main/java/androidx/media3/container/Mp4TimestampData.java index a2d6f442db..92c1ad5b81 100644 --- a/libraries/container/src/main/java/androidx/media3/container/Mp4TimestampData.java +++ b/libraries/container/src/main/java/androidx/media3/container/Mp4TimestampData.java @@ -31,8 +31,10 @@ public final class Mp4TimestampData implements Metadata.Entry { /** The creation timestamp. */ public final long creationTimestampSeconds; + /** The modification timestamp. */ public final long modificationTimestampSeconds; + /** The timescale of the movie. */ public final long timescale; diff --git a/libraries/container/src/main/java/androidx/media3/container/NalUnitUtil.java b/libraries/container/src/main/java/androidx/media3/container/NalUnitUtil.java index 5889e8152a..18d4123c15 100644 --- a/libraries/container/src/main/java/androidx/media3/container/NalUnitUtil.java +++ b/libraries/container/src/main/java/androidx/media3/container/NalUnitUtil.java @@ -36,16 +36,22 @@ public final class NalUnitUtil { /** Coded slice of a non-IDR picture. */ public static final int NAL_UNIT_TYPE_NON_IDR = 1; + /** Coded slice data partition A. */ public static final int NAL_UNIT_TYPE_PARTITION_A = 2; + /** Coded slice of an IDR picture. */ public static final int NAL_UNIT_TYPE_IDR = 5; + /** Supplemental enhancement information. */ public static final int NAL_UNIT_TYPE_SEI = 6; + /** Sequence parameter set. */ public static final int NAL_UNIT_TYPE_SPS = 7; + /** Picture parameter set. */ public static final int NAL_UNIT_TYPE_PPS = 8; + /** Access unit delimiter. */ public static final int NAL_UNIT_TYPE_AUD = 9; @@ -186,6 +192,7 @@ public final class NalUnitUtil { /** Value for aspect_ratio_idc indicating an extended aspect ratio, in H.264 and H.265 SPSs. */ public static final int EXTENDED_SAR = 0xFF; + /** Aspect ratios indexed by aspect_ratio_idc, in H.264 and H.265 SPSs. */ public static final float[] ASPECT_RATIO_IDC_VALUES = new float[] { diff --git a/libraries/database/src/main/java/androidx/media3/database/VersionTable.java b/libraries/database/src/main/java/androidx/media3/database/VersionTable.java index 74be07e9b7..5fae2e1242 100644 --- a/libraries/database/src/main/java/androidx/media3/database/VersionTable.java +++ b/libraries/database/src/main/java/androidx/media3/database/VersionTable.java @@ -43,12 +43,16 @@ public final class VersionTable { /** Returned by {@link #getVersion(SQLiteDatabase, int, String)} if the version is unset. */ public static final int VERSION_UNSET = -1; + /** Version of tables used for offline functionality. */ public static final int FEATURE_OFFLINE = 0; + /** Version of tables used for cache content metadata. */ public static final int FEATURE_CACHE_CONTENT_METADATA = 1; + /** Version of tables used for cache file metadata. */ public static final int FEATURE_CACHE_FILE_METADATA = 2; + /** Version of tables used from external features. */ public static final int FEATURE_EXTERNAL = 1000; diff --git a/libraries/datasource/src/main/java/androidx/media3/datasource/DataSpec.java b/libraries/datasource/src/main/java/androidx/media3/datasource/DataSpec.java index bbaf39f0f9..2b858ded0f 100644 --- a/libraries/datasource/src/main/java/androidx/media3/datasource/DataSpec.java +++ b/libraries/datasource/src/main/java/androidx/media3/datasource/DataSpec.java @@ -259,6 +259,7 @@ public final class DataSpec { FLAG_MIGHT_NOT_USE_FULL_NETWORK_SPEED }) public @interface Flags {} + /** * Allows an underlying network stack to request that the server use gzip compression. * @@ -271,8 +272,10 @@ public final class DataSpec { * DataSource#read(byte[], int, int)} will be the decompressed data. */ public static final int FLAG_ALLOW_GZIP = 1; + /** Prevents caching if the length cannot be resolved when the {@link DataSource} is opened. */ public static final int FLAG_DONT_CACHE_IF_LENGTH_UNKNOWN = 1 << 1; + /** * Allows fragmentation of this request into multiple cache files, meaning a cache eviction policy * will be able to evict individual fragments of the data. Depending on the cache implementation, @@ -280,6 +283,7 @@ public final class DataSpec { * whilst writing another). */ public static final int FLAG_ALLOW_CACHE_FRAGMENTATION = 1 << 2; + /** * Indicates there are known external factors that might prevent the data from being loaded at * full network speed (e.g. server throttling or unfinished live media chunks). @@ -295,10 +299,13 @@ public final class DataSpec { @Target(TYPE_USE) @IntDef({HTTP_METHOD_GET, HTTP_METHOD_POST, HTTP_METHOD_HEAD}) public @interface HttpMethod {} + /** HTTP GET method. */ public static final int HTTP_METHOD_GET = 1; + /** HTTP POST method. */ public static final int HTTP_METHOD_POST = 2; + /** HTTP HEAD method. */ public static final int HTTP_METHOD_HEAD = 3; diff --git a/libraries/datasource/src/main/java/androidx/media3/datasource/DefaultHttpDataSource.java b/libraries/datasource/src/main/java/androidx/media3/datasource/DefaultHttpDataSource.java index e29963f8ed..4e1a6b08e1 100644 --- a/libraries/datasource/src/main/java/androidx/media3/datasource/DefaultHttpDataSource.java +++ b/libraries/datasource/src/main/java/androidx/media3/datasource/DefaultHttpDataSource.java @@ -220,6 +220,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou /** The default connection timeout, in milliseconds. */ @UnstableApi public static final int DEFAULT_CONNECT_TIMEOUT_MILLIS = 8 * 1000; + /** The default read timeout, in milliseconds. */ @UnstableApi public static final int DEFAULT_READ_TIMEOUT_MILLIS = 8 * 1000; diff --git a/libraries/datasource/src/main/java/androidx/media3/datasource/HttpDataSource.java b/libraries/datasource/src/main/java/androidx/media3/datasource/HttpDataSource.java index ac54956a08..5716eb4776 100644 --- a/libraries/datasource/src/main/java/androidx/media3/datasource/HttpDataSource.java +++ b/libraries/datasource/src/main/java/androidx/media3/datasource/HttpDataSource.java @@ -204,8 +204,10 @@ public interface HttpDataSource extends DataSource { /** The error occurred reading data from a {@code HttpDataSource}. */ public static final int TYPE_OPEN = 1; + /** The error occurred in opening a {@code HttpDataSource}. */ public static final int TYPE_READ = 2; + /** The error occurred in closing a {@code HttpDataSource}. */ public static final int TYPE_CLOSE = 3; diff --git a/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CacheDataSink.java b/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CacheDataSink.java index d87fcfdacc..2e05953185 100644 --- a/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CacheDataSink.java +++ b/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CacheDataSink.java @@ -122,6 +122,7 @@ public final class CacheDataSink implements DataSink { /** Default {@code fragmentSize} recommended for caching use cases. */ public static final long DEFAULT_FRAGMENT_SIZE = 5 * 1024 * 1024; + /** Default buffer size in bytes. */ public static final int DEFAULT_BUFFER_SIZE = 20 * 1024; diff --git a/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CacheDataSource.java b/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CacheDataSource.java index f0c8788c1f..e4c665229f 100644 --- a/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CacheDataSource.java +++ b/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CacheDataSource.java @@ -355,6 +355,7 @@ public final class CacheDataSource implements DataSource { FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS }) public @interface Flags {} + /** * A flag indicating whether we will block reads if the cache key is locked. If unset then data is * read from upstream if the cache key is locked, regardless of whether the data is cached. diff --git a/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CacheSpan.java b/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CacheSpan.java index 869ff066f7..bb5ff0be62 100644 --- a/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CacheSpan.java +++ b/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CacheSpan.java @@ -26,16 +26,21 @@ public class CacheSpan implements Comparable { /** The cache key that uniquely identifies the resource. */ public final String key; + /** The position of the {@link CacheSpan} in the resource. */ public final long position; + /** * The length of the {@link CacheSpan}, or {@link C#LENGTH_UNSET} if this is an open-ended hole. */ public final long length; + /** Whether the {@link CacheSpan} is cached. */ public final boolean isCached; + /** The file corresponding to this {@link CacheSpan}, or null if {@link #isCached} is false. */ @Nullable public final File file; + /** The last touch timestamp, or {@link C#TIME_UNSET} if {@link #isCached} is false. */ public final long lastTouchTimestamp; diff --git a/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CachedContent.java b/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CachedContent.java index 4349c1f31c..5cf85dc81a 100644 --- a/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CachedContent.java +++ b/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CachedContent.java @@ -35,10 +35,13 @@ import java.util.TreeSet; /** The cache id that uniquely identifies the resource. */ public final int id; + /** The cache key that uniquely identifies the resource. */ public final String key; + /** The cached spans of this content. */ private final TreeSet cachedSpans; + /** Currently locked ranges. */ private final ArrayList lockedRanges; @@ -280,6 +283,7 @@ import java.util.TreeSet; /** The starting position of the range. */ public final long position; + /** The length of the range, or {@link C#LENGTH_UNSET} if unbounded. */ public final long length; diff --git a/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CachedContentIndex.java b/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CachedContentIndex.java index ad1ef1410b..bfb2a02e5e 100644 --- a/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CachedContentIndex.java +++ b/libraries/datasource/src/main/java/androidx/media3/datasource/cache/CachedContentIndex.java @@ -74,6 +74,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; private static final int INCREMENTAL_METADATA_READ_LENGTH = 10 * 1024 * 1024; private final HashMap keyToContent; + /** * Maps assigned ids to their corresponding keys. Also contains (id -> null) entries for ids that * have been removed from the index since it was last stored. This prevents reuse of these ids, @@ -92,11 +93,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; * reuse. */ private final SparseArray<@NullableType String> idToKey; + /** * Tracks ids for which (id -> null) entries are present in idToKey, so that they can be removed * efficiently when the index is next stored. */ private final SparseBooleanArray removedIds; + /** Tracks ids that are new since the index was last stored. */ private final SparseBooleanArray newIds; diff --git a/libraries/datasource/src/main/java/androidx/media3/datasource/cache/ContentMetadata.java b/libraries/datasource/src/main/java/androidx/media3/datasource/cache/ContentMetadata.java index d7a63c2a35..e04100b8b3 100644 --- a/libraries/datasource/src/main/java/androidx/media3/datasource/cache/ContentMetadata.java +++ b/libraries/datasource/src/main/java/androidx/media3/datasource/cache/ContentMetadata.java @@ -30,8 +30,10 @@ public interface ContentMetadata { */ @SuppressWarnings("unused") String KEY_CUSTOM_PREFIX = "custom_"; + /** Key for redirected uri (type: String). */ String KEY_REDIRECTED_URI = "exo_redir"; + /** Key for content length in bytes (type: long). */ String KEY_CONTENT_LENGTH = "exo_len"; diff --git a/libraries/datasource/src/main/java/androidx/media3/datasource/cache/SimpleCache.java b/libraries/datasource/src/main/java/androidx/media3/datasource/cache/SimpleCache.java index a6268598a1..44dde6ce66 100644 --- a/libraries/datasource/src/main/java/androidx/media3/datasource/cache/SimpleCache.java +++ b/libraries/datasource/src/main/java/androidx/media3/datasource/cache/SimpleCache.java @@ -51,6 +51,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; public final class SimpleCache implements Cache { private static final String TAG = "SimpleCache"; + /** * Cache files are distributed between a number of subdirectories. This helps to avoid poor * performance in cases where the performance of the underlying file system (e.g. FAT32) scales diff --git a/libraries/datasource_cronet/src/main/java/androidx/media3/datasource/cronet/CronetDataSource.java b/libraries/datasource_cronet/src/main/java/androidx/media3/datasource/cronet/CronetDataSource.java index e5d93dab8f..a5ed7457b2 100644 --- a/libraries/datasource_cronet/src/main/java/androidx/media3/datasource/cronet/CronetDataSource.java +++ b/libraries/datasource_cronet/src/main/java/androidx/media3/datasource/cronet/CronetDataSource.java @@ -415,6 +415,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { /** The default connection timeout, in milliseconds. */ @UnstableApi public static final int DEFAULT_CONNECT_TIMEOUT_MILLIS = 8 * 1000; + /** The default read timeout, in milliseconds. */ @UnstableApi public static final int DEFAULT_READ_TIMEOUT_MILLIS = 8 * 1000; diff --git a/libraries/decoder/src/main/java/androidx/media3/decoder/CryptoInfo.java b/libraries/decoder/src/main/java/androidx/media3/decoder/CryptoInfo.java index 8ddaef5d9b..ba7131b321 100644 --- a/libraries/decoder/src/main/java/androidx/media3/decoder/CryptoInfo.java +++ b/libraries/decoder/src/main/java/androidx/media3/decoder/CryptoInfo.java @@ -37,18 +37,21 @@ public final class CryptoInfo { * @see android.media.MediaCodec.CryptoInfo#iv */ @Nullable public byte[] iv; + /** * The 16 byte key id. * * @see android.media.MediaCodec.CryptoInfo#key */ @Nullable public byte[] key; + /** * The type of encryption that has been applied. Must be one of the {@link C.CryptoMode} values. * * @see android.media.MediaCodec.CryptoInfo#mode */ public @C.CryptoMode int mode; + /** * The number of leading unencrypted bytes in each sub-sample. If null, all bytes are treated as * encrypted and {@link #numBytesOfEncryptedData} must be specified. @@ -56,6 +59,7 @@ public final class CryptoInfo { * @see android.media.MediaCodec.CryptoInfo#numBytesOfClearData */ @Nullable public int[] numBytesOfClearData; + /** * The number of trailing encrypted bytes in each sub-sample. If null, all bytes are treated as * clear and {@link #numBytesOfClearData} must be specified. @@ -63,16 +67,19 @@ public final class CryptoInfo { * @see android.media.MediaCodec.CryptoInfo#numBytesOfEncryptedData */ @Nullable public int[] numBytesOfEncryptedData; + /** * The number of subSamples that make up the buffer's contents. * * @see android.media.MediaCodec.CryptoInfo#numSubSamples */ public int numSubSamples; + /** * @see android.media.MediaCodec.CryptoInfo.Pattern */ public int encryptedBlocks; + /** * @see android.media.MediaCodec.CryptoInfo.Pattern */ diff --git a/libraries/decoder/src/main/java/androidx/media3/decoder/DecoderInputBuffer.java b/libraries/decoder/src/main/java/androidx/media3/decoder/DecoderInputBuffer.java index 265e2b0685..ced6ffb1a2 100644 --- a/libraries/decoder/src/main/java/androidx/media3/decoder/DecoderInputBuffer.java +++ b/libraries/decoder/src/main/java/androidx/media3/decoder/DecoderInputBuffer.java @@ -47,6 +47,7 @@ public class DecoderInputBuffer extends Buffer { /** The current capacity of the buffer. */ public final int currentCapacity; + /** The required capacity of the buffer. */ public final int requiredCapacity; @@ -78,10 +79,13 @@ public class DecoderInputBuffer extends Buffer { BUFFER_REPLACEMENT_MODE_DIRECT }) public @interface BufferReplacementMode {} + /** Disallows buffer replacement. */ public static final int BUFFER_REPLACEMENT_MODE_DISABLED = 0; + /** Allows buffer replacement using {@link ByteBuffer#allocate(int)}. */ public static final int BUFFER_REPLACEMENT_MODE_NORMAL = 1; + /** Allows buffer replacement using {@link ByteBuffer#allocateDirect(int)}. */ public static final int BUFFER_REPLACEMENT_MODE_DIRECT = 2; diff --git a/libraries/decoder/src/main/java/androidx/media3/decoder/VideoDecoderOutputBuffer.java b/libraries/decoder/src/main/java/androidx/media3/decoder/VideoDecoderOutputBuffer.java index b0fb72294b..9113197614 100644 --- a/libraries/decoder/src/main/java/androidx/media3/decoder/VideoDecoderOutputBuffer.java +++ b/libraries/decoder/src/main/java/androidx/media3/decoder/VideoDecoderOutputBuffer.java @@ -35,11 +35,13 @@ public class VideoDecoderOutputBuffer extends DecoderOutputBuffer { /** Output mode. */ public @C.VideoOutputMode int mode; + /** RGB buffer for RGB mode. */ @Nullable public ByteBuffer data; public int width; public int height; + /** The format of the input from which this output buffer was decoded. */ @Nullable public Format format; diff --git a/libraries/decoder_av1/src/main/java/androidx/media3/decoder/av1/Libgav1VideoRenderer.java b/libraries/decoder_av1/src/main/java/androidx/media3/decoder/av1/Libgav1VideoRenderer.java index 14ae84f868..68a38bb2a1 100644 --- a/libraries/decoder_av1/src/main/java/androidx/media3/decoder/av1/Libgav1VideoRenderer.java +++ b/libraries/decoder_av1/src/main/java/androidx/media3/decoder/av1/Libgav1VideoRenderer.java @@ -47,6 +47,7 @@ public class Libgav1VideoRenderer extends DecoderVideoRenderer { private static final String TAG = "Libgav1VideoRenderer"; private static final int DEFAULT_NUM_OF_INPUT_BUFFERS = 4; private static final int DEFAULT_NUM_OF_OUTPUT_BUFFERS = 4; + /** * Default input buffer size in bytes, based on 720p resolution video compressed by a factor of * two. @@ -56,6 +57,7 @@ public class Libgav1VideoRenderer extends DecoderVideoRenderer { /** The number of input buffers. */ private final int numInputBuffers; + /** * The number of output buffers. The renderer may limit the minimum possible value due to * requiring multiple output buffers to be dequeued at a time for it to make progress. diff --git a/libraries/decoder_ffmpeg/src/main/java/androidx/media3/decoder/ffmpeg/FfmpegAudioRenderer.java b/libraries/decoder_ffmpeg/src/main/java/androidx/media3/decoder/ffmpeg/FfmpegAudioRenderer.java index 9cfc9b3e3c..421d3adac0 100644 --- a/libraries/decoder_ffmpeg/src/main/java/androidx/media3/decoder/ffmpeg/FfmpegAudioRenderer.java +++ b/libraries/decoder_ffmpeg/src/main/java/androidx/media3/decoder/ffmpeg/FfmpegAudioRenderer.java @@ -44,6 +44,7 @@ public final class FfmpegAudioRenderer extends DecoderAudioRenderer { throws MidiDecoderException { return new MidiDecoder(context); } + /** * {@inheritDoc} * diff --git a/libraries/decoder_midi/src/main/java/androidx/media3/decoder/midi/TrackEvent.java b/libraries/decoder_midi/src/main/java/androidx/media3/decoder/midi/TrackEvent.java index 5951642b5b..0dca5d33bb 100644 --- a/libraries/decoder_midi/src/main/java/androidx/media3/decoder/midi/TrackEvent.java +++ b/libraries/decoder_midi/src/main/java/androidx/media3/decoder/midi/TrackEvent.java @@ -32,6 +32,7 @@ import androidx.media3.common.util.UnstableApi; /** The length of a MIDI event message in bytes. */ public static final int MIDI_MESSAGE_LENGTH_BYTES = 3; + /** A default or unset data value. */ public static final int DATA_FIELD_UNSET = Integer.MIN_VALUE; diff --git a/libraries/decoder_opus/src/main/java/androidx/media3/decoder/opus/LibopusAudioRenderer.java b/libraries/decoder_opus/src/main/java/androidx/media3/decoder/opus/LibopusAudioRenderer.java index 100389ef33..a31bdc523d 100644 --- a/libraries/decoder_opus/src/main/java/androidx/media3/decoder/opus/LibopusAudioRenderer.java +++ b/libraries/decoder_opus/src/main/java/androidx/media3/decoder/opus/LibopusAudioRenderer.java @@ -35,8 +35,10 @@ import androidx.media3.exoplayer.audio.DecoderAudioRenderer; public class LibopusAudioRenderer extends DecoderAudioRenderer { private static final String TAG = "LibopusAudioRenderer"; + /** The number of input and output buffers. */ private static final int NUM_BUFFERS = 16; + /** The default input buffer size. */ private static final int DEFAULT_INPUT_BUFFER_SIZE = 960 * 6; diff --git a/libraries/decoder_vp9/src/main/java/androidx/media3/decoder/vp9/LibvpxVideoRenderer.java b/libraries/decoder_vp9/src/main/java/androidx/media3/decoder/vp9/LibvpxVideoRenderer.java index 3f8130c1ad..76da83d405 100644 --- a/libraries/decoder_vp9/src/main/java/androidx/media3/decoder/vp9/LibvpxVideoRenderer.java +++ b/libraries/decoder_vp9/src/main/java/androidx/media3/decoder/vp9/LibvpxVideoRenderer.java @@ -41,11 +41,13 @@ public class LibvpxVideoRenderer extends DecoderVideoRenderer { /** The number of input buffers. */ private final int numInputBuffers; + /** * The number of output buffers. The renderer may limit the minimum possible value due to * requiring multiple output buffers to be dequeued at a time for it to make progress. */ private final int numOutputBuffers; + /** * The default input buffer size. The value is based on SoftVPX.cpp. diff --git a/libraries/effect/src/androidTest/java/androidx/media3/effect/DefaultVideoFrameProcessorVideoFrameRenderingTest.java b/libraries/effect/src/androidTest/java/androidx/media3/effect/DefaultVideoFrameProcessorVideoFrameRenderingTest.java index 204e3ce25c..48c13a2630 100644 --- a/libraries/effect/src/androidTest/java/androidx/media3/effect/DefaultVideoFrameProcessorVideoFrameRenderingTest.java +++ b/libraries/effect/src/androidTest/java/androidx/media3/effect/DefaultVideoFrameProcessorVideoFrameRenderingTest.java @@ -60,11 +60,13 @@ public final class DefaultVideoFrameProcessorVideoFrameRenderingTest { private static final int WIDTH = 200; private static final int HEIGHT = 100; + /** * Time to wait between rendering frames to avoid frame drops between GL and the {@link * ImageReader}. */ private static final long PER_FRAME_RENDERING_WAIT_TIME_MS = 1000L; + /** Maximum time to wait for each rendered frame to be notified. */ private static final long PER_FRAME_TIMEOUT_MS = 5000L; diff --git a/libraries/effect/src/main/java/androidx/media3/effect/DefaultShaderProgram.java b/libraries/effect/src/main/java/androidx/media3/effect/DefaultShaderProgram.java index f7fa79bcd0..bb740cffb9 100644 --- a/libraries/effect/src/main/java/androidx/media3/effect/DefaultShaderProgram.java +++ b/libraries/effect/src/main/java/androidx/media3/effect/DefaultShaderProgram.java @@ -101,27 +101,34 @@ import java.util.List; /** The {@link MatrixTransformation MatrixTransformations} to apply. */ private final ImmutableList matrixTransformations; + /** The {@link RgbMatrix RgbMatrices} to apply. */ private final ImmutableList rgbMatrices; + /** Whether the frame is in HDR or not. */ private final boolean useHdr; + /** * The transformation matrices provided by the {@link MatrixTransformation MatrixTransformations} * for the most recent frame. */ private final float[][] transformationMatrixCache; + /** The RGB matrices provided by the {@link RgbMatrix RgbMatrices} for the most recent frame. */ private final float[][] rgbMatrixCache; + /** * The product of the {@link #transformationMatrixCache} for the most recent frame, to be applied * in the vertex shader. */ private final float[] compositeTransformationMatrixArray; + /** * The product of the {@link #rgbMatrixCache} for the most recent frame, to be applied in the * fragment shader. */ private final float[] compositeRgbMatrixArray; + /** Matrix for storing an intermediate calculation result. */ private final float[] tempResultMatrix; diff --git a/libraries/effect/src/main/java/androidx/media3/effect/DefaultVideoFrameProcessor.java b/libraries/effect/src/main/java/androidx/media3/effect/DefaultVideoFrameProcessor.java index e4b56e3304..4d0c11654d 100644 --- a/libraries/effect/src/main/java/androidx/media3/effect/DefaultVideoFrameProcessor.java +++ b/libraries/effect/src/main/java/androidx/media3/effect/DefaultVideoFrameProcessor.java @@ -297,6 +297,7 @@ public final class DefaultVideoFrameProcessor implements VideoFrameProcessor { // Shader programs that apply Effects. private final List intermediateGlShaderPrograms; + // Whether DefaultVideoFrameProcessor is currently processing an input stream. @GuardedBy("lock") private boolean processingInput; diff --git a/libraries/effect/src/main/java/androidx/media3/effect/ExternalTextureManager.java b/libraries/effect/src/main/java/androidx/media3/effect/ExternalTextureManager.java index 21d5d1c11a..558b9583b1 100644 --- a/libraries/effect/src/main/java/androidx/media3/effect/ExternalTextureManager.java +++ b/libraries/effect/src/main/java/androidx/media3/effect/ExternalTextureManager.java @@ -44,6 +44,7 @@ import java.util.concurrent.atomic.AtomicInteger; private static final String TAG = "ExtTexMgr"; private static final String TIMER_THREAD_NAME = "ExtTexMgr:Timer"; + /** * The time out in milliseconds after calling signalEndOfCurrentInputStream after which the input * stream is considered to have ended, even if not all expected frames have been received from the diff --git a/libraries/effect/src/main/java/androidx/media3/effect/HslAdjustment.java b/libraries/effect/src/main/java/androidx/media3/effect/HslAdjustment.java index 786129a8d0..9de8ff16c9 100644 --- a/libraries/effect/src/main/java/androidx/media3/effect/HslAdjustment.java +++ b/libraries/effect/src/main/java/androidx/media3/effect/HslAdjustment.java @@ -101,8 +101,10 @@ public class HslAdjustment implements GlEffect { /** Indicates the hue adjustment in degrees. */ public final float hueAdjustmentDegrees; + /** Indicates the saturation adjustment. */ public final float saturationAdjustment; + /** Indicates the lightness adjustment. */ public final float lightnessAdjustment; diff --git a/libraries/effect/src/main/java/androidx/media3/effect/OverlaySettings.java b/libraries/effect/src/main/java/androidx/media3/effect/OverlaySettings.java index 2cdb5d2f07..eaa6919304 100644 --- a/libraries/effect/src/main/java/androidx/media3/effect/OverlaySettings.java +++ b/libraries/effect/src/main/java/androidx/media3/effect/OverlaySettings.java @@ -1,4 +1,5 @@ package androidx.media3.effect; + /* * Copyright 2022 The Android Open Source Project * diff --git a/libraries/effect/src/main/java/androidx/media3/effect/Presentation.java b/libraries/effect/src/main/java/androidx/media3/effect/Presentation.java index 6483e0ac55..cf49c7d5bf 100644 --- a/libraries/effect/src/main/java/androidx/media3/effect/Presentation.java +++ b/libraries/effect/src/main/java/androidx/media3/effect/Presentation.java @@ -55,6 +55,7 @@ public final class Presentation implements MatrixTransformation { @Target(TYPE_USE) @IntDef({LAYOUT_SCALE_TO_FIT, LAYOUT_SCALE_TO_FIT_WITH_CROP, LAYOUT_STRETCH_TO_FIT}) public @interface Layout {} + /** * Empty pixels added above and below the input frame (for letterboxing), or to the left and right * of the input frame (for pillarboxing), until the desired aspect ratio is achieved. All input @@ -70,6 +71,7 @@ public final class Presentation implements MatrixTransformation { * */ public static final int LAYOUT_SCALE_TO_FIT = 0; + /** * Pixels cropped from the input frame, until the desired aspect ratio is achieved. Pixels may be * cropped either from the bottom and top, or from the left and right sides, of the input frame. @@ -84,6 +86,7 @@ public final class Presentation implements MatrixTransformation { * */ public static final int LAYOUT_SCALE_TO_FIT_WITH_CROP = 1; + /** * Frame stretched larger on the x or y axes to fit the desired aspect ratio. * diff --git a/libraries/effect/src/main/java/androidx/media3/effect/RgbFilter.java b/libraries/effect/src/main/java/androidx/media3/effect/RgbFilter.java index 951d334e5c..c9d7a8902e 100644 --- a/libraries/effect/src/main/java/androidx/media3/effect/RgbFilter.java +++ b/libraries/effect/src/main/java/androidx/media3/effect/RgbFilter.java @@ -48,6 +48,7 @@ public class RgbFilter implements RgbMatrix { }; private final int colorFilter; + /** * Ensures that the usage of HDR is consistent. {@code null} indicates that HDR has not yet been * set. diff --git a/libraries/effect/src/main/java/androidx/media3/effect/ScaleAndRotateTransformation.java b/libraries/effect/src/main/java/androidx/media3/effect/ScaleAndRotateTransformation.java index 45604d1741..06494e06b5 100644 --- a/libraries/effect/src/main/java/androidx/media3/effect/ScaleAndRotateTransformation.java +++ b/libraries/effect/src/main/java/androidx/media3/effect/ScaleAndRotateTransformation.java @@ -97,8 +97,10 @@ public final class ScaleAndRotateTransformation implements MatrixTransformation /** The multiplier by which the frame will scale horizontally, along the x-axis. */ public final float scaleX; + /** The multiplier by which the frame will scale vertically, along the y-axis. */ public final float scaleY; + /** * The counterclockwise rotation, in degrees. The value should always be between 0 (included) and * 360 degrees (excluded). diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/AudioFocusManager.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/AudioFocusManager.java index 28ccfa2121..cc93255206 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/AudioFocusManager.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/AudioFocusManager.java @@ -71,10 +71,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; PLAYER_COMMAND_PLAY_WHEN_READY, }) public @interface PlayerCommand {} + /** Do not play. */ public static final int PLAYER_COMMAND_DO_NOT_PLAY = -1; + /** Do not play now. Wait for callback to play. */ public static final int PLAYER_COMMAND_WAIT_FOR_CALLBACK = 0; + /** Play freely. */ public static final int PLAYER_COMMAND_PLAY_WHEN_READY = 1; @@ -89,12 +92,16 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; AUDIO_FOCUS_STATE_LOSS_TRANSIENT_DUCK }) private @interface AudioFocusState {} + /** No audio focus is currently being held. */ private static final int AUDIO_FOCUS_STATE_NO_FOCUS = 0; + /** The requested audio focus is currently held. */ private static final int AUDIO_FOCUS_STATE_HAVE_FOCUS = 1; + /** Audio focus has been temporarily lost. */ private static final int AUDIO_FOCUS_STATE_LOSS_TRANSIENT = 2; + /** Audio focus has been temporarily lost, but playback may continue with reduced volume. */ private static final int AUDIO_FOCUS_STATE_LOSS_TRANSIENT_DUCK = 3; @@ -114,24 +121,29 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE }) private @interface AudioFocusGain {} + /** * @see AudioManager#AUDIOFOCUS_NONE */ @SuppressWarnings("InlinedApi") private static final int AUDIOFOCUS_NONE = AudioManager.AUDIOFOCUS_NONE; + /** * @see AudioManager#AUDIOFOCUS_GAIN */ private static final int AUDIOFOCUS_GAIN = AudioManager.AUDIOFOCUS_GAIN; + /** * @see AudioManager#AUDIOFOCUS_GAIN_TRANSIENT */ private static final int AUDIOFOCUS_GAIN_TRANSIENT = AudioManager.AUDIOFOCUS_GAIN_TRANSIENT; + /** * @see AudioManager#AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK */ private static final int AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK = AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK; + /** * @see AudioManager#AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE */ diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/DecoderCounters.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/DecoderCounters.java index 954884027b..669249ef5e 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/DecoderCounters.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/DecoderCounters.java @@ -32,18 +32,23 @@ public final class DecoderCounters { /** The number of times a decoder has been initialized. */ public int decoderInitCount; + /** The number of times a decoder has been released. */ public int decoderReleaseCount; + /** The number of input buffers queued to the decoder. */ public int queuedInputBufferCount; + /** * The number of skipped input buffers. * *

A skipped input buffer is an input buffer that was deliberately not queued to the decoder. */ public int skippedInputBufferCount; + /** The number of rendered output buffers. */ public int renderedOutputBufferCount; + /** * The number of skipped output buffers. * @@ -52,6 +57,7 @@ public final class DecoderCounters { * the codec due to a flush. */ public int skippedOutputBufferCount; + /** * The number of dropped buffers. * @@ -62,6 +68,7 @@ public final class DecoderCounters { * being queued to the decoder. */ public int droppedBufferCount; + /** * The number of input buffers dropped. * @@ -69,12 +76,14 @@ public final class DecoderCounters { * be rendered in time. */ public int droppedInputBufferCount; + /** * The maximum number of dropped buffers without an interleaving rendered output buffer. * *

Skipped buffers are ignored for the purposes of calculating this value. */ public int maxConsecutiveDroppedBufferCount; + /** * The number of times all buffers to a keyframe were dropped. * @@ -90,6 +99,7 @@ public final class DecoderCounters { * */ public int droppedToKeyframeCount; + /** * The sum of the video frame processing offsets in microseconds. * @@ -103,6 +113,7 @@ public final class DecoderCounters { * updating it directly. */ public long totalVideoFrameProcessingOffsetUs; + /** * The number of video frame processing offsets added. * diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/DecoderReuseEvaluation.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/DecoderReuseEvaluation.java index e56b172b50..95771c00ce 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/DecoderReuseEvaluation.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/DecoderReuseEvaluation.java @@ -47,15 +47,19 @@ public final class DecoderReuseEvaluation { REUSE_RESULT_YES_WITHOUT_RECONFIGURATION }) public @interface DecoderReuseResult {} + /** The decoder cannot be reused. */ public static final int REUSE_RESULT_NO = 0; + /** The decoder can be reused, but must be flushed. */ public static final int REUSE_RESULT_YES_WITH_FLUSH = 1; + /** * The decoder can be reused. It does not need to be flushed, but must be reconfigured by * prefixing the next input buffer with the new format's configuration data. */ public static final int REUSE_RESULT_YES_WITH_RECONFIGURATION = 2; + /** The decoder can be kept. It does not need to be flushed and no reconfiguration is required. */ public static final int REUSE_RESULT_YES_WITHOUT_RECONFIGURATION = 3; @@ -87,34 +91,49 @@ public final class DecoderReuseEvaluation { /** Decoder reuse is not implemented. */ public static final int DISCARD_REASON_REUSE_NOT_IMPLEMENTED = 1 << 0; + /** Decoder reuse is disabled by a workaround. */ public static final int DISCARD_REASON_WORKAROUND = 1 << 1; + /** Decoder reuse is disabled by overriding behavior in application code. */ public static final int DISCARD_REASON_APP_OVERRIDE = 1 << 2; + /** The sample MIME type is changing. */ public static final int DISCARD_REASON_MIME_TYPE_CHANGED = 1 << 3; + /** The codec's operating rate is changing. */ public static final int DISCARD_REASON_OPERATING_RATE_CHANGED = 1 << 4; + /** The format initialization data is changing. */ public static final int DISCARD_REASON_INITIALIZATION_DATA_CHANGED = 1 << 5; + /** The new format may exceed the decoder's configured maximum sample size, in bytes. */ public static final int DISCARD_REASON_MAX_INPUT_SIZE_EXCEEDED = 1 << 6; + /** The DRM session is changing. */ public static final int DISCARD_REASON_DRM_SESSION_CHANGED = 1 << 7; + /** The new format may exceed the decoder's configured maximum resolution. */ public static final int DISCARD_REASON_VIDEO_MAX_RESOLUTION_EXCEEDED = 1 << 8; + /** The video resolution is changing. */ public static final int DISCARD_REASON_VIDEO_RESOLUTION_CHANGED = 1 << 9; + /** The video rotation is changing. */ public static final int DISCARD_REASON_VIDEO_ROTATION_CHANGED = 1 << 10; + /** The video {@link ColorInfo} is changing. */ public static final int DISCARD_REASON_VIDEO_COLOR_INFO_CHANGED = 1 << 11; + /** The audio channel count is changing. */ public static final int DISCARD_REASON_AUDIO_CHANNEL_COUNT_CHANGED = 1 << 12; + /** The audio sample rate is changing. */ public static final int DISCARD_REASON_AUDIO_SAMPLE_RATE_CHANGED = 1 << 13; + /** The audio encoding is changing. */ public static final int DISCARD_REASON_AUDIO_ENCODING_CHANGED = 1 << 14; + /** The audio bypass mode is possible. */ public static final int DISCARD_REASON_AUDIO_BYPASS_POSSIBLE = 1 << 15; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/DefaultRenderersFactory.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/DefaultRenderersFactory.java index 4c13fb101a..fd23bfd88e 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/DefaultRenderersFactory.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/DefaultRenderersFactory.java @@ -68,8 +68,10 @@ public class DefaultRenderersFactory implements RenderersFactory { @Target(TYPE_USE) @IntDef({EXTENSION_RENDERER_MODE_OFF, EXTENSION_RENDERER_MODE_ON, EXTENSION_RENDERER_MODE_PREFER}) public @interface ExtensionRendererMode {} + /** Do not allow use of extension renderers. */ public static final int EXTENSION_RENDERER_MODE_OFF = 0; + /** * Allow use of extension renderers. Extension renderers are indexed after core renderers of the * same type. A {@link TrackSelector} that prefers the first suitable renderer will therefore @@ -77,6 +79,7 @@ public class DefaultRenderersFactory implements RenderersFactory { * given track. */ public static final int EXTENSION_RENDERER_MODE_ON = 1; + /** * Allow use of extension renderers. Extension renderers are indexed before core renderers of the * same type. A {@link TrackSelector} that prefers the first suitable renderer will therefore diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlaybackException.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlaybackException.java index 3dc08580af..f8eeb6d9d8 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlaybackException.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlaybackException.java @@ -58,24 +58,28 @@ public final class ExoPlaybackException extends PlaybackException { @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @IntDef({TYPE_SOURCE, TYPE_RENDERER, TYPE_UNEXPECTED, TYPE_REMOTE}) public @interface Type {} + /** * The error occurred loading data from a {@link MediaSource}. * *

Call {@link #getSourceException()} to retrieve the underlying cause. */ @UnstableApi public static final int TYPE_SOURCE = 0; + /** * The error occurred in a {@link Renderer}. * *

Call {@link #getRendererException()} to retrieve the underlying cause. */ @UnstableApi public static final int TYPE_RENDERER = 1; + /** * The error was an unexpected {@link RuntimeException}. * *

Call {@link #getUnexpectedException()} to retrieve the underlying cause. */ @UnstableApi public static final int TYPE_UNEXPECTED = 2; + /** * The error occurred in a remote component. * diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlayerImpl.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlayerImpl.java index a0bfdc20a9..7de18e287a 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlayerImpl.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlayerImpl.java @@ -143,6 +143,7 @@ import java.util.concurrent.TimeoutException; * operation. */ /* package */ final TrackSelectorResult emptyTrackSelectorResult; + /* package */ final Commands permanentAvailableCommands; private final ConditionVariable constructorFinished; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlayerImplInternal.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlayerImplInternal.java index 30d1aa433b..ec3c33f5ee 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlayerImplInternal.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlayerImplInternal.java @@ -169,6 +169,7 @@ import java.util.concurrent.atomic.AtomicBoolean; private static final int ACTIVE_INTERVAL_MS = 10; private static final int IDLE_INTERVAL_MS = 1000; + /** * Duration for which the player needs to appear stuck before the playback is failed on the * assumption that no further progress will be made. To appear stuck, the player's renderers must @@ -176,6 +177,7 @@ import java.util.concurrent.atomic.AtomicBoolean; * to load it. */ private static final long PLAYBACK_STUCK_AFTER_MS = 4000; + /** * Threshold under which a buffered duration is assumed to be empty. We cannot use zero to account * for buffers currently hold but not played by the renderer. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoTimeoutException.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoTimeoutException.java index 06dd0f9ff7..c7f324da74 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoTimeoutException.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoTimeoutException.java @@ -54,10 +54,13 @@ public final class ExoTimeoutException extends RuntimeException { /** The operation where this error occurred is not defined. */ public static final int TIMEOUT_OPERATION_UNDEFINED = 0; + /** The error occurred in {@link Player#release}. */ public static final int TIMEOUT_OPERATION_RELEASE = 1; + /** The error occurred in {@link ExoPlayer#setForegroundMode}. */ public static final int TIMEOUT_OPERATION_SET_FOREGROUND_MODE = 2; + /** The error occurred while detaching a surface from the player. */ public static final int TIMEOUT_OPERATION_DETACH_SURFACE = 3; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/MediaPeriodHolder.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/MediaPeriodHolder.java index 1554c096ca..8a2d3aa419 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/MediaPeriodHolder.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/MediaPeriodHolder.java @@ -42,8 +42,10 @@ import androidx.media3.exoplayer.upstream.Allocator; /** The {@link MediaPeriod} wrapped by this class. */ public final MediaPeriod mediaPeriod; + /** The unique timeline period identifier the media period belongs to. */ public final Object uid; + /** * The sample streams for each renderer associated with this period. May contain null elements. */ @@ -51,10 +53,13 @@ import androidx.media3.exoplayer.upstream.Allocator; /** Whether the media period has finished preparing. */ public boolean prepared; + /** Whether any of the tracks of this media period are enabled. */ public boolean hasEnabledTracks; + /** {@link MediaPeriodInfo} about this media period. */ public MediaPeriodInfo info; + /** * Whether all renderers are in the correct state for this {@link #mediaPeriod}. * diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/MediaPeriodInfo.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/MediaPeriodInfo.java index cd50c7e739..53c852fa4b 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/MediaPeriodInfo.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/MediaPeriodInfo.java @@ -27,8 +27,10 @@ import androidx.media3.exoplayer.source.MediaSource.MediaPeriodId; /** The media period's identifier. */ public final MediaPeriodId id; + /** The start position of the media to play within the media period, in microseconds. */ public final long startPositionUs; + /** * The requested next start position for the current timeline period, in microseconds, or {@link * C#TIME_UNSET} if the period was requested to start at its default position. @@ -37,6 +39,7 @@ import androidx.media3.exoplayer.source.MediaSource.MediaPeriodId; * suspended content. */ public final long requestedContentPositionUs; + /** * The end position to which the media period's content is clipped in order to play a following ad * group or to terminate a server side ad inserted stream before a played postroll, in @@ -45,25 +48,30 @@ import androidx.media3.exoplayer.source.MediaSource.MediaPeriodId; * of this content media period. */ public final long endPositionUs; + /** * The duration of the media period, like {@link #endPositionUs} but with {@link * C#TIME_END_OF_SOURCE} and {@link C#TIME_UNSET} resolved to the timeline period duration if * known. */ public final long durationUs; + /** * Whether this media period is followed by a transition to another media period of the same * server-side inserted ad stream. If true, {@link #isLastInTimelinePeriod}, {@link * #isLastInTimelineWindow} and {@link #isFinal} will all be false. */ public final boolean isFollowedByTransitionToSameStream; + /** * Whether this is the last media period in its timeline period (e.g., a postroll ad, or a media * period corresponding to a timeline period without ads). */ public final boolean isLastInTimelinePeriod; + /** Whether this is the last media period in its timeline window. */ public final boolean isLastInTimelineWindow; + /** * Whether this is the last media period in the entire timeline. If true, {@link * #isLastInTimelinePeriod} will also be true. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/PlaybackInfo.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/PlaybackInfo.java index 479c47ffa9..a4be60d383 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/PlaybackInfo.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/PlaybackInfo.java @@ -43,8 +43,10 @@ import java.util.List; /** The current {@link Timeline}. */ public final Timeline timeline; + /** The {@link MediaPeriodId} of the currently playing media period in the {@link #timeline}. */ public final MediaPeriodId periodId; + /** * The requested next start position for the current period in the {@link #timeline}, in * microseconds, or {@link C#TIME_UNSET} if the period was requested to start at its default @@ -54,28 +56,40 @@ import java.util.List; * suspended content. */ public final long requestedContentPositionUs; + /** The start position after a reported position discontinuity, in microseconds. */ public final long discontinuityStartPositionUs; + /** The current playback state. One of the {@link Player}.STATE_ constants. */ public final @Player.State int playbackState; + /** The current playback error, or null if this is not an error state. */ @Nullable public final ExoPlaybackException playbackError; + /** Whether the player is currently loading. */ public final boolean isLoading; + /** The currently available track groups. */ public final TrackGroupArray trackGroups; + /** The result of the current track selection. */ public final TrackSelectorResult trackSelectorResult; + /** The current static metadata of the track selections. */ public final List staticMetadata; + /** The {@link MediaPeriodId} of the currently loading media period in the {@link #timeline}. */ public final MediaPeriodId loadingMediaPeriodId; + /** Whether playback should proceed when {@link #playbackState} == {@link Player#STATE_READY}. */ public final boolean playWhenReady; + /** Reason why playback is suppressed even though {@link #playWhenReady} is {@code true}. */ public final @PlaybackSuppressionReason int playbackSuppressionReason; + /** The playback parameters. */ public final PlaybackParameters playbackParameters; + /** Whether the main player loop is sleeping, while using offload scheduling. */ public final boolean sleepingForOffload; @@ -84,16 +98,19 @@ import java.util.List; * of the associated period in the {@link #timeline}, in microseconds. */ public volatile long bufferedPositionUs; + /** * Total duration of buffered media from {@link #positionUs} to {@link #bufferedPositionUs} * including all ads. */ public volatile long totalBufferedDurationUs; + /** * Current playback position in {@link #periodId} relative to the start of the associated period * in the {@link #timeline}, in microseconds. */ public volatile long positionUs; + /** * The value of {@link SystemClock#elapsedRealtime()} when {@link #positionUs} was updated, in * milliseconds. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/Renderer.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/Renderer.java index fcfbcd3c66..e5de1f2eaf 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/Renderer.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/Renderer.java @@ -115,6 +115,7 @@ public interface Renderer extends PlayerMessage.Target { MSG_SET_VIDEO_OUTPUT_RESOLUTION }) public @interface MessageType {} + /** * The type of a message that can be passed to a video renderer via {@link * ExoPlayer#createMessage(PlayerMessage.Target)}. The message payload is normally a {@link @@ -125,12 +126,14 @@ public interface Renderer extends PlayerMessage.Target { * any existing output that it has. */ int MSG_SET_VIDEO_OUTPUT = 1; + /** * A type of a message that can be passed to an audio renderer via {@link * ExoPlayer#createMessage(PlayerMessage.Target)}. The message payload should be a {@link Float} * with 0 being silence and 1 being unity gain. */ int MSG_SET_VOLUME = 2; + /** * A type of a message that can be passed to an audio renderer via {@link * ExoPlayer#createMessage(PlayerMessage.Target)}. The message payload should be an {@link @@ -152,6 +155,7 @@ public interface Renderer extends PlayerMessage.Target { * an audio attributes instance. */ int MSG_SET_AUDIO_ATTRIBUTES = 3; + /** * The type of a message that can be passed to a {@link MediaCodec}-based video renderer via * {@link ExoPlayer#createMessage(PlayerMessage.Target)}. The message payload should be one of the @@ -161,36 +165,42 @@ public interface Renderer extends PlayerMessage.Target { * owned by a {@link android.view.SurfaceView}. */ int MSG_SET_SCALING_MODE = 4; + /** * The type of a message that can be passed to a video renderer via {@link * ExoPlayer#createMessage(PlayerMessage.Target)}. The message payload should be one of the * integer strategy constants in {@link C.VideoChangeFrameRateStrategy}. */ int MSG_SET_CHANGE_FRAME_RATE_STRATEGY = 5; + /** * A type of a message that can be passed to an audio renderer via {@link * ExoPlayer#createMessage(PlayerMessage.Target)}. The message payload should be an {@link * AuxEffectInfo} instance representing an auxiliary audio effect for the underlying audio track. */ int MSG_SET_AUX_EFFECT_INFO = 6; + /** * The type of a message that can be passed to a video renderer via {@link * ExoPlayer#createMessage(PlayerMessage.Target)}. The message payload should be a {@link * VideoFrameMetadataListener} instance, or null. */ int MSG_SET_VIDEO_FRAME_METADATA_LISTENER = 7; + /** * The type of a message that can be passed to a camera motion renderer via {@link * ExoPlayer#createMessage(PlayerMessage.Target)}. The message payload should be a {@link * CameraMotionListener} instance, or null. */ int MSG_SET_CAMERA_MOTION_LISTENER = 8; + /** * The type of a message that can be passed to an audio renderer via {@link * ExoPlayer#createMessage(PlayerMessage.Target)}. The message payload should be a {@link Boolean} * instance telling whether to enable or disable skipping silences in the audio stream. */ int MSG_SET_SKIP_SILENCE_ENABLED = 9; + /** * The type of a message that can be passed to audio and video renderers via {@link * ExoPlayer#createMessage(PlayerMessage.Target)}. The message payload should be an {@link @@ -199,6 +209,7 @@ public interface Renderer extends PlayerMessage.Target { * tunneling is enabled. */ int MSG_SET_AUDIO_SESSION_ID = 10; + /** * The type of a message that can be passed to a {@link Renderer} via {@link * ExoPlayer#createMessage(PlayerMessage.Target)}, to inform the renderer that it can schedule @@ -207,6 +218,7 @@ public interface Renderer extends PlayerMessage.Target { *

The message payload must be a {@link WakeupListener} instance. */ int MSG_SET_WAKEUP_LISTENER = 11; + /** * The type of a message that can be passed to audio renderers via {@link * ExoPlayer#createMessage(PlayerMessage.Target)}. The message payload should be an {@link @@ -214,17 +226,20 @@ public interface Renderer extends PlayerMessage.Target { * restore the default. */ int MSG_SET_PREFERRED_AUDIO_DEVICE = 12; + /** * The type of a message that can be passed to a video renderer. The message payload should be a * {@link List} containing {@linkplain Effect video effects}. */ int MSG_SET_VIDEO_EFFECTS = 13; + /** * The type of a message that can be passed to a video renderer to set the desired output * resolution. The message payload should be a {@link Size} of the desired output width and * height. Use this method only when playing with video {@linkplain Effect effects}. */ int MSG_SET_VIDEO_OUTPUT_RESOLUTION = 14; + /** * Applications or extensions may define custom {@code MSG_*} constants that can be passed to * renderers. These custom constants must be greater than or equal to this value. @@ -240,12 +255,14 @@ public interface Renderer extends PlayerMessage.Target { @Target(TYPE_USE) @IntDef({STATE_DISABLED, STATE_ENABLED, STATE_STARTED}) @interface State {} + /** * The renderer is disabled. A renderer in this state will not proactively acquire resources that * it requires for rendering (e.g., media decoders), but may continue to hold any that it already * has. {@link #reset()} can be called to force the renderer to release such resources. */ int STATE_DISABLED = 0; + /** * The renderer is enabled but not started. A renderer in this state may render media at the * current position (e.g. an initial video frame), but the position will not advance. A renderer @@ -253,6 +270,7 @@ public interface Renderer extends PlayerMessage.Target { * decoders). */ int STATE_ENABLED = 1; + /** * The renderer is started. Calls to {@link #render(long, long)} will cause media to be rendered. */ diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/RendererCapabilities.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/RendererCapabilities.java index 3839753266..62d1c6badc 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/RendererCapabilities.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/RendererCapabilities.java @@ -60,24 +60,30 @@ public interface RendererCapabilities { }) @Deprecated @interface FormatSupport {} + /** A mask to apply to {@link Capabilities} to obtain the {@link C.FormatSupport} only. */ int FORMAT_SUPPORT_MASK = 0b111; + /** * @deprecated Use {@link C#FORMAT_HANDLED} instead. */ @Deprecated int FORMAT_HANDLED = C.FORMAT_HANDLED; + /** * @deprecated Use {@link C#FORMAT_EXCEEDS_CAPABILITIES} instead. */ @Deprecated int FORMAT_EXCEEDS_CAPABILITIES = C.FORMAT_EXCEEDS_CAPABILITIES; + /** * @deprecated Use {@link C#FORMAT_UNSUPPORTED_DRM} instead. */ @Deprecated int FORMAT_UNSUPPORTED_DRM = C.FORMAT_UNSUPPORTED_DRM; + /** * @deprecated Use {@link C#FORMAT_UNSUPPORTED_SUBTYPE} instead. */ @Deprecated int FORMAT_UNSUPPORTED_SUBTYPE = C.FORMAT_UNSUPPORTED_SUBTYPE; + /** * @deprecated Use {@link C#FORMAT_UNSUPPORTED_TYPE} instead. */ @@ -95,13 +101,16 @@ public interface RendererCapabilities { /** A mask to apply to {@link Capabilities} to obtain the {@link AdaptiveSupport} only. */ int ADAPTIVE_SUPPORT_MASK = 0b11 << 3; + /** The {@link Renderer} can seamlessly adapt between formats. */ int ADAPTIVE_SEAMLESS = 0b10 << 3; + /** * The {@link Renderer} can adapt between formats, but may suffer a brief discontinuity * (~50-100ms) when adaptation occurs. */ int ADAPTIVE_NOT_SEAMLESS = 0b01 << 3; + /** The {@link Renderer} does not support adaptation between formats. */ int ADAPTIVE_NOT_SUPPORTED = 0; @@ -117,8 +126,10 @@ public interface RendererCapabilities { /** A mask to apply to {@link Capabilities} to obtain {@link TunnelingSupport} only. */ int TUNNELING_SUPPORT_MASK = 0b1 << 5; + /** The {@link Renderer} supports tunneled output. */ int TUNNELING_SUPPORTED = 0b1 << 5; + /** The {@link Renderer} does not support tunneled output. */ int TUNNELING_NOT_SUPPORTED = 0; @@ -136,10 +147,13 @@ public interface RendererCapabilities { HARDWARE_ACCELERATION_NOT_SUPPORTED, }) @interface HardwareAccelerationSupport {} + /** A mask to apply to {@link Capabilities} to obtain {@link HardwareAccelerationSupport} only. */ int HARDWARE_ACCELERATION_SUPPORT_MASK = 0b1 << 6; + /** The renderer is able to use hardware acceleration. */ int HARDWARE_ACCELERATION_SUPPORTED = 0b1 << 6; + /** The renderer is not able to use hardware acceleration. */ int HARDWARE_ACCELERATION_NOT_SUPPORTED = 0; @@ -154,15 +168,19 @@ public interface RendererCapabilities { @Target(TYPE_USE) @IntDef({DECODER_SUPPORT_FALLBACK_MIMETYPE, DECODER_SUPPORT_PRIMARY, DECODER_SUPPORT_FALLBACK}) @interface DecoderSupport {} + /** A mask to apply to {@link Capabilities} to obtain {@link DecoderSupport} only. */ int DECODER_SUPPORT_MASK = 0b11 << 7; + /** * The format's MIME type is unsupported and the renderer may use a decoder for a fallback MIME * type. */ int DECODER_SUPPORT_FALLBACK_MIMETYPE = 0b10 << 7; + /** The renderer is able to use the primary decoder for the format's MIME type. */ int DECODER_SUPPORT_PRIMARY = 0b1 << 7; + /** The format exceeds the primary decoder's capabilities but is supported by fallback decoder */ int DECODER_SUPPORT_FALLBACK = 0; @@ -187,15 +205,19 @@ public interface RendererCapabilities { AUDIO_OFFLOAD_NOT_SUPPORTED }) @interface AudioOffloadSupport {} + /** A mask to apply to {@link Capabilities} to obtain {@link AudioOffloadSupport} only. */ int AUDIO_OFFLOAD_SUPPORT_MASK = 0b111 << 9; /** The renderer supports audio offload and speed changes with this format. */ int AUDIO_OFFLOAD_SPEED_CHANGE_SUPPORTED = 0b100 << 9; + /** The renderer supports audio offload and gapless transitions with this format. */ int AUDIO_OFFLOAD_GAPLESS_SUPPORTED = 0b10 << 9; + /** The renderer supports audio offload with this format. */ int AUDIO_OFFLOAD_SUPPORTED = 0b1 << 9; + /** Audio offload is not supported with this format. */ int AUDIO_OFFLOAD_NOT_SUPPORTED = 0; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/SeekParameters.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/SeekParameters.java index 2dbc495ba6..c355ca5ee5 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/SeekParameters.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/SeekParameters.java @@ -40,13 +40,17 @@ public final class SeekParameters { /** Parameters for exact seeking. */ public static final SeekParameters EXACT = new SeekParameters(0, 0); + /** Parameters for seeking to the closest sync point. */ public static final SeekParameters CLOSEST_SYNC = new SeekParameters(Long.MAX_VALUE, Long.MAX_VALUE); + /** Parameters for seeking to the sync point immediately before a requested seek position. */ public static final SeekParameters PREVIOUS_SYNC = new SeekParameters(Long.MAX_VALUE, 0); + /** Parameters for seeking to the sync point immediately after a requested seek position. */ public static final SeekParameters NEXT_SYNC = new SeekParameters(0, Long.MAX_VALUE); + /** Default parameters. */ public static final SeekParameters DEFAULT = EXACT; @@ -55,6 +59,7 @@ public final class SeekParameters { * microseconds. */ public final long toleranceBeforeUs; + /** * The maximum time that the actual position seeked to may exceed the requested seek position, in * microseconds. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/AnalyticsListener.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/AnalyticsListener.java index 5cd62c18f8..41c3e9d12a 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/AnalyticsListener.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/AnalyticsListener.java @@ -234,142 +234,204 @@ public interface AnalyticsListener { EVENT_VIDEO_CODEC_ERROR, }) @interface EventFlags {} + /** {@link Player#getCurrentTimeline()} changed. */ @UnstableApi int EVENT_TIMELINE_CHANGED = Player.EVENT_TIMELINE_CHANGED; + /** * {@link Player#getCurrentMediaItem()} changed or the player started repeating the current item. */ @UnstableApi int EVENT_MEDIA_ITEM_TRANSITION = Player.EVENT_MEDIA_ITEM_TRANSITION; + /** {@link Player#getCurrentTracks()} changed. */ @UnstableApi int EVENT_TRACKS_CHANGED = Player.EVENT_TRACKS_CHANGED; + /** {@link Player#isLoading()} ()} changed. */ @UnstableApi int EVENT_IS_LOADING_CHANGED = Player.EVENT_IS_LOADING_CHANGED; + /** {@link Player#getPlaybackState()} changed. */ @UnstableApi int EVENT_PLAYBACK_STATE_CHANGED = Player.EVENT_PLAYBACK_STATE_CHANGED; + /** {@link Player#getPlayWhenReady()} changed. */ @UnstableApi int EVENT_PLAY_WHEN_READY_CHANGED = Player.EVENT_PLAY_WHEN_READY_CHANGED; + /** {@link Player#getPlaybackSuppressionReason()} changed. */ @UnstableApi int EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED = Player.EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED; + /** {@link Player#isPlaying()} changed. */ @UnstableApi int EVENT_IS_PLAYING_CHANGED = Player.EVENT_IS_PLAYING_CHANGED; + /** {@link Player#getRepeatMode()} changed. */ @UnstableApi int EVENT_REPEAT_MODE_CHANGED = Player.EVENT_REPEAT_MODE_CHANGED; + /** {@link Player#getShuffleModeEnabled()} changed. */ @UnstableApi int EVENT_SHUFFLE_MODE_ENABLED_CHANGED = Player.EVENT_SHUFFLE_MODE_ENABLED_CHANGED; + /** {@link Player#getPlayerError()} changed. */ @UnstableApi int EVENT_PLAYER_ERROR = Player.EVENT_PLAYER_ERROR; + /** * A position discontinuity occurred. See {@link * Player.Listener#onPositionDiscontinuity(Player.PositionInfo, Player.PositionInfo, int)}. */ @UnstableApi int EVENT_POSITION_DISCONTINUITY = Player.EVENT_POSITION_DISCONTINUITY; + /** {@link Player#getPlaybackParameters()} changed. */ @UnstableApi int EVENT_PLAYBACK_PARAMETERS_CHANGED = Player.EVENT_PLAYBACK_PARAMETERS_CHANGED; + /** {@link Player#getAvailableCommands()} changed. */ @UnstableApi int EVENT_AVAILABLE_COMMANDS_CHANGED = Player.EVENT_AVAILABLE_COMMANDS_CHANGED; + /** {@link Player#getMediaMetadata()} changed. */ @UnstableApi int EVENT_MEDIA_METADATA_CHANGED = Player.EVENT_MEDIA_METADATA_CHANGED; + /** {@link Player#getPlaylistMetadata()} changed. */ @UnstableApi int EVENT_PLAYLIST_METADATA_CHANGED = Player.EVENT_PLAYLIST_METADATA_CHANGED; + /** {@link Player#getSeekBackIncrement()} changed. */ @UnstableApi int EVENT_SEEK_BACK_INCREMENT_CHANGED = Player.EVENT_SEEK_BACK_INCREMENT_CHANGED; + /** {@link Player#getSeekForwardIncrement()} changed. */ @UnstableApi int EVENT_SEEK_FORWARD_INCREMENT_CHANGED = Player.EVENT_SEEK_FORWARD_INCREMENT_CHANGED; + /** {@link Player#getMaxSeekToPreviousPosition()} changed. */ @UnstableApi int EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED = Player.EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED; + /** {@link Player#getTrackSelectionParameters()} changed. */ @UnstableApi int EVENT_TRACK_SELECTION_PARAMETERS_CHANGED = Player.EVENT_TRACK_SELECTION_PARAMETERS_CHANGED; + /** Audio attributes changed. */ @UnstableApi int EVENT_AUDIO_ATTRIBUTES_CHANGED = Player.EVENT_AUDIO_ATTRIBUTES_CHANGED; + /** An audio session id was set. */ @UnstableApi int EVENT_AUDIO_SESSION_ID = Player.EVENT_AUDIO_SESSION_ID; + /** The volume changed. */ @UnstableApi int EVENT_VOLUME_CHANGED = Player.EVENT_VOLUME_CHANGED; + /** Skipping silences was enabled or disabled in the audio stream. */ @UnstableApi int EVENT_SKIP_SILENCE_ENABLED_CHANGED = Player.EVENT_SKIP_SILENCE_ENABLED_CHANGED; + /** The surface size changed. */ @UnstableApi int EVENT_SURFACE_SIZE_CHANGED = Player.EVENT_SURFACE_SIZE_CHANGED; + /** The video size changed. */ @UnstableApi int EVENT_VIDEO_SIZE_CHANGED = Player.EVENT_VIDEO_SIZE_CHANGED; + /** * The first frame has been rendered since setting the surface, since the renderer was reset or * since the stream changed. */ @UnstableApi int EVENT_RENDERED_FIRST_FRAME = Player.EVENT_RENDERED_FIRST_FRAME; + /** Metadata associated with the current playback time was reported. */ @UnstableApi int EVENT_METADATA = Player.EVENT_METADATA; + /** {@link Player#getCurrentCues()} changed. */ @UnstableApi int EVENT_CUES = Player.EVENT_CUES; + /** {@link Player#getDeviceInfo()} changed. */ @UnstableApi int EVENT_DEVICE_INFO_CHANGED = Player.EVENT_DEVICE_INFO_CHANGED; + /** {@link Player#getDeviceVolume()} changed. */ @UnstableApi int EVENT_DEVICE_VOLUME_CHANGED = Player.EVENT_DEVICE_VOLUME_CHANGED; + /** A source started loading data. */ @UnstableApi int EVENT_LOAD_STARTED = 1000; // Intentional gap to leave space for new Player events + /** A source started completed loading data. */ @UnstableApi int EVENT_LOAD_COMPLETED = 1001; + /** A source canceled loading data. */ @UnstableApi int EVENT_LOAD_CANCELED = 1002; + /** A source had a non-fatal error loading data. */ @UnstableApi int EVENT_LOAD_ERROR = 1003; + /** The downstream format sent to renderers changed. */ @UnstableApi int EVENT_DOWNSTREAM_FORMAT_CHANGED = 1004; + /** Data was removed from the end of the media buffer. */ @UnstableApi int EVENT_UPSTREAM_DISCARDED = 1005; + /** The bandwidth estimate has been updated. */ @UnstableApi int EVENT_BANDWIDTH_ESTIMATE = 1006; + /** An audio renderer was enabled. */ @UnstableApi int EVENT_AUDIO_ENABLED = 1007; + /** An audio renderer created a decoder. */ @UnstableApi int EVENT_AUDIO_DECODER_INITIALIZED = 1008; + /** The format consumed by an audio renderer changed. */ @UnstableApi int EVENT_AUDIO_INPUT_FORMAT_CHANGED = 1009; + /** The audio position has increased for the first time since the last pause or position reset. */ @UnstableApi int EVENT_AUDIO_POSITION_ADVANCING = 1010; + /** An audio underrun occurred. */ @UnstableApi int EVENT_AUDIO_UNDERRUN = 1011; + /** An audio renderer released a decoder. */ @UnstableApi int EVENT_AUDIO_DECODER_RELEASED = 1012; + /** An audio renderer was disabled. */ @UnstableApi int EVENT_AUDIO_DISABLED = 1013; + /** The audio sink encountered a non-fatal error. */ @UnstableApi int EVENT_AUDIO_SINK_ERROR = 1014; + /** A video renderer was enabled. */ @UnstableApi int EVENT_VIDEO_ENABLED = 1015; + /** A video renderer created a decoder. */ @UnstableApi int EVENT_VIDEO_DECODER_INITIALIZED = 1016; + /** The format consumed by a video renderer changed. */ @UnstableApi int EVENT_VIDEO_INPUT_FORMAT_CHANGED = 1017; + /** Video frames have been dropped. */ @UnstableApi int EVENT_DROPPED_VIDEO_FRAMES = 1018; + /** A video renderer released a decoder. */ @UnstableApi int EVENT_VIDEO_DECODER_RELEASED = 1019; + /** A video renderer was disabled. */ @UnstableApi int EVENT_VIDEO_DISABLED = 1020; + /** Video frame processing offset data has been reported. */ @UnstableApi int EVENT_VIDEO_FRAME_PROCESSING_OFFSET = 1021; + /** A DRM session has been acquired. */ @UnstableApi int EVENT_DRM_SESSION_ACQUIRED = 1022; + /** DRM keys were loaded. */ @UnstableApi int EVENT_DRM_KEYS_LOADED = 1023; + /** A non-fatal DRM session manager error occurred. */ @UnstableApi int EVENT_DRM_SESSION_MANAGER_ERROR = 1024; + /** DRM keys were restored. */ @UnstableApi int EVENT_DRM_KEYS_RESTORED = 1025; + /** DRM keys were removed. */ @UnstableApi int EVENT_DRM_KEYS_REMOVED = 1026; + /** A DRM session has been released. */ @UnstableApi int EVENT_DRM_SESSION_RELEASED = 1027; + /** The player was released. */ @UnstableApi int EVENT_PLAYER_RELEASED = 1028; + /** The audio codec encountered an error. */ @UnstableApi int EVENT_AUDIO_CODEC_ERROR = 1029; + /** The video codec encountered an error. */ @UnstableApi int EVENT_VIDEO_CODEC_ERROR = 1030; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/PlaybackStats.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/PlaybackStats.java index 1296db65c8..a8febf125c 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/PlaybackStats.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/analytics/PlaybackStats.java @@ -41,6 +41,7 @@ public final class PlaybackStats { public static final class EventTimeAndPlaybackState { /** The event time at which the playback state became active. */ public final EventTime eventTime; + /** The playback state that became active. */ public final @PlaybackState int playbackState; @@ -85,6 +86,7 @@ public final class PlaybackStats { public static final class EventTimeAndFormat { /** The event time associated with {@link #format}. */ public final EventTime eventTime; + /** The format that started being used, or {@code null} if no format was used. */ @Nullable public final Format format; @@ -126,6 +128,7 @@ public final class PlaybackStats { public static final class EventTimeAndException { /** The event time at which the exception occurred. */ public final EventTime eventTime; + /** The exception that was thrown. */ public final Exception exception; @@ -193,36 +196,52 @@ public final class PlaybackStats { PLAYBACK_STATE_ABANDONED }) @interface PlaybackState {} + /** Playback has not started (initial state). */ public static final int PLAYBACK_STATE_NOT_STARTED = 0; + /** Playback is buffering in the background for initial playback start. */ public static final int PLAYBACK_STATE_JOINING_BACKGROUND = 1; + /** Playback is buffering in the foreground for initial playback start. */ public static final int PLAYBACK_STATE_JOINING_FOREGROUND = 2; + /** Playback is actively playing. */ public static final int PLAYBACK_STATE_PLAYING = 3; + /** Playback is paused but ready to play. */ public static final int PLAYBACK_STATE_PAUSED = 4; + /** Playback is handling a seek. */ public static final int PLAYBACK_STATE_SEEKING = 5; + /** Playback is buffering to resume active playback. */ public static final int PLAYBACK_STATE_BUFFERING = 6; + /** Playback is buffering while paused. */ public static final int PLAYBACK_STATE_PAUSED_BUFFERING = 7; + /** Playback is suppressed (e.g. due to audio focus loss). */ public static final int PLAYBACK_STATE_SUPPRESSED = 9; + /** Playback is suppressed (e.g. due to audio focus loss) while buffering to resume a playback. */ public static final int PLAYBACK_STATE_SUPPRESSED_BUFFERING = 10; + /** Playback has reached the end of the media. */ public static final int PLAYBACK_STATE_ENDED = 11; + /** Playback is stopped and can be restarted. */ public static final int PLAYBACK_STATE_STOPPED = 12; + /** Playback is stopped due a fatal error and can be retried. */ public static final int PLAYBACK_STATE_FAILED = 13; + /** Playback is interrupted by an ad. */ public static final int PLAYBACK_STATE_INTERRUPTED_BY_AD = 14; + /** Playback is abandoned before reaching the end of the media. */ public static final int PLAYBACK_STATE_ABANDONED = 15; + /** Total number of playback states. */ /* package */ static final int PLAYBACK_STATE_COUNT = 16; @@ -388,25 +407,32 @@ public final class PlaybackStats { * ordered by {@code EventTime.realTimeMs}. */ public final List playbackStateHistory; + /** * The media time history as an ordered list of long[2] arrays with [0] being the realtime as * returned by {@code SystemClock.elapsedRealtime()} and [1] being the media time at this * realtime, in milliseconds. */ public final List mediaTimeHistory; + /** * The elapsed real-time as returned by {@code SystemClock.elapsedRealtime()} of the first * reported playback event, or {@link C#TIME_UNSET} if no event has been reported. */ public final long firstReportedTimeMs; + /** The number of playbacks which were the active foreground playback at some point. */ public final int foregroundPlaybackCount; + /** The number of playbacks which were abandoned before they were ready to play. */ public final int abandonedBeforeReadyCount; + /** The number of playbacks which reached the ended state at least once. */ public final int endedCount; + /** The number of playbacks which were pre-buffered in the background. */ public final int backgroundJoiningCount; + /** * The total time spent joining the playback, in milliseconds, or {@link C#TIME_UNSET} if no valid * join time could be determined. @@ -416,29 +442,36 @@ public final class PlaybackStats { * joining was interrupted by a seek, stop, or error state. */ public final long totalValidJoinTimeMs; + /** * The number of playbacks with a valid join time as documented in {@link #totalValidJoinTimeMs}. */ public final int validJoinTimeCount; + /** The total number of times a playback has been paused. */ public final int totalPauseCount; + /** The total number of times a playback has been paused while rebuffering. */ public final int totalPauseBufferCount; + /** * The total number of times a seek occurred. This includes seeks happening before playback * resumed after another seek. */ public final int totalSeekCount; + /** * The total number of times a rebuffer occurred. This excludes initial joining and buffering * after seek. */ public final int totalRebufferCount; + /** * The maximum time spent during a single rebuffer, in milliseconds, or {@link C#TIME_UNSET} if no * rebuffer occurred. */ public final long maxRebufferTimeMs; + /** The number of ad playbacks. */ public final int adPlaybackCount; @@ -449,48 +482,61 @@ public final class PlaybackStats { * EventTime.realTimeMs}. The {@link Format} may be null if no video format was used. */ public final List videoFormatHistory; + /** * The audio format history as {@link EventTimeAndFormat EventTimeAndFormats} ordered by {@code * EventTime.realTimeMs}. The {@link Format} may be null if no audio format was used. */ public final List audioFormatHistory; + /** The total media time for which video format height data is available, in milliseconds. */ public final long totalVideoFormatHeightTimeMs; + /** * The accumulated sum of all video format heights, in pixels, times the time the format was used * for playback, in milliseconds. */ public final long totalVideoFormatHeightTimeProduct; + /** The total media time for which video format bitrate data is available, in milliseconds. */ public final long totalVideoFormatBitrateTimeMs; + /** * The accumulated sum of all video format bitrates, in bits per second, times the time the format * was used for playback, in milliseconds. */ public final long totalVideoFormatBitrateTimeProduct; + /** The total media time for which audio format data is available, in milliseconds. */ public final long totalAudioFormatTimeMs; + /** * The accumulated sum of all audio format bitrates, in bits per second, times the time the format * was used for playback, in milliseconds. */ public final long totalAudioFormatBitrateTimeProduct; + /** The number of playbacks with initial video format height data. */ public final int initialVideoFormatHeightCount; + /** The number of playbacks with initial video format bitrate data. */ public final int initialVideoFormatBitrateCount; + /** * The total initial video format height for all playbacks, in pixels, or {@link C#LENGTH_UNSET} * if no initial video format data is available. */ public final int totalInitialVideoFormatHeight; + /** * The total initial video format bitrate for all playbacks, in bits per second, or {@link * C#LENGTH_UNSET} if no initial video format data is available. */ public final long totalInitialVideoFormatBitrate; + /** The number of playbacks with initial audio format bitrate data. */ public final int initialAudioFormatBitrateCount; + /** * The total initial audio format bitrate for all playbacks, in bits per second, or {@link * C#LENGTH_UNSET} if no initial audio format data is available. @@ -501,6 +547,7 @@ public final class PlaybackStats { /** The total time for which bandwidth measurement data is available, in milliseconds. */ public final long totalBandwidthTimeMs; + /** The total bytes transferred during {@link #totalBandwidthTimeMs}. */ public final long totalBandwidthBytes; @@ -508,6 +555,7 @@ public final class PlaybackStats { /** The total number of dropped video frames. */ public final long totalDroppedFrames; + /** The total number of audio underruns. */ public final long totalAudioUnderruns; @@ -518,18 +566,22 @@ public final class PlaybackStats { * stopped due to this error. */ public final int fatalErrorPlaybackCount; + /** The total number of fatal errors. Errors are fatal if playback stopped due to this error. */ public final int fatalErrorCount; + /** * The total number of non-fatal errors. Error are non-fatal if playback can recover from the * error without stopping. */ public final int nonFatalErrorCount; + /** * The history of fatal errors as {@link EventTimeAndException EventTimeAndExceptions} ordered by * {@code EventTime.realTimeMs}. Errors are fatal if playback stopped due to this error. */ public final List fatalErrorHistory; + /** * The history of non-fatal errors as {@link EventTimeAndException EventTimeAndExceptions} ordered * by {@code EventTime.realTimeMs}. Errors are non-fatal if playback can recover from the error diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioOffloadSupport.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioOffloadSupport.java index 5df205778f..91ffc6c8a7 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioOffloadSupport.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioOffloadSupport.java @@ -31,8 +31,10 @@ public final class AudioOffloadSupport { public static final class Builder { /** Whether the format is supported with offload playback. */ private boolean isFormatSupported; + /** Whether playback of the format is supported with gapless transitions. */ private boolean isGaplessSupported; + /** Whether playback of the format is supported with speed changes. */ private boolean isSpeedChangeSupported; @@ -94,8 +96,10 @@ public final class AudioOffloadSupport { /** Whether the format is supported with offload playback. */ public final boolean isFormatSupported; + /** Whether playback of the format is supported with gapless transitions. */ public final boolean isGaplessSupported; + /** Whether playback of the format is supported with speed changes. */ public final boolean isSpeedChangeSupported; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioSink.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioSink.java index 00a441507e..a7cd282cca 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioSink.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioSink.java @@ -163,8 +163,10 @@ public interface AudioSink { /** The underlying {@link AudioTrack}'s state. */ public final int audioTrackState; + /** If the exception can be recovered by recreating the sink. */ public final boolean isRecoverable; + /** The input {@link Format} of the sink when the error occurs. */ public final Format format; @@ -212,8 +214,10 @@ public interface AudioSink { * Otherwise, the meaning of the error code depends on the sink implementation. */ public final int errorCode; + /** If the exception can be recovered by recreating the sink. */ public final boolean isRecoverable; + /** The input {@link Format} of the sink when the error occurs. */ public final Format format; @@ -236,6 +240,7 @@ public interface AudioSink { final class UnexpectedDiscontinuityException extends Exception { /** The actual presentation time of a sample, in microseconds. */ public final long actualPresentationTimeUs; + /** The expected presentation time of a sample, in microseconds. */ public final long expectedPresentationTimeUs; @@ -272,13 +277,16 @@ public interface AudioSink { SINK_FORMAT_UNSUPPORTED }) @interface SinkFormatSupport {} + /** The sink supports the format directly, without the need for internal transcoding. */ int SINK_FORMAT_SUPPORTED_DIRECTLY = 2; + /** * The sink supports the format, but needs to transcode it internally to do so. Internal * transcoding may result in lower quality and higher CPU load in some cases. */ int SINK_FORMAT_SUPPORTED_WITH_TRANSCODING = 1; + /** The sink does not support the format. */ int SINK_FORMAT_UNSUPPORTED = 0; @@ -301,6 +309,7 @@ public interface AudioSink { /** The audio sink will never play in offload mode. */ int OFFLOAD_MODE_DISABLED = 0; + /** * The audio sink will prefer offload playback except in the case where both the track is gapless * and the device does support gapless offload playback. @@ -309,6 +318,7 @@ public interface AudioSink { * savings. */ int OFFLOAD_MODE_ENABLED_GAPLESS_REQUIRED = 1; + /** * The audio sink will prefer offload playback even if this might result in silence gaps between * tracks. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioTimestampPoller.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioTimestampPoller.java index 50b2a39feb..374fec488c 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioTimestampPoller.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioTimestampPoller.java @@ -61,23 +61,30 @@ import java.lang.annotation.Target; STATE_ERROR }) private @interface State {} + /** State when first initializing. */ private static final int STATE_INITIALIZING = 0; + /** State when we have a timestamp and we don't know if it's advancing. */ private static final int STATE_TIMESTAMP = 1; + /** State when we have a timestamp and we know it is advancing. */ private static final int STATE_TIMESTAMP_ADVANCING = 2; + /** State when the no timestamp is available. */ private static final int STATE_NO_TIMESTAMP = 3; + /** State when the last timestamp was rejected as invalid. */ private static final int STATE_ERROR = 4; /** The polling interval for {@link #STATE_INITIALIZING} and {@link #STATE_TIMESTAMP}. */ private static final int FAST_POLL_INTERVAL_US = 10_000; + /** * The polling interval for {@link #STATE_TIMESTAMP_ADVANCING} and {@link #STATE_NO_TIMESTAMP}. */ private static final int SLOW_POLL_INTERVAL_US = 10_000_000; + /** The polling interval for {@link #STATE_ERROR}. */ private static final int ERROR_POLL_INTERVAL_US = 500_000; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioTrackPositionTracker.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioTrackPositionTracker.java index 8a9576aeb8..9d85a9e364 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioTrackPositionTracker.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioTrackPositionTracker.java @@ -116,14 +116,17 @@ import java.lang.reflect.Method; @Target(TYPE_USE) @IntDef({PLAYSTATE_STOPPED, PLAYSTATE_PAUSED, PLAYSTATE_PLAYING}) private @interface PlayState {} + /** * @see AudioTrack#PLAYSTATE_STOPPED */ private static final int PLAYSTATE_STOPPED = AudioTrack.PLAYSTATE_STOPPED; + /** * @see AudioTrack#PLAYSTATE_PAUSED */ private static final int PLAYSTATE_PAUSED = AudioTrack.PLAYSTATE_PAUSED; + /** * @see AudioTrack#PLAYSTATE_PLAYING */ @@ -143,6 +146,7 @@ import java.lang.reflect.Method; *

This is a fail safe that should not be required on correctly functioning devices. */ private static final long MAX_LATENCY_US = 5 * C.MICROS_PER_SECOND; + /** The duration of time used to smooth over an adjustment between position sampling modes. */ private static final long MODE_SWITCH_SMOOTHING_DURATION_US = C.MICROS_PER_SECOND; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DecoderAudioRenderer.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DecoderAudioRenderer.java index 202ba408d4..812780c537 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DecoderAudioRenderer.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DecoderAudioRenderer.java @@ -110,20 +110,24 @@ public abstract class DecoderAudioRenderer< REINITIALIZATION_STATE_WAIT_END_OF_STREAM }) private @interface ReinitializationState {} + /** The decoder does not need to be re-initialized. */ private static final int REINITIALIZATION_STATE_NONE = 0; + /** * The input format has changed in a way that requires the decoder to be re-initialized, but we * haven't yet signaled an end of stream to the existing decoder. We need to do so in order to * ensure that it outputs any remaining buffers before we release it. */ private static final int REINITIALIZATION_STATE_SIGNAL_END_OF_STREAM = 1; + /** * The input format has changed in a way that requires the decoder to be re-initialized, and we've * signaled an end of stream to the existing decoder. We're waiting for the decoder to output an * end of stream signal to indicate that it has output any remaining buffers before we release it. */ private static final int REINITIALIZATION_STATE_WAIT_END_OF_STREAM = 2; + /** * Generally there is zero or one pending output stream offset. We track more offsets to allow for * pending output streams that have fewer frames than the codec latency. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DefaultAudioSink.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DefaultAudioSink.java index 82cb742ec1..b226323093 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DefaultAudioSink.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DefaultAudioSink.java @@ -194,6 +194,7 @@ public final class DefaultAudioSink implements AudioSink { /** Default instance. */ AudioTrackBufferSizeProvider DEFAULT = new DefaultAudioTrackBufferSizeProvider.Builder().build(); + /** * Returns the buffer size to use when creating an {@link AudioTrack} for a specific format and * output mode. @@ -404,12 +405,16 @@ public final class DefaultAudioSink implements AudioSink { /** The default playback speed. */ public static final float DEFAULT_PLAYBACK_SPEED = 1f; + /** The minimum allowed playback speed. Lower values will be constrained to fall in range. */ public static final float MIN_PLAYBACK_SPEED = 0.1f; + /** The maximum allowed playback speed. Higher values will be constrained to fall in range. */ public static final float MAX_PLAYBACK_SPEED = 8f; + /** The minimum allowed pitch factor. Lower values will be constrained to fall in range. */ public static final float MIN_PITCH = 0.1f; + /** The maximum allowed pitch factor. Higher values will be constrained to fall in range. */ public static final float MAX_PITCH = 8f; @@ -425,8 +430,10 @@ public final class DefaultAudioSink implements AudioSink { /** The audio sink plays PCM audio. */ public static final int OUTPUT_MODE_PCM = 0; + /** The audio sink plays encoded audio in offload. */ public static final int OUTPUT_MODE_OFFLOAD = 1; + /** The audio sink plays encoded audio in passthrough. */ public static final int OUTPUT_MODE_PASSTHROUGH = 2; @@ -1874,8 +1881,10 @@ public final class DefaultAudioSink implements AudioSink { /** The playback parameters. */ public final PlaybackParameters playbackParameters; + /** The media time from which the playback parameters apply, in microseconds. */ public final long mediaTimeUs; + /** The audio track position from which the playback parameters apply, in microseconds. */ public final long audioTrackPositionUs; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DefaultAudioTrackBufferSizeProvider.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DefaultAudioTrackBufferSizeProvider.java index e0f117d222..9819ab0380 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DefaultAudioTrackBufferSizeProvider.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DefaultAudioTrackBufferSizeProvider.java @@ -44,14 +44,19 @@ public class DefaultAudioTrackBufferSizeProvider /** Default minimum length for the {@link AudioTrack} buffer, in microseconds. */ private static final int MIN_PCM_BUFFER_DURATION_US = 250_000; + /** Default maximum length for the {@link AudioTrack} buffer, in microseconds. */ private static final int MAX_PCM_BUFFER_DURATION_US = 750_000; + /** Default multiplication factor to apply to the minimum buffer size requested. */ private static final int PCM_BUFFER_MULTIPLICATION_FACTOR = 4; + /** Default length for passthrough {@link AudioTrack} buffers, in microseconds. */ private static final int PASSTHROUGH_BUFFER_DURATION_US = 250_000; + /** Default length for offload {@link AudioTrack} buffers, in microseconds. */ private static final int OFFLOAD_BUFFER_DURATION_US = 50_000_000; + /** * Default multiplication factor to apply to AC3 passthrough buffer to avoid underruns on some * devices (e.g., Broadcom 7271). @@ -146,14 +151,19 @@ public class DefaultAudioTrackBufferSizeProvider /** The minimum length for PCM {@link AudioTrack} buffers, in microseconds. */ protected final int minPcmBufferDurationUs; + /** The maximum length for PCM {@link AudioTrack} buffers, in microseconds. */ protected final int maxPcmBufferDurationUs; + /** The multiplication factor to apply to the minimum buffer size requested. */ protected final int pcmBufferMultiplicationFactor; + /** The length for passthrough {@link AudioTrack} buffers, in microseconds. */ protected final int passthroughBufferDurationUs; + /** The length for offload {@link AudioTrack} buffers, in microseconds. */ protected final int offloadBufferDurationUs; + /** * The multiplication factor to apply to AC3 passthrough buffer to avoid underruns on some devices * (e.g., Broadcom 7271). diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/MediaCodecAudioRenderer.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/MediaCodecAudioRenderer.java index 12a9835f14..e98889ecf6 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/MediaCodecAudioRenderer.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/MediaCodecAudioRenderer.java @@ -93,6 +93,7 @@ import java.util.List; public class MediaCodecAudioRenderer extends MediaCodecRenderer implements MediaClock { private static final String TAG = "MediaCodecAudioRenderer"; + /** * Custom key used to indicate bits per sample by some decoders on Vivo devices. For example * OMX.vivo.alac.decoder on the Vivo Z1 Pro. @@ -106,6 +107,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media private int codecMaxInputSize; private boolean codecNeedsDiscardChannelsWorkaround; @Nullable private Format inputFormat; + /** Codec used for DRM decryption only in passthrough and offload. */ @Nullable private Format decryptOnlyCodecFormat; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/SilenceSkippingAudioProcessor.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/SilenceSkippingAudioProcessor.java index 84700fe658..53898a9747 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/SilenceSkippingAudioProcessor.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/SilenceSkippingAudioProcessor.java @@ -44,11 +44,13 @@ public final class SilenceSkippingAudioProcessor extends BaseAudioProcessor { * minimumSilenceDurationUs}. */ public static final long DEFAULT_MINIMUM_SILENCE_DURATION_US = 150_000; + /** * The default value for {@link #SilenceSkippingAudioProcessor(long, long, short) * paddingSilenceUs}. */ public static final long DEFAULT_PADDING_SILENCE_US = 20_000; + /** * The default value for {@link #SilenceSkippingAudioProcessor(long, long, short) * silenceThresholdLevel}. @@ -65,10 +67,13 @@ public final class SilenceSkippingAudioProcessor extends BaseAudioProcessor { STATE_SILENT, }) private @interface State {} + /** State when the input is not silent. */ private static final int STATE_NOISY = 0; + /** State when the input may be silent but we haven't read enough yet to know. */ private static final int STATE_MAYBE_SILENT = 1; + /** State when the input is silent. */ private static final int STATE_SILENT = 2; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DefaultDrmSessionManager.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DefaultDrmSessionManager.java index 4fd04f9c57..5067c57319 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DefaultDrmSessionManager.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DefaultDrmSessionManager.java @@ -276,19 +276,25 @@ public class DefaultDrmSessionManager implements DrmSessionManager { @Target(TYPE_USE) @IntDef({MODE_PLAYBACK, MODE_QUERY, MODE_DOWNLOAD, MODE_RELEASE}) public @interface Mode {} + /** * Loads and refreshes (if necessary) a license for playback. Supports streaming and offline * licenses. */ public static final int MODE_PLAYBACK = 0; + /** Restores an offline license to allow its status to be queried. */ public static final int MODE_QUERY = 1; + /** Downloads an offline license or renews an existing one. */ public static final int MODE_DOWNLOAD = 2; + /** Releases an existing offline license. */ public static final int MODE_RELEASE = 3; + /** Number of times to retry for initial provisioning and key request for reporting error. */ public static final int INITIAL_DRM_REQUEST_RETRY_COUNT = 3; + /** Default value for {@link Builder#setSessionKeepaliveMs(long)}. */ public static final long DEFAULT_SESSION_KEEPALIVE_MS = 5 * 60 * C.MILLIS_PER_SECOND; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmSession.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmSession.java index 968a3d207f..c6283aa429 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmSession.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmSession.java @@ -84,17 +84,22 @@ public interface DrmSession { @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @IntDef({STATE_RELEASED, STATE_ERROR, STATE_OPENING, STATE_OPENED, STATE_OPENED_WITH_KEYS}) @interface State {} + /** The session has been released. This is a terminal state. */ int STATE_RELEASED = 0; + /** * The session has encountered an error. {@link #getError()} can be used to retrieve the cause. * This is a terminal state. */ int STATE_ERROR = 1; + /** The session is being opened. */ int STATE_OPENING = 2; + /** The session is open, but does not have keys required for decryption. */ int STATE_OPENED = 3; + /** The session is open and has keys required for decryption. */ int STATE_OPENED_WITH_KEYS = 4; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmSessionEventListener.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmSessionEventListener.java index 414c4ae58d..72a7f7cf35 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmSessionEventListener.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmSessionEventListener.java @@ -100,6 +100,7 @@ public interface DrmSessionEventListener { /** The timeline window index reported with the events. */ public final int windowIndex; + /** The {@link MediaPeriodId} reported with the events. */ @Nullable public final MediaPeriodId mediaPeriodId; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmUtil.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmUtil.java index a47fb682bb..f9101ae08a 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmUtil.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/DrmUtil.java @@ -57,8 +57,10 @@ public final class DrmUtil { /** Corresponds to failures caused by an {@link ExoMediaDrm} method call. */ public static final int ERROR_SOURCE_EXO_MEDIA_DRM = 1; + /** Corresponds to failures caused by an operation related to obtaining DRM licenses. */ public static final int ERROR_SOURCE_LICENSE_ACQUISITION = 2; + /** Corresponds to failures caused by an operation related to provisioning the device. */ public static final int ERROR_SOURCE_PROVISIONING = 3; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/ExoMediaDrm.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/ExoMediaDrm.java index 115cad12bb..9bd4205a7d 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/ExoMediaDrm.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/ExoMediaDrm.java @@ -97,10 +97,12 @@ public interface ExoMediaDrm { @UnstableApi @SuppressWarnings("InlinedApi") int EVENT_KEY_REQUIRED = MediaDrm.EVENT_KEY_REQUIRED; + /** Event indicating that keys have expired, and are no longer usable. */ @UnstableApi @SuppressWarnings("InlinedApi") int EVENT_KEY_EXPIRED = MediaDrm.EVENT_KEY_EXPIRED; + /** Event indicating that a certificate needs to be requested from the provisioning server. */ @UnstableApi @SuppressWarnings("InlinedApi") @@ -113,6 +115,7 @@ public interface ExoMediaDrm { @UnstableApi @SuppressWarnings("InlinedApi") int KEY_TYPE_STREAMING = MediaDrm.KEY_TYPE_STREAMING; + /** * Key request type for keys that will be used for offline use. They will be saved to the device * for subsequent use when the device is not connected to a network. @@ -120,6 +123,7 @@ public interface ExoMediaDrm { @UnstableApi @SuppressWarnings("InlinedApi") int KEY_TYPE_OFFLINE = MediaDrm.KEY_TYPE_OFFLINE; + /** Key request type indicating that saved offline keys should be released. */ @UnstableApi @SuppressWarnings("InlinedApi") @@ -256,15 +260,19 @@ public interface ExoMediaDrm { /** Key request type for an initial license request. */ public static final int REQUEST_TYPE_INITIAL = MediaDrm.KeyRequest.REQUEST_TYPE_INITIAL; + /** Key request type for license renewal. */ public static final int REQUEST_TYPE_RENEWAL = MediaDrm.KeyRequest.REQUEST_TYPE_RENEWAL; + /** Key request type for license release. */ public static final int REQUEST_TYPE_RELEASE = MediaDrm.KeyRequest.REQUEST_TYPE_RELEASE; + /** * Key request type if keys are already loaded and available for use. No license request is * necessary, and no key request data is returned. */ public static final int REQUEST_TYPE_NONE = MediaDrm.KeyRequest.REQUEST_TYPE_NONE; + /** * Key request type if keys have been loaded, but an additional license request is needed to * update their values. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/FrameworkCryptoConfig.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/FrameworkCryptoConfig.java index c0ad39cc9c..ee66d07b0a 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/FrameworkCryptoConfig.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/FrameworkCryptoConfig.java @@ -42,8 +42,10 @@ public final class FrameworkCryptoConfig implements CryptoConfig { /** The DRM scheme UUID. */ public final UUID uuid; + /** The DRM session id. */ public final byte[] sessionId; + /** * Whether to allow use of insecure decoder components even if the underlying platform says * otherwise. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/MediaDrmCallbackException.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/MediaDrmCallbackException.java index 0cf5abebd3..7ef362589f 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/MediaDrmCallbackException.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/MediaDrmCallbackException.java @@ -31,13 +31,16 @@ public final class MediaDrmCallbackException extends IOException { /** The {@link DataSpec} associated with the request. */ public final DataSpec dataSpec; + /** * The {@link Uri} after redirections, or {@link #dataSpec dataSpec.uri} if no redirection * occurred. */ public final Uri uriAfterRedirects; + /** The HTTP request headers included in the response. */ public final Map> responseHeaders; + /** The number of bytes obtained from the server. */ public final long bytesLoaded; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/UnsupportedDrmException.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/UnsupportedDrmException.java index 2b70a51439..8711ab131d 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/UnsupportedDrmException.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/UnsupportedDrmException.java @@ -43,8 +43,10 @@ public final class UnsupportedDrmException extends Exception { @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @IntDef({REASON_UNSUPPORTED_SCHEME, REASON_INSTANTIATION_ERROR}) public @interface Reason {} + /** The requested DRM scheme is unsupported by the device. */ public static final int REASON_UNSUPPORTED_SCHEME = 1; + /** * There device advertises support for the requested DRM scheme, but there was an error * instantiating it. The cause can be retrieved using {@link #getCause()}. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/WidevineUtil.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/WidevineUtil.java index 2815f8c796..1063b896ac 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/WidevineUtil.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/drm/WidevineUtil.java @@ -27,6 +27,7 @@ public final class WidevineUtil { /** Widevine specific key status field name for the remaining license duration, in seconds. */ public static final String PROPERTY_LICENSE_DURATION_REMAINING = "LicenseDurationRemaining"; + /** Widevine specific key status field name for the remaining playback duration, in seconds. */ public static final String PROPERTY_PLAYBACK_DURATION_REMAINING = "PlaybackDurationRemaining"; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/BatchBuffer.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/BatchBuffer.java index b222dfe619..4b41709d3b 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/BatchBuffer.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/BatchBuffer.java @@ -29,6 +29,7 @@ import java.nio.ByteBuffer; /** The default maximum number of samples that can be appended before the buffer is full. */ public static final int DEFAULT_MAX_SAMPLE_COUNT = 32; + /** * The maximum size of the buffer in bytes. This prevents excessive memory usage for high bitrate * streams. The limit is equivalent of 75s of mp3 at highest bitrate (320kb/s) and 30s of AAC LC diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecAdapter.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecAdapter.java index 6fa902bd7a..49c9620f0f 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecAdapter.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecAdapter.java @@ -81,18 +81,23 @@ public interface MediaCodecAdapter { /** Information about the {@link MediaCodec} being configured. */ public final MediaCodecInfo codecInfo; + /** The {@link MediaFormat} for which the codec is being configured. */ public final MediaFormat mediaFormat; + /** The {@link Format} for which the codec is being configured. */ public final Format format; + /** * For video decoding, the output where the object will render the decoded frames. This must be * null if the codec is not a video decoder, or if it is configured for {@link ByteBuffer} * output. */ @Nullable public final Surface surface; + /** For DRM protected playbacks, a {@link MediaCrypto} to use for decryption. */ @Nullable public final MediaCrypto crypto; + /** See {@link MediaCodec#configure}. */ public final int flags; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecInfo.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecInfo.java index 8bc7d67ff4..9591aea2db 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecInfo.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecInfo.java @@ -896,11 +896,13 @@ public final class MediaCodecInfo { /** The decoder has a PerformancePoint that covers the resolution and frame rate */ private static final int COVERAGE_RESULT_YES = 2; + /** * The decoder has at least one PerformancePoint, but none of them cover the resolution and frame * rate */ private static final int COVERAGE_RESULT_NO = 1; + /** The VideoCapabilities does not contain any PerformancePoints */ private static final int COVERAGE_RESULT_NO_EMPTY_LIST = 0; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecRenderer.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecRenderer.java index 387ac41d92..b5cc99b504 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecRenderer.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecRenderer.java @@ -218,10 +218,13 @@ public abstract class MediaCodecRenderer extends BaseRenderer { RECONFIGURATION_STATE_QUEUE_PENDING }) private @interface ReconfigurationState {} + /** There is no pending adaptive reconfiguration work. */ private static final int RECONFIGURATION_STATE_NONE = 0; + /** Codec configuration data needs to be written into the next buffer. */ private static final int RECONFIGURATION_STATE_WRITE_PENDING = 1; + /** * Codec configuration data has been written into the next buffer, but that buffer still needs to * be returned to the codec. @@ -233,10 +236,13 @@ public abstract class MediaCodecRenderer extends BaseRenderer { @Target(TYPE_USE) @IntDef({DRAIN_STATE_NONE, DRAIN_STATE_SIGNAL_END_OF_STREAM, DRAIN_STATE_WAIT_END_OF_STREAM}) private @interface DrainState {} + /** The codec is not being drained. */ private static final int DRAIN_STATE_NONE = 0; + /** The codec needs to be drained, but we haven't signaled an end of stream to it yet. */ private static final int DRAIN_STATE_SIGNAL_END_OF_STREAM = 1; + /** The codec needs to be drained, and we're waiting for it to output an end of stream. */ private static final int DRAIN_STATE_WAIT_END_OF_STREAM = 2; @@ -250,12 +256,16 @@ public abstract class MediaCodecRenderer extends BaseRenderer { DRAIN_ACTION_REINITIALIZE }) private @interface DrainAction {} + /** No special action should be taken. */ private static final int DRAIN_ACTION_NONE = 0; + /** The codec should be flushed. */ private static final int DRAIN_ACTION_FLUSH = 1; + /** The codec should be flushed and updated to use the pending DRM session. */ private static final int DRAIN_ACTION_FLUSH_AND_UPDATE_DRM_SESSION = 2; + /** The codec should be reinitialized. */ private static final int DRAIN_ACTION_REINITIALIZE = 3; @@ -271,10 +281,12 @@ public abstract class MediaCodecRenderer extends BaseRenderer { /** The adaptation workaround is never used. */ private static final int ADAPTATION_WORKAROUND_MODE_NEVER = 0; + /** * The adaptation workaround is used when adapting between formats of the same resolution only. */ private static final int ADAPTATION_WORKAROUND_MODE_SAME_RESOLUTION = 1; + /** The adaptation workaround is always used when adapting between formats. */ private static final int ADAPTATION_WORKAROUND_MODE_ALWAYS = 2; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/offline/Download.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/offline/Download.java index 6eae3298d3..1674bd4779 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/offline/Download.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/offline/Download.java @@ -54,6 +54,7 @@ public final class Download { STATE_RESTARTING }) public @interface State {} + // Important: These constants are persisted into DownloadIndex. Do not change them. /** * The download is waiting to be started. A download may be queued because the {@code @@ -67,16 +68,22 @@ public final class Download { * */ public static final int STATE_QUEUED = 0; + /** The download is stopped for a specified {@link #stopReason}. */ public static final int STATE_STOPPED = 1; + /** The download is currently started. */ public static final int STATE_DOWNLOADING = 2; + /** The download completed. */ public static final int STATE_COMPLETED = 3; + /** The download failed. */ public static final int STATE_FAILED = 4; + /** The download is being removed. */ public static final int STATE_REMOVING = 5; + /** The download will restart after all downloaded data is removed. */ public static final int STATE_RESTARTING = 7; @@ -88,8 +95,10 @@ public final class Download { @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @IntDef({FAILURE_REASON_NONE, FAILURE_REASON_UNKNOWN}) public @interface FailureReason {} + /** The download isn't failed. */ public static final int FAILURE_REASON_NONE = 0; + /** The download is failed because of unknown reason. */ public static final int FAILURE_REASON_UNKNOWN = 1; @@ -98,16 +107,22 @@ public final class Download { /** The download request. */ public final DownloadRequest request; + /** The state of the download. */ public final @State int state; + /** The first time when download entry is created. */ public final long startTimeMs; + /** The last update time. */ public final long updateTimeMs; + /** The total size of the content in bytes, or {@link C#LENGTH_UNSET} if unknown. */ public final long contentLength; + /** The reason the download is stopped, or {@link #STOP_REASON_NONE}. */ public final int stopReason; + /** * If {@link #state} is {@link #STATE_FAILED} then this is the cause, otherwise {@link * #FAILURE_REASON_NONE}. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/offline/DownloadManager.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/offline/DownloadManager.java index 2284b936fa..40c133c0a7 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/offline/DownloadManager.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/offline/DownloadManager.java @@ -148,8 +148,10 @@ public final class DownloadManager { /** The default maximum number of parallel downloads. */ public static final int DEFAULT_MAX_PARALLEL_DOWNLOADS = 3; + /** The default minimum number of times a download must be retried before failing. */ public static final int DEFAULT_MIN_RETRY_COUNT = 5; + /** The default requirement is that the device has network connectivity. */ public static final Requirements DEFAULT_REQUIREMENTS = new Requirements(Requirements.NETWORK); diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/offline/DownloadRequest.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/offline/DownloadRequest.java index 487b998d0a..2f69102775 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/offline/DownloadRequest.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/offline/DownloadRequest.java @@ -107,23 +107,29 @@ public final class DownloadRequest implements Parcelable { /** The unique content id. */ public final String id; + /** The uri being downloaded. */ public final Uri uri; + /** * The MIME type of this content. Used as a hint to infer the content's type (DASH, HLS, * SmoothStreaming). If null, a {@code DownloadService} will infer the content type from the * {@link #uri}. */ @Nullable public final String mimeType; + /** Stream keys to be downloaded. If empty, all streams will be downloaded. */ public final List streamKeys; + /** The key set id of the offline licence if the content is protected with DRM. */ @Nullable public final byte[] keySetId; + /** * Custom key for cache indexing, or null. Must be null for DASH, HLS and SmoothStreaming * downloads. */ @Nullable public final String customCacheKey; + /** Application defined data associated with the download. May be empty. */ public final byte[] data; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/scheduler/Requirements.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/scheduler/Requirements.java index 53ad113710..cd503ba09f 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/scheduler/Requirements.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/scheduler/Requirements.java @@ -62,12 +62,16 @@ public final class Requirements implements Parcelable { /** Requirement that the device has network connectivity. */ public static final int NETWORK = 1; + /** Requirement that the device has a network connection that is unmetered. */ public static final int NETWORK_UNMETERED = 1 << 1; + /** Requirement that the device is idle. */ public static final int DEVICE_IDLE = 1 << 2; + /** Requirement that the device is charging. */ public static final int DEVICE_CHARGING = 1 << 3; + /** * Requirement that the device's internal storage is not low. Note that this requirement * is not affected by the status of external storage. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/ClippingMediaSource.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/ClippingMediaSource.java index f11d117f72..8576fd2fdd 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/ClippingMediaSource.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/ClippingMediaSource.java @@ -53,10 +53,13 @@ public final class ClippingMediaSource extends WrappingMediaSource { @Target(TYPE_USE) @IntDef({REASON_INVALID_PERIOD_COUNT, REASON_NOT_SEEKABLE_TO_START, REASON_START_EXCEEDS_END}) public @interface Reason {} + /** The wrapped source doesn't consist of a single period. */ public static final int REASON_INVALID_PERIOD_COUNT = 0; + /** The wrapped source is not seekable and a non-zero clipping start position was specified. */ public static final int REASON_NOT_SEEKABLE_TO_START = 1; + /** The wrapped source ends before the specified clipping start position. */ public static final int REASON_START_EXCEEDS_END = 2; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/LoadEventInfo.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/LoadEventInfo.java index fa9c7e7f56..cf2ca7635f 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/LoadEventInfo.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/LoadEventInfo.java @@ -38,20 +38,26 @@ public final class LoadEventInfo { /** Identifies the load task to which this event corresponds. */ public final long loadTaskId; + /** Defines the requested data. */ public final DataSpec dataSpec; + /** * The {@link Uri} from which data is being read. The uri will be identical to the one in {@link * #dataSpec}.uri unless redirection has occurred. If redirection has occurred, this is the uri * after redirection. */ public final Uri uri; + /** The response headers associated with the load, or an empty map if unavailable. */ public final Map> responseHeaders; + /** The value of {@link SystemClock#elapsedRealtime} at the time of the load event. */ public final long elapsedRealtimeMs; + /** The duration of the load up to the event time. */ public final long loadDurationMs; + /** The number of bytes that were loaded up to the event time. */ public final long bytesLoaded; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/MediaLoadData.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/MediaLoadData.java index c5df2e15ea..63ba909e3d 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/MediaLoadData.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/MediaLoadData.java @@ -29,31 +29,37 @@ public final class MediaLoadData { /** The {@link DataType data type}. */ public final @DataType int dataType; + /** * One of the {@link TrackType track types}, which is a media track type if the data corresponds * to media of a specific type, or {@link C#TRACK_TYPE_UNKNOWN} otherwise. */ public final @TrackType int trackType; + /** * The format of the track to which the data belongs. Null if the data does not belong to a * specific track. */ @Nullable public final Format trackFormat; + /** * One of the {@link SelectionReason selection reasons} if the data belongs to a track. {@link * C#SELECTION_REASON_UNKNOWN} otherwise. */ public final @C.SelectionReason int trackSelectionReason; + /** * Optional data associated with the selection of the track to which the data belongs. Null if the * data does not belong to a track. */ @Nullable public final Object trackSelectionData; + /** * The start time of the media in the {@link MediaPeriod}, or {@link C#TIME_UNSET} if the data * does not belong to a specific {@link MediaPeriod}. */ public final long mediaStartTimeMs; + /** * The end time of the media in the {@link MediaPeriod}, or {@link C#TIME_UNSET} if the data does * not belong to a specific {@link MediaPeriod} or the end time is unknown. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/MediaSourceEventListener.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/MediaSourceEventListener.java index 5cb2ea15b1..4583dc9991 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/MediaSourceEventListener.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/MediaSourceEventListener.java @@ -148,6 +148,7 @@ public interface MediaSourceEventListener { /** The timeline window index reported with the events. */ public final int windowIndex; + /** The {@link MediaPeriodId} reported with the events. */ @Nullable public final MediaPeriodId mediaPeriodId; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/MergingMediaSource.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/MergingMediaSource.java index fc708ba175..b7cc41f04a 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/MergingMediaSource.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/MergingMediaSource.java @@ -57,6 +57,7 @@ public final class MergingMediaSource extends CompositeMediaSource { @Target(TYPE_USE) @IntDef({REASON_PERIOD_COUNT_MISMATCH}) public @interface Reason {} + /** The sources have different period counts. */ public static final int REASON_PERIOD_COUNT_MISMATCH = 0; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/SampleDataQueue.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/SampleDataQueue.java index bd6c2a5601..3643036429 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/SampleDataQueue.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/SampleDataQueue.java @@ -463,12 +463,15 @@ import java.util.Arrays; /** The absolute position of the start of the data (inclusive). */ public long startPosition; + /** The absolute position of the end of the data (exclusive). */ public long endPosition; + /** * The {@link Allocation}, or {@code null} if the node is not {@link #initialize initialized}. */ @Nullable public Allocation allocation; + /** * The next {@link AllocationNode} in the list, or {@code null} if the node is not {@link * #initialize initialized}. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/SampleStream.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/SampleStream.java index dc088cd117..146cddc9f8 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/SampleStream.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/SampleStream.java @@ -44,8 +44,10 @@ public interface SampleStream { flag = true, value = {FLAG_PEEK, FLAG_REQUIRE_FORMAT, FLAG_OMIT_SAMPLE_DATA}) @interface ReadFlags {} + /** Specifies that the read position should not be advanced if a sample buffer is read. */ int FLAG_PEEK = 1; + /** * Specifies that if a sample buffer would normally be read next, the format of the stream should * be read instead. In detail, the effect of this flag is as follows: @@ -60,6 +62,7 @@ public interface SampleStream { * */ int FLAG_REQUIRE_FORMAT = 1 << 1; + /** * Specifies that {@link DecoderInputBuffer#data}, {@link DecoderInputBuffer#supplementalData} and * {@link DecoderInputBuffer#cryptoInfo} should not be populated when reading a sample buffer. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/ads/AdsMediaSource.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/ads/AdsMediaSource.java index 0263361a12..5015b9f67f 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/ads/AdsMediaSource.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/ads/AdsMediaSource.java @@ -79,12 +79,16 @@ public final class AdsMediaSource extends CompositeMediaSource { @Target(TYPE_USE) @IntDef({TYPE_AD, TYPE_AD_GROUP, TYPE_ALL_ADS, TYPE_UNEXPECTED}) public @interface Type {} + /** Type for when an ad failed to load. The ad will be skipped. */ public static final int TYPE_AD = 0; + /** Type for when an ad group failed to load. The ad group will be skipped. */ public static final int TYPE_AD_GROUP = 1; + /** Type for when all ad groups failed to load. All ads will be skipped. */ public static final int TYPE_ALL_ADS = 2; + /** Type for when an unexpected error occurred while loading ads. All ads will be skipped. */ public static final int TYPE_UNEXPECTED = 3; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/chunk/BaseMediaChunk.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/chunk/BaseMediaChunk.java index 77da67fe38..46f0ce1542 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/chunk/BaseMediaChunk.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/chunk/BaseMediaChunk.java @@ -33,6 +33,7 @@ public abstract class BaseMediaChunk extends MediaChunk { * start of the chunk. */ public final long clippedStartTimeUs; + /** * The time from which output will end, or {@link C#TIME_UNSET} if output will end at the end of * the chunk. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/chunk/Chunk.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/chunk/Chunk.java index 7a2d8060ec..ea00cf5eab 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/chunk/Chunk.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/chunk/Chunk.java @@ -39,28 +39,35 @@ public abstract class Chunk implements Loadable { /** Identifies the load task for this loadable. */ public final long loadTaskId; + /** The {@link DataSpec} that defines the data to be loaded. */ public final DataSpec dataSpec; + /** The {@link DataType data type} of the chunk. For reporting only. */ public final @DataType int type; + /** The format of the track to which this chunk belongs. */ public final Format trackFormat; + /** * One of the {@link C.SelectionReason selection reasons} if the chunk belongs to a track. {@link * C#SELECTION_REASON_UNKNOWN} if the chunk does not belong to a track, or if the selection reason * is unknown. */ public final @C.SelectionReason int trackSelectionReason; + /** * Optional data associated with the selection of the track to which this chunk belongs. Null if * the chunk does not belong to a track, or if there is no associated track selection data. */ @Nullable public final Object trackSelectionData; + /** * The start time of the media contained by the chunk, or {@link C#TIME_UNSET} if the data being * loaded does not contain media samples. */ public final long startTimeUs; + /** * The end time of the media contained by the chunk, or {@link C#TIME_UNSET} if the data being * loaded does not contain media samples. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/text/TextRenderer.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/text/TextRenderer.java index 8cd8bb0c37..de74671018 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/text/TextRenderer.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/text/TextRenderer.java @@ -71,14 +71,17 @@ public final class TextRenderer extends BaseRenderer implements Callback { REPLACEMENT_STATE_WAIT_END_OF_STREAM }) private @interface ReplacementState {} + /** The decoder does not need to be replaced. */ private static final int REPLACEMENT_STATE_NONE = 0; + /** * The decoder needs to be replaced, but we haven't yet signaled an end of stream to the existing * decoder. We need to do so in order to ensure that it outputs any remaining buffers before we * release it. */ private static final int REPLACEMENT_STATE_SIGNAL_END_OF_STREAM = 1; + /** * The decoder needs to be replaced, and we've signaled an end of stream to the existing decoder. * We're waiting for the decoder to output an end of stream signal to indicate that it has output diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection.java index ee1afd5505..51fd488033 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection.java @@ -826,6 +826,7 @@ public class AdaptiveTrackSelection extends BaseTrackSelection { /** Total bandwidth in bits per second at which this checkpoint applies. */ public final long totalBandwidth; + /** Allocated bandwidth at this checkpoint in bits per second. */ public final long allocatedBandwidth; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/BaseTrackSelection.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/BaseTrackSelection.java index 73cf7b9daf..77e4a752b7 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/BaseTrackSelection.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/BaseTrackSelection.java @@ -35,15 +35,19 @@ public abstract class BaseTrackSelection implements ExoTrackSelection { /** The selected {@link TrackGroup}. */ protected final TrackGroup group; + /** The number of selected tracks within the {@link TrackGroup}. Always greater than zero. */ protected final int length; + /** The indices of the selected tracks in {@link #group}, in order of decreasing bandwidth. */ protected final int[] tracks; /** The type of the selection. */ private final @Type int type; + /** The {@link Format}s of the selected tracks, in order of decreasing bandwidth. */ private final Format[] formats; + /** Selected track exclusion timestamps, in order of decreasing bandwidth. */ private final long[] excludeUntilTimes; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/DefaultTrackSelector.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/DefaultTrackSelector.java index af67f3b346..7d3ff55245 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/DefaultTrackSelector.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/DefaultTrackSelector.java @@ -1663,6 +1663,7 @@ public class DefaultTrackSelector extends MappingTrackSelector */ @SuppressWarnings("deprecation") public static final Parameters DEFAULT_WITHOUT_CONTEXT = new Builder().build(); + /** * @deprecated This instance is not configured using {@link Context} constraints. Use {@link * #getDefaults(Context)} instead. @@ -1682,6 +1683,7 @@ public class DefaultTrackSelector extends MappingTrackSelector * {@code true}. */ public final boolean exceedVideoConstraintsIfNecessary; + /** * Whether to allow adaptive video selections containing mixed MIME types. Adaptations between * different MIME types may not be completely seamless, in which case {@link @@ -1689,11 +1691,13 @@ public class DefaultTrackSelector extends MappingTrackSelector * selections to be made. The default value is {@code false}. */ public final boolean allowVideoMixedMimeTypeAdaptiveness; + /** * Whether to allow adaptive video selections where adaptation may not be completely seamless. * The default value is {@code true}. */ public final boolean allowVideoNonSeamlessAdaptiveness; + /** * Whether to allow adaptive video selections with mixed levels of {@link * RendererCapabilities.DecoderSupport} and {@link @@ -1708,28 +1712,33 @@ public class DefaultTrackSelector extends MappingTrackSelector * when no selection can be made otherwise. The default value is {@code true}. */ public final boolean exceedAudioConstraintsIfNecessary; + /** * Whether to allow adaptive audio selections containing mixed MIME types. Adaptations between * different MIME types may not be completely seamless. The default value is {@code false}. */ public final boolean allowAudioMixedMimeTypeAdaptiveness; + /** * Whether to allow adaptive audio selections containing mixed sample rates. Adaptations between * different sample rates may not be completely seamless. The default value is {@code false}. */ public final boolean allowAudioMixedSampleRateAdaptiveness; + /** * Whether to allow adaptive audio selections containing mixed channel counts. Adaptations * between different channel counts may not be completely seamless. The default value is {@code * false}. */ public final boolean allowAudioMixedChannelCountAdaptiveness; + /** * Whether to allow adaptive audio selections with mixed levels of {@link * RendererCapabilities.DecoderSupport} and {@link * RendererCapabilities.HardwareAccelerationSupport}. */ public final boolean allowAudioMixedDecoderSupportAdaptiveness; + /** * Whether to constrain audio track selection so that the selected track's channel count does * not exceed the device's output capabilities. The default value is {@code true}. @@ -1748,8 +1757,10 @@ public class DefaultTrackSelector extends MappingTrackSelector * {@code true}. */ public final boolean exceedRendererCapabilitiesIfNecessary; + /** Whether to enable tunneling if possible. */ public final boolean tunnelingEnabled; + /** * Whether multiple adaptive selections with more than one track are allowed. The default value * is {@code true}. @@ -2202,8 +2213,10 @@ public class DefaultTrackSelector extends MappingTrackSelector /** Track is not eligible for selection. */ protected static final int SELECTION_ELIGIBILITY_NO = 0; + /** Track is eligible for a fixed selection with one track. */ protected static final int SELECTION_ELIGIBILITY_FIXED = 1; + /** * Track is eligible for both a fixed selection and as part of an adaptive selection with multiple * tracks. @@ -2224,6 +2237,7 @@ public class DefaultTrackSelector extends MappingTrackSelector first == Format.NO_VALUE ? (second == Format.NO_VALUE ? 0 : -1) : (second == Format.NO_VALUE ? 1 : (first - second))); + /** Ordering where all elements are equal. */ private static final Ordering NO_ORDER = Ordering.from((first, second) -> 0); diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/ExoTrackSelection.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/ExoTrackSelection.java index 92c11d9039..1bf5c2b7c7 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/ExoTrackSelection.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/ExoTrackSelection.java @@ -43,8 +43,10 @@ public interface ExoTrackSelection extends TrackSelection { final class Definition { /** The {@link TrackGroup} which tracks belong to. */ public final TrackGroup group; + /** The indices of the selected tracks in {@link #group}. */ public final int[] tracks; + /** The type that will be returned from {@link TrackSelection#getType()}. */ public final @Type int type; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/MappingTrackSelector.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/MappingTrackSelector.java index 2340da03a9..bc0de4ad25 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/MappingTrackSelector.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/MappingTrackSelector.java @@ -77,8 +77,10 @@ public abstract class MappingTrackSelector extends TrackSelector { RENDERER_SUPPORT_PLAYABLE_TRACKS }) public @interface RendererSupport {} + /** The renderer does not have any associated tracks. */ public static final int RENDERER_SUPPORT_NO_TRACKS = 0; + /** * The renderer has tracks mapped to it, but all are unsupported. In other words, {@link * #getTrackSupport(int, int, int)} returns {@link C#FORMAT_UNSUPPORTED_DRM}, {@link @@ -86,6 +88,7 @@ public abstract class MappingTrackSelector extends TrackSelector { * the renderer. */ public static final int RENDERER_SUPPORT_UNSUPPORTED_TRACKS = 1; + /** * The renderer has tracks mapped to it and at least one is of a supported type, but all such * tracks exceed the renderer's capabilities. In other words, {@link #getTrackSupport(int, int, @@ -93,6 +96,7 @@ public abstract class MappingTrackSelector extends TrackSelector { * renderer, but does not return {@link C#FORMAT_HANDLED} for any tracks mapped to the renderer. */ public static final int RENDERER_SUPPORT_EXCEEDS_CAPABILITIES_TRACKS = 2; + /** * The renderer has tracks mapped to it, and at least one such track is playable. In other * words, {@link #getTrackSupport(int, int, int)} returns {@link C#FORMAT_HANDLED} for at least diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/TrackSelection.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/TrackSelection.java index ff496ca5d9..47d1e87735 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/TrackSelection.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/TrackSelection.java @@ -47,8 +47,10 @@ public interface TrackSelection { open = true, value = {TYPE_UNSET}) @interface Type {} + /** An unspecified track selection type. */ int TYPE_UNSET = 0; + /** The first value that can be used for application specific track selection types. */ int TYPE_CUSTOM_BASE = 10000; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/TrackSelectorResult.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/TrackSelectorResult.java index f0187c08d7..a59284d84b 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/TrackSelectorResult.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/TrackSelectorResult.java @@ -28,15 +28,19 @@ public final class TrackSelectorResult { /** The number of selections in the result. Greater than or equal to zero. */ public final int length; + /** * A {@link RendererConfiguration} for each renderer. A null entry indicates the corresponding * renderer should be disabled. */ public final @NullableType RendererConfiguration[] rendererConfigurations; + /** A {@link ExoTrackSelection} array containing the track selection for each renderer. */ public final @NullableType ExoTrackSelection[] selections; + /** Describe the tracks and which one were selected. */ public final Tracks tracks; + /** * An opaque object that will be returned to {@link TrackSelector#onSelectionActivated(Object)} * should the selections be activated. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/CachedRegionTracker.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/CachedRegionTracker.java index bee8c01878..0c088324a1 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/CachedRegionTracker.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/CachedRegionTracker.java @@ -182,8 +182,10 @@ public final class CachedRegionTracker implements Cache.Listener { /** The first byte of the region (inclusive). */ public long startOffset; + /** End offset of the region (exclusive). */ public long endOffset; + /** * The index in chunkIndex that contains the end offset. May be -1 if the end offset comes * before the start of the first media chunk (i.e. if the end offset is within the stream diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/CmcdConfiguration.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/CmcdConfiguration.java index f1fffdbe30..f3efc1af13 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/CmcdConfiguration.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/CmcdConfiguration.java @@ -177,6 +177,7 @@ public final class CmcdConfiguration { * Maximum length is 64 characters. */ @Nullable public final String sessionId; + /** * A GUID identifying the current content, or {@code null} if unset. * @@ -184,6 +185,7 @@ public final class CmcdConfiguration { * updated at the discretion of the service provider. Maximum length is 64 characters. */ @Nullable public final String contentId; + /** Dynamic request specific configuration. */ public final RequestConfig requestConfig; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/CmcdLog.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/CmcdLog.java index 823c0a3867..82df4529f7 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/CmcdLog.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/CmcdLog.java @@ -155,6 +155,7 @@ public final class CmcdLog { * values, the peak value should be transmitted. */ public final int bitrateKbps; + /** * Custom data where the values of the keys vary with the object being requested, or {@code * null} if unset. @@ -239,6 +240,7 @@ public final class CmcdLog { *

This value MUST be rounded to the nearest 100 ms. */ public final long bufferLengthMs; + /** * Custom data where the values of the keys vary with each request, or {@code null} if unset. * @@ -331,6 +333,7 @@ public final class CmcdLog { * updated at the discretion of the service provider. Maximum length is 64 characters. */ @Nullable public final String contentId; + /** * A GUID identifying the current playback session, or {@code null} if unset. * @@ -338,6 +341,7 @@ public final class CmcdLog { * Maximum length is 64 characters. */ @Nullable public final String sessionId; + /** * Custom data where the values of the keys are expected to be invariant over the life of the * session, or {@code null} if unset. @@ -434,6 +438,7 @@ public final class CmcdLog { * 100kbps. */ public final int maximumRequestedThroughputKbps; + /** * Custom data where the values of the keys do not vary with every request or object, or {@code * null} if unset. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/DefaultBandwidthMeter.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/DefaultBandwidthMeter.java index 43a4f0f6db..c14c090452 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/DefaultBandwidthMeter.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/DefaultBandwidthMeter.java @@ -84,26 +84,31 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList * #getInitialBitrateCountryGroupAssignment}. */ private static final int COUNTRY_GROUP_INDEX_WIFI = 0; + /** * Index for the 2G group index in the array returned by {@link * #getInitialBitrateCountryGroupAssignment}. */ private static final int COUNTRY_GROUP_INDEX_2G = 1; + /** * Index for the 3G group index in the array returned by {@link * #getInitialBitrateCountryGroupAssignment}. */ private static final int COUNTRY_GROUP_INDEX_3G = 2; + /** * Index for the 4G group index in the array returned by {@link * #getInitialBitrateCountryGroupAssignment}. */ private static final int COUNTRY_GROUP_INDEX_4G = 3; + /** * Index for the 5G-NSA group index in the array returned by {@link * #getInitialBitrateCountryGroupAssignment}. */ private static final int COUNTRY_GROUP_INDEX_5G_NSA = 4; + /** * Index for the 5G-SA group index in the array returned by {@link * #getInitialBitrateCountryGroupAssignment}. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy.java index 6c5d66857a..39d5c78b64 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy.java @@ -34,17 +34,21 @@ public class DefaultLoadErrorHandlingPolicy implements LoadErrorHandlingPolicy { /** The default minimum number of times to retry loading data prior to propagating the error. */ public static final int DEFAULT_MIN_LOADABLE_RETRY_COUNT = 3; + /** * The default minimum number of times to retry loading prior to failing for progressive live * streams. */ public static final int DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE = 6; + /** The default duration for which a track is excluded in milliseconds. */ public static final long DEFAULT_TRACK_EXCLUSION_MS = 60_000; + /** * @deprecated Use {@link #DEFAULT_TRACK_EXCLUSION_MS} instead. */ @Deprecated public static final long DEFAULT_TRACK_BLACKLIST_MS = DEFAULT_TRACK_EXCLUSION_MS; + /** The default duration for which a location is excluded in milliseconds. */ public static final long DEFAULT_LOCATION_EXCLUSION_MS = 5 * 60_000; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.java index 40e5c13c2c..3315a96fb7 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.java @@ -65,6 +65,7 @@ public interface LoadErrorHandlingPolicy { * exact same data can be requested). */ int FALLBACK_TYPE_LOCATION = 1; + /** * Fallback to a different track (i.e., a different representation of the same content; for * example the same video encoded at a different bitrate or resolution). @@ -76,10 +77,13 @@ public interface LoadErrorHandlingPolicy { /** The {@link LoadEventInfo} associated with the load that encountered an error. */ public final LoadEventInfo loadEventInfo; + /** {@link MediaLoadData} associated with the load that encountered an error. */ public final MediaLoadData mediaLoadData; + /** The exception associated to the load error. */ public final IOException exception; + /** The number of errors this load task has encountered, including this one. */ public final int errorCount; @@ -100,10 +104,13 @@ public interface LoadErrorHandlingPolicy { final class FallbackOptions { /** The number of available locations. */ public final int numberOfLocations; + /** The number of locations that are already excluded. */ public final int numberOfExcludedLocations; + /** The number of tracks. */ public final int numberOfTracks; + /** The number of tracks that are already excluded. */ public final int numberOfExcludedTracks; @@ -131,6 +138,7 @@ public interface LoadErrorHandlingPolicy { final class FallbackSelection { /** The type of fallback. */ public final @FallbackType int type; + /** The duration for which the failing resource should be excluded, in milliseconds. */ public final long exclusionDurationMs; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/Loader.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/Loader.java index a033f1b4bb..2b9c45259d 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/Loader.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/Loader.java @@ -164,12 +164,15 @@ public final class Loader implements LoaderErrorThrower { /** Retries the load using the default delay. */ public static final LoadErrorAction RETRY = createRetryAction(/* resetErrorCount= */ false, C.TIME_UNSET); + /** Retries the load using the default delay and resets the error count. */ public static final LoadErrorAction RETRY_RESET_ERROR_COUNT = createRetryAction(/* resetErrorCount= */ true, C.TIME_UNSET); + /** Discards the failed {@link Loadable} and ignores any errors that have occurred. */ public static final LoadErrorAction DONT_RETRY = new LoadErrorAction(ACTION_TYPE_DONT_RETRY, C.TIME_UNSET); + /** * Discards the failed {@link Loadable}. The next call to {@link #maybeThrowError()} will throw * the last load error. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/ParsingLoadable.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/ParsingLoadable.java index 859f920713..c9aaa329fc 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/ParsingLoadable.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/ParsingLoadable.java @@ -93,8 +93,10 @@ public final class ParsingLoadable implements Loadable { /** Identifies the load task for this loadable. */ public final long loadTaskId; + /** The {@link DataSpec} that defines the data to be loaded. */ public final DataSpec dataSpec; + /** * The type of the data. One of the {@code DATA_TYPE_*} constants defined in {@link C}. For * reporting only. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.java index 9f00daf019..4486436e7d 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/experimental/ExperimentalBandwidthMeter.java @@ -88,26 +88,31 @@ public final class ExperimentalBandwidthMeter implements BandwidthMeter, Transfe * #getInitialBitrateCountryGroupAssignment}. */ private static final int COUNTRY_GROUP_INDEX_WIFI = 0; + /** * Index for the 2G group index in the array returned by {@link * #getInitialBitrateCountryGroupAssignment}. */ private static final int COUNTRY_GROUP_INDEX_2G = 1; + /** * Index for the 3G group index in the array returned by {@link * #getInitialBitrateCountryGroupAssignment}. */ private static final int COUNTRY_GROUP_INDEX_3G = 2; + /** * Index for the 4G group index in the array returned by {@link * #getInitialBitrateCountryGroupAssignment}. */ private static final int COUNTRY_GROUP_INDEX_4G = 3; + /** * Index for the 5G-NSA group index in the array returned by {@link * #getInitialBitrateCountryGroupAssignment}. */ private static final int COUNTRY_GROUP_INDEX_5G_NSA = 4; + /** * Index for the 5G-SA group index in the array returned by {@link * #getInitialBitrateCountryGroupAssignment}. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/experimental/SlidingWeightedAverageBandwidthStatistic.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/experimental/SlidingWeightedAverageBandwidthStatistic.java index e4de6cd337..81895f915b 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/experimental/SlidingWeightedAverageBandwidthStatistic.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/experimental/SlidingWeightedAverageBandwidthStatistic.java @@ -34,8 +34,10 @@ public class SlidingWeightedAverageBandwidthStatistic implements BandwidthStatis public static class Sample { /** The sample bitrate. */ public final long bitrate; + /** The sample weight. */ public final double weight; + /** * The time this sample was added, in milliseconds. Timestamps should come from the same source, * so that samples can reliably be ordered in time. It is suggested to use {@link diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/DecoderVideoRenderer.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/DecoderVideoRenderer.java index e1e03f875b..b02b6fd3c8 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/DecoderVideoRenderer.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/DecoderVideoRenderer.java @@ -90,14 +90,17 @@ public abstract class DecoderVideoRenderer extends BaseRenderer { REINITIALIZATION_STATE_WAIT_END_OF_STREAM }) private @interface ReinitializationState {} + /** The decoder does not need to be re-initialized. */ private static final int REINITIALIZATION_STATE_NONE = 0; + /** * The input format has changed in a way that requires the decoder to be re-initialized, but we * haven't yet signaled an end of stream to the existing decoder. We need to do so in order to * ensure that it outputs any remaining buffers before we release it. */ private static final int REINITIALIZATION_STATE_SIGNAL_END_OF_STREAM = 1; + /** * The input format has changed in a way that requires the decoder to be re-initialized, and we've * signaled an end of stream to the existing decoder. We're waiting for the decoder to output an diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/FixedFrameRateEstimator.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/FixedFrameRateEstimator.java index e0b47cae78..0a8a7ef56d 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/FixedFrameRateEstimator.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/FixedFrameRateEstimator.java @@ -27,6 +27,7 @@ import java.util.Arrays; /** The number of consecutive matching frame durations required to detect a fixed frame rate. */ public static final int CONSECUTIVE_MATCHING_FRAME_DURATIONS_FOR_SYNC = 15; + /** * The maximum amount frame durations can differ for them to be considered matching, in * nanoseconds. @@ -140,10 +141,13 @@ import java.util.Arrays; /** The total number of frames that have matched the frame duration being tracked. */ private long matchingFrameCount; + /** The sum of the frame durations of all matching frames. */ private long matchingFrameDurationSumNs; + /** Cyclic buffer of flags indicating whether the most recent frame durations were outliers. */ private final boolean[] recentFrameOutlierFlags; + /** * The number of recent frame durations that were outliers. Equal to the number of {@code true} * values in {@link #recentFrameOutlierFlags}. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/MediaCodecVideoRenderer.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/MediaCodecVideoRenderer.java index fa161cf632..76ccd9beca 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/MediaCodecVideoRenderer.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/MediaCodecVideoRenderer.java @@ -1930,6 +1930,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { @Nullable private VideoFrameProcessor videoFrameProcessor; @Nullable private CopyOnWriteArrayList videoEffects; @Nullable private Format inputFormat; + /** * The current frame {@link Format} and the earliest presentationTimeUs that associates to it. */ @@ -1957,6 +1958,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { private long lastCodecBufferPresentationTimestampUs; private VideoSize processedFrameSize; private boolean pendingOutputSizeChange; + /** The presentation time, after which the listener should be notified about the size change. */ private long pendingOutputSizeChangeNotificationTimeUs; @@ -2461,6 +2463,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { listener); } } + /** * Returns a maximum video size to use when configuring a codec for {@code format} in a way that * will allow possible adaptation to other compatible formats that are expected to have the same diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/VideoFrameReleaseHelper.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/VideoFrameReleaseHelper.java index bfac6433f6..11f179b974 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/VideoFrameReleaseHelper.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/VideoFrameReleaseHelper.java @@ -80,11 +80,13 @@ public final class VideoFrameReleaseHelper { /** The period between sampling display VSYNC timestamps, in milliseconds. */ private static final long VSYNC_SAMPLE_UPDATE_PERIOD_MS = 500; + /** * The maximum adjustment that can be made to a frame release timestamp, in nanoseconds, excluding * the part of the adjustment that aligns frame release timestamps with the display VSYNC. */ private static final long MAX_ALLOWED_ADJUSTMENT_NS = 20_000_000; + /** * If a frame is targeted to a display VSYNC with timestamp {@code vsyncTime}, the adjusted frame * release timestamp will be calculated as {@code releaseTime = vsyncTime - ((vsyncDuration * @@ -101,12 +103,14 @@ public final class VideoFrameReleaseHelper { /** The media frame rate specified in the {@link Format}. */ private float formatFrameRate; + /** * The media frame rate used to calculate the playback frame rate of the {@link Surface}. This may * be different to {@link #formatFrameRate} if {@link #formatFrameRate} is unspecified or * inaccurate. */ private float surfaceMediaFrameRate; + /** The playback frame rate set on the {@link Surface}. */ private float surfacePlaybackFrameRate; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/spherical/Projection.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/spherical/Projection.java index 98add9b58e..107522d667 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/spherical/Projection.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/spherical/Projection.java @@ -35,15 +35,19 @@ import java.lang.annotation.Target; @Target(TYPE_USE) @IntDef({DRAW_MODE_TRIANGLES, DRAW_MODE_TRIANGLES_STRIP, DRAW_MODE_TRIANGLES_FAN}) public @interface DrawMode {} + /** Triangle draw mode. */ public static final int DRAW_MODE_TRIANGLES = 0; + /** Triangle strip draw mode. */ public static final int DRAW_MODE_TRIANGLES_STRIP = 1; + /** Triangle fan draw mode. */ public static final int DRAW_MODE_TRIANGLES_FAN = 2; /** Number of position coordinates per vertex. */ public static final int TEXTURE_COORDS_PER_VERTEX = 2; + /** Number of texture coordinates per vertex. */ public static final int POSITION_COORDS_PER_VERTEX = 3; @@ -154,13 +158,16 @@ import java.lang.annotation.Target; /** The Mesh corresponding to the left eye. */ public final Mesh leftMesh; + /** * The Mesh corresponding to the right eye. If {@code singleMesh} is true then this mesh is * identical to {@link #leftMesh}. */ public final Mesh rightMesh; + /** The stereo mode. */ public final @StereoMode int stereoMode; + /** Whether the left and right mesh are identical. */ public final boolean singleMesh; @@ -196,10 +203,13 @@ import java.lang.annotation.Target; /** Texture ID. */ public final int textureId; + /** The drawing mode. One of {@link DrawMode}. */ public final @DrawMode int mode; + /** The SubMesh vertices. */ public final float[] vertices; + /** The SubMesh texture coordinates. */ public final float[] textureCoords; diff --git a/libraries/exoplayer/src/test/java/androidx/media3/exoplayer/offline/DownloadManagerTest.java b/libraries/exoplayer/src/test/java/androidx/media3/exoplayer/offline/DownloadManagerTest.java index 337736d9e3..e3bdc1343f 100644 --- a/libraries/exoplayer/src/test/java/androidx/media3/exoplayer/offline/DownloadManagerTest.java +++ b/libraries/exoplayer/src/test/java/androidx/media3/exoplayer/offline/DownloadManagerTest.java @@ -51,10 +51,13 @@ public class DownloadManagerTest { /** Timeout to use when blocking on conditions that we expect to become unblocked. */ private static final int TIMEOUT_MS = 10_000; + /** An application provided stop reason. */ private static final int APP_STOP_REASON = 1; + /** The minimum number of times a download must be retried before failing. */ private static final int MIN_RETRY_COUNT = 3; + /** Test value for the current time. */ private static final long NOW_MS = 1234; diff --git a/libraries/exoplayer/src/test/java/androidx/media3/exoplayer/source/SampleQueueTest.java b/libraries/exoplayer/src/test/java/androidx/media3/exoplayer/source/SampleQueueTest.java index a7f935ef17..410a8c8f40 100644 --- a/libraries/exoplayer/src/test/java/androidx/media3/exoplayer/source/SampleQueueTest.java +++ b/libraries/exoplayer/src/test/java/androidx/media3/exoplayer/source/SampleQueueTest.java @@ -123,6 +123,7 @@ public final class SampleQueueTest { private static final long[] ENCRYPTED_SAMPLE_TIMESTAMPS = new long[] {0, 1000, 2000, 3000}; private static final Format[] ENCRYPTED_SAMPLE_FORMATS = new Format[] {FORMAT_ENCRYPTED, FORMAT_ENCRYPTED, FORMAT_1, FORMAT_ENCRYPTED}; + /** Encrypted samples require the encryption preamble. */ private static final int[] ENCRYPTED_SAMPLE_SIZES = new int[] {1, 3, 1, 3}; diff --git a/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/DashMediaSource.java b/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/DashMediaSource.java index fede790776..71586a83b0 100644 --- a/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/DashMediaSource.java +++ b/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/DashMediaSource.java @@ -367,10 +367,12 @@ public final class DashMediaSource extends BaseMediaSource { * if no value is defined in the {@link MediaItem} or the manifest. */ public static final long DEFAULT_FALLBACK_TARGET_LIVE_OFFSET_MS = 30_000; + /** * @deprecated Use {@link #DEFAULT_FALLBACK_TARGET_LIVE_OFFSET_MS} instead. */ @Deprecated public static final long DEFAULT_LIVE_PRESENTATION_DELAY_MS = 30_000; + /** The media id used by media items of dash media sources without a manifest URI. */ public static final String DEFAULT_MEDIA_ID = "DashMediaSource"; diff --git a/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/BaseUrl.java b/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/BaseUrl.java index 6f2dc6c800..21ecb512b8 100644 --- a/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/BaseUrl.java +++ b/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/BaseUrl.java @@ -25,17 +25,22 @@ public final class BaseUrl { /** The default weight. */ public static final int DEFAULT_WEIGHT = 1; + /** The default priority. */ public static final int DEFAULT_DVB_PRIORITY = 1; + /** Constant representing an unset priority in a manifest that does not declare a DVB profile. */ public static final int PRIORITY_UNSET = Integer.MIN_VALUE; /** The URL. */ public final String url; + /** The service location. */ public final String serviceLocation; + /** The priority. */ public final int priority; + /** The weight. */ public final int weight; diff --git a/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/Descriptor.java b/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/Descriptor.java index 7e3aae9d27..66e2d56f86 100644 --- a/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/Descriptor.java +++ b/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/Descriptor.java @@ -25,8 +25,10 @@ public final class Descriptor { /** The scheme URI. */ public final String schemeIdUri; + /** The value, or null. */ @Nullable public final String value; + /** The identifier, or null. */ @Nullable public final String id; diff --git a/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/Representation.java b/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/Representation.java index e3422a8a2f..f17ec5477b 100644 --- a/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/Representation.java +++ b/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/Representation.java @@ -44,16 +44,22 @@ public abstract class Representation { * often a suitable. */ public final long revisionId; + /** The format of the representation. */ public final Format format; + /** The base URLs of the representation. */ public final ImmutableList baseUrls; + /** The offset of the presentation timestamps in the media stream relative to media time. */ public final long presentationTimeOffsetUs; + /** The in-band event streams in the representation. May be empty. */ public final List inbandEventStreams; + /** Essential properties in the representation. May be empty. */ public final List essentialProperties; + /** Supplemental properties in the adaptation set. May be empty. */ public final List supplementalProperties; @@ -181,6 +187,7 @@ public abstract class Representation { /** The uri of the single segment. */ public final Uri uri; + /** The content length, or {@link C#LENGTH_UNSET} if unknown. */ public final long contentLength; diff --git a/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/ServiceDescriptionElement.java b/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/ServiceDescriptionElement.java index 209815976a..3d737c069f 100644 --- a/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/ServiceDescriptionElement.java +++ b/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/manifest/ServiceDescriptionElement.java @@ -24,15 +24,19 @@ public final class ServiceDescriptionElement { /** The target live offset in milliseconds, or {@link C#TIME_UNSET} if undefined. */ public final long targetOffsetMs; + /** The minimum live offset in milliseconds, or {@link C#TIME_UNSET} if undefined. */ public final long minOffsetMs; + /** The maximum live offset in milliseconds, or {@link C#TIME_UNSET} if undefined. */ public final long maxOffsetMs; + /** * The minimum factor by which playback can be sped up for live speed adjustment, or {@link * C#RATE_UNSET} if undefined. */ public final float minPlaybackSpeed; + /** * The maximum factor by which playback can be sped up for live speed adjustment, or {@link * C#RATE_UNSET} if undefined. diff --git a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsChunkSource.java b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsChunkSource.java index 56d74f8785..ad0631321a 100644 --- a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsChunkSource.java +++ b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsChunkSource.java @@ -107,8 +107,10 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; /** Indicates that the chunk is based on a preload hint. */ public static final int CHUNK_PUBLICATION_STATE_PRELOAD = 0; + /** Indicates that the chunk is definitely published. */ public static final int CHUNK_PUBLICATION_STATE_PUBLISHED = 1; + /** * Indicates that the chunk has been removed from the playlist. * diff --git a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsManifest.java b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsManifest.java index d7e974aecc..7e1791d8fb 100644 --- a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsManifest.java +++ b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsManifest.java @@ -25,6 +25,7 @@ public final class HlsManifest { /** The multivariant playlist of an HLS stream. */ public final HlsMultivariantPlaylist multivariantPlaylist; + /** A snapshot of a media playlist referred to by {@link #multivariantPlaylist}. */ public final HlsMediaPlaylist mediaPlaylist; diff --git a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsMediaSource.java b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsMediaSource.java index 8ca9750ce3..08144895fb 100644 --- a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsMediaSource.java +++ b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsMediaSource.java @@ -93,6 +93,7 @@ public final class HlsMediaSource extends BaseMediaSource /** Type for ID3 metadata in HLS streams. */ public static final int METADATA_TYPE_ID3 = 1; + /** Type for ESMG metadata in HLS streams. */ public static final int METADATA_TYPE_EMSG = 3; diff --git a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsTrackMetadataEntry.java b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsTrackMetadataEntry.java index 37f98e68fa..5f864a4dd1 100644 --- a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsTrackMetadataEntry.java +++ b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsTrackMetadataEntry.java @@ -164,11 +164,13 @@ public final class HlsTrackMetadataEntry implements Metadata.Entry { * track is not derived from an EXT-X-MEDIA TAG. */ @Nullable public final String groupId; + /** * The NAME value of this track, if the track is derived from an EXT-X-MEDIA tag. Null if the * track is not derived from an EXT-X-MEDIA TAG. */ @Nullable public final String name; + /** * The EXT-X-STREAM-INF tags attributes associated with this track. This field is non-applicable * (and therefore empty) if this track is derived from an EXT-X-MEDIA tag. diff --git a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsMediaPlaylist.java b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsMediaPlaylist.java index 5e6baec46b..0555f37be9 100644 --- a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsMediaPlaylist.java +++ b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsMediaPlaylist.java @@ -49,20 +49,24 @@ public final class HlsMediaPlaylist extends HlsPlaylist { * are not supported. */ public final long skipUntilUs; + /** * Whether the playlist can produce delta updates that skip older #EXT-X-DATERANGE tags in * addition to media segments. */ public final boolean canSkipDateRanges; + /** * The server-recommended live offset in microseconds, or {@link C#TIME_UNSET} if none defined. */ public final long holdBackUs; + /** * The server-recommended live offset in microseconds in low-latency mode, or {@link * C#TIME_UNSET} if none defined. */ public final long partHoldBackUs; + /** Whether the server supports blocking playlist reload. */ public final boolean canBlockReload; @@ -95,6 +99,7 @@ public final class HlsMediaPlaylist extends HlsPlaylist { /** The human readable title of the segment. */ public final String title; + /** The parts belonging to this segment. */ public final List parts; @@ -206,6 +211,7 @@ public final class HlsMediaPlaylist extends HlsPlaylist { /** Whether the part is independent. */ public final boolean isIndependent; + /** Whether the part is a preloading part. */ public final boolean isPreload; @@ -279,44 +285,54 @@ public final class HlsMediaPlaylist extends HlsPlaylist { public static class SegmentBase implements Comparable { /** The url of the segment. */ public final String url; + /** * The media initialization section for this segment, as defined by #EXT-X-MAP. May be null if * the media playlist does not define a media initialization section for this segment. The same * instance is used for all segments that share an EXT-X-MAP tag. */ @Nullable public final Segment initializationSegment; + /** The duration of the segment in microseconds, as defined by #EXTINF or #EXT-X-PART. */ public final long durationUs; + /** The number of #EXT-X-DISCONTINUITY tags in the playlist before the segment. */ public final int relativeDiscontinuitySequence; + /** The start time of the segment in microseconds, relative to the start of the playlist. */ public final long relativeStartTimeUs; + /** * DRM initialization data for sample decryption, or null if the segment does not use CDM-DRM * protection. */ @Nullable public final DrmInitData drmInitData; + /** * The encryption identity key uri as defined by #EXT-X-KEY, or null if the segment does not use * full segment encryption with identity key. */ @Nullable public final String fullSegmentEncryptionKeyUri; + /** * The encryption initialization vector as defined by #EXT-X-KEY, or null if the segment is not * encrypted. */ @Nullable public final String encryptionIV; + /** * The segment's byte range offset, as defined by #EXT-X-BYTERANGE, #EXT-X-PART or * #EXT-X-PRELOAD-HINT. */ public final long byteRangeOffset; + /** * The segment's byte range length, as defined by #EXT-X-BYTERANGE, #EXT-X-PART or * #EXT-X-PRELOAD-HINT, or {@link C#LENGTH_UNSET} if no byte range is specified or the byte * range is open-ended. */ public final long byteRangeLength; + /** Whether the segment is marked as a gap. */ public final boolean hasGapTag; @@ -361,8 +377,10 @@ public final class HlsMediaPlaylist extends HlsPlaylist { public static final class RenditionReport { /** The URI of the media playlist of the reported rendition. */ public final Uri playlistUri; + /** The last media sequence that is in the playlist of the reported rendition. */ public final long lastMediaSequence; + /** * The last part index that is in the playlist of the reported rendition, or {@link * C#INDEX_UNSET} if the rendition does not contain partial segments. @@ -399,65 +417,83 @@ public final class HlsMediaPlaylist extends HlsPlaylist { /** The type of the playlist. See {@link PlaylistType}. */ public final @PlaylistType int playlistType; + /** * The start offset in microseconds from the beginning of the playlist, as defined by * #EXT-X-START, or {@link C#TIME_UNSET} if undefined. The value is guaranteed to be between 0 and * {@link #durationUs}, inclusive. */ public final long startOffsetUs; + /** * Whether the {@link #startOffsetUs} was explicitly defined by #EXT-X-START as a positive value * or zero. */ public final boolean hasPositiveStartOffset; + /** Whether the start position should be precise, as defined by #EXT-X-START. */ public final boolean preciseStart; + /** * If {@link #hasProgramDateTime} is true, contains the datetime as microseconds since epoch. * Otherwise, contains the aggregated duration of removed segments up to this snapshot of the * playlist. */ public final long startTimeUs; + /** Whether the playlist contains the #EXT-X-DISCONTINUITY-SEQUENCE tag. */ public final boolean hasDiscontinuitySequence; + /** * The discontinuity sequence number of the first media segment in the playlist, as defined by * #EXT-X-DISCONTINUITY-SEQUENCE. */ public final int discontinuitySequence; + /** * The media sequence number of the first media segment in the playlist, as defined by * #EXT-X-MEDIA-SEQUENCE. */ public final long mediaSequence; + /** The compatibility version, as defined by #EXT-X-VERSION. */ public final int version; + /** The target duration in microseconds, as defined by #EXT-X-TARGETDURATION. */ public final long targetDurationUs; + /** * The target duration for segment parts, as defined by #EXT-X-PART-INF, or {@link C#TIME_UNSET} * if undefined. */ public final long partTargetDurationUs; + /** Whether the playlist contains the #EXT-X-ENDLIST tag. */ public final boolean hasEndTag; + /** Whether the playlist contains a #EXT-X-PROGRAM-DATE-TIME tag. */ public final boolean hasProgramDateTime; + /** * Contains the CDM protection schemes used by segments in this playlist. Does not contain any key * acquisition data. Null if none of the segments in the playlist is CDM-encrypted. */ @Nullable public final DrmInitData protectionSchemes; + /** The list of segments in the playlist. */ public final List segments; + /** * The list of parts at the end of the playlist for which the segment is not in the playlist yet. */ public final List trailingParts; + /** The rendition reports of alternative rendition playlists. */ public final Map renditionReports; + /** The total duration of the playlist in microseconds. */ public final long durationUs; + /** The attributes of the #EXT-X-SERVER-CONTROL header. */ public final ServerControl serverControl; diff --git a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsMultivariantPlaylist.java b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsMultivariantPlaylist.java index 6f70689a06..cd174f371d 100644 --- a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsMultivariantPlaylist.java +++ b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsMultivariantPlaylist.java @@ -151,14 +151,19 @@ public final class HlsMultivariantPlaylist extends HlsPlaylist { /** All of the media playlist URLs referenced by the playlist. */ public final List mediaPlaylistUrls; + /** The variants declared by the playlist. */ public final List variants; + /** The video renditions declared by the playlist. */ public final List videos; + /** The audio renditions declared by the playlist. */ public final List audios; + /** The subtitle renditions declared by the playlist. */ public final List subtitles; + /** The closed caption renditions declared by the playlist. */ public final List closedCaptions; @@ -167,14 +172,17 @@ public final class HlsMultivariantPlaylist extends HlsPlaylist { * muxed audio. */ @Nullable public final Format muxedAudioFormat; + /** * The format of the closed captions declared by the playlist. May be empty if the playlist * explicitly declares no captions are available, or null if the playlist does not declare any * captions information. */ @Nullable public final List muxedCaptionFormats; + /** Contains variable definitions, as defined by the #EXT-X-DEFINE tag. */ public final Map variableDefinitions; + /** DRM initialization data derived from #EXT-X-SESSION-KEY tags. */ public final List sessionKeyDrmInitData; diff --git a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsPlaylist.java b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsPlaylist.java index 29d1199a9a..1d7b410ed8 100644 --- a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsPlaylist.java +++ b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsPlaylist.java @@ -26,8 +26,10 @@ public abstract class HlsPlaylist implements FilterableManifest { /** The base uri. Used to resolve relative paths. */ public final String baseUri; + /** The list of tags in the playlist. */ public final List tags; + /** * Whether the media is formed of independent segments, as defined by the * #EXT-X-INDEPENDENT-SEGMENTS tag. diff --git a/libraries/exoplayer_ima/src/main/java/androidx/media3/exoplayer/ima/AdTagLoader.java b/libraries/exoplayer_ima/src/main/java/androidx/media3/exoplayer/ima/AdTagLoader.java index 91d91c2e23..c1dd3737a3 100644 --- a/libraries/exoplayer_ima/src/main/java/androidx/media3/exoplayer/ima/AdTagLoader.java +++ b/libraries/exoplayer_ima/src/main/java/androidx/media3/exoplayer/ima/AdTagLoader.java @@ -103,11 +103,13 @@ import java.util.Map; * player buffers, in milliseconds. */ private static final long THRESHOLD_END_OF_CONTENT_MS = 5000; + /** * Threshold before the start of an ad at which IMA is expected to be able to preload the ad, in * milliseconds. */ private static final long THRESHOLD_AD_PRELOAD_MS = 4000; + /** The threshold below which ad cue points are treated as matching, in microseconds. */ private static final long THRESHOLD_AD_MATCH_US = 1000; @@ -120,11 +122,13 @@ import java.util.Map; /** The ad playback state when IMA is not playing an ad. */ private static final int IMA_AD_STATE_NONE = 0; + /** * The ad playback state when IMA has called {@link ComponentListener#playAd(AdMediaInfo)} and not * {@link ComponentListener##pauseAd(AdMediaInfo)}. */ private static final int IMA_AD_STATE_PLAYING = 1; + /** * The ad playback state when IMA has called {@link ComponentListener#pauseAd(AdMediaInfo)} while * playing an ad. @@ -166,12 +170,16 @@ import java.util.Map; /** Whether IMA has sent an ad event to pause content since the last resume content event. */ private boolean imaPausedContent; + /** The current ad playback state. */ private @ImaAdState int imaAdState; + /** The current ad media info, or {@code null} if in state {@link #IMA_AD_STATE_NONE}. */ @Nullable private AdMediaInfo imaAdMediaInfo; + /** The current ad info, or {@code null} if in state {@link #IMA_AD_STATE_NONE}. */ @Nullable private AdInfo imaAdInfo; + /** Whether IMA has been notified that playback of content has finished. */ private boolean sentContentComplete; @@ -179,18 +187,22 @@ import java.util.Map; /** Whether the player is playing an ad. */ private boolean playingAd; + /** Whether the player is buffering an ad. */ private boolean bufferingAd; + /** * If the player is playing an ad, stores the ad index in its ad group. {@link C#INDEX_UNSET} * otherwise. */ private int playingAdIndexInAdGroup; + /** * The ad info for a pending ad for which the media failed preparation, or {@code null} if no * pending ads have failed to prepare. */ @Nullable private AdInfo pendingAdPrepareErrorAdInfo; + /** * If a content period has finished but IMA has not yet called {@link * ComponentListener#playAd(AdMediaInfo)}, stores the value of {@link @@ -198,18 +210,22 @@ import java.util.Map; * a fake, increasing content position. {@link C#TIME_UNSET} otherwise. */ private long fakeContentProgressElapsedRealtimeMs; + /** * If {@link #fakeContentProgressElapsedRealtimeMs} is set, stores the offset from which the * content progress should increase. {@link C#TIME_UNSET} otherwise. */ private long fakeContentProgressOffsetMs; + /** Stores the pending content position when a seek operation was intercepted to play an ad. */ private long pendingContentPositionMs; + /** * Whether {@link ComponentListener#getContentProgress()} has sent {@link * #pendingContentPositionMs} to IMA. */ private boolean sentPendingContentPositionMs; + /** * Stores the real time in milliseconds at which the player started buffering, possibly due to not * having preloaded an ad, or {@link C#TIME_UNSET} if not applicable. diff --git a/libraries/exoplayer_ima/src/main/java/androidx/media3/exoplayer/ima/ImaUtil.java b/libraries/exoplayer_ima/src/main/java/androidx/media3/exoplayer/ima/ImaUtil.java index 60ae1cd4b7..255b90ffd5 100644 --- a/libraries/exoplayer_ima/src/main/java/androidx/media3/exoplayer/ima/ImaUtil.java +++ b/libraries/exoplayer_ima/src/main/java/androidx/media3/exoplayer/ima/ImaUtil.java @@ -83,18 +83,22 @@ import java.util.Set; public interface ImaFactory { /** Creates {@link ImaSdkSettings} for configuring the IMA SDK. */ ImaSdkSettings createImaSdkSettings(); + /** * Creates {@link AdsRenderingSettings} for giving the {@link AdsManager} parameters that * control rendering of ads. */ AdsRenderingSettings createAdsRenderingSettings(); + /** * Creates an {@link AdDisplayContainer} to hold the player for video ads, a container for * non-linear ads, and slots for companion ads. */ AdDisplayContainer createAdDisplayContainer(ViewGroup container, VideoAdPlayer player); + /** Creates an {@link AdDisplayContainer} to hold the player for audio ads. */ AdDisplayContainer createAudioAdDisplayContainer(Context context, VideoAdPlayer player); + /** * Creates a {@link FriendlyObstruction} to describe an obstruction considered "friendly" for * viewability measurement purposes. @@ -103,8 +107,10 @@ import java.util.Set; View view, FriendlyObstructionPurpose friendlyObstructionPurpose, @Nullable String reasonDetail); + /** Creates an {@link AdsRequest} to contain the data used to request ads. */ AdsRequest createAdsRequest(); + /** Creates an {@link AdsLoader} for requesting ads using the specified settings. */ AdsLoader createAdsLoader( Context context, ImaSdkSettings imaSdkSettings, AdDisplayContainer adDisplayContainer); diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/MediaDescription.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/MediaDescription.java index 26d8078721..66ac29c998 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/MediaDescription.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/MediaDescription.java @@ -62,10 +62,13 @@ import java.util.HashMap; /** The assigned RTP payload type. */ public final int payloadType; + /** The encoding method used in the RTP stream. */ public final String mediaEncoding; + /** The clock rate used in the RTP stream. */ public final int clockRate; + /** The optional encoding parameter. */ public final int encodingParameters; @@ -271,31 +274,43 @@ import java.util.HashMap; @StringDef({MEDIA_TYPE_VIDEO, MEDIA_TYPE_AUDIO}) @Documented public @interface MediaType {} + /** Audio media type. */ public static final String MEDIA_TYPE_AUDIO = "audio"; + /** Video media type. */ public static final String MEDIA_TYPE_VIDEO = "video"; + /** Default RTP/AVP profile. */ public static final String RTP_AVP_PROFILE = "RTP/AVP"; /** The {@link MediaType}. */ @MediaType public final String mediaType; + /** The associated port number. */ public final int port; + /** The protocol used for data transport. */ public final String transportProtocol; + /** The assigned RTP payload type. */ public final int payloadType; + /** The estimated connection bitrate in bits per second. */ public final int bitrate; + /** The assigned media title. */ @Nullable public final String mediaTitle; + /** The connection parameters. */ @Nullable public final String connection; + /** The encryption parameter. */ @Nullable public final String key; + /** The media-specific attributes. */ public final ImmutableMap attributes; + /** The mandatory rtpmap attribute in the media description (RFC2327 Page 22). */ public final RtpMapAttribute rtpMapAttribute; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpDataLoadable.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpDataLoadable.java index debd66c472..7f2f959994 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpDataLoadable.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpDataLoadable.java @@ -68,6 +68,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; /** The track ID associated with the Loadable. */ public final int trackId; + /** The {@link RtspMediaTrack} to load. */ public final RtspMediaTrack rtspMediaTrack; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpPacket.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpPacket.java index 6df3023b37..7f3add3b75 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpPacket.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpPacket.java @@ -158,15 +158,19 @@ public final class RtpPacket { /** The RTP version field (Word 0, bits 0-1), should always be 2. */ public final byte version = RTP_VERSION; + /** The RTP padding bit (Word 0, bit 2). */ public final boolean padding; + /** The RTP extension bit (Word 0, bit 3). */ public final boolean extension; + /** The RTP CSRC count field (Word 0, bits 4-7). */ public final byte csrcCount; /** The RTP marker bit (Word 0, bit 8). */ public final boolean marker; + /** The RTP CSRC count field (Word 0, bits 9-15). */ public final byte payloadType; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpPayloadFormat.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpPayloadFormat.java index db768b84dc..92a8fb052c 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpPayloadFormat.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtpPayloadFormat.java @@ -139,12 +139,16 @@ public final class RtpPayloadFormat { /** The payload type associated with this format. */ public final int rtpPayloadType; + /** The clock rate in Hertz, associated with the format. */ public final int clockRate; + /** The {@link Format} of this RTP payload. */ public final Format format; + /** The format parameters, mapped from the SDP FMTP attribute (RFC2327 Page 22). */ public final ImmutableMap fmtpParameters; + /** The RTP media encoding. */ public final String mediaEncoding; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspAuthenticationInfo.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspAuthenticationInfo.java index d6e8a7db58..d269586dfa 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspAuthenticationInfo.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspAuthenticationInfo.java @@ -44,6 +44,7 @@ import java.security.NoSuchAlgorithmException; /** HTTP basic authentication (RFC2068 Section 11.1). */ public static final int BASIC = 1; + /** HTTP digest authentication (RFC2069). */ public static final int DIGEST = 2; @@ -62,10 +63,13 @@ import java.security.NoSuchAlgorithmException; /** The authentication mechanism. */ public final @AuthenticationMechanism int authenticationMechanism; + /** The authentication realm. */ public final String realm; + /** The nonce used in digest authentication; empty if using {@link #BASIC} authentication. */ public final String nonce; + /** The opaque used in digest authentication; empty if using {@link #BASIC} authentication. */ public final String opaque; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspClient.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspClient.java index f04b1a62c5..1589a2c43d 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspClient.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspClient.java @@ -84,12 +84,16 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; @Target(TYPE_USE) @IntDef({RTSP_STATE_UNINITIALIZED, RTSP_STATE_INIT, RTSP_STATE_READY, RTSP_STATE_PLAYING}) public @interface RtspState {} + /** RTSP uninitialized state, the state before sending any SETUP request. */ public static final int RTSP_STATE_UNINITIALIZED = -1; + /** RTSP initial state, the state after sending SETUP REQUEST. */ public static final int RTSP_STATE_INIT = 0; + /** RTSP ready state, the state after receiving SETUP, or PAUSE response. */ public static final int RTSP_STATE_READY = 1; + /** RTSP playing state, the state after receiving PLAY response. */ public static final int RTSP_STATE_PLAYING = 2; @@ -100,6 +104,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; public interface SessionInfoListener { /** Called when the session information is available. */ void onSessionTimelineUpdated(RtspSessionTiming timing, ImmutableList tracks); + /** * Called when failed to get session information from the RTSP server, or when error happened * during updating the session timeline. diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspDescribeResponse.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspDescribeResponse.java index 209e072a40..20c711b8ad 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspDescribeResponse.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspDescribeResponse.java @@ -22,8 +22,10 @@ import androidx.media3.common.util.UnstableApi; /* package */ final class RtspDescribeResponse { /** The response's headers. */ public final RtspHeaders headers; + /** The response's status code. */ public final int status; + /** The {@link SessionDescription} (see RFC2327) in the DESCRIBE response. */ public final SessionDescription sessionDescription; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMediaTrack.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMediaTrack.java index 6bcf3dcf30..6d93fd51a4 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMediaTrack.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMediaTrack.java @@ -62,12 +62,15 @@ import com.google.common.collect.ImmutableMap; /** Prefix for the RFC6381 codecs string for AAC formats. */ private static final String AAC_CODECS_PREFIX = "mp4a.40."; + /** Prefix for the RFC6381 codecs string for AVC formats. */ private static final String H264_CODECS_PREFIX = "avc1."; + /** Prefix for the RFC6416 codecs string for MPEG4V-ES formats. */ private static final String MPEG4_CODECS_PREFIX = "mp4v."; private static final String GENERIC_CONTROL_ATTR = "*"; + /** * Default height for MP4V. * @@ -97,6 +100,7 @@ import com.google.common.collect.ImmutableMap; * software VP8 decoder. */ private static final int DEFAULT_VP8_WIDTH = 320; + /** * Default height for VP8. * @@ -120,6 +124,7 @@ import com.google.common.collect.ImmutableMap; * software VP9 decoder. */ private static final int DEFAULT_VP9_WIDTH = 320; + /** * Default height for VP9. * @@ -140,6 +145,7 @@ import com.google.common.collect.ImmutableMap; * >Android's software H263 decoder. */ private static final int DEFAULT_H263_WIDTH = 352; + /** * Default height for H263. * @@ -152,6 +158,7 @@ import com.google.common.collect.ImmutableMap; /** The track's associated {@link RtpPayloadFormat}. */ public final RtpPayloadFormat payloadFormat; + /** The track's URI. */ public final Uri uri; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMessageUtil.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMessageUtil.java index 16e5dd7c19..ebdb61e91e 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMessageUtil.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMessageUtil.java @@ -54,6 +54,7 @@ import java.util.regex.Pattern; public static final class RtspSessionHeader { /** The session ID. */ public final String sessionId; + /** * The session timeout, measured in milliseconds, {@link #DEFAULT_RTSP_TIMEOUT_MS} if not * specified in the Session header. @@ -71,6 +72,7 @@ import java.util.regex.Pattern; public static final class RtspAuthUserInfo { /** The username. */ public final String username; + /** The password. */ public final String password; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspOptionsResponse.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspOptionsResponse.java index 74d067c291..9b3f564976 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspOptionsResponse.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspOptionsResponse.java @@ -24,6 +24,7 @@ import java.util.List; /* package */ final class RtspOptionsResponse { /** The response's status code. */ public final int status; + /** * A list of methods supported by the RTSP server, encoded as {@link RtspRequest.Method}; or an * empty list if the server does not disclose the supported methods. diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspPlayResponse.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspPlayResponse.java index 6b7e43576a..a7117c22b2 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspPlayResponse.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspPlayResponse.java @@ -24,8 +24,10 @@ import java.util.List; /* package */ final class RtspPlayResponse { /** The response's status code. */ public final int status; + /** The playback start timing, {@link RtspSessionTiming#DEFAULT} if not present. */ public final RtspSessionTiming sessionTiming; + /** The list of {@link RtspTrackTiming} representing the {@link RtspHeaders#RTP_INFO} header. */ public final ImmutableList trackTimingList; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspRequest.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspRequest.java index 23cff58977..f3661348e8 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspRequest.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspRequest.java @@ -87,10 +87,13 @@ import java.lang.annotation.Target; /** The {@link Uri} to which this request is sent. */ public final Uri uri; + /** The request method, as defined in {@link Method}. */ public final @Method int method; + /** The headers of this request. */ public final RtspHeaders headers; + /** The body of this RTSP message, or empty string if absent. */ public final String messageBody; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspResponse.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspResponse.java index 81134a1cdf..efa99cba72 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspResponse.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspResponse.java @@ -24,8 +24,10 @@ import androidx.media3.common.util.UnstableApi; /** The status code of this response, as defined in RFC 2326 section 11. */ public final int status; + /** The headers of this response. */ public final RtspHeaders headers; + /** The body of this RTSP message, or empty string if absent. */ public final String messageBody; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspSessionTiming.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspSessionTiming.java index c637bb5ae3..987caed782 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspSessionTiming.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspSessionTiming.java @@ -86,6 +86,7 @@ import java.util.regex.Pattern; * always zero. */ public final long startTimeMs; + /** * The stop time of the session, in milliseconds, or {@link C#TIME_UNSET} when the stop time is * not set, for example when playing a live session. diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspSetupResponse.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspSetupResponse.java index 881ae9ef3a..a62664ec1b 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspSetupResponse.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspSetupResponse.java @@ -23,8 +23,10 @@ import androidx.media3.common.util.UnstableApi; /** The response's status code. */ public final int status; + /** The Session header (RFC2326 Section 12.37). */ public final RtspMessageUtil.RtspSessionHeader sessionHeader; + /** The Transport header (RFC2326 Section 12.39). */ public final String transport; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspTrackTiming.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspTrackTiming.java index 346f0555ba..4484ead99c 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspTrackTiming.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspTrackTiming.java @@ -152,12 +152,14 @@ import com.google.common.collect.ImmutableList; *

Cannot be {@link C#TIME_UNSET} if {@link #sequenceNumber} is {@link C#INDEX_UNSET}. */ public final long rtpTimestamp; + /** * The sequence number of the next RTP packet, {@link C#INDEX_UNSET} if not present. * *

Cannot be {@link C#INDEX_UNSET} if {@link #rtpTimestamp} is {@link C#TIME_UNSET}. */ public final int sequenceNumber; + /** The {@link Uri} that identifies a matching {@link RtspMediaTrack}. */ public final Uri uri; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/SessionDescription.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/SessionDescription.java index f7fc7ae5fa..49184ecebe 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/SessionDescription.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/SessionDescription.java @@ -222,18 +222,25 @@ import java.util.HashMap; /** The only supported SDP version, will be checked against every SDP message received. */ public static final String SUPPORTED_SDP_VERSION = "0"; + /** The control attribute name. */ public static final String ATTR_CONTROL = "control"; + /** The format property attribute name. */ public static final String ATTR_FMTP = "fmtp"; + /** The length property attribute name. */ public static final String ATTR_LENGTH = "length"; + /** The range property attribute name. */ public static final String ATTR_RANGE = "range"; + /** The RTP format mapping property attribute name. */ public static final String ATTR_RTPMAP = "rtpmap"; + /** The tool property attribute name. */ public static final String ATTR_TOOL = "tool"; + /** The type property attribute name. */ public static final String ATTR_TYPE = "type"; @@ -242,28 +249,39 @@ import java.util.HashMap; * present. */ public final ImmutableMap attributes; + /** * The {@link MediaDescription MediaDescriptions} for each media track included in the session. */ public final ImmutableList mediaDescriptionList; + /** The name of a session. */ @Nullable public final String sessionName; + /** The origin sender info. */ @Nullable public final String origin; + /** The timing info. */ @Nullable public final String timing; + /** The estimated bitrate in bits per seconds. */ public final int bitrate; + /** The uri of a linked content. */ @Nullable public final Uri uri; + /** The connection info. */ @Nullable public final String connection; + /** The encryption method and key info. */ @Nullable public final String key; + /** The email info. */ @Nullable public final String emailAddress; + /** The phone number info. */ @Nullable public final String phoneNumber; + /** The session info, a detailed description of the session. */ @Nullable public final String sessionInfo; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpAacReader.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpAacReader.java index 456b911970..652876c589 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpAacReader.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpAacReader.java @@ -36,6 +36,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; /** AAC low bit rate mode, RFC3640 Section 3.3.5. */ private static final String AAC_LOW_BITRATE_MODE = "AAC-lbr"; + /** AAC high bit rate mode, RFC3640 Section 3.3.6. */ private static final String AAC_HIGH_BITRATE_MODE = "AAC-hbr"; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpAc3Reader.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpAc3Reader.java index 676476620e..707404ae62 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpAc3Reader.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpAc3Reader.java @@ -36,8 +36,10 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; /** AC3 frame types defined in RFC4184 Section 4.1.1. */ private static final int AC3_FRAME_TYPE_COMPLETE_FRAME = 0; + /** Initial fragment of frame which includes the first 5/8ths of the frame. */ private static final int AC3_FRAME_TYPE_INITIAL_FRAGMENT_A = 1; + /** Initial fragment of frame which does not include the first 5/8ths of the frame. */ private static final int AC3_FRAME_TYPE_INITIAL_FRAGMENT_B = 2; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpAmrReader.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpAmrReader.java index b175fcea7f..bf3439bc89 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpAmrReader.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpAmrReader.java @@ -37,6 +37,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; */ /* package */ final class RtpAmrReader implements RtpPayloadReader { private static final String TAG = "RtpAmrReader"; + /** * The frame size in bytes, including header (1 byte), for each of the 16 frame types for AMR-NB * (narrow band). AMR-NB supports eight narrow band speech encoding modes with bit rates between diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH263Reader.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH263Reader.java index cb3512c523..45631a43fb 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH263Reader.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH263Reader.java @@ -65,6 +65,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; private boolean isOutputFormatSet; private long startTimeOffsetUs; private long fragmentedSampleTimeUs; + /** * Whether the first packet of a H263 frame is received, it mark the start of a H263 partition. A * H263 frame can be split into multiple RTP packets. diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH264Reader.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH264Reader.java index 0403ecf6bc..836692e5c6 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH264Reader.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH264Reader.java @@ -44,6 +44,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; /** Single Time Aggregation Packet type A. */ private static final int RTP_PACKET_TYPE_STAP_A = 24; + /** Fragmentation Unit type A. */ private static final int RTP_PACKET_TYPE_FU_A = 28; @@ -63,6 +64,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; private long firstReceivedTimestamp; private int previousSequenceNumber; + /** The combined size of a sample that is fragmented into multiple RTP packets. */ private int fragmentedSampleSizeBytes; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH265Reader.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH265Reader.java index 2f77918dae..e59e680a2c 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH265Reader.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH265Reader.java @@ -40,12 +40,16 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; private static final String TAG = "RtpH265Reader"; private static final int MEDIA_CLOCK_FREQUENCY = 90_000; + /** Offset of payload data within a FU payload. */ private static final int FU_PAYLOAD_OFFSET = 3; + /** Aggregation Packet. RFC7798 Section 4.4.2. */ private static final int RTP_PACKET_TYPE_AP = 48; + /** Fragmentation Unit. RFC7798 Section 4.4.3. */ private static final int RTP_PACKET_TYPE_FU = 49; + /** IDR NAL unit types. */ private static final int NAL_IDR_W_RADL = 19; @@ -61,6 +65,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; private @C.BufferFlags int bufferFlags; private long firstReceivedTimestamp; private int previousSequenceNumber; + /** The combined size of a sample that is fragmented into multiple RTP packets. */ private int fragmentedSampleSizeBytes; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpMp4aReader.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpMp4aReader.java index 28886f2024..f294d8f6dd 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpMp4aReader.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpMp4aReader.java @@ -52,6 +52,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; private @MonotonicNonNull TrackOutput trackOutput; private long firstReceivedTimestamp; private int previousSequenceNumber; + /** The combined size of a sample that is fragmented into multiple subFrames. */ private int fragmentedSampleSizeBytes; diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpVp8Reader.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpVp8Reader.java index a167e6f205..8c9c782ee0 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpVp8Reader.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpVp8Reader.java @@ -51,12 +51,14 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; private long firstReceivedTimestamp; private int previousSequenceNumber; + /** The combined size of a sample that is fragmented into multiple RTP packets. */ private int fragmentedSampleSizeBytes; private long fragmentedSampleTimeUs; private long startTimeOffsetUs; + /** * Whether the first packet of one VP8 frame is received. A VP8 frame can be split into two RTP * packets. diff --git a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpVp9Reader.java b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpVp9Reader.java index 172588afb5..fc91741821 100644 --- a/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpVp9Reader.java +++ b/libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpVp9Reader.java @@ -55,6 +55,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; private long startTimeOffsetUs; private int previousSequenceNumber; + /** The combined size of a sample that is fragmented into multiple RTP packets. */ private int fragmentedSampleSizeBytes; @@ -62,6 +63,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; private int width; private int height; + /** * Whether the first packet of a VP9 frame is received, it mark the start of a VP9 partition. A * VP9 frame can be split into multiple RTP packets. diff --git a/libraries/exoplayer_rtsp/src/test/java/androidx/media3/exoplayer/rtsp/RtpPacketStreamDump.java b/libraries/exoplayer_rtsp/src/test/java/androidx/media3/exoplayer/rtsp/RtpPacketStreamDump.java index 5371b80015..44ebde3f47 100644 --- a/libraries/exoplayer_rtsp/src/test/java/androidx/media3/exoplayer/rtsp/RtpPacketStreamDump.java +++ b/libraries/exoplayer_rtsp/src/test/java/androidx/media3/exoplayer/rtsp/RtpPacketStreamDump.java @@ -27,14 +27,19 @@ import org.json.JSONObject; /* package */ class RtpPacketStreamDump { /** The name of the RTP track. */ public final String trackName; + /** The sequence number of the first RTP packet in the dump file. */ public final int firstSequenceNumber; + /** The timestamp of the first RTP packet in the dump file. */ public final long firstTimestamp; + /** The interval between transmitting two consecutive RTP packets, in milliseconds. */ public final long transmissionIntervalMs; + /** The description of the dumped media in SDP(RFC2327) format. */ public final String mediaDescription; + /** A list of hex strings. Each hex string represents a binary RTP packet. */ public final ImmutableList packets; diff --git a/libraries/exoplayer_rtsp/src/test/java/androidx/media3/exoplayer/rtsp/RtspServer.java b/libraries/exoplayer_rtsp/src/test/java/androidx/media3/exoplayer/rtsp/RtspServer.java index 7ba284121f..34a03fbf18 100644 --- a/libraries/exoplayer_rtsp/src/test/java/androidx/media3/exoplayer/rtsp/RtspServer.java +++ b/libraries/exoplayer_rtsp/src/test/java/androidx/media3/exoplayer/rtsp/RtspServer.java @@ -66,6 +66,7 @@ public final class RtspServer implements Closeable { } private final Thread listenerThread; + /** Runs on the thread on which the constructor was called. */ private final Handler mainHandler; diff --git a/libraries/exoplayer_smoothstreaming/src/main/java/androidx/media3/exoplayer/smoothstreaming/SsMediaSource.java b/libraries/exoplayer_smoothstreaming/src/main/java/androidx/media3/exoplayer/smoothstreaming/SsMediaSource.java index 7b81f7e50f..ac4aa92760 100644 --- a/libraries/exoplayer_smoothstreaming/src/main/java/androidx/media3/exoplayer/smoothstreaming/SsMediaSource.java +++ b/libraries/exoplayer_smoothstreaming/src/main/java/androidx/media3/exoplayer/smoothstreaming/SsMediaSource.java @@ -326,6 +326,7 @@ public final class SsMediaSource extends BaseMediaSource /** The minimum period between manifest refreshes. */ private static final int MINIMUM_MANIFEST_REFRESH_PERIOD_MS = 5000; + /** * The minimum default start position for live streams, relative to the start of the live window. */ diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/AacUtil.java b/libraries/extractor/src/main/java/androidx/media3/extractor/AacUtil.java index 82f561561b..85309bbce7 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/AacUtil.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/AacUtil.java @@ -39,8 +39,10 @@ public final class AacUtil { /** The sample rate in Hertz. */ public final int sampleRateHz; + /** The number of channels. */ public final int channelCount; + /** The RFC 6381 codecs string. */ public final String codecs; @@ -56,14 +58,17 @@ public final class AacUtil { * Number of raw audio samples that are produced per channel when decoding an AAC LC access unit. */ public static final int AAC_LC_AUDIO_SAMPLE_COUNT = 1024; + /** * Number of raw audio samples that are produced per channel when decoding an AAC XHE access unit. */ public static final int AAC_XHE_AUDIO_SAMPLE_COUNT = AAC_LC_AUDIO_SAMPLE_COUNT; + /** * Number of raw audio samples that are produced per channel when decoding an AAC HE access unit. */ public static final int AAC_HE_AUDIO_SAMPLE_COUNT = 2048; + /** * Number of raw audio samples that are produced per channel when decoding an AAC LD access unit. */ @@ -73,10 +78,13 @@ public final class AacUtil { // https://cs.android.com/android/platform/superproject/+/android-9.0.0_r8:external/aac/libAACenc/include/aacenc_lib.h;l=718 /** Maximum rate for an AAC LC audio stream, in bytes per second. */ public static final int AAC_LC_MAX_RATE_BYTES_PER_SECOND = 800 * 1000 / 8; + /** Maximum rate for an AAC HE V1 audio stream, in bytes per second. */ public static final int AAC_HE_V1_MAX_RATE_BYTES_PER_SECOND = 128 * 1000 / 8; + /** Maximum rate for an AAC HE V2 audio stream, in bytes per second. */ public static final int AAC_HE_V2_MAX_RATE_BYTES_PER_SECOND = 56 * 1000 / 8; + /** * Maximum rate for an AAC XHE audio stream, in bytes per second. * @@ -84,6 +92,7 @@ public final class AacUtil { * above the 500 kbit/s level. */ public static final int AAC_XHE_MAX_RATE_BYTES_PER_SECOND = 2048 * 1000 / 8; + /** * Maximum rate for an AAC ELD audio stream, in bytes per second. * @@ -97,6 +106,7 @@ public final class AacUtil { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350 }; private static final int AUDIO_SPECIFIC_CONFIG_CHANNEL_CONFIGURATION_INVALID = -1; + /** * In the channel configurations below, <A> indicates a single channel element; (A, B) * indicates a channel pair element; and [A] indicates a low-frequency effects element. The diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/Ac3Util.java b/libraries/extractor/src/main/java/androidx/media3/extractor/Ac3Util.java index 439e76df4b..5d4b176393 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/Ac3Util.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/Ac3Util.java @@ -53,12 +53,16 @@ public final class Ac3Util { @Target(TYPE_USE) @IntDef({STREAM_TYPE_UNDEFINED, STREAM_TYPE_TYPE0, STREAM_TYPE_TYPE1, STREAM_TYPE_TYPE2}) public @interface StreamType {} + /** Undefined AC3 stream type. */ public static final int STREAM_TYPE_UNDEFINED = -1; + /** Type 0 AC3 stream type. */ public static final int STREAM_TYPE_TYPE0 = 0; + /** Type 1 AC3 stream type. */ public static final int STREAM_TYPE_TYPE1 = 1; + /** Type 2 AC3 stream type. */ public static final int STREAM_TYPE_TYPE2 = 2; @@ -67,19 +71,25 @@ public final class Ac3Util { * MimeTypes#AUDIO_E_AC3}. */ @Nullable public final String mimeType; + /** * The type of the stream if {@link #mimeType} is {@link MimeTypes#AUDIO_E_AC3}, or {@link * #STREAM_TYPE_UNDEFINED} otherwise. */ public final @StreamType int streamType; + /** The audio sampling rate in Hz. */ public final int sampleRate; + /** The number of audio channels */ public final int channelCount; + /** The size of the frame. */ public final int frameSize; + /** Number of audio samples in the frame. */ public final int sampleCount; + /** The bitrate of audio samples. */ public final int bitrate; @@ -103,8 +113,10 @@ public final class Ac3Util { /** Maximum rate for an AC-3 audio stream, in bytes per second. */ public static final int AC3_MAX_RATE_BYTES_PER_SECOND = 640 * 1000 / 8; + /** Maximum rate for an E-AC-3 audio stream, in bytes per second. */ public static final int E_AC3_MAX_RATE_BYTES_PER_SECOND = 6144 * 1000 / 8; + /** Maximum rate for a TrueHD audio stream, in bytes per second. */ public static final int TRUEHD_MAX_RATE_BYTES_PER_SECOND = 24500 * 1000 / 8; @@ -114,6 +126,7 @@ public final class Ac3Util { * multiple of this value. */ public static final int TRUEHD_RECHUNK_SAMPLE_COUNT = 16; + /** * The number of bytes that must be parsed from a TrueHD syncframe to calculate the sample count. */ @@ -121,21 +134,28 @@ public final class Ac3Util { /** The number of new samples per (E-)AC-3 audio block. */ private static final int AUDIO_SAMPLES_PER_AUDIO_BLOCK = 256; + /** Each syncframe has 6 blocks that provide 256 new audio samples. See subsection 4.1. */ private static final int AC3_SYNCFRAME_AUDIO_SAMPLE_COUNT = 6 * AUDIO_SAMPLES_PER_AUDIO_BLOCK; + /** Number of audio blocks per E-AC-3 syncframe, indexed by numblkscod. */ private static final int[] BLOCKS_PER_SYNCFRAME_BY_NUMBLKSCOD = new int[] {1, 2, 3, 6}; + /** Sample rates, indexed by fscod. */ private static final int[] SAMPLE_RATE_BY_FSCOD = new int[] {48000, 44100, 32000}; + /** Sample rates, indexed by fscod2 (E-AC-3). */ private static final int[] SAMPLE_RATE_BY_FSCOD2 = new int[] {24000, 22050, 16000}; + /** Channel counts, indexed by acmod. */ private static final int[] CHANNEL_COUNT_BY_ACMOD = new int[] {2, 1, 2, 3, 3, 4, 4, 5}; + /** Nominal bitrates in kbps, indexed by frmsizecod / 2. (See table 4.13.) */ private static final int[] BITRATE_BY_HALF_FRMSIZECOD = new int[] { 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 576, 640 }; + /** 16-bit words per syncframe, indexed by frmsizecod / 2. (See table 4.13.) */ private static final int[] SYNCFRAME_SIZE_WORDS_BY_HALF_FRMSIZECOD_44_1 = new int[] { diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/Ac4Util.java b/libraries/extractor/src/main/java/androidx/media3/extractor/Ac4Util.java index 46513ba7b8..3386f73b41 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/Ac4Util.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/Ac4Util.java @@ -34,12 +34,16 @@ public final class Ac4Util { /** The bitstream version. */ public final int bitstreamVersion; + /** The audio sampling rate in Hz. */ public final int sampleRate; + /** The number of audio channels */ public final int channelCount; + /** The size of the frame. */ public final int frameSize; + /** Number of audio samples in the frame. */ public final int sampleCount; @@ -62,16 +66,19 @@ public final class Ac4Util { /** The channel count of AC-4 stream. */ // TODO: Parse AC-4 stream channel count. private static final int CHANNEL_COUNT_2 = 2; + /** * The AC-4 sync frame header size for extractor. The seven bytes are 0xAC, 0x40, 0xFF, 0xFF, * sizeByte1, sizeByte2, sizeByte3. See ETSI TS 103 190-1 V1.3.1, Annex G */ public static final int SAMPLE_HEADER_SIZE = 7; + /** * The header size for AC-4 parser. Only needs to be as big as we need to read, not the full * header size. */ public static final int HEADER_SIZE_FOR_PARSER = 16; + /** * Number of audio samples in the frame. Defined in IEC61937-14:2017 table 5 and 6. This table * provides the number of samples per frame at the playback sampling frequency of 48 kHz. For 44.1 diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/BinarySearchSeeker.java b/libraries/extractor/src/main/java/androidx/media3/extractor/BinarySearchSeeker.java index 61c8ac6b78..d28b3d1b20 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/BinarySearchSeeker.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/BinarySearchSeeker.java @@ -401,10 +401,13 @@ public abstract class BinarySearchSeeker { /** The search found a timestamp that it deems close enough to the given target. */ public static final int TYPE_TARGET_TIMESTAMP_FOUND = 0; + /** The search found only timestamps larger than the target timestamp. */ public static final int TYPE_POSITION_OVERESTIMATED = -1; + /** The search found only timestamps smaller than the target timestamp. */ public static final int TYPE_POSITION_UNDERESTIMATED = -2; + /** The search didn't find any timestamps. */ public static final int TYPE_NO_TIMESTAMP = -3; @@ -432,6 +435,7 @@ public abstract class BinarySearchSeeker { * SeekOperationParams#floorTimePosition} should be updated with this value. */ private final long timestampToUpdate; + /** * When {@link #type} is {@link #TYPE_POSITION_OVERESTIMATED}, the {@link * SeekOperationParams#ceilingBytePosition} should be updated with this value. When {@link diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/DolbyVisionConfig.java b/libraries/extractor/src/main/java/androidx/media3/extractor/DolbyVisionConfig.java index 80fa63c74b..620ce8fa78 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/DolbyVisionConfig.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/DolbyVisionConfig.java @@ -53,8 +53,10 @@ public final class DolbyVisionConfig { /** The profile number. */ public final int profile; + /** The level number. */ public final int level; + /** The RFC 6381 codecs string. */ public final String codecs; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/DtsUtil.java b/libraries/extractor/src/main/java/androidx/media3/extractor/DtsUtil.java index 19f870d84f..8e91119a59 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/DtsUtil.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/DtsUtil.java @@ -34,6 +34,7 @@ public final class DtsUtil { *

DTS allows an 'open' bitrate, but we assume the maximum listed value: 1536 kbit/s. */ public static final int DTS_MAX_RATE_BYTES_PER_SECOND = 1536 * 1000 / 8; + /** Maximum rate for a DTS-HD audio stream, in bytes per second. */ public static final int DTS_HD_MAX_RATE_BYTES_PER_SECOND = 18000 * 1000 / 8; @@ -41,11 +42,13 @@ public final class DtsUtil { private static final int SYNC_VALUE_14B_BE = 0x1FFFE800; private static final int SYNC_VALUE_LE = 0xFE7F0180; private static final int SYNC_VALUE_14B_LE = 0xFF1F00E8; + /** * DTS Extension Substream Syncword (in different Endianness). See ETSI TS 102 114 (V1.6.1) * Section 7.4.1. */ private static final int SYNC_EXT_SUB_LE = 0x25205864; + /** * DTS FTOC Sync words (in different Endianness). See ETSI TS 103 491 (V1.2.1) Section 6.4.4.1. */ diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/Extractor.java b/libraries/extractor/src/main/java/androidx/media3/extractor/Extractor.java index 02e8275f6f..aa89ba46c6 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/Extractor.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/Extractor.java @@ -36,12 +36,14 @@ public interface Extractor { * continuing from the position in the stream reached by the returning call. */ int RESULT_CONTINUE = 0; + /** * Returned by {@link #read(ExtractorInput, PositionHolder)} if the {@link ExtractorInput} passed * to the next {@link #read(ExtractorInput, PositionHolder)} is required to provide data starting * from a specified position in the stream. */ int RESULT_SEEK = 1; + /** * Returned by {@link #read(ExtractorInput, PositionHolder)} if the end of the {@link * ExtractorInput} was reached. Equal to {@link C#RESULT_END_OF_INPUT}. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/FlacStreamMetadata.java b/libraries/extractor/src/main/java/androidx/media3/extractor/FlacStreamMetadata.java index 7c2a9712ce..bf85418310 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/FlacStreamMetadata.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/FlacStreamMetadata.java @@ -53,6 +53,7 @@ public final class FlacStreamMetadata { public static class SeekTable { /** Seek points sample numbers. */ public final long[] pointSampleNumbers; + /** Seek points byte offsets from the first frame. */ public final long[] pointOffsets; @@ -69,14 +70,19 @@ public final class FlacStreamMetadata { /** Minimum number of samples per block. */ public final int minBlockSizeSamples; + /** Maximum number of samples per block. */ public final int maxBlockSizeSamples; + /** Minimum frame size in bytes, or 0 if the value is unknown. */ public final int minFrameSize; + /** Maximum frame size in bytes, or 0 if the value is unknown. */ public final int maxFrameSize; + /** Sample rate in Hertz. */ public final int sampleRate; + /** * Lookup key corresponding to the stream sample rate, or {@link #NOT_IN_LOOKUP_TABLE} if it is * not in the lookup table. @@ -86,10 +92,13 @@ public final class FlacStreamMetadata { *

The sample rate lookup table is described in https://xiph.org/flac/format.html#frame_header. */ public final int sampleRateLookupKey; + /** Number of audio channels. */ public final int channels; + /** Number of bits per sample. */ public final int bitsPerSample; + /** * Lookup key corresponding to the number of bits per sample of the stream, or {@link * #NOT_IN_LOOKUP_TABLE} if it is not in the lookup table. @@ -100,10 +109,13 @@ public final class FlacStreamMetadata { *

The sample size lookup table is described in https://xiph.org/flac/format.html#frame_header. */ public final int bitsPerSampleLookupKey; + /** Total number of samples, or 0 if the value is unknown. */ public final long totalSamples; + /** Seek table, or {@code null} if it is not provided. */ @Nullable public final SeekTable seekTable; + /** Content metadata, or {@code null} if it is not provided. */ @Nullable private final Metadata metadata; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/MpegAudioUtil.java b/libraries/extractor/src/main/java/androidx/media3/extractor/MpegAudioUtil.java index 8c362cee49..f8fa5c99e1 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/MpegAudioUtil.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/MpegAudioUtil.java @@ -29,16 +29,22 @@ public final class MpegAudioUtil { /** MPEG audio header version. */ public int version; + /** The MIME type. */ @Nullable public String mimeType; + /** Size of the frame associated with this header, in bytes. */ public int frameSize; + /** Sample rate in samples per second. */ public int sampleRate; + /** Number of audio channels in the frame. */ public int channels; + /** Bitrate of the frame in bit/s. */ public int bitrate; + /** Number of samples stored in the frame. */ public int samplesPerFrame; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/SeekMap.java b/libraries/extractor/src/main/java/androidx/media3/extractor/SeekMap.java index 037f8d7cb9..bd35d0e29f 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/SeekMap.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/SeekMap.java @@ -72,6 +72,7 @@ public interface SeekMap { /** The first seek point. */ public final SeekPoint first; + /** The second seek point, or {@link #first} if there's only one seek point. */ public final SeekPoint second; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/TrackOutput.java b/libraries/extractor/src/main/java/androidx/media3/extractor/TrackOutput.java index e479c27aac..5bbc9f2f09 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/TrackOutput.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/TrackOutput.java @@ -104,6 +104,7 @@ public interface TrackOutput { /** Main media sample data. */ int SAMPLE_DATA_PART_MAIN = 0; + /** * Sample encryption data. * @@ -128,6 +129,7 @@ public interface TrackOutput { * */ int SAMPLE_DATA_PART_ENCRYPTION = 1; + /** * Sample supplemental data. * diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/VorbisUtil.java b/libraries/extractor/src/main/java/androidx/media3/extractor/VorbisUtil.java index eedcb30185..946ff1e393 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/VorbisUtil.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/VorbisUtil.java @@ -59,22 +59,31 @@ public final class VorbisUtil { /** The {@code vorbis_version} field. */ public final int version; + /** The {@code audio_channels} field. */ public final int channels; + /** The {@code audio_sample_rate} field. */ public final int sampleRate; + /** The {@code bitrate_maximum} field, or {@link Format#NO_VALUE} if not greater than zero. */ public final int bitrateMaximum; + /** The {@code bitrate_nominal} field, or {@link Format#NO_VALUE} if not greater than zero. */ public final int bitrateNominal; + /** The {@code bitrate_minimum} field, or {@link Format#NO_VALUE} if not greater than zero. */ public final int bitrateMinimum; + /** The {@code blocksize_0} field. */ public final int blockSize0; + /** The {@code blocksize_1} field. */ public final int blockSize1; + /** The {@code framing_flag} field. */ public final boolean framingFlag; + /** The raw header data. */ public final byte[] data; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/WavUtil.java b/libraries/extractor/src/main/java/androidx/media3/extractor/WavUtil.java index 6b45d5d97d..2b7eeaeae9 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/WavUtil.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/WavUtil.java @@ -26,27 +26,37 @@ public final class WavUtil { /** Four character code for "RIFF". */ public static final int RIFF_FOURCC = 0x52494646; + /** Four character code for "WAVE". */ public static final int WAVE_FOURCC = 0x57415645; + /** Four character code for "fmt ". */ public static final int FMT_FOURCC = 0x666d7420; + /** Four character code for "data". */ public static final int DATA_FOURCC = 0x64617461; + /** Four character code for "RF64". */ public static final int RF64_FOURCC = 0x52463634; + /** Four character code for "ds64". */ public static final int DS64_FOURCC = 0x64733634; /** WAVE type value for integer PCM audio data. */ public static final int TYPE_PCM = 0x0001; + /** WAVE type value for float PCM audio data. */ public static final int TYPE_FLOAT = 0x0003; + /** WAVE type value for 8-bit ITU-T G.711 A-law audio data. */ public static final int TYPE_ALAW = 0x0006; + /** WAVE type value for 8-bit ITU-T G.711 mu-law audio data. */ public static final int TYPE_MLAW = 0x0007; + /** WAVE type value for IMA ADPCM audio data. */ public static final int TYPE_IMA_ADPCM = 0x0011; + /** WAVE type value for extended WAVE format. */ public static final int TYPE_WAVE_FORMAT_EXTENSIBLE = 0xFFFE; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/amr/AmrExtractor.java b/libraries/extractor/src/main/java/androidx/media3/extractor/amr/AmrExtractor.java index 3597a8ad50..2260a55a8e 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/amr/AmrExtractor.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/amr/AmrExtractor.java @@ -70,11 +70,13 @@ public final class AmrExtractor implements Extractor { flag = true, value = {FLAG_ENABLE_CONSTANT_BITRATE_SEEKING, FLAG_ENABLE_CONSTANT_BITRATE_SEEKING_ALWAYS}) public @interface Flags {} + /** * Flag to force enable seeking using a constant bitrate assumption in cases where seeking would * otherwise not be possible. */ public static final int FLAG_ENABLE_CONSTANT_BITRATE_SEEKING = 1; + /** * Like {@link #FLAG_ENABLE_CONSTANT_BITRATE_SEEKING}, except that seeking is also enabled in * cases where the content length (and hence the duration of the media) is unknown. Application @@ -139,6 +141,7 @@ public final class AmrExtractor implements Extractor { /** Theoretical maximum frame size for a AMR frame. */ private static final int MAX_FRAME_SIZE_BYTES = frameSizeBytesByTypeWb[8]; + /** * The required number of samples in the stream with same sample size to classify the stream as a * constant-bitrate-stream. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/avi/ChunkReader.java b/libraries/extractor/src/main/java/androidx/media3/extractor/avi/ChunkReader.java index 4f788429ce..7ad8197a9b 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/avi/ChunkReader.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/avi/ChunkReader.java @@ -55,6 +55,7 @@ import java.util.Arrays; /** The chunk id fourCC (example: `01wb`), as defined in the index and the movi. */ private final int chunkId; + /** Secondary chunk id. Bad muxers sometimes use an uncompressed video id (db) for key frames */ private final int alternativeChunkId; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/flac/FlacConstants.java b/libraries/extractor/src/main/java/androidx/media3/extractor/flac/FlacConstants.java index a82453f3d1..212ee37627 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/flac/FlacConstants.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/flac/FlacConstants.java @@ -23,21 +23,28 @@ public final class FlacConstants { /** Size of the FLAC stream marker in bytes. */ public static final int STREAM_MARKER_SIZE = 4; + /** Size of the header of a FLAC metadata block in bytes. */ public static final int METADATA_BLOCK_HEADER_SIZE = 4; + /** Size of the FLAC stream info block (header included) in bytes. */ public static final int STREAM_INFO_BLOCK_SIZE = 38; + /** Minimum size of a FLAC frame header in bytes. */ public static final int MIN_FRAME_HEADER_SIZE = 6; + /** Maximum size of a FLAC frame header in bytes. */ public static final int MAX_FRAME_HEADER_SIZE = 16; /** Stream info metadata block type. */ public static final int METADATA_TYPE_STREAM_INFO = 0; + /** Seek table metadata block type. */ public static final int METADATA_TYPE_SEEK_TABLE = 3; + /** Vorbis comment metadata block type. */ public static final int METADATA_TYPE_VORBIS_COMMENT = 4; + /** Picture metadata block type. */ public static final int METADATA_TYPE_PICTURE = 6; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/jpeg/MotionPhotoDescription.java b/libraries/extractor/src/main/java/androidx/media3/extractor/jpeg/MotionPhotoDescription.java index f3715c8bee..d35447b0cb 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/jpeg/MotionPhotoDescription.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/jpeg/MotionPhotoDescription.java @@ -28,13 +28,16 @@ import java.util.List; public static final class ContainerItem { /** The MIME type of the media item. */ public final String mime; + /** The application-specific meaning of the media item. */ public final String semantic; + /** * The positive integer length in bytes of the media item, or 0 for primary media items and * secondary media items that share their resource with the preceding media item. */ public final long length; + /** * The number of bytes of additional padding between the end of the primary media item and the * start of the next media item. 0 for secondary media items. @@ -54,6 +57,7 @@ import java.util.List; * if unknown. */ public final long photoPresentationTimestampUs; + /** * The media items represented by the motion photo file, in order. The primary media item is * listed first, followed by any secondary media items. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/dvbsi/AppInfoTable.java b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/dvbsi/AppInfoTable.java index ebbe7a712c..2374e42709 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/dvbsi/AppInfoTable.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/dvbsi/AppInfoTable.java @@ -35,6 +35,7 @@ public final class AppInfoTable implements Metadata.Entry { * already running. */ public static final int CONTROL_CODE_AUTOSTART = 0x01; + /** * The application is allowed to run while the service is selected, however it shall not start * automatically when the service becomes selected. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/dvbsi/AppInfoTableDecoder.java b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/dvbsi/AppInfoTableDecoder.java index b5b086a724..50be1d77e5 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/dvbsi/AppInfoTableDecoder.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/dvbsi/AppInfoTableDecoder.java @@ -37,6 +37,7 @@ public final class AppInfoTableDecoder extends SimpleMetadataDecoder { /** See section 5.3.6. */ private static final int DESCRIPTOR_TRANSPORT_PROTOCOL = 0x02; + /** See section 5.3.7. */ private static final int DESCRIPTOR_SIMPLE_APPLICATION_LOCATION = 0x15; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/flac/PictureFrame.java b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/flac/PictureFrame.java index 4dd72f135a..6189212518 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/flac/PictureFrame.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/flac/PictureFrame.java @@ -33,18 +33,25 @@ public final class PictureFrame implements Metadata.Entry { /** The type of the picture. */ public final int pictureType; + /** The MIME type of the picture. */ public final String mimeType; + /** A description of the picture. */ public final String description; + /** The width of the picture in pixels. */ public final int width; + /** The height of the picture in pixels. */ public final int height; + /** The color depth of the picture in bits-per-pixel. */ public final int depth; + /** For indexed-color pictures (e.g. GIF), the number of colors used. 0 otherwise. */ public final int colors; + /** The encoded picture data. */ public final byte[] pictureData; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/icy/IcyHeaders.java b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/icy/IcyHeaders.java index 84dc021c3e..a3cd64698d 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/icy/IcyHeaders.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/icy/IcyHeaders.java @@ -121,12 +121,16 @@ public final class IcyHeaders implements Metadata.Entry { * was not present. */ public final int bitrate; + /** The genre ({@code icy-genre}). */ @Nullable public final String genre; + /** The stream name ({@code icy-name}). */ @Nullable public final String name; + /** The URL of the radio station ({@code icy-url}). */ @Nullable public final String url; + /** * Whether the radio station is listed ({@code icy-pub}), or {@code false} if the header was not * present. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/icy/IcyInfo.java b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/icy/IcyInfo.java index 8c44790348..1a18e74ccf 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/icy/IcyInfo.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/icy/IcyInfo.java @@ -30,8 +30,10 @@ public final class IcyInfo implements Metadata.Entry { /** The complete metadata bytes used to construct this IcyInfo. */ public final byte[] rawMetadata; + /** The stream title if present and decodable, or {@code null}. */ @Nullable public final String title; + /** The stream URL if present and decodable, or {@code null}. */ @Nullable public final String url; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/id3/ChapterFrame.java b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/id3/ChapterFrame.java index 93f73f10ad..4f5c88b6d3 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/id3/ChapterFrame.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/id3/ChapterFrame.java @@ -33,8 +33,10 @@ public final class ChapterFrame extends Id3Frame { public final String chapterId; public final int startTimeMs; public final int endTimeMs; + /** The byte offset of the start of the chapter, or {@link C#INDEX_UNSET} if not set. */ public final long startOffset; + /** The byte offset of the end of the chapter, or {@link C#INDEX_UNSET} if not set. */ public final long endOffset; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/id3/Id3Decoder.java b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/id3/Id3Decoder.java index 45beb7f641..3358fe0daf 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/id3/Id3Decoder.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/id3/Id3Decoder.java @@ -63,6 +63,7 @@ public final class Id3Decoder extends SimpleMetadataDecoder { /** The first three bytes of a well formed ID3 tag header. */ public static final int ID3_TAG = 0x00494433; + /** Length of an ID3 tag header. */ public static final int ID3_HEADER_LENGTH = 10; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/id3/PrivFrame.java b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/id3/PrivFrame.java index 155003045e..cbdcaeae32 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/id3/PrivFrame.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/id3/PrivFrame.java @@ -69,6 +69,7 @@ public final class PrivFrame extends Id3Frame { public String toString() { return id + ": owner=" + owner; } + // Parcelable implementation. @Override diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/mp4/MotionPhotoMetadata.java b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/mp4/MotionPhotoMetadata.java index 849554a8cf..fd7deb72bb 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/mp4/MotionPhotoMetadata.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/mp4/MotionPhotoMetadata.java @@ -30,14 +30,18 @@ public final class MotionPhotoMetadata implements Metadata.Entry { /** The start offset of the photo data, in bytes. */ public final long photoStartPosition; + /** The size of the photo data, in bytes. */ public final long photoSize; + /** * The presentation timestamp of the photo, in microseconds, or {@link C#TIME_UNSET} if unknown. */ public final long photoPresentationTimestampUs; + /** The start offset of the video data, in bytes. */ public final long videoStartPosition; + /** The size of the video data, in bytes. */ public final long videoSize; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/mp4/SlowMotionData.java b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/mp4/SlowMotionData.java index d496bf3b38..a48b7c2090 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/mp4/SlowMotionData.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/mp4/SlowMotionData.java @@ -46,8 +46,10 @@ public final class SlowMotionData implements Metadata.Entry { /** The start time, in milliseconds, of the track segment that is intended to be slow motion. */ public final long startTimeMs; + /** The end time, in milliseconds, of the track segment that is intended to be slow motion. */ public final long endTimeMs; + /** * The speed reduction factor. * diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/mp4/SmtaMetadataEntry.java b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/mp4/SmtaMetadataEntry.java index c399a1abf7..f0a747f3c2 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/mp4/SmtaMetadataEntry.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/mp4/SmtaMetadataEntry.java @@ -37,6 +37,7 @@ public final class SmtaMetadataEntry implements Metadata.Entry { *

If known, the capture frame rate should always be an integer value. */ public final float captureFrameRate; + /** The number of layers in the SVC extended frames. */ public final int svcTemporalLayerCount; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/PrivateCommand.java b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/PrivateCommand.java index 53e0f372b1..d867f3c4a5 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/PrivateCommand.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/PrivateCommand.java @@ -27,8 +27,10 @@ public final class PrivateCommand extends SpliceCommand { /** The {@code pts_adjustment} as defined in SCTE35, Section 9.2. */ public final long ptsAdjustment; + /** The identifier as defined in SCTE35, Section 9.3.6. */ public final long identifier; + /** The private bytes as defined in SCTE35, Section 9.3.6. */ public final byte[] commandBytes; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/SpliceInsertCommand.java b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/SpliceInsertCommand.java index 2ba778f805..79c2bb9748 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/SpliceInsertCommand.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/SpliceInsertCommand.java @@ -31,50 +31,62 @@ public final class SpliceInsertCommand extends SpliceCommand { /** The splice event id. */ public final long spliceEventId; + /** True if the event with id {@link #spliceEventId} has been canceled. */ public final boolean spliceEventCancelIndicator; + /** * If true, the splice event is an opportunity to exit from the network feed. If false, indicates * an opportunity to return to the network feed. */ public final boolean outOfNetworkIndicator; + /** * Whether the splice mode is program splice mode, whereby all PIDs/components are to be spliced. * If false, splicing is done per PID/component. */ public final boolean programSpliceFlag; + /** * Whether splicing should be done at the nearest opportunity. If false, splicing should be done * at the moment indicated by {@link #programSplicePlaybackPositionUs} or {@link * ComponentSplice#componentSplicePlaybackPositionUs}, depending on {@link #programSpliceFlag}. */ public final boolean spliceImmediateFlag; + /** * If {@link #programSpliceFlag} is true, the PTS at which the program splice should occur. {@link * C#TIME_UNSET} otherwise. */ public final long programSplicePts; + /** Equivalent to {@link #programSplicePts} but in the playback timebase. */ public final long programSplicePlaybackPositionUs; + /** * If {@link #programSpliceFlag} is false, a non-empty list containing the {@link * ComponentSplice}s. Otherwise, an empty list. */ public final List componentSpliceList; + /** * If {@link #breakDurationUs} is not {@link C#TIME_UNSET}, defines whether {@link * #breakDurationUs} should be used to know when to return to the network feed. If {@link * #breakDurationUs} is {@link C#TIME_UNSET}, the value is undefined. */ public final boolean autoReturn; + /** * The duration of the splice in microseconds, or {@link C#TIME_UNSET} if no duration is present. */ public final long breakDurationUs; + /** The unique program id as defined in SCTE35, Section 9.3.3. */ public final int uniqueProgramId; + /** Holds the value of {@code avail_num} as defined in SCTE35, Section 9.3.3. */ public final int availNum; + /** Holds the value of {@code avails_expected} as defined in SCTE35, Section 9.3.3. */ public final int availsExpected; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/SpliceScheduleCommand.java b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/SpliceScheduleCommand.java index d7c086e7c2..a751cd9975 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/SpliceScheduleCommand.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/SpliceScheduleCommand.java @@ -33,43 +33,53 @@ public final class SpliceScheduleCommand extends SpliceCommand { /** The splice event id. */ public final long spliceEventId; + /** True if the event with id {@link #spliceEventId} has been canceled. */ public final boolean spliceEventCancelIndicator; + /** * If true, the splice event is an opportunity to exit from the network feed. If false, * indicates an opportunity to return to the network feed. */ public final boolean outOfNetworkIndicator; + /** * Whether the splice mode is program splice mode, whereby all PIDs/components are to be * spliced. If false, splicing is done per PID/component. */ public final boolean programSpliceFlag; + /** * Represents the time of the signaled splice event as the number of seconds since 00 hours UTC, * January 6th, 1980, with the count of intervening leap seconds included. */ public final long utcSpliceTime; + /** * If {@link #programSpliceFlag} is false, a non-empty list containing the {@link * ComponentSplice}s. Otherwise, an empty list. */ public final List componentSpliceList; + /** * If {@link #breakDurationUs} is not {@link C#TIME_UNSET}, defines whether {@link * #breakDurationUs} should be used to know when to return to the network feed. If {@link * #breakDurationUs} is {@link C#TIME_UNSET}, the value is undefined. */ public final boolean autoReturn; + /** * The duration of the splice in microseconds, or {@link C#TIME_UNSET} if no duration is * present. */ public final long breakDurationUs; + /** The unique program id as defined in SCTE35, Section 9.3.2. */ public final int uniqueProgramId; + /** Holds the value of {@code avail_num} as defined in SCTE35, Section 9.3.2. */ public final int availNum; + /** Holds the value of {@code avails_expected} as defined in SCTE35, Section 9.3.2. */ public final int availsExpected; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/TimeSignalCommand.java b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/TimeSignalCommand.java index ab52517a2e..e12f4cf138 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/TimeSignalCommand.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/metadata/scte35/TimeSignalCommand.java @@ -27,6 +27,7 @@ public final class TimeSignalCommand extends SpliceCommand { /** A PTS value, as defined in SCTE35, Section 9.3.4. */ public final long ptsTime; + /** Equivalent to {@link #ptsTime} but in the playback timebase. */ public final long playbackPositionUs; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mkv/EbmlProcessor.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mkv/EbmlProcessor.java index 762e897d9d..18227d1cc9 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mkv/EbmlProcessor.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mkv/EbmlProcessor.java @@ -48,16 +48,22 @@ public interface EbmlProcessor { ELEMENT_TYPE_FLOAT }) @interface ElementType {} + /** Type for unknown elements. */ int ELEMENT_TYPE_UNKNOWN = 0; + /** Type for elements that contain child elements. */ int ELEMENT_TYPE_MASTER = 1; + /** Type for integer value elements of up to 8 bytes. */ int ELEMENT_TYPE_UNSIGNED_INT = 2; + /** Type for string elements. */ int ELEMENT_TYPE_STRING = 3; + /** Type for binary elements. */ int ELEMENT_TYPE_BINARY = 4; + /** Type for IEEE floating point value elements of either 4 or 8 bytes. */ int ELEMENT_TYPE_FLOAT = 5; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mkv/MatroskaExtractor.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mkv/MatroskaExtractor.java index 9d2c4e6ce8..181d97a298 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mkv/MatroskaExtractor.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mkv/MatroskaExtractor.java @@ -94,6 +94,7 @@ public class MatroskaExtractor implements Extractor { flag = true, value = {FLAG_DISABLE_SEEK_FOR_CUES}) public @interface Flags {} + /** * Flag to disable seeking for cues. * @@ -258,6 +259,7 @@ public class MatroskaExtractor implements Extractor { * https://www.matroska.org/technical/codec_specs.html. */ private static final int BLOCK_ADD_ID_TYPE_DVCC = 0x64766343; + /** * BlockAddIdType value for Dolby Vision configuration with profile > 7. See also * https://www.matroska.org/technical/codec_specs.html. @@ -289,13 +291,16 @@ public class MatroskaExtractor implements Extractor { 49, 10, 48, 48, 58, 48, 48, 58, 48, 48, 44, 48, 48, 48, 32, 45, 45, 62, 32, 48, 48, 58, 48, 48, 58, 48, 48, 44, 48, 48, 48, 10 }; + /** The byte offset of the end timecode in {@link #SUBRIP_PREFIX}. */ private static final int SUBRIP_PREFIX_END_TIMECODE_OFFSET = 19; + /** * The value by which to divide a time in microseconds to convert it to the unit of the last value * in a subrip timecode (milliseconds). */ private static final long SUBRIP_TIMECODE_LAST_VALUE_SCALING_FACTOR = 1000; + /** The format of a subrip timecode. */ private static final String SUBRIP_TIMECODE_FORMAT = "%02d:%02d:%02d,%03d"; @@ -304,6 +309,7 @@ public class MatroskaExtractor implements Extractor { Util.getUtf8Bytes( "Format: Start, End, " + "ReadOrder, Layer, Style, Name, MarginL, MarginR, MarginV, Effect, Text"); + /** * A template for the prefix that must be added to each SSA sample. * @@ -320,13 +326,16 @@ public class MatroskaExtractor implements Extractor { 68, 105, 97, 108, 111, 103, 117, 101, 58, 32, 48, 58, 48, 48, 58, 48, 48, 58, 48, 48, 44, 48, 58, 48, 48, 58, 48, 48, 58, 48, 48, 44 }; + /** The byte offset of the end timecode in {@link #SSA_PREFIX}. */ private static final int SSA_PREFIX_END_TIMECODE_OFFSET = 21; + /** * The value by which to divide a time in microseconds to convert it to the unit of the last value * in an SSA timecode (1/100ths of a second). */ private static final long SSA_TIMECODE_LAST_VALUE_SCALING_FACTOR = 10_000; + /** The format of an SSA timecode. */ private static final String SSA_TIMECODE_FORMAT = "%01d:%02d:%02d:%02d"; @@ -346,22 +355,28 @@ public class MatroskaExtractor implements Extractor { 87, 69, 66, 86, 84, 84, 10, 10, 48, 48, 58, 48, 48, 58, 48, 48, 46, 48, 48, 48, 32, 45, 45, 62, 32, 48, 48, 58, 48, 48, 58, 48, 48, 46, 48, 48, 48, 10 }; + /** The byte offset of the end timecode in {@link #VTT_PREFIX}. */ private static final int VTT_PREFIX_END_TIMECODE_OFFSET = 25; + /** * The value by which to divide a time in microseconds to convert it to the unit of the last value * in a VTT timecode (milliseconds). */ private static final long VTT_TIMECODE_LAST_VALUE_SCALING_FACTOR = 1000; + /** The format of a VTT timecode. */ private static final String VTT_TIMECODE_FORMAT = "%02d:%02d:%02d.%03d"; /** The length in bytes of a WAVEFORMATEX structure. */ private static final int WAVE_FORMAT_SIZE = 18; + /** Format tag indicating a WAVEFORMATEXTENSIBLE structure. */ private static final int WAVE_FORMAT_EXTENSIBLE = 0xFFFE; + /** Format tag for PCM. */ private static final int WAVE_FORMAT_PCM = 1; + /** Sub format for PCM. */ private static final UUID WAVE_SUBFORMAT_PCM = new UUID(0x0100000000001000L, 0x800000AA00389B71L); @@ -1974,6 +1989,7 @@ public class MatroskaExtractor implements Extractor { private static final int DISPLAY_UNIT_PIXELS = 0; private static final int MAX_CHROMATICITY = 50_000; // Defined in CTA-861.3. + /** Default max content light level (CLL) that should be encoded into hdrStaticInfo. */ private static final int DEFAULT_MAX_CLL = 1000; // nits. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/Mp3Extractor.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/Mp3Extractor.java index e0817da35b..9ab3dc27ab 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/Mp3Extractor.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/Mp3Extractor.java @@ -78,6 +78,7 @@ public final class Mp3Extractor implements Extractor { FLAG_DISABLE_ID3_METADATA }) public @interface Flags {} + /** * Flag to force enable seeking using a constant bitrate assumption in cases where seeking would * otherwise not be possible. @@ -85,6 +86,7 @@ public final class Mp3Extractor implements Extractor { *

This flag is ignored if {@link #FLAG_ENABLE_INDEX_SEEKING} is set. */ public static final int FLAG_ENABLE_CONSTANT_BITRATE_SEEKING = 1; + /** * Like {@link #FLAG_ENABLE_CONSTANT_BITRATE_SEEKING}, except that seeking is also enabled in * cases where the content length (and hence the duration of the media) is unknown. Application @@ -113,6 +115,7 @@ public final class Mp3Extractor implements Extractor { * */ public static final int FLAG_ENABLE_INDEX_SEEKING = 1 << 2; + /** * Flag to disable parsing of ID3 metadata. Can be set to save memory if ID3 metadata is not * required. @@ -127,10 +130,12 @@ public final class Mp3Extractor implements Extractor { /** The maximum number of bytes to search when synchronizing, before giving up. */ private static final int MAX_SYNC_BYTES = 128 * 1024; + /** * The maximum number of bytes to peek when sniffing, excluding the ID3 header, before giving up. */ private static final int MAX_SNIFF_BYTES = 32 * 1024; + /** Maximum length of data read into {@link #scratch}. */ private static final int SCRATCH_LENGTH = 10; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/XingSeeker.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/XingSeeker.java index 34c57babb8..1642e53367 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/XingSeeker.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/XingSeeker.java @@ -84,10 +84,12 @@ import androidx.media3.extractor.SeekPoint; private final long dataStartPosition; private final int xingFrameSize; private final long durationUs; + /** Data size, including the XING frame. */ private final long dataSize; private final long dataEndPosition; + /** * Entries are in the range [0, 255], but are stored as long integers for convenience. Null if the * table of contents was missing from the header, in which case seeking is not be supported. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/AtomParsers.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/AtomParsers.java index 22fdc3bd01..b1696cbbad 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/AtomParsers.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/AtomParsers.java @@ -736,7 +736,10 @@ import java.util.List; long ptsUs = Util.scaleLargeTimestamp(pts, C.MICROS_PER_SECOND, track.movieTimescale); long timeInSegmentUs = Util.scaleLargeTimestamp( - max(0, timestamps[j] - editMediaTime), C.MICROS_PER_SECOND, track.timescale); + timestamps[j] - editMediaTime, C.MICROS_PER_SECOND, track.timescale); + if (canTrimSamplesWithTimestampChange(track.type)) { + timeInSegmentUs = max(0, timeInSegmentUs); + } editedTimestamps[sampleIndex] = ptsUs + timeInSegmentUs; if (copyMetadata && editedSizes[sampleIndex] > editedMaximumSize) { editedMaximumSize = sizes[j]; @@ -757,6 +760,12 @@ import java.util.List; editedDurationUs); } + private static boolean canTrimSamplesWithTimestampChange(@C.TrackType int trackType) { + // Audio samples have an inherent duration and we can't trim data by changing the sample + // timestamp alone. + return trackType != C.TRACK_TYPE_AUDIO; + } + @Nullable private static Metadata parseUdtaMeta(ParsableByteArray meta, int limit) { meta.skipBytes(Atom.HEADER_SIZE); diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/FragmentedMp4Extractor.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/FragmentedMp4Extractor.java index f4705aa934..9c56828a20 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/FragmentedMp4Extractor.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/FragmentedMp4Extractor.java @@ -92,6 +92,7 @@ public class FragmentedMp4Extractor implements Extractor { FLAG_WORKAROUND_IGNORE_EDIT_LISTS }) public @interface Flags {} + /** * Flag to work around an issue in some video streams where every frame is marked as a sync frame. * The workaround overrides the sync frame flags in the stream, forcing them to false except for @@ -100,8 +101,10 @@ public class FragmentedMp4Extractor implements Extractor { *

This flag does nothing if the stream is not a video stream. */ public static final int FLAG_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME = 1; + /** Flag to ignore any tfdt boxes in the stream. */ public static final int FLAG_WORKAROUND_IGNORE_TFDT_BOX = 1 << 1; // 2 + /** * Flag to indicate that the extractor should output an event message metadata track. Any event * messages in the stream will be delivered as samples to this track. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Mp4Extractor.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Mp4Extractor.java index 469d9862c5..acf20076e9 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Mp4Extractor.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Mp4Extractor.java @@ -83,8 +83,10 @@ public final class Mp4Extractor implements Extractor, SeekMap { FLAG_READ_SEF_DATA }) public @interface Flags {} + /** Flag to ignore any edit lists in the stream. */ public static final int FLAG_WORKAROUND_IGNORE_EDIT_LISTS = 1; + /** * Flag to extract {@link MotionPhotoMetadata} from HEIC motion photos following the Google Photos * Motion Photo File Format V1.1. @@ -93,6 +95,7 @@ public final class Mp4Extractor implements Extractor, SeekMap { * retrieval use cases. */ public static final int FLAG_READ_MOTION_PHOTO_METADATA = 1 << 1; + /** * Flag to extract {@link SlowMotionData} metadata from Samsung Extension Format (SEF) slow motion * videos. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/SefReader.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/SefReader.java index b5161fbf1e..a45e3cca00 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/SefReader.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/SefReader.java @@ -87,8 +87,10 @@ import java.util.List; *

This is the last 4 bytes of a file that has Samsung Extension Format (SEF) data. */ private static final int SAMSUNG_TAIL_SIGNATURE = 0x53454654; + /** Start signature (4 bytes), SEF version (4 bytes), SDR count (4 bytes). */ private static final int TAIL_HEADER_LENGTH = 12; + /** Tail offset (4 bytes), tail signature (4 bytes). */ private static final int TAIL_FOOTER_LENGTH = 8; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Sniffer.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Sniffer.java index c52fa67a3e..7d486f55fb 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Sniffer.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Sniffer.java @@ -28,6 +28,7 @@ import java.io.IOException; /** Brand stored in the ftyp atom for QuickTime media. */ public static final int BRAND_QUICKTIME = 0x71742020; + /** Brand stored in the ftyp atom for HEIC media. */ public static final int BRAND_HEIC = 0x68656963; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Track.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Track.java index 5a15d5c4ed..ec32a0f767 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Track.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Track.java @@ -40,8 +40,10 @@ public final class Track { @Target(TYPE_USE) @IntDef({TRANSFORMATION_NONE, TRANSFORMATION_CEA608_CDAT}) public @interface Transformation {} + /** A no-op sample transformation. */ public static final int TRANSFORMATION_NONE = 0; + /** A transformation for caption samples in cdat atoms. */ public static final int TRANSFORMATION_CEA608_CDAT = 1; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/TrackFragment.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/TrackFragment.java index f5a70a1d6e..c4c6c58ca6 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/TrackFragment.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/TrackFragment.java @@ -26,48 +26,65 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; /** The default values for samples from the track fragment header. */ public @MonotonicNonNull DefaultSampleValues header; + /** The position (byte offset) of the start of fragment. */ public long atomPosition; + /** The position (byte offset) of the start of data contained in the fragment. */ public long dataPosition; + /** The position (byte offset) of the start of auxiliary data. */ public long auxiliaryDataPosition; + /** The number of track runs of the fragment. */ public int trunCount; + /** The total number of samples in the fragment. */ public int sampleCount; + /** The position (byte offset) of the start of sample data of each track run in the fragment. */ public long[] trunDataPosition; + /** The number of samples contained by each track run in the fragment. */ public int[] trunLength; + /** The size of each sample in the fragment. */ public int[] sampleSizeTable; + /** The presentation time of each sample in the fragment, in microseconds. */ public long[] samplePresentationTimesUs; + /** Indicates which samples are sync frames. */ public boolean[] sampleIsSyncFrameTable; + /** Whether the fragment defines encryption data. */ public boolean definesEncryptionData; + /** * If {@link #definesEncryptionData} is true, indicates which samples use sub-sample encryption. * Undefined otherwise. */ public boolean[] sampleHasSubsampleEncryptionTable; + /** Fragment specific track encryption. May be null. */ @Nullable public TrackEncryptionBox trackEncryptionBox; + /** * If {@link #definesEncryptionData} is true, contains binary sample encryption data. Undefined * otherwise. */ public final ParsableByteArray sampleEncryptionData; + /** Whether {@link #sampleEncryptionData} needs populating with the actual encryption data. */ public boolean sampleEncryptionDataNeedsFill; + /** * The duration of all the samples defined in the fragments up to and including this one, plus the * duration of the samples defined in the moov atom if {@link #nextFragmentDecodeTimeIncludesMoov} * is {@code true}. */ public long nextFragmentDecodeTime; + /** * Whether {@link #nextFragmentDecodeTime} includes the duration of the samples referred to by the * moov atom. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/TrackSampleTable.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/TrackSampleTable.java index 5472db9ae7..7f2c046865 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/TrackSampleTable.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/TrackSampleTable.java @@ -24,18 +24,25 @@ import androidx.media3.common.util.Util; /** The track corresponding to this sample table. */ public final Track track; + /** Number of samples. */ public final int sampleCount; + /** Sample offsets in bytes. */ public final long[] offsets; + /** Sample sizes in bytes. */ public final int[] sizes; + /** Maximum sample size in {@link #sizes}. */ public final int maximumSize; + /** Sample timestamps in microseconds. */ public final long[] timestampsUs; + /** Sample flags. */ public final int[] flags; + /** The duration of the track sample table in microseconds. */ public final long durationUs; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/ogg/OggPageHeader.java b/libraries/extractor/src/main/java/androidx/media3/extractor/ogg/OggPageHeader.java index 9f6cfc52b3..23fba1678a 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/ogg/OggPageHeader.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/ogg/OggPageHeader.java @@ -38,6 +38,7 @@ import java.io.IOException; public int revision; public int type; + /** * The absolute granule position of the page. This is the total number of samples from the start * of the file up to the end of the page. Samples partially in the page that continue on @@ -51,6 +52,7 @@ import java.io.IOException; public int pageSegmentCount; public int headerSize; public int bodySize; + /** * Be aware that {@code laces.length} is always {@link #MAX_SEGMENT_COUNT}. Instead use {@link * #pageSegmentCount} to iterate. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/text/SubtitleExtractor.java b/libraries/extractor/src/main/java/androidx/media3/extractor/text/SubtitleExtractor.java index df43d16ae5..c74794a629 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/text/SubtitleExtractor.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/text/SubtitleExtractor.java @@ -64,14 +64,19 @@ public class SubtitleExtractor implements Extractor { /** The extractor has been created. */ private static final int STATE_CREATED = 0; + /** The extractor has been initialized. */ private static final int STATE_INITIALIZED = 1; + /** The extractor is reading from the input and writing to the output. */ private static final int STATE_EXTRACTING = 2; + /** The extractor has received a seek() operation after it has already finished extracting. */ private static final int STATE_SEEKING = 3; + /** The extractor has finished extracting the input. */ private static final int STATE_FINISHED = 4; + /** The extractor has been released. */ private static final int STATE_RELEASED = 5; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/text/cea/Cea608Decoder.java b/libraries/extractor/src/main/java/androidx/media3/extractor/text/cea/Cea608Decoder.java index 7c54f93a4e..f5efdfd53b 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/text/cea/Cea608Decoder.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/text/cea/Cea608Decoder.java @@ -106,11 +106,13 @@ public final class Cea608Decoder extends CeaDecoder { * simultaneously. */ private static final byte CTRL_ROLL_UP_CAPTIONS_2_ROWS = 0x25; + /** * Command initiating roll-up style captioning, with the maximum of 3 rows displayed * simultaneously. */ private static final byte CTRL_ROLL_UP_CAPTIONS_3_ROWS = 0x26; + /** * Command initiating roll-up style captioning, with the maximum of 4 rows displayed * simultaneously. @@ -122,6 +124,7 @@ public final class Cea608Decoder extends CeaDecoder { * to displayed memory without need for the {@link #CTRL_RESUME_CAPTION_LOADING} command. */ private static final byte CTRL_RESUME_DIRECT_CAPTIONING = 0x29; + /** * TEXT commands are switching to TEXT service. All consecutive incoming data must be filtered out * until a command is received that switches back to the CAPTION service. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/text/cea/Cea708Decoder.java b/libraries/extractor/src/main/java/androidx/media3/extractor/text/cea/Cea708Decoder.java index a2e659478c..516a44a324 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/text/cea/Cea708Decoder.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/text/cea/Cea708Decoder.java @@ -147,6 +147,7 @@ public final class Cea708Decoder extends CeaDecoder { private final ParsableByteArray ccData; private final ParsableBitArray captionChannelPacketData; private int previousSequenceNumber; + // TODO: Use isWideAspectRatio in decoding. @SuppressWarnings({"unused", "FieldCanBeLocal"}) private final boolean isWideAspectRatio; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/text/ssa/SsaDecoder.java b/libraries/extractor/src/main/java/androidx/media3/extractor/text/ssa/SsaDecoder.java index 30017383e9..0067e68f65 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/text/ssa/SsaDecoder.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/text/ssa/SsaDecoder.java @@ -73,6 +73,7 @@ public final class SsaDecoder extends SimpleSubtitleDecoder { *

Parsed from the {@code PlayResX} value in the {@code [Script Info]} section. */ private float screenWidth; + /** * The vertical resolution used by the subtitle author - all cue positions are relative to this. * diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/text/ssa/SsaStyle.java b/libraries/extractor/src/main/java/androidx/media3/extractor/text/ssa/SsaStyle.java index f644b08feb..e8b27a75ee 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/text/ssa/SsaStyle.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/text/ssa/SsaStyle.java @@ -441,6 +441,7 @@ import java.util.regex.Pattern; /** Matches "\pos(x,y)" and returns "x" in group 1 and "y" in group 2 */ private static final Pattern POSITION_PATTERN = Pattern.compile(Util.formatInvariant("\\\\pos\\((%1$s),(%1$s)\\)", PADDED_DECIMAL_PATTERN)); + /** Matches "\move(x1,y1,x2,y2[,t1,t2])" and returns "x2" in group 1 and "y2" in group 2 */ private static final Pattern MOVE_PATTERN = Pattern.compile( diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/text/webvtt/WebvttCueParser.java b/libraries/extractor/src/main/java/androidx/media3/extractor/text/webvtt/WebvttCueParser.java index 456dd61680..ff6d0fd298 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/text/webvtt/WebvttCueParser.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/text/webvtt/WebvttCueParser.java @@ -971,6 +971,7 @@ public final class WebvttCueParser { (e1, e2) -> Integer.compare(e1.startTag.position, e2.startTag.position); private final StartTag startTag; + /** * The position of the end of this element's text in the un-marked-up cue text (i.e. the * corollary to {@link StartTag#position}). diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/ts/AdtsExtractor.java b/libraries/extractor/src/main/java/androidx/media3/extractor/ts/AdtsExtractor.java index e1013e689f..547a56eaea 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/ts/AdtsExtractor.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/ts/AdtsExtractor.java @@ -65,6 +65,7 @@ public final class AdtsExtractor implements Extractor { flag = true, value = {FLAG_ENABLE_CONSTANT_BITRATE_SEEKING, FLAG_ENABLE_CONSTANT_BITRATE_SEEKING_ALWAYS}) public @interface Flags {} + /** * Flag to force enable seeking using a constant bitrate assumption in cases where seeking would * otherwise not be possible. @@ -73,6 +74,7 @@ public final class AdtsExtractor implements Extractor { * are not precise, especially when the stream bitrate varies a lot. */ public static final int FLAG_ENABLE_CONSTANT_BITRATE_SEEKING = 1; + /** * Like {@link #FLAG_ENABLE_CONSTANT_BITRATE_SEEKING}, except that seeking is also enabled in * cases where the content length (and hence the duration of the media) is unknown. Application @@ -87,11 +89,13 @@ public final class AdtsExtractor implements Extractor { public static final int FLAG_ENABLE_CONSTANT_BITRATE_SEEKING_ALWAYS = 1 << 1; private static final int MAX_PACKET_SIZE = 2 * 1024; + /** * The maximum number of bytes to search when sniffing, excluding the header, before giving up. * Frame sizes are represented by 13-bit fields, so expect a valid frame in the first 8192 bytes. */ private static final int MAX_SNIFF_BYTES = 8 * 1024; + /** * The maximum number of frames to use when calculating the average frame size for constant * bitrate seeking. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/ts/DefaultTsPayloadReaderFactory.java b/libraries/extractor/src/main/java/androidx/media3/extractor/ts/DefaultTsPayloadReaderFactory.java index 11fa10f074..b55157081e 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/ts/DefaultTsPayloadReaderFactory.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/ts/DefaultTsPayloadReaderFactory.java @@ -66,29 +66,34 @@ public final class DefaultTsPayloadReaderFactory implements TsPayloadReader.Fact * synchronization samples (key-frames). */ public static final int FLAG_ALLOW_NON_IDR_KEYFRAMES = 1; + /** * Prevents the creation of {@link AdtsReader} and {@link LatmReader} instances. This flag should * be enabled if the transport stream contains no packets for an AAC elementary stream that is * declared in the PMT. */ public static final int FLAG_IGNORE_AAC_STREAM = 1 << 1; + /** * Prevents the creation of {@link H264Reader} instances. This flag should be enabled if the * transport stream contains no packets for an H.264 elementary stream that is declared in the * PMT. */ public static final int FLAG_IGNORE_H264_STREAM = 1 << 2; + /** * When extracting H.264 samples, whether to split the input stream into access units (samples) * based on slice headers. This flag should be disabled if the stream contains access unit * delimiters (AUDs). */ public static final int FLAG_DETECT_ACCESS_UNITS = 1 << 3; + /** * Prevents the creation of {@link SectionPayloadReader}s for splice information sections * (SCTE-35). */ public static final int FLAG_IGNORE_SPLICE_INFO_STREAM = 1 << 4; + /** * Whether the list of {@code closedCaptionFormats} passed to {@link * DefaultTsPayloadReaderFactory#DefaultTsPayloadReaderFactory(int, List)} should be used in spite @@ -96,6 +101,7 @@ public final class DefaultTsPayloadReaderFactory implements TsPayloadReader.Fact * closedCaptionFormats} will be ignored if the PMT contains closed captions service descriptors. */ public static final int FLAG_OVERRIDE_CAPTION_DESCRIPTORS = 1 << 5; + /** * Sets whether HDMV DTS audio streams will be handled. If this flag is set, SCTE subtitles will * not be detected, as they share the same elementary stream type as HDMV DTS. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/ts/H263Reader.java b/libraries/extractor/src/main/java/androidx/media3/extractor/ts/H263Reader.java index a623d7dadf..302dd500e8 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/ts/H263Reader.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/ts/H263Reader.java @@ -431,6 +431,7 @@ public final class H263Reader implements ElementaryStreamReader { /** Byte offset of vop_coding_type after the start code value. */ private static final int OFFSET_VOP_CODING_TYPE = 1; + /** Value of vop_coding_type for intra video object planes. */ private static final int VOP_CODING_TYPE_INTRA = 0; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/ts/TsExtractor.java b/libraries/extractor/src/main/java/androidx/media3/extractor/ts/TsExtractor.java index 049e2c003b..d29c77fc84 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/ts/TsExtractor.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/ts/TsExtractor.java @@ -73,8 +73,10 @@ public final class TsExtractor implements Extractor { /** Behave as defined in ISO/IEC 13818-1. */ public static final int MODE_MULTI_PMT = 0; + /** Assume only one PMT will be contained in the stream, even if more are declared by the PAT. */ public static final int MODE_SINGLE_PMT = 1; + /** * Enable single PMT mode, map {@link TrackOutput}s by their type (instead of PID) and ignore * continuity counters. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/ts/TsPayloadReader.java b/libraries/extractor/src/main/java/androidx/media3/extractor/ts/TsPayloadReader.java index f5b2a76575..fc89d4f7d8 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/ts/TsPayloadReader.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/ts/TsPayloadReader.java @@ -201,10 +201,12 @@ public interface TsPayloadReader { /** Indicates the presence of the payload_unit_start_indicator in the TS packet header. */ int FLAG_PAYLOAD_UNIT_START_INDICATOR = 1; + /** * Indicates the presence of the random_access_indicator in the TS packet header adaptation field. */ int FLAG_RANDOM_ACCESS_INDICATOR = 1 << 1; + /** Indicates the presence of the data_alignment_indicator in the PES header. */ int FLAG_DATA_ALIGNMENT_INDICATOR = 1 << 2; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/wav/WavExtractor.java b/libraries/extractor/src/main/java/androidx/media3/extractor/wav/WavExtractor.java index dea141335a..7195777653 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/wav/WavExtractor.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/wav/WavExtractor.java @@ -276,17 +276,20 @@ public final class WavExtractor implements Extractor { private final TrackOutput trackOutput; private final WavFormat wavFormat; private final Format format; + /** The target size of each output sample, in bytes. */ private final int targetSampleSizeBytes; /** The time at which the writer was last {@link #reset}. */ private long startTimeUs; + /** * The number of bytes that have been written to {@link #trackOutput} but have yet to be * included as part of a sample (i.e. the corresponding call to {@link * TrackOutput#sampleMetadata} has yet to be made). */ private int pendingOutputBytes; + /** * The total number of frames in samples that have been written to the trackOutput since the * last call to {@link #reset}. @@ -398,25 +401,32 @@ public final class WavExtractor implements Extractor { /** Number of frames per block of the input (yet to be decoded) data. */ private final int framesPerBlock; + /** Target for the input (yet to be decoded) data. */ private final byte[] inputData; + /** Target for decoded (yet to be output) data. */ private final ParsableByteArray decodedData; + /** The target size of each output sample, in frames. */ private final int targetSampleSizeFrames; + /** The output format. */ private final Format format; /** The number of pending bytes in {@link #inputData}. */ private int pendingInputBytes; + /** The time at which the writer was last {@link #reset}. */ private long startTimeUs; + /** * The number of bytes that have been written to {@link #trackOutput} but have yet to be * included as part of a sample (i.e. the corresponding call to {@link * TrackOutput#sampleMetadata} has yet to be made). */ private int pendingOutputBytes; + /** * The total number of frames in samples that have been written to the trackOutput since the * last call to {@link #reset}. diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/wav/WavFormat.java b/libraries/extractor/src/main/java/androidx/media3/extractor/wav/WavFormat.java index 714e4eb44e..ac315e0828 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/wav/WavFormat.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/wav/WavFormat.java @@ -23,16 +23,22 @@ package androidx.media3.extractor.wav; * defined in RFC 2361 Appendix A. */ public final int formatType; + /** The number of channels. */ public final int numChannels; + /** The sample rate in Hertz. */ public final int frameRateHz; + /** The average bytes per second for the sample data. */ public final int averageBytesPerSecond; + /** The block size in bytes. */ public final int blockSize; + /** Bits per sample for a single channel. */ public final int bitsPerSample; + /** Extra data appended to the format chunk. */ public final byte[] extraData; diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/wav/WavHeaderReader.java b/libraries/extractor/src/main/java/androidx/media3/extractor/wav/WavHeaderReader.java index 3c24cd5009..53cf0f902a 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/wav/WavHeaderReader.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/wav/WavHeaderReader.java @@ -194,6 +194,7 @@ import java.io.IOException; /** 4-character identifier, stored as an integer, for this chunk. */ public final int id; + /** Size of this chunk in bytes. */ public final long size; diff --git a/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/XingSeekerTest.java b/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/XingSeekerTest.java index f1e6fe5518..11fbb3e204 100644 --- a/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/XingSeekerTest.java +++ b/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/XingSeekerTest.java @@ -43,8 +43,10 @@ public final class XingSeekerTest { /** Data size, as encoded in {@link #XING_FRAME_PAYLOAD}. */ private static final int DATA_SIZE_BYTES = 948505; + /** Duration of the audio stream in microseconds, encoded in {@link #XING_FRAME_PAYLOAD}. */ private static final int STREAM_DURATION_US = 59271836; + /** The length of the stream in bytes. */ private static final int STREAM_LENGTH = XING_FRAME_POSITION + DATA_SIZE_BYTES; diff --git a/libraries/muxer/src/main/java/androidx/media3/muxer/Mp4Muxer.java b/libraries/muxer/src/main/java/androidx/media3/muxer/Mp4Muxer.java index 69eeef217a..58b6086bef 100644 --- a/libraries/muxer/src/main/java/androidx/media3/muxer/Mp4Muxer.java +++ b/libraries/muxer/src/main/java/androidx/media3/muxer/Mp4Muxer.java @@ -76,8 +76,10 @@ public final class Mp4Muxer { LAST_FRAME_DURATION_BEHAVIOR_INSERT_SHORT_FRAME }) public @interface LastFrameDurationBehavior {} + /** Insert a zero-length last sample. */ public static final int LAST_FRAME_DURATION_BEHAVIOR_INSERT_SHORT_FRAME = 0; + /** * Use the difference between the last timestamp and the one before that as the duration of the * last sample. diff --git a/libraries/session/src/main/java/androidx/media3/session/ConnectionRequest.java b/libraries/session/src/main/java/androidx/media3/session/ConnectionRequest.java index b9f6258594..805baffc58 100644 --- a/libraries/session/src/main/java/androidx/media3/session/ConnectionRequest.java +++ b/libraries/session/src/main/java/androidx/media3/session/ConnectionRequest.java @@ -69,6 +69,7 @@ import androidx.media3.common.util.Util; private static final String FIELD_PID = Util.intToStringMaxRadix(2); private static final String FIELD_CONNECTION_HINTS = Util.intToStringMaxRadix(3); private static final String FIELD_CONTROLLER_INTERFACE_VERSION = Util.intToStringMaxRadix(4); + // Next id: 5 @Override diff --git a/libraries/session/src/main/java/androidx/media3/session/ConnectionState.java b/libraries/session/src/main/java/androidx/media3/session/ConnectionState.java index c681ab4420..b4c808373f 100644 --- a/libraries/session/src/main/java/androidx/media3/session/ConnectionState.java +++ b/libraries/session/src/main/java/androidx/media3/session/ConnectionState.java @@ -82,6 +82,7 @@ import androidx.media3.common.util.Util; private static final String FIELD_TOKEN_EXTRAS = Util.intToStringMaxRadix(6); private static final String FIELD_PLAYER_INFO = Util.intToStringMaxRadix(7); private static final String FIELD_SESSION_INTERFACE_VERSION = Util.intToStringMaxRadix(8); + // Next field key = 9 @Override diff --git a/libraries/session/src/main/java/androidx/media3/session/DefaultMediaNotificationProvider.java b/libraries/session/src/main/java/androidx/media3/session/DefaultMediaNotificationProvider.java index a6e85731cd..9afbf8994b 100644 --- a/libraries/session/src/main/java/androidx/media3/session/DefaultMediaNotificationProvider.java +++ b/libraries/session/src/main/java/androidx/media3/session/DefaultMediaNotificationProvider.java @@ -223,11 +223,13 @@ public class DefaultMediaNotificationProvider implements MediaNotification.Provi /** The default ID used for the {@link MediaNotification#notificationId}. */ public static final int DEFAULT_NOTIFICATION_ID = 1001; + /** * The default ID used for the {@link NotificationChannel} on which created notifications are * posted on. */ public static final String DEFAULT_CHANNEL_ID = "default_channel_id"; + /** * The default name used for the {@link NotificationChannel} on which created notifications are * posted on. diff --git a/libraries/session/src/main/java/androidx/media3/session/LibraryResult.java b/libraries/session/src/main/java/androidx/media3/session/LibraryResult.java index accd427207..4310bf697e 100644 --- a/libraries/session/src/main/java/androidx/media3/session/LibraryResult.java +++ b/libraries/session/src/main/java/androidx/media3/session/LibraryResult.java @@ -399,6 +399,7 @@ public final class LibraryResult implements Bundleable { private static final int VALUE_TYPE_VOID = 1; private static final int VALUE_TYPE_ITEM = 2; private static final int VALUE_TYPE_ITEM_LIST = 3; + /** The value type isn't known because the result is carrying an error. */ private static final int VALUE_TYPE_ERROR = 4; } diff --git a/libraries/session/src/main/java/androidx/media3/session/MediaController.java b/libraries/session/src/main/java/androidx/media3/session/MediaController.java index 0dbaf68657..4286e2229f 100644 --- a/libraries/session/src/main/java/androidx/media3/session/MediaController.java +++ b/libraries/session/src/main/java/androidx/media3/session/MediaController.java @@ -1689,6 +1689,7 @@ public class MediaController implements Player { } impl.setDeviceVolume(volume, flags); } + /** * @deprecated Use {@link #increaseDeviceVolume(int)} instead. */ @@ -1712,6 +1713,7 @@ public class MediaController implements Player { } impl.increaseDeviceVolume(flags); } + /** * @deprecated Use {@link #decreaseDeviceVolume(int)} instead. */ @@ -1735,6 +1737,7 @@ public class MediaController implements Player { } impl.decreaseDeviceVolume(flags); } + /** * @deprecated Use {@link #setDeviceMuted(boolean, int)} instead. */ diff --git a/libraries/session/src/main/java/androidx/media3/session/MediaSession.java b/libraries/session/src/main/java/androidx/media3/session/MediaSession.java index 21b1cb9ce1..bba9acb2c8 100644 --- a/libraries/session/src/main/java/androidx/media3/session/MediaSession.java +++ b/libraries/session/src/main/java/androidx/media3/session/MediaSession.java @@ -232,6 +232,7 @@ public class MediaSession { // It's better to have private static lock instead of using MediaSession.class because the // private lock object isn't exposed. private static final Object STATIC_LOCK = new Object(); + // Note: This checks the uniqueness of a session ID only in single process. // When the framework becomes able to check the uniqueness, this logic should be removed. @GuardedBy("STATIC_LOCK") @@ -369,6 +370,7 @@ public class MediaSession { /** The {@linkplain #getControllerVersion() controller version} of legacy controllers. */ public static final int LEGACY_CONTROLLER_VERSION = 0; + /** The {@linkplain #getInterfaceVersion()} interface version} of legacy controllers. */ @UnstableApi public static final int LEGACY_CONTROLLER_INTERFACE_VERSION = 0; @@ -1282,6 +1284,7 @@ public class MediaSession { public static final class MediaItemsWithStartPosition { /** List of {@linkplain MediaItem media items}. */ public final ImmutableList mediaItems; + /** * Index to start playing at in {@link #mediaItems}. * @@ -1289,6 +1292,7 @@ public class MediaSession { * C#INDEX_UNSET} to start playing from the default index in the playlist. */ public final int startIndex; + /** * Position in milliseconds to start playing from in the starting media item. * diff --git a/libraries/session/src/main/java/androidx/media3/session/MediaUtils.java b/libraries/session/src/main/java/androidx/media3/session/MediaUtils.java index cf078a7216..8cb439a0c4 100644 --- a/libraries/session/src/main/java/androidx/media3/session/MediaUtils.java +++ b/libraries/session/src/main/java/androidx/media3/session/MediaUtils.java @@ -110,6 +110,7 @@ import java.util.concurrent.TimeoutException; public static final String TAG = "MediaUtils"; public static final int TRANSACTION_SIZE_LIMIT_IN_BYTES = 256 * 1024; // 256KB + /** Constant to identify whether two calculated positions are considered as same */ public static final long POSITION_DIFF_TOLERANCE_MS = 100; diff --git a/libraries/session/src/main/java/androidx/media3/session/PlayerInfo.java b/libraries/session/src/main/java/androidx/media3/session/PlayerInfo.java index 4fa7ac0714..bc80edcf35 100644 --- a/libraries/session/src/main/java/androidx/media3/session/PlayerInfo.java +++ b/libraries/session/src/main/java/androidx/media3/session/PlayerInfo.java @@ -66,8 +66,10 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; public static final BundlingExclusions NONE = new BundlingExclusions( /* isTimelineExcluded= */ false, /* areCurrentTracksExcluded= */ false); + /** Whether the {@linkplain PlayerInfo#timeline timeline} is excluded. */ public final boolean isTimelineExcluded; + /** Whether the {@linkplain PlayerInfo#currentTracks current tracks} are excluded. */ public final boolean areCurrentTracksExcluded; @@ -81,6 +83,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; private static final String FIELD_IS_TIMELINE_EXCLUDED = Util.intToStringMaxRadix(0); private static final String FIELD_ARE_CURRENT_TRACKS_EXCLUDED = Util.intToStringMaxRadix(1); + // Next field key = 2 @UnstableApi @@ -822,6 +825,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; private static final String FIELD_TRACK_SELECTION_PARAMETERS = Util.intToStringMaxRadix(29); private static final String FIELD_CURRENT_TRACKS = Util.intToStringMaxRadix(30); private static final String FIELD_TIMELINE_CHANGE_REASON = Util.intToStringMaxRadix(31); + // Next field key = 32 public Bundle toBundle( diff --git a/libraries/session/src/main/java/androidx/media3/session/SessionTokenImplBase.java b/libraries/session/src/main/java/androidx/media3/session/SessionTokenImplBase.java index 22b0d9df67..6c027b51c2 100644 --- a/libraries/session/src/main/java/androidx/media3/session/SessionTokenImplBase.java +++ b/libraries/session/src/main/java/androidx/media3/session/SessionTokenImplBase.java @@ -214,6 +214,7 @@ import com.google.common.base.Objects; private static final String FIELD_ISESSION = Util.intToStringMaxRadix(6); private static final String FIELD_EXTRAS = Util.intToStringMaxRadix(7); private static final String FIELD_INTERFACE_VERSION = Util.intToStringMaxRadix(8); + // Next field key = 9 @Override diff --git a/libraries/session/src/test/java/androidx/media3/session/DefaultMediaNotificationProviderTest.java b/libraries/session/src/test/java/androidx/media3/session/DefaultMediaNotificationProviderTest.java index dc43b274e7..86c024c042 100644 --- a/libraries/session/src/test/java/androidx/media3/session/DefaultMediaNotificationProviderTest.java +++ b/libraries/session/src/test/java/androidx/media3/session/DefaultMediaNotificationProviderTest.java @@ -69,6 +69,7 @@ public class DefaultMediaNotificationProviderTest { private static final String TEST_CHANNEL_ID = "test_channel_id"; private static final NotificationCompat.Action fakeAction = new NotificationCompat.Action(0, null, null); + /** * The key string is defined as @@ -76,6 +77,7 @@ public class DefaultMediaNotificationProviderTest { */ private static final String EXTRA_ALLOW_GENERATED_REPLIES = "android.support.allowGeneratedReplies"; + /** * The key string is defined as @@ -83,6 +85,7 @@ public class DefaultMediaNotificationProviderTest { */ private static final String EXTRA_SHOWS_USER_INTERFACE = "android.support.action.showsUserInterface"; + /** * The key string is defined as diff --git a/libraries/test_data/src/test/assets/extractordumps/mp4/sample_opus.mp4.0.dump b/libraries/test_data/src/test/assets/extractordumps/mp4/sample_opus.mp4.0.dump index 36e01036bf..e02ee654f5 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp4/sample_opus.mp4.0.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp4/sample_opus.mp4.0.dump @@ -22,7 +22,7 @@ track 0: data = length 8, hash 72CBCBF5 data = length 8, hash 79C07075 sample 0: - time = 0 + time = -6500 flags = 1 data = length 3, hash 4732 sample 1: diff --git a/libraries/test_data/src/test/assets/extractordumps/mp4/sample_opus.mp4.unknown_length.dump b/libraries/test_data/src/test/assets/extractordumps/mp4/sample_opus.mp4.unknown_length.dump index 36e01036bf..e02ee654f5 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp4/sample_opus.mp4.unknown_length.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp4/sample_opus.mp4.unknown_length.dump @@ -22,7 +22,7 @@ track 0: data = length 8, hash 72CBCBF5 data = length 8, hash 79C07075 sample 0: - time = 0 + time = -6500 flags = 1 data = length 3, hash 4732 sample 1: diff --git a/libraries/test_session_current/src/main/java/androidx/media3/session/MockMediaLibraryService.java b/libraries/test_session_current/src/main/java/androidx/media3/session/MockMediaLibraryService.java index cc0b452106..745182949b 100644 --- a/libraries/test_session_current/src/main/java/androidx/media3/session/MockMediaLibraryService.java +++ b/libraries/test_session_current/src/main/java/androidx/media3/session/MockMediaLibraryService.java @@ -83,9 +83,11 @@ import java.util.concurrent.Executors; public class MockMediaLibraryService extends MediaLibraryService { /** ID of the session that this service will create. */ public static final String ID = "TestLibrary"; + /** Key used in connection hints to instruct the mock service to use a given library root. */ public static final String CONNECTION_HINTS_CUSTOM_LIBRARY_ROOT = "CONNECTION_HINTS_CUSTOM_LIBRARY_ROOT"; + /** * Key used in connection hints to instruct the mock service to remove {@link * SessionCommand#COMMAND_CODE_LIBRARY_SEARCH} from the available commands in {@link diff --git a/libraries/test_session_current/src/main/java/androidx/media3/session/MockPlayer.java b/libraries/test_session_current/src/main/java/androidx/media3/session/MockPlayer.java index 6341a5bf89..08cf2771a9 100644 --- a/libraries/test_session_current/src/main/java/androidx/media3/session/MockPlayer.java +++ b/libraries/test_session_current/src/main/java/androidx/media3/session/MockPlayer.java @@ -115,98 +115,145 @@ public class MockPlayer implements Player { /** Maps to {@link Player#addMediaItem(MediaItem)}. */ public static final int METHOD_ADD_MEDIA_ITEM = 0; + /** Maps to {@link Player#addMediaItems(List)}. */ public static final int METHOD_ADD_MEDIA_ITEMS = 1; + /** Maps to {@link Player#addMediaItem(int, MediaItem)}. */ public static final int METHOD_ADD_MEDIA_ITEM_WITH_INDEX = 2; + /** Maps to {@link Player#addMediaItems(int, List)}. */ public static final int METHOD_ADD_MEDIA_ITEMS_WITH_INDEX = 3; + /** Maps to {@link Player#clearMediaItems()}. */ public static final int METHOD_CLEAR_MEDIA_ITEMS = 4; + /** Maps to {@link Player#decreaseDeviceVolume()}. */ public static final int METHOD_DECREASE_DEVICE_VOLUME = 5; + /** Maps to {@link Player#increaseDeviceVolume()}. */ public static final int METHOD_INCREASE_DEVICE_VOLUME = 6; + /** Maps to {@link Player#moveMediaItem(int, int)}. */ public static final int METHOD_MOVE_MEDIA_ITEM = 7; + /** Maps to {@link Player#moveMediaItems(int, int, int)}. */ public static final int METHOD_MOVE_MEDIA_ITEMS = 8; + /** Maps to {@link Player#pause()}. */ public static final int METHOD_PAUSE = 9; + /** Maps to {@link Player#play()}. */ public static final int METHOD_PLAY = 10; + /** Maps to {@link Player#prepare()}. */ public static final int METHOD_PREPARE = 11; + /** Maps to {@link Player#release()}. */ public static final int METHOD_RELEASE = 12; + /** Maps to {@link Player#removeMediaItem(int)}. */ public static final int METHOD_REMOVE_MEDIA_ITEM = 13; + /** Maps to {@link Player#removeMediaItems(int, int)}. */ public static final int METHOD_REMOVE_MEDIA_ITEMS = 14; + /** Maps to {@link Player#seekBack()}. */ public static final int METHOD_SEEK_BACK = 15; + /** Maps to {@link Player#seekForward()}. */ public static final int METHOD_SEEK_FORWARD = 16; + /** Maps to {@link Player#seekTo(long)}. */ public static final int METHOD_SEEK_TO = 17; + /** Maps to {@link Player#seekToDefaultPosition()}. */ public static final int METHOD_SEEK_TO_DEFAULT_POSITION = 18; + /** Maps to {@link Player#seekToDefaultPosition(int)}. */ public static final int METHOD_SEEK_TO_DEFAULT_POSITION_WITH_MEDIA_ITEM_INDEX = 19; + /** Maps to {@link Player#seekToNext()}. */ public static final int METHOD_SEEK_TO_NEXT = 20; + /** Maps to {@link Player#seekToNextMediaItem()}. */ public static final int METHOD_SEEK_TO_NEXT_MEDIA_ITEM = 21; + /** Maps to {@link Player#seekToPrevious()}. */ public static final int METHOD_SEEK_TO_PREVIOUS = 22; + /** Maps to {@link Player#seekToPreviousMediaItem()}. */ public static final int METHOD_SEEK_TO_PREVIOUS_MEDIA_ITEM = 23; + /** Maps to {@link Player#seekTo(int, long)}. */ public static final int METHOD_SEEK_TO_WITH_MEDIA_ITEM_INDEX = 24; + /** Maps to {@link Player#setDeviceMuted(boolean)}. */ public static final int METHOD_SET_DEVICE_MUTED = 25; + /** Maps to {@link Player#setDeviceVolume(int)}. */ public static final int METHOD_SET_DEVICE_VOLUME = 26; + /** Maps to {@link Player#setMediaItem(MediaItem)}. */ public static final int METHOD_SET_MEDIA_ITEM = 27; + /** Maps to {@link Player#setMediaItem(MediaItem, boolean)}. */ public static final int METHOD_SET_MEDIA_ITEM_WITH_RESET_POSITION = 28; + /** Maps to {@link Player#setMediaItem(MediaItem, long)}. */ public static final int METHOD_SET_MEDIA_ITEM_WITH_START_POSITION = 29; + /** Maps to {@link Player#setMediaItems(List)}. */ public static final int METHOD_SET_MEDIA_ITEMS = 30; + /** Maps to {@link Player#setMediaItems(List, boolean)}. */ public static final int METHOD_SET_MEDIA_ITEMS_WITH_RESET_POSITION = 31; + /** Maps to {@link Player#setMediaItems(List, int, long)}. */ public static final int METHOD_SET_MEDIA_ITEMS_WITH_START_INDEX = 32; + /** Maps to {@link Player#setPlayWhenReady(boolean)}. */ public static final int METHOD_SET_PLAY_WHEN_READY = 33; + /** Maps to {@link Player#setPlaybackParameters(PlaybackParameters)}. */ public static final int METHOD_SET_PLAYBACK_PARAMETERS = 34; + /** Maps to {@link Player#setPlaybackSpeed(float)}. */ public static final int METHOD_SET_PLAYBACK_SPEED = 35; + /** Maps to {@link Player#setPlaylistMetadata(MediaMetadata)}. */ public static final int METHOD_SET_PLAYLIST_METADATA = 36; + /** Maps to {@link Player#setRepeatMode(int)}. */ public static final int METHOD_SET_REPEAT_MODE = 37; + /** Maps to {@link Player#setShuffleModeEnabled(boolean)}. */ public static final int METHOD_SET_SHUFFLE_MODE = 38; + /** Maps to {@link Player#setTrackSelectionParameters(TrackSelectionParameters)}. */ public static final int METHOD_SET_TRACK_SELECTION_PARAMETERS = 39; + /** Maps to {@link Player#setVolume(float)}. */ public static final int METHOD_SET_VOLUME = 40; + /** Maps to {@link Player#stop()}. */ public static final int METHOD_STOP = 41; + /** Maps to {@link Player#decreaseDeviceVolume(int)}. */ public static final int METHOD_DECREASE_DEVICE_VOLUME_WITH_FLAGS = 42; + /** Maps to {@link Player#increaseDeviceVolume(int)}. */ public static final int METHOD_INCREASE_DEVICE_VOLUME_WITH_FLAGS = 43; + /** Maps to {@link Player#setDeviceMuted(boolean, int)}. */ public static final int METHOD_SET_DEVICE_MUTED_WITH_FLAGS = 44; + /** Maps to {@link Player#setDeviceVolume(int, int)}. */ public static final int METHOD_SET_DEVICE_VOLUME_WITH_FLAGS = 45; + /** Maps to {@link Player#replaceMediaItem(int, MediaItem)}. */ public static final int METHOD_REPLACE_MEDIA_ITEM = 46; + /** Maps to {@link Player#replaceMediaItems(int, int, List)} . */ public static final int METHOD_REPLACE_MEDIA_ITEMS = 47; diff --git a/libraries/test_utils/src/main/java/androidx/media3/test/utils/ActionSchedule.java b/libraries/test_utils/src/main/java/androidx/media3/test/utils/ActionSchedule.java index 451404139e..ed70354e76 100644 --- a/libraries/test_utils/src/main/java/androidx/media3/test/utils/ActionSchedule.java +++ b/libraries/test_utils/src/main/java/androidx/media3/test/utils/ActionSchedule.java @@ -381,6 +381,7 @@ public final class ActionSchedule { /* positionMs= */ C.TIME_UNSET, mediaSources)); } + /** * Schedules a add media items action to be executed. * diff --git a/libraries/test_utils/src/main/java/androidx/media3/test/utils/DumpFileAsserts.java b/libraries/test_utils/src/main/java/androidx/media3/test/utils/DumpFileAsserts.java index 7059c004ae..bf870b308f 100644 --- a/libraries/test_utils/src/main/java/androidx/media3/test/utils/DumpFileAsserts.java +++ b/libraries/test_utils/src/main/java/androidx/media3/test/utils/DumpFileAsserts.java @@ -60,8 +60,10 @@ public class DumpFileAsserts { flag = true, value = {COMPARE_WITH_EXISTING, WRITE_TO_LOCAL, WRITE_TO_DEVICE}) private @interface DumpFilesAction {} + /** Compare output with existing dump file. */ private static final int COMPARE_WITH_EXISTING = 0; + /** * Write output to the project folder {@code testdata/src/test}. * @@ -69,6 +71,7 @@ public class DumpFileAsserts { * tests are run in another environment. */ private static final int WRITE_TO_LOCAL = 1; + /** Write output to folder {@code /storage/emulated/0/Android/data} of device. */ private static final int WRITE_TO_DEVICE = 1 << 1; diff --git a/libraries/test_utils/src/main/java/androidx/media3/test/utils/ExtractorAsserts.java b/libraries/test_utils/src/main/java/androidx/media3/test/utils/ExtractorAsserts.java index 979ac9d097..e4b2e86213 100644 --- a/libraries/test_utils/src/main/java/androidx/media3/test/utils/ExtractorAsserts.java +++ b/libraries/test_utils/src/main/java/androidx/media3/test/utils/ExtractorAsserts.java @@ -90,10 +90,13 @@ public final class ExtractorAsserts { * consuming it. */ public final boolean sniffFirst; + /** Whether to simulate IO errors. */ public final boolean simulateIOErrors; + /** Whether to simulate unknown input length. */ public final boolean simulateUnknownLength; + /** Whether to simulate partial reads. */ public final boolean simulatePartialReads; @@ -409,6 +412,7 @@ public final class ExtractorAsserts { simulationConfig.simulateUnknownLength, simulationConfig.simulatePartialReads); } + /** * Asserts that an extractor consumes valid input data successfully under the specified * conditions. diff --git a/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeDataSet.java b/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeDataSet.java index 12ca43eee5..aa295a1044 100644 --- a/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeDataSet.java +++ b/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeDataSet.java @@ -132,6 +132,7 @@ public class FakeDataSet { } private final FakeDataSet dataSet; + /** Uri of the data or null if this is the default FakeData. */ @Nullable public final Uri uri; diff --git a/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeExoMediaDrm.java b/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeExoMediaDrm.java index 600a6f9524..4f802f073a 100644 --- a/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeExoMediaDrm.java +++ b/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeExoMediaDrm.java @@ -154,8 +154,10 @@ public final class FakeExoMediaDrm implements ExoMediaDrm { /** Key for use with the Map returned from {@link FakeExoMediaDrm#queryKeyStatus(byte[])}. */ public static final String KEY_STATUS_KEY = "KEY_STATUS"; + /** Value for use with the Map returned from {@link FakeExoMediaDrm#queryKeyStatus(byte[])}. */ public static final String KEY_STATUS_AVAILABLE = "AVAILABLE"; + /** Value for use with the Map returned from {@link FakeExoMediaDrm#queryKeyStatus(byte[])}. */ public static final String KEY_STATUS_UNAVAILABLE = "UNAVAILABLE"; diff --git a/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeRenderer.java b/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeRenderer.java index e4c99ffa64..4a05ae7a29 100644 --- a/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeRenderer.java +++ b/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeRenderer.java @@ -44,6 +44,7 @@ import java.util.List; public class FakeRenderer extends BaseRenderer { private static final String TAG = "FakeRenderer"; + /** * The amount of time ahead of the current playback position that the renderer reads from the * source. A real renderer will typically read ahead by a small amount due to pipelining through diff --git a/libraries/test_utils/src/main/java/androidx/media3/test/utils/VideoFrameProcessorTestRunner.java b/libraries/test_utils/src/main/java/androidx/media3/test/utils/VideoFrameProcessorTestRunner.java index a10a19b53c..8a43c37b49 100644 --- a/libraries/test_utils/src/main/java/androidx/media3/test/utils/VideoFrameProcessorTestRunner.java +++ b/libraries/test_utils/src/main/java/androidx/media3/test/utils/VideoFrameProcessorTestRunner.java @@ -193,6 +193,7 @@ public final class VideoFrameProcessorTestRunner { this.outputColorInfo = outputColorInfo; return this; } + /** * Sets whether input comes from an external texture. See {@link * VideoFrameProcessor.Factory#create}. diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/AndroidTestUtil.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/AndroidTestUtil.java index db0856e05b..1718eeb81e 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/AndroidTestUtil.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/AndroidTestUtil.java @@ -59,6 +59,7 @@ public final class AndroidTestUtil { /** A realtime {@linkplain MediaFormat#KEY_PRIORITY encoder priority}. */ public static final int MEDIA_CODEC_PRIORITY_REALTIME = 0; + /** * A non-realtime (as fast as possible) {@linkplain MediaFormat#KEY_PRIORITY encoder priority}. */ diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/ExportTestResult.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/ExportTestResult.java index ed9bc25905..e721962ba4 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/ExportTestResult.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/ExportTestResult.java @@ -127,25 +127,31 @@ public class ExportTestResult { /** The {@link ExportResult} of the export. */ public final ExportResult exportResult; + /** The path to the file created in the export, or {@code null} if unset. */ @Nullable public final String filePath; + /** * The amount of time taken to perform the export in milliseconds, or {@link C#TIME_UNSET} if * unset. */ public final long elapsedTimeMs; + /** * The average rate (per second) at which frames were processed by the transformer, or {@link * C#RATE_UNSET} if unset. */ public final float throughputFps; + /** The SSIM score of the export, or {@link #SSIM_UNSET} if unset. */ public final double ssim; + /** * The {@link FallbackDetails} describing the fallbacks that occurred doing export, or {@code * null} if no fallback occurred. */ @Nullable public final FallbackDetails fallbackDetails; + /** * The {@link Exception} thrown during post-export analysis, or {@code null} if nothing was * thrown. diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerMixedInputEndToEndTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerMixedInputEndToEndTest.java index 146c75ee14..307ababe2b 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerMixedInputEndToEndTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerMixedInputEndToEndTest.java @@ -186,6 +186,7 @@ public class TransformerMixedInputEndToEndTest { .setFrameRate(frameCount) .build(); } + /** * Creates an {@link EditedMediaItem} with video, with audio removed and a {@link Presentation} of * specified {@code height}. diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/DefaultVideoFrameProcessorTextureOutputPixelTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/DefaultVideoFrameProcessorTextureOutputPixelTest.java index c34e391338..a8179f8303 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/DefaultVideoFrameProcessorTextureOutputPixelTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/DefaultVideoFrameProcessorTextureOutputPixelTest.java @@ -79,8 +79,10 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest { /** Input SDR video of which we only use the first frame. */ private static final String INPUT_SDR_MP4_ASSET_STRING = "media/mp4/sample.mp4"; + /** Input PQ video of which we only use the first frame. */ private static final String INPUT_PQ_MP4_ASSET_STRING = "media/mp4/hdr10-720p.mp4"; + /** Input HLG video of which we only use the first frame. */ private static final String INPUT_HLG10_MP4_ASSET_STRING = "media/mp4/hlg-1080p.mp4"; diff --git a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingOpenGlPixelTest.java b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingOpenGlPixelTest.java index 7521ceec9e..a4eb3b2d37 100644 --- a/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingOpenGlPixelTest.java +++ b/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/ToneMapHdrToSdrUsingOpenGlPixelTest.java @@ -54,6 +54,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public final class ToneMapHdrToSdrUsingOpenGlPixelTest { private static final String TAG = "ToneMapHdrToSdrGl"; + /** * Maximum allowed average pixel difference between the expected and actual edited images in * on-device pixel difference-based tests. The value is chosen so that differences in behavior @@ -73,6 +74,7 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest { /** Input HLG video of which we only use the first frame. */ private static final String INPUT_HLG_MP4_ASSET_STRING = "media/mp4/hlg-1080p.mp4"; + /** Input PQ video of which we only use the first frame. */ private static final String INPUT_PQ_MP4_ASSET_STRING = "media/mp4/hdr10-720p.mp4"; diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/AssetLoader.java b/libraries/transformer/src/main/java/androidx/media3/transformer/AssetLoader.java index 62938bb438..bbc3b8f1a6 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/AssetLoader.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/AssetLoader.java @@ -147,8 +147,10 @@ public interface AssetLoader { SUPPORTED_OUTPUT_TYPE_DECODED, }) @interface SupportedOutputTypes {} + /** Indicates that the asset loader can output encoded samples. */ int SUPPORTED_OUTPUT_TYPE_ENCODED = 1; + /** Indicates that the asset loader can output decoded samples. */ int SUPPORTED_OUTPUT_TYPE_DECODED = 1 << 1; diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/Composition.java b/libraries/transformer/src/main/java/androidx/media3/transformer/Composition.java index 5d45bea420..61cec33e18 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/Composition.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/Composition.java @@ -175,20 +175,24 @@ public final class Composition { *

For more information, see {@link Builder#Builder(List)}. */ public final ImmutableList sequences; + /** The {@link Effects} to apply to the composition. */ public final Effects effects; + /** * Whether the output file should always contain an audio track. * *

For more information, see {@link Builder#experimentalSetForceAudioTrack(boolean)}. */ public final boolean forceAudioTrack; + /** * Whether to transmux the {@linkplain MediaItem media items'} audio tracks. * *

For more information, see {@link Builder#setTransmuxAudio(boolean)}. */ public final boolean transmuxAudio; + /** * Whether to transmux the {@linkplain MediaItem media items'} video tracks. * diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultAssetLoaderFactory.java b/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultAssetLoaderFactory.java index 2255ca12db..0930c1cbf3 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultAssetLoaderFactory.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultAssetLoaderFactory.java @@ -42,6 +42,7 @@ public final class DefaultAssetLoaderFactory implements AssetLoader.Factory { private AssetLoader.@MonotonicNonNull Factory imageAssetLoaderFactory; private AssetLoader.@MonotonicNonNull Factory exoPlayerAssetLoaderFactory; + /** * Creates an instance. * diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultCodec.java b/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultCodec.java index 91fa44a0f9..a45918fbcb 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultCodec.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultCodec.java @@ -59,6 +59,7 @@ public class DefaultCodec implements Codec { private static final String TAG = "DefaultCodec"; private final BufferInfo outputBufferInfo; + /** The {@link MediaFormat} used to configure the underlying {@link MediaCodec}. */ private final MediaFormat configurationMediaFormat; diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultEncoderFactory.java b/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultEncoderFactory.java index 18d1936f07..5c7942dfee 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultEncoderFactory.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultEncoderFactory.java @@ -47,6 +47,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; @UnstableApi public final class DefaultEncoderFactory implements Codec.EncoderFactory { private static final int DEFAULT_FRAME_RATE = 30; + /** Best effort, or as-fast-as-possible priority setting for {@link MediaFormat#KEY_PRIORITY}. */ private static final int PRIORITY_BEST_EFFORT = 1; diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultMuxer.java b/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultMuxer.java index 8682574fbf..3296f3690d 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultMuxer.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultMuxer.java @@ -41,6 +41,7 @@ public final class DefaultMuxer implements Muxer { public Factory() { this(/* maxDelayBetweenSamplesMs= */ DEFAULT_MAX_DELAY_BETWEEN_SAMPLES_MS); } + /** * Creates an instance. * diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/EditedMediaItem.java b/libraries/transformer/src/main/java/androidx/media3/transformer/EditedMediaItem.java index 7305767c16..a6375b077c 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/EditedMediaItem.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/EditedMediaItem.java @@ -184,10 +184,13 @@ public final class EditedMediaItem { /** The {@link MediaItem} on which transformations are applied. */ public final MediaItem mediaItem; + /** Whether to remove the audio from the {@link #mediaItem}. */ public final boolean removeAudio; + /** Whether to remove the video from the {@link #mediaItem}. */ public final boolean removeVideo; + /** * Whether to flatten the {@link #mediaItem} if it contains slow motion markers. * @@ -206,11 +209,14 @@ public final class EditedMediaItem { * */ public final boolean flattenForSlowMotion; + /** The duration of the image in the output video, in microseconds. */ public final long durationUs; + /** The frame rate of the image in the output video, in frames per second. */ @IntRange(from = 0) public final int frameRate; + /** The {@link Effects} to apply to the {@link #mediaItem}. */ public final Effects effects; diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/EditedMediaItemSequence.java b/libraries/transformer/src/main/java/androidx/media3/transformer/EditedMediaItemSequence.java index 354db579c3..fd7e8674bf 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/EditedMediaItemSequence.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/EditedMediaItemSequence.java @@ -35,6 +35,7 @@ public final class EditedMediaItemSequence { *

This list must not be empty. */ public final ImmutableList editedMediaItems; + /** * Whether this sequence is looping. * diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/Effects.java b/libraries/transformer/src/main/java/androidx/media3/transformer/Effects.java index 052cfa6e72..ec597ed31b 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/Effects.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/Effects.java @@ -37,6 +37,7 @@ public final class Effects { * AudioProcessor} if it {@link AudioProcessor#isActive()} based on the current configuration. */ public final ImmutableList audioProcessors; + /** * The list of {@linkplain Effect video effects} to apply to each frame. They are applied in the * order of the list. diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/ExportException.java b/libraries/transformer/src/main/java/androidx/media3/transformer/ExportException.java index 5d5d32b6b1..73ec7aa385 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/ExportException.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/ExportException.java @@ -77,6 +77,7 @@ public final class ExportException extends Exception { /** Caused by an error whose cause could not be identified. */ public static final int ERROR_CODE_UNSPECIFIED = 1000; + /** * Caused by a failed runtime check. * @@ -88,6 +89,7 @@ public final class ExportException extends Exception { /** Caused by an Input/Output error which could not be identified. */ public static final int ERROR_CODE_IO_UNSPECIFIED = 2000; + /** * Caused by a network connection failure. * @@ -101,8 +103,10 @@ public final class ExportException extends Exception { * */ public static final int ERROR_CODE_IO_NETWORK_CONNECTION_FAILED = 2001; + /** Caused by a network timeout, meaning the server is taking too long to fulfill a request. */ public static final int ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT = 2002; + /** * Caused by a server returning a resource with an invalid "Content-Type" HTTP header value. * @@ -110,20 +114,25 @@ public final class ExportException extends Exception { * the server returns a paywall HTML page, with content type "text/html". */ public static final int ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE = 2003; + /** Caused by an HTTP server returning an unexpected HTTP response status code. */ public static final int ERROR_CODE_IO_BAD_HTTP_STATUS = 2004; + /** Caused by a non-existent file. */ public static final int ERROR_CODE_IO_FILE_NOT_FOUND = 2005; + /** * Caused by lack of permission to perform an IO operation. For example, lack of permission to * access internet or external storage. */ public static final int ERROR_CODE_IO_NO_PERMISSION = 2006; + /** * Caused by the {@link AssetLoader} trying to access cleartext HTTP traffic (meaning http:// * rather than https://) when the app's Network Security Configuration does not permit it. */ public static final int ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED = 2007; + /** Caused by reading data out of the data bound. */ public static final int ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE = 2008; @@ -131,8 +140,10 @@ public final class ExportException extends Exception { /** Caused by a decoder initialization failure. */ public static final int ERROR_CODE_DECODER_INIT_FAILED = 3001; + /** Caused by a failure while trying to decode media samples. */ public static final int ERROR_CODE_DECODING_FAILED = 3002; + /** Caused by trying to decode content whose format is not supported. */ public static final int ERROR_CODE_DECODING_FORMAT_UNSUPPORTED = 3003; @@ -140,8 +151,10 @@ public final class ExportException extends Exception { /** Caused by an encoder initialization failure. */ public static final int ERROR_CODE_ENCODER_INIT_FAILED = 4001; + /** Caused by a failure while trying to encode media samples. */ public static final int ERROR_CODE_ENCODING_FAILED = 4002; + /** * Caused by trying to encode content whose format is not supported. * * @@ -164,6 +177,7 @@ public final class ExportException extends Exception { /** Caused by a failure while muxing media samples. */ public static final int ERROR_CODE_MUXING_FAILED = 7001; + /** * Caused by a timeout while muxing media samples. * diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/ExportResult.java b/libraries/transformer/src/main/java/androidx/media3/transformer/ExportResult.java index 1e74ec55cd..c88c118492 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/ExportResult.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/ExportResult.java @@ -227,11 +227,13 @@ public final class ExportResult { public static final class ProcessedInput { /** The processed {@link MediaItem}. */ public final MediaItem mediaItem; + /** * The name of the audio decoder used to process {@code mediaItem}. This field is {@code null} * if no audio decoder was used. */ public final @MonotonicNonNull String audioDecoderName; + /** * The name of the video decoder used to process {@code mediaItem}. This field is {@code null} * if no video decoder was used. @@ -252,6 +254,7 @@ public final class ExportResult { /** The duration of the file in milliseconds, or {@link C#TIME_UNSET} if unset or unknown. */ public final long durationMs; + /** The size of the file in bytes, or {@link C#LENGTH_UNSET} if unset or unknown. */ public final long fileSizeBytes; @@ -259,10 +262,13 @@ public final class ExportResult { * The average bitrate of the audio track data, or {@link C#RATE_UNSET_INT} if unset or unknown. */ public final int averageAudioBitrate; + /** The channel count of the audio, or {@link C#LENGTH_UNSET} if unset or unknown. */ public final int channelCount; + /** The sample rate of the audio, or {@link C#RATE_UNSET_INT} if unset or unknown. */ public final int sampleRate; + /** The name of the audio encoder used, or {@code null} if none were used. */ @Nullable public final String audioEncoderName; @@ -270,14 +276,19 @@ public final class ExportResult { * The average bitrate of the video track data, or {@link C#RATE_UNSET_INT} if unset or unknown. */ public final int averageVideoBitrate; + /** The {@link ColorInfo} of the video, or {@code null} if unset or unknown. */ @Nullable public final ColorInfo colorInfo; + /** The height of the video, or {@link C#LENGTH_UNSET} if unset or unknown. */ public final int height; + /** The width of the video, or {@link C#LENGTH_UNSET} if unset or unknown. */ public final int width; + /** The number of video frames. */ public final int videoFrameCount; + /** The name of the video encoder used, or {@code null} if none were used. */ @Nullable public final String videoEncoderName; diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/SefSlowMotionFlattener.java b/libraries/transformer/src/main/java/androidx/media3/transformer/SefSlowMotionFlattener.java index 5499da5c58..6c33a03589 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/SefSlowMotionFlattener.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/SefSlowMotionFlattener.java @@ -66,6 +66,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; private static final int TARGET_OUTPUT_FRAME_RATE = 30; private static final int NAL_START_CODE_LENGTH = NAL_START_CODE.length; + /** * The nal_unit_type corresponding to a prefix NAL unit (see ITU-T Recommendation H.264 (2016) * table 7-1). @@ -73,17 +74,22 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; private static final int NAL_UNIT_TYPE_PREFIX = 0x0E; private final byte[] scratch; + /** The SEF slow motion configuration of the input. */ @Nullable private final SlowMotionData slowMotionData; + /** * An iterator iterating over the slow motion segments, pointing at the segment following {@code * nextSegmentInfo}, if any. */ private final Iterator segmentIterator; + /** The frame rate at which the input has been captured, in fps. */ private final float captureFrameRate; + /** The maximum SVC temporal layer present in the input. */ private final int inputMaxLayer; + /** * The maximum SVC temporal layer value of the frames that should be kept in the input (or a part * of it) so that it is played at normal speed. @@ -95,16 +101,19 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; * frame is not in such a segment. */ @Nullable private SegmentInfo currentSegmentInfo; + /** * The {@link SegmentInfo} describing the slow motion segment following (not including) the * current frame, or null if there is no such segment. */ @Nullable private SegmentInfo nextSegmentInfo; + /** * The time delta to be added to the output timestamps before scaling to take the slow motion * segments into account, in microseconds. */ private long frameTimeDeltaUs; + /** * The presentation time for the last {@linkplain #dropOrTransformSample(ByteBuffer, long) * processed sample}. @@ -332,15 +341,18 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; * C#RATE_UNSET} if it is unknown or invalid. */ public float captureFrameRate; + /** * The maximum SVC layer value of the input frames, or {@link C#INDEX_UNSET} if it is unknown. */ public int inputMaxLayer; + /** * The maximum SVC layer value of the frames to keep in order to play the video at normal speed * at {@link #TARGET_OUTPUT_FRAME_RATE}, or {@link C#INDEX_UNSET} if it is unknown. */ public int normalSpeedMaxLayer; + /** The input {@link SlowMotionData}. */ @Nullable public SlowMotionData slowMotionData; @@ -355,14 +367,17 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; private static final class SegmentInfo { /** The segment start time, in microseconds. */ public final long startTimeUs; + /** The segment end time, in microseconds. */ public final long endTimeUs; + /** * The segment speedDivisor. * * @see SlowMotionData.Segment#speedDivisor */ public final int speedDivisor; + /** * The maximum SVC layer value of the frames to keep in the segment in order to slow down the * segment by {@code speedDivisor}. diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/SequenceAssetLoader.java b/libraries/transformer/src/main/java/androidx/media3/transformer/SequenceAssetLoader.java index 26b3447ed7..a746b265f9 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/SequenceAssetLoader.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/SequenceAssetLoader.java @@ -62,6 +62,7 @@ import java.util.concurrent.atomic.AtomicInteger; private final AssetLoader.Factory assetLoaderFactory; private final HandlerWrapper handler; private final Listener sequenceAssetLoaderListener; + /** * A mapping from track types to {@link SampleConsumer} instances. * @@ -69,6 +70,7 @@ import java.util.concurrent.atomic.AtomicInteger; * video. */ private final Map sampleConsumersByTrackType; + /** * A mapping from track types to {@link OnMediaItemChangedListener} instances. * diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/TransformationException.java b/libraries/transformer/src/main/java/androidx/media3/transformer/TransformationException.java index c575c5c873..b9e2a4a28b 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/TransformationException.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/TransformationException.java @@ -79,6 +79,7 @@ public final class TransformationException extends Exception { /** Caused by an error whose cause could not be identified. */ public static final int ERROR_CODE_UNSPECIFIED = 1000; + /** * Caused by a failed runtime check. * @@ -90,6 +91,7 @@ public final class TransformationException extends Exception { /** Caused by an Input/Output error which could not be identified. */ public static final int ERROR_CODE_IO_UNSPECIFIED = 2000; + /** * Caused by a network connection failure. * @@ -103,8 +105,10 @@ public final class TransformationException extends Exception { * */ public static final int ERROR_CODE_IO_NETWORK_CONNECTION_FAILED = 2001; + /** Caused by a network timeout, meaning the server is taking too long to fulfill a request. */ public static final int ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT = 2002; + /** * Caused by a server returning a resource with an invalid "Content-Type" HTTP header value. * @@ -112,20 +116,25 @@ public final class TransformationException extends Exception { * the server returns a paywall HTML page, with content type "text/html". */ public static final int ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE = 2003; + /** Caused by an HTTP server returning an unexpected HTTP response status code. */ public static final int ERROR_CODE_IO_BAD_HTTP_STATUS = 2004; + /** Caused by a non-existent file. */ public static final int ERROR_CODE_IO_FILE_NOT_FOUND = 2005; + /** * Caused by lack of permission to perform an IO operation. For example, lack of permission to * access internet or external storage. */ public static final int ERROR_CODE_IO_NO_PERMISSION = 2006; + /** * Caused by the {@link AssetLoader} trying to access cleartext HTTP traffic (meaning http:// * rather than https://) when the app's Network Security Configuration does not permit it. */ public static final int ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED = 2007; + /** Caused by reading data out of the data bound. */ public static final int ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE = 2008; @@ -133,8 +142,10 @@ public final class TransformationException extends Exception { /** Caused by a decoder initialization failure. */ public static final int ERROR_CODE_DECODER_INIT_FAILED = 3001; + /** Caused by a failure while trying to decode media samples. */ public static final int ERROR_CODE_DECODING_FAILED = 3002; + /** Caused by trying to decode content whose format is not supported. */ public static final int ERROR_CODE_DECODING_FORMAT_UNSUPPORTED = 3003; @@ -142,8 +153,10 @@ public final class TransformationException extends Exception { /** Caused by an encoder initialization failure. */ public static final int ERROR_CODE_ENCODER_INIT_FAILED = 4001; + /** Caused by a failure while trying to encode media samples. */ public static final int ERROR_CODE_ENCODING_FAILED = 4002; + /** * Caused by trying to encode content whose format is not supported. * * diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/TransformationRequest.java b/libraries/transformer/src/main/java/androidx/media3/transformer/TransformationRequest.java index 824c978dc0..a5784fc976 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/TransformationRequest.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/TransformationRequest.java @@ -54,6 +54,7 @@ public final class TransformationRequest { HDR_MODE_EXPERIMENTAL_FORCE_INTERPRET_HDR_AS_SDR, }) public @interface HdrMode {} + /** * Processes HDR input as HDR, to generate HDR output. * @@ -65,6 +66,7 @@ public final class TransformationRequest { * #HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_MEDIACODEC}. */ public static final int HDR_MODE_KEEP_HDR = 0; + /** * Tone map HDR input to SDR before processing, to generate SDR output, using the {@link * android.media.MediaCodec} decoder tone-mapper. @@ -75,6 +77,7 @@ public final class TransformationRequest { *

If not supported, {@link Transformer} throws an {@link ExportException}. */ public static final int HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_MEDIACODEC = 1; + /** * Tone map HDR input to SDR before processing, to generate SDR output, using an OpenGL * tone-mapper. @@ -89,6 +92,7 @@ public final class TransformationRequest { *

If not supported, {@link Transformer} throws an {@link ExportException}. */ public static final int HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_OPEN_GL = 2; + /** * Interpret HDR input as SDR, likely with a washed out look. * @@ -254,6 +258,7 @@ public final class TransformationRequest { * */ public final int outputHeight; + /** * The requested output audio sample {@linkplain MimeTypes MIME type}, or {@code null} if inferred * from the input. @@ -261,6 +266,7 @@ public final class TransformationRequest { * @see Builder#setAudioMimeType(String) */ @Nullable public final String audioMimeType; + /** * The requested output video sample {@linkplain MimeTypes MIME type}, or {@code null} if inferred * from the input. @@ -268,6 +274,7 @@ public final class TransformationRequest { * @see Builder#setVideoMimeType(String) */ @Nullable public final String videoMimeType; + /** * The {@link HdrMode} specifying how to handle HDR input video. * diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/TransformationResult.java b/libraries/transformer/src/main/java/androidx/media3/transformer/TransformationResult.java index e336a55603..9037261262 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/TransformationResult.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/TransformationResult.java @@ -266,11 +266,13 @@ public final class TransformationResult { public static final class ProcessedInput { /** The processed {@link MediaItem}. */ public final MediaItem mediaItem; + /** * The name of the audio decoder used to process {@code mediaItem}. This field is {@code null} * if no audio decoder was used. */ public final @MonotonicNonNull String audioDecoderName; + /** * The name of the video decoder used to process {@code mediaItem}. This field is {@code null} * if no video decoder was used. @@ -291,6 +293,7 @@ public final class TransformationResult { /** The duration of the file in milliseconds, or {@link C#TIME_UNSET} if unset or unknown. */ public final long durationMs; + /** The size of the file in bytes, or {@link C#LENGTH_UNSET} if unset or unknown. */ public final long fileSizeBytes; @@ -298,10 +301,13 @@ public final class TransformationResult { * The average bitrate of the audio track data, or {@link C#RATE_UNSET_INT} if unset or unknown. */ public final int averageAudioBitrate; + /** The channel count of the audio, or {@link C#LENGTH_UNSET} if unset or unknown. */ public final int channelCount; + /** The sample rate of the audio, or {@link C#RATE_UNSET_INT} if unset or unknown. */ public final int sampleRate; + /** The name of the audio encoder used, or {@code null} if none were used. */ @Nullable public final String audioEncoderName; @@ -309,14 +315,19 @@ public final class TransformationResult { * The average bitrate of the video track data, or {@link C#RATE_UNSET_INT} if unset or unknown. */ public final int averageVideoBitrate; + /** The {@link ColorInfo} of the video, or {@code null} if unset or unknown. */ @Nullable public final ColorInfo colorInfo; + /** The height of the video, or {@link C#LENGTH_UNSET} if unset or unknown. */ public final int height; + /** The width of the video, or {@link C#LENGTH_UNSET} if unset or unknown. */ public final int width; + /** The number of video frames. */ public final int videoFrameCount; + /** The name of the video encoder used, or {@code null} if none were used. */ @Nullable public final String videoEncoderName; diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/Transformer.java b/libraries/transformer/src/main/java/androidx/media3/transformer/Transformer.java index a4e0aa70e1..9f58c4572c 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/Transformer.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/Transformer.java @@ -543,16 +543,21 @@ public final class Transformer { PROGRESS_STATE_UNAVAILABLE }) public @interface ProgressState {} + /** Indicates that the corresponding operation hasn't been started. */ public static final int PROGRESS_STATE_NOT_STARTED = 0; + /** * @deprecated Use {@link #PROGRESS_STATE_NOT_STARTED} instead. */ @Deprecated public static final int PROGRESS_STATE_NO_TRANSFORMATION = PROGRESS_STATE_NOT_STARTED; + /** Indicates that the progress is currently unavailable, but might become available. */ public static final int PROGRESS_STATE_WAITING_FOR_AVAILABILITY = 1; + /** Indicates that the progress is available. */ public static final int PROGRESS_STATE_AVAILABLE = 2; + /** Indicates that the progress is permanently unavailable. */ public static final int PROGRESS_STATE_UNAVAILABLE = 3; diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/TransformerInternal.java b/libraries/transformer/src/main/java/androidx/media3/transformer/TransformerInternal.java index 7b691bf947..8dedc7f68c 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/TransformerInternal.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/TransformerInternal.java @@ -80,10 +80,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; @Target(TYPE_USE) @IntDef({END_REASON_COMPLETED, END_REASON_CANCELLED, END_REASON_ERROR}) private @interface EndReason {} + /** The export completed successfully. */ private static final int END_REASON_COMPLETED = 0; + /** The export was cancelled. */ private static final int END_REASON_CANCELLED = 1; + /** An error occurred during the export. */ private static final int END_REASON_ERROR = 2; diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/VideoEncoderSettings.java b/libraries/transformer/src/main/java/androidx/media3/transformer/VideoEncoderSettings.java index 1806e8e12e..ced51358cd 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/VideoEncoderSettings.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/VideoEncoderSettings.java @@ -42,6 +42,7 @@ public final class VideoEncoderSettings { /** A value for various fields to indicate that the field's value is unknown or not applicable. */ public static final int NO_VALUE = Format.NO_VALUE; + /** The default I-frame interval in seconds. */ public static final float DEFAULT_I_FRAME_INTERVAL_SECONDS = 1.0f; @@ -219,18 +220,25 @@ public final class VideoEncoderSettings { /** The encoding bitrate in bits per second. */ public final int bitrate; + /** One of {@linkplain BitrateMode}. */ public final @BitrateMode int bitrateMode; + /** The encoding profile. */ public final int profile; + /** The encoding level. */ public final int level; + /** The encoding I-Frame interval in seconds. */ public final float iFrameIntervalSeconds; + /** The encoder {@link MediaFormat#KEY_OPERATING_RATE operating rate} in frames per second. */ public final int operatingRate; + /** The encoder {@link MediaFormat#KEY_PRIORITY priority}. */ public final int priority; + /** Whether the encoder should automatically set the bitrate to target a high quality encoding. */ public final boolean enableHighQualityTargeting; diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/VideoSamplePipeline.java b/libraries/transformer/src/main/java/androidx/media3/transformer/VideoSamplePipeline.java index 8d57fee861..5d6546d302 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/VideoSamplePipeline.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/VideoSamplePipeline.java @@ -76,6 +76,7 @@ import org.checkerframework.dataflow.qual.Pure; @Nullable final Presentation presentation; private volatile boolean encoderExpectsTimestampZero; + /** * The timestamp of the last buffer processed before {@linkplain * VideoFrameProcessor.Listener#onEnded() frame processing has ended}. diff --git a/libraries/ui/src/main/java/androidx/media3/ui/AspectRatioFrameLayout.java b/libraries/ui/src/main/java/androidx/media3/ui/AspectRatioFrameLayout.java index c851dd4312..539e8b0f71 100644 --- a/libraries/ui/src/main/java/androidx/media3/ui/AspectRatioFrameLayout.java +++ b/libraries/ui/src/main/java/androidx/media3/ui/AspectRatioFrameLayout.java @@ -68,16 +68,20 @@ public final class AspectRatioFrameLayout extends FrameLayout { /** Either the width or height is decreased to obtain the desired aspect ratio. */ public static final int RESIZE_MODE_FIT = 0; + /** * The width is fixed and the height is increased or decreased to obtain the desired aspect ratio. */ public static final int RESIZE_MODE_FIXED_WIDTH = 1; + /** * The height is fixed and the width is increased or decreased to obtain the desired aspect ratio. */ public static final int RESIZE_MODE_FIXED_HEIGHT = 2; + /** The specified aspect ratio is ignored. */ public static final int RESIZE_MODE_FILL = 3; + /** Either the width or height is increased to obtain the desired aspect ratio. */ public static final int RESIZE_MODE_ZOOM = 4; diff --git a/libraries/ui/src/main/java/androidx/media3/ui/CaptionStyleCompat.java b/libraries/ui/src/main/java/androidx/media3/ui/CaptionStyleCompat.java index 531084cccd..3f1e8507aa 100644 --- a/libraries/ui/src/main/java/androidx/media3/ui/CaptionStyleCompat.java +++ b/libraries/ui/src/main/java/androidx/media3/ui/CaptionStyleCompat.java @@ -51,14 +51,19 @@ public final class CaptionStyleCompat { EDGE_TYPE_DEPRESSED }) public @interface EdgeType {} + /** Edge type value specifying no character edges. */ public static final int EDGE_TYPE_NONE = 0; + /** Edge type value specifying uniformly outlined character edges. */ public static final int EDGE_TYPE_OUTLINE = 1; + /** Edge type value specifying drop-shadowed character edges. */ public static final int EDGE_TYPE_DROP_SHADOW = 2; + /** Edge type value specifying raised bevel character edges. */ public static final int EDGE_TYPE_RAISED = 3; + /** Edge type value specifying depressed bevel character edges. */ public static final int EDGE_TYPE_DEPRESSED = 4; diff --git a/libraries/ui/src/main/java/androidx/media3/ui/DefaultTimeBar.java b/libraries/ui/src/main/java/androidx/media3/ui/DefaultTimeBar.java index 4aec163bfa..692132441e 100644 --- a/libraries/ui/src/main/java/androidx/media3/ui/DefaultTimeBar.java +++ b/libraries/ui/src/main/java/androidx/media3/ui/DefaultTimeBar.java @@ -131,38 +131,52 @@ public class DefaultTimeBar extends View implements TimeBar { /** Default height for the time bar, in dp. */ public static final int DEFAULT_BAR_HEIGHT_DP = 4; + /** Default height for the touch target, in dp. */ public static final int DEFAULT_TOUCH_TARGET_HEIGHT_DP = 26; + /** Default width for ad markers, in dp. */ public static final int DEFAULT_AD_MARKER_WIDTH_DP = 4; + /** Default diameter for the scrubber when enabled, in dp. */ public static final int DEFAULT_SCRUBBER_ENABLED_SIZE_DP = 12; + /** Default diameter for the scrubber when disabled, in dp. */ public static final int DEFAULT_SCRUBBER_DISABLED_SIZE_DP = 0; + /** Default diameter for the scrubber when dragged, in dp. */ public static final int DEFAULT_SCRUBBER_DRAGGED_SIZE_DP = 16; + /** Default color for the played portion of the time bar. */ public static final int DEFAULT_PLAYED_COLOR = 0xFFFFFFFF; + /** Default color for the unplayed portion of the time bar. */ public static final int DEFAULT_UNPLAYED_COLOR = 0x33FFFFFF; + /** Default color for the buffered portion of the time bar. */ public static final int DEFAULT_BUFFERED_COLOR = 0xCCFFFFFF; + /** Default color for the scrubber handle. */ public static final int DEFAULT_SCRUBBER_COLOR = 0xFFFFFFFF; + /** Default color for ad markers. */ public static final int DEFAULT_AD_MARKER_COLOR = 0xB2FFFF00; + /** Default color for played ad markers. */ public static final int DEFAULT_PLAYED_AD_MARKER_COLOR = 0x33FFFF00; /** Vertical gravity for progress bar to be located at the center in the view. */ public static final int BAR_GRAVITY_CENTER = 0; + /** Vertical gravity for progress bar to be located at the bottom in the view. */ public static final int BAR_GRAVITY_BOTTOM = 1; /** The threshold in dps above the bar at which touch events trigger fine scrub mode. */ private static final int FINE_SCRUB_Y_THRESHOLD_DP = -50; + /** The ratio by which times are reduced in fine scrub mode. */ private static final int FINE_SCRUB_RATIO = 3; + /** * The time after which the scrubbing listener is notified that scrubbing has stopped after * performing an incremental scrub using key input. diff --git a/libraries/ui/src/main/java/androidx/media3/ui/LegacyPlayerControlView.java b/libraries/ui/src/main/java/androidx/media3/ui/LegacyPlayerControlView.java index 3a7649a027..1e14fa5afa 100644 --- a/libraries/ui/src/main/java/androidx/media3/ui/LegacyPlayerControlView.java +++ b/libraries/ui/src/main/java/androidx/media3/ui/LegacyPlayerControlView.java @@ -277,11 +277,14 @@ public class LegacyPlayerControlView extends FrameLayout { /** The default show timeout, in milliseconds. */ public static final int DEFAULT_SHOW_TIMEOUT_MS = 5000; + /** The default repeat toggle modes. */ public static final @RepeatModeUtil.RepeatToggleModes int DEFAULT_REPEAT_TOGGLE_MODES = RepeatModeUtil.REPEAT_TOGGLE_MODE_NONE; + /** The default minimum interval between time bar position updates. */ public static final int DEFAULT_TIME_BAR_MIN_UPDATE_INTERVAL_MS = 200; + /** The maximum number of windows that can be shown in a multi-window time bar. */ public static final int MAX_WINDOWS_FOR_MULTI_WINDOW_TIME_BAR = 100; diff --git a/libraries/ui/src/main/java/androidx/media3/ui/PlayerControlView.java b/libraries/ui/src/main/java/androidx/media3/ui/PlayerControlView.java index edec2cbfac..eb13af7cf6 100644 --- a/libraries/ui/src/main/java/androidx/media3/ui/PlayerControlView.java +++ b/libraries/ui/src/main/java/androidx/media3/ui/PlayerControlView.java @@ -244,15 +244,20 @@ public class PlayerControlView extends FrameLayout { /** The default show timeout, in milliseconds. */ public static final int DEFAULT_SHOW_TIMEOUT_MS = 5_000; + /** The default repeat toggle modes. */ public static final @RepeatModeUtil.RepeatToggleModes int DEFAULT_REPEAT_TOGGLE_MODES = RepeatModeUtil.REPEAT_TOGGLE_MODE_NONE; + /** The default minimum interval between time bar position updates. */ public static final int DEFAULT_TIME_BAR_MIN_UPDATE_INTERVAL_MS = 200; + /** The maximum number of windows that can be shown in a multi-window time bar. */ public static final int MAX_WINDOWS_FOR_MULTI_WINDOW_TIME_BAR = 100; + /** The maximum interval between time bar position updates. */ private static final int MAX_UPDATE_INTERVAL_MS = 1_000; + // LINT.IfChange(playback_speeds) private static final float[] PLAYBACK_SPEEDS = new float[] {0.25f, 0.5f, 0.75f, 1f, 1.25f, 1.5f, 2f}; diff --git a/libraries/ui/src/main/java/androidx/media3/ui/PlayerNotificationManager.java b/libraries/ui/src/main/java/androidx/media3/ui/PlayerNotificationManager.java index f3860ce962..fb99b3d88b 100644 --- a/libraries/ui/src/main/java/androidx/media3/ui/PlayerNotificationManager.java +++ b/libraries/ui/src/main/java/androidx/media3/ui/PlayerNotificationManager.java @@ -613,20 +613,28 @@ public class PlayerNotificationManager { /** The action which starts playback. */ public static final String ACTION_PLAY = "androidx.media3.ui.notification.play"; + /** The action which pauses playback. */ public static final String ACTION_PAUSE = "androidx.media3.ui.notification.pause"; + /** The action which skips to the previous media item. */ public static final String ACTION_PREVIOUS = "androidx.media3.ui.notification.prev"; + /** The action which skips to the next media item. */ public static final String ACTION_NEXT = "androidx.media3.ui.notification.next"; + /** The action which fast forwards. */ public static final String ACTION_FAST_FORWARD = "androidx.media3.ui.notification.ffwd"; + /** The action which rewinds. */ public static final String ACTION_REWIND = "androidx.media3.ui.notification.rewind"; + /** The action which stops playback. */ public static final String ACTION_STOP = "androidx.media3.ui.notification.stop"; + /** The extra key of the instance id of the player notification manager. */ public static final String EXTRA_INSTANCE_ID = "INSTANCE_ID"; + /** * The action which is executed when the notification is dismissed. It cancels the notification * and calls {@link NotificationListener#onNotificationCancelled(int, boolean)}. diff --git a/libraries/ui/src/main/java/androidx/media3/ui/PlayerView.java b/libraries/ui/src/main/java/androidx/media3/ui/PlayerView.java index 76de29aba2..3a9a2a0d35 100644 --- a/libraries/ui/src/main/java/androidx/media3/ui/PlayerView.java +++ b/libraries/ui/src/main/java/androidx/media3/ui/PlayerView.java @@ -215,8 +215,10 @@ public class PlayerView extends FrameLayout implements AdViewProvider { /** No artwork is shown. */ @UnstableApi public static final int ARTWORK_DISPLAY_MODE_OFF = 0; + /** The artwork is fit into the player view and centered creating a letterbox style. */ @UnstableApi public static final int ARTWORK_DISPLAY_MODE_FIT = 1; + /** * The artwork covers the entire space of the player view. If the aspect ratio of the image is * different than the player view some areas of the image are cropped. @@ -233,13 +235,16 @@ public class PlayerView extends FrameLayout implements AdViewProvider { @Target(TYPE_USE) @IntDef({SHOW_BUFFERING_NEVER, SHOW_BUFFERING_WHEN_PLAYING, SHOW_BUFFERING_ALWAYS}) public @interface ShowBuffering {} + /** The buffering view is never shown. */ @UnstableApi public static final int SHOW_BUFFERING_NEVER = 0; + /** * The buffering view is shown when the player is in the {@link Player#STATE_BUFFERING buffering} * state and {@link Player#getPlayWhenReady() playWhenReady} is {@code true}. */ @UnstableApi public static final int SHOW_BUFFERING_WHEN_PLAYING = 1; + /** * The buffering view is always shown when the player is in the {@link Player#STATE_BUFFERING * buffering} state.