421 Commits

Author SHA1 Message Date
Cedric T
f47930e587 Refactor getDirectPlaybackSupportedEncodings() 2023-05-25 09:55:10 +00:00
Cedric T
6823a2916a Add C.ENCODING_DTS_UHD_P2 2023-05-25 09:55:09 +00:00
Cedric T
b73d2cc736 Add direct passthrough support for DTS audio. 2023-05-25 09:55:09 +00:00
tonihei
2c07468908 Implement Player.replaceMediaItem(s)
This change moves the default logic into the actual Player
implementations, but does not introduce any behavior changes compared
to addMediaItems+removeMediaItems except to make the updates "atomic"
in ExoPlayerImpl, SimpleBasePlayer and MediaController. It also
provides backwards compatbility for cases where Players don't support
the operation.

Issue: google/ExoPlayer#8046

#minor-release

PiperOrigin-RevId: 534945089
2023-05-25 10:00:02 +01:00
jbibik
3cc4e44fe3 Make MediaItem.AdsConfiguration bundleable
PiperOrigin-RevId: 534848363
2023-05-25 09:53:10 +01:00
tonihei
acb567d5a7 Add clarifiying note to Player.replaceMediaItem
This helps to highlight that the replaced range doesn't need to have
the same size as before.

#minor-release

PiperOrigin-RevId: 534834917
2023-05-25 09:52:18 +01:00
ibaker
5c713feb60 Remove deprecated onSeekProcessed
This change removes it from `Player.Listener` and `AnalyticsListener`,
use `onPositionDiscontinuity` with `DISCONTINUITY_REASON_SEEK` instead.

#minor-release

PiperOrigin-RevId: 534757426
2023-05-24 16:06:05 +01:00
huangdarwin
66554b9b68 Codec: Reduce limit for max decoder pending output frames.
Tentative/experimental value to reduce codec timeouts. We will reconsider using a larger limit after seeing whether this really does reduce error rate.

PiperOrigin-RevId: 534491615
2023-05-24 16:05:00 +01:00
michaelkatz
4f0a256cc9 Set offload mode preference through TrackSelectionParameters
Added piping to present offload support from the audio sink to the renderer and track selection. Applications can set offload mode preference and with both sink support and compatible track selection, renderer will be configured for offload.

PiperOrigin-RevId: 534450534
2023-05-24 16:00:42 +01:00
ibaker
e6f5f58e47 Remove deprecated Cue constructors, use Cue.Builder instead
#minor-release

PiperOrigin-RevId: 534412494
2023-05-24 15:56:23 +01:00
jbibik
b7edc9e416 Make MediaItem.SubtitleConfiguration bundleable
PiperOrigin-RevId: 534390168
2023-05-24 15:55:18 +01:00
huangdarwin
a6897aedaa Effect: Add GlTextureInfo release() and accessor methods.
This allows us to disallow access after release.

PiperOrigin-RevId: 534046475
2023-05-24 15:42:47 +01:00
tonihei
6de6bd9c4f Extend main Player Javadoc
The main interface documentation hasn't been updated substantially
since 2017 and is missing notes for many of its current features and
requirements.

Also change the recommendation for implementors from BasePlayer to
SimpleBasePlayer to ensure new classes are more likely to cover all
of the interface requirements.

#minor-release

PiperOrigin-RevId: 534027117
2023-05-24 15:36:55 +01:00
jbibik
5008417c8c Make DrmConfiguration Bundleable
PiperOrigin-RevId: 533721679
2023-05-24 15:30:35 +01:00
bachinger
2a6f893fba Set video size to 0/0 when video render is disabled
In terms of MCVR with a `VideoRendererEventListener`, the video size is set to
0/0 right after `onVideoDisabled()` is called and is set to the actual size as
soon as the video size is known after 'onVideoEnabled()`.

For ExoPlayer and in terms of the `Player` interface, `Player.getVideoSize()`
returns a video size of 0/0 when `Player.getCurrentTracks()` does not support
`C.TRACK_TYPE_VIDEO`. This is ensured by the masking behavior of
`ExoPlayerImpl` that sets an empty track selection result when the playing
period changes due to a seek or timeline removal.

When transitioning playback from a video media item to the next, or when
seeking within the same video media item, the renderer is not disabled.

#minor-release

PiperOrigin-RevId: 533479600
2023-05-24 15:28:20 +01:00
ibaker
d5f9cf4f19 Add singleVariant publishing config to all published gradle files
Docs:
* https://developer.android.com/build/publish-library/configure-pub-variants#single-pub-var
* https://developer.android.com/reference/tools/gradle-api/8.0/com/android/build/api/dsl/PublishingOptions

This resolves the following warning from Android Gradle Plugin 7.2.2 and
helps unblock the upgrade to AGP 8.0.1:

> Software Components will not be created automatically for Maven
> publishing from Android Gradle Plugin 8.0. To opt-in to the future
> behavior, set the Gradle property
> `android.disableAutomaticComponentCreation=true` in the
> `gradle.properties` file or use the new publishing DSL.
>
> Affected Modules: `lib-cast`, `lib-common`, `lib-container`,
> `lib-database`, `lib-datasource`, `lib-datasource-cronet`,
> `lib-datasource-okhttp`, `lib-datasource-rtmp`, `lib-decoder`,
> `lib-effect`, `lib-exoplayer`, `lib-exoplayer-all (legacy)`,
> `lib-exoplayer-dash`, `lib-exoplayer-hls`, `lib-exoplayer-ima`,
> `lib-exoplayer-rtsp`, `lib-exoplayer-smoothstreaming`,
> `lib-exoplayer-workmanager`, `lib-extractor`, `lib-media2 (legacy)`,
> `lib-mediasession (legacy)`, `lib-muxer`, `lib-session`,
> `lib-transformer`, `lib-ui`, `lib-ui-leanback`, `test-utils`,
> `test-utils-robolectric`

Issue: androidx/media#409
PiperOrigin-RevId: 533464133
2023-05-19 17:22:21 +01:00
ibaker
b3db85133a Add android.namespace to all build.gradle files
This is a pre-requisite for the Android Studio upgrade assistant to
upgrade from AGP 7.2.2 to 8.0.1, otherwise it fails and complains
this is missing.

Issue: androidx/media#409
PiperOrigin-RevId: 533463246
2023-05-19 17:19:15 +01:00
huangdarwin
25fa2df2de Effect: Use callback to release texture
This allows us to avoid needing a reference to the VideoFrameProcessor, which
can be especially difficult if an App only has a reference to the
VideoFrameProcessor.Factory it passes into Transformer/ExoPlayer.

PiperOrigin-RevId: 533205983
2023-05-19 17:10:53 +01:00
jbibik
620b9e1540 Use TestUtil.getPublicMethods instead of getDeclaredMethods
JaCoCo introduces private synthetic methods (even on interfaces) which
have to be skipped when checking that a 'forwarding' implementation does
forward everything. Instead we can use the existing `getPublicMethods()`
method which implicitly skips these (since they're private).

PiperOrigin-RevId: 533130932
2023-05-19 17:08:26 +01:00
claincly
24a4396990 Always use sRGB/BT.709 for bitmap inputs
PiperOrigin-RevId: 533117700
2023-05-19 17:05:16 +01:00
rohks
538524e579 Remove deprecated methods Format.copyWithXXX
Use `Format.buildUpon()` and `setXXX` instead.

#minor-release

PiperOrigin-RevId: 532840625
2023-05-18 12:20:08 +00:00
rohks
18aa664cb8 Remove deprecated methods that create an instance of Format
Use `Format.Builder` instead.

#minor-release

PiperOrigin-RevId: 532808478
2023-05-18 12:17:15 +00:00
huangdarwin
94efcd7917 Effect: Make TexturePool and use in FinalWrapper.
Have the FinalShaderProgramWrapper / VideoFrameProcessor texture
output access textures provided through a texture pool, that
recycles used textures.

Also, add the TexturePool interface to generally re-use textures.

PiperOrigin-RevId: 532754377
2023-05-17 16:33:57 +01:00
sheenachhabra
e0d6f67dd9 Move NAL unit related methods from common to container module
PiperOrigin-RevId: 532750099
2023-05-17 16:32:46 +01:00
tianyifeng
5d4c73eee5 Avoid using @see in the summary fragment in C.java
PiperOrigin-RevId: 532536037
2023-05-17 08:51:06 +01:00
rohks
1061135cfd Remove deprecated String constants for Charsets
Use Kotlin Charsets from the `kotlin.text` package, the `java.nio.charset.StandardCharsets` or the `com.google.common.base.Charsets` instead.

#minor-release

PiperOrigin-RevId: 532469103
2023-05-17 08:48:35 +01:00
tonihei
b1cfeb04a0 Add Player.replaceMediaItem(s)
This methods allows to replace single items or a range of items directly
without using separate operations for add and remove. The advantage is
more readable code for apps and the potential for player
implementations to optimize this process (e.g. only replace values
without interrupting playback).

The current change just introduces the API with its default behavior.
The default logic will be removed again in the future in favor of
better logic in the Player implementations.

Issue: google/ExoPlayer#8046
PiperOrigin-RevId: 532151471
2023-05-16 09:55:53 +01:00
huangdarwin
07ec1eaa48 Effect: Multiple Texture output
Allow the VideoFrameProcessor to output multiple textures at a time, so that
lifetime of textures is up to the consumer calling VFP.releaseOutputFrame.

The FinalShaderProgramWrapper also has a new maxCapacity limit added, to ensure
the a reasonable amount of textures is used and avoid using up memory.

PiperOrigin-RevId: 532094256
2023-05-16 09:49:52 +01:00
huangdarwin
82ede47398 media3: Capitalize "MIME" for MIME types.
Find and replace "mime" to "MIME", where appropriate, throughout media3.

PiperOrigin-RevId: 531122121
2023-05-11 10:05:01 +00:00
ibaker
17b183b11a Remove a copybara stripping tag
#minor-release

PiperOrigin-RevId: 530935437
2023-05-11 10:02:15 +00:00
Googler
ecaf219d74 Adding mime type checking to Transformer to identify images.
PiperOrigin-RevId: 530711523
2023-05-11 09:58:15 +00:00
kimvde
dc4c6daf0b Fix HDR tone mapping stuck on SM device
Tone-mapping an HDR video with MediaCodec on sm-s908u1 was timing out.
The reason for that is that the decoder was dropping frames, and the
ExternalTextureManager was therefore never propagating the end-of-stream
signal.

There was already a workaround for a similar issue but restricted to
sm-f936b. Removed the model check as the bug is probably present on more
devices.

PiperOrigin-RevId: 530639437
2023-05-11 09:53:25 +00:00
tofunmi
7875131e2a Effect: Support input via texture ID
PiperOrigin-RevId: 530624195
2023-05-11 09:49:26 +00:00
tonihei
99dac0be0f Ensure behavior of add/setMediaItems is consistent on empty playlist
Adding items to an empty playlist is slightly different from adding
items to a non-empty playlist, because the former usually requires to
handle a change in the current item, position and playback state,
while the latter is not expected to affect the current item, position
or state.

The current ExoPlayer and SimpleBasePlayer code doesn't account for
this difference, leading to inconsistent behavior between
setMediaItem(s) and addMediaItem(s) when called on an empty playlist.

PiperOrigin-RevId: 530549928
2023-05-11 09:40:47 +00:00
ibaker
eb58d20067 Add tests for MediaLibraryInfo version code consistency
`VERSION_INT` is quite long with several sections, and it's easy to make
a mistake when updating it - this should help since it checks it against
`VERSION`, which is more easily human readable/writable.

PiperOrigin-RevId: 529747023
2023-05-08 15:18:59 +00:00
tofunmi
8c5e1974f2 Version bump to media3:1.1.0-alpha01
#minor-release

PiperOrigin-RevId: 529735598
2023-05-05 17:00:08 +00:00
claincly
213740c456 Enable switching input types via InputMultiplexer.
PiperOrigin-RevId: 529624205
2023-05-05 16:43:58 +00:00
michaelkatz
06ac2f7990 Add UTF-16 encoded subtitle support to SsaDecoder
Issue: androidx/media#319
PiperOrigin-RevId: 527891646
2023-05-03 17:04:35 +01:00
huangdarwin
24343f55af effect: Rename VFP frame release to render.
renderOutputFrame actually renders frames to an output surface. We'll soon have
a releaseOutputFrame method, that would release resources associated with an
output time, so rename this to disambiguate the two methods.

Also rename onOutputFrameAvailable to onOutputFrameAvailableForRendering, to
make it clear this is not available for "release"

This change should be a renaming-only change and have no functional differences.

PiperOrigin-RevId: 527844947
2023-05-03 17:00:48 +01:00
claincly
12cac0d69f Add a listener once one MediaItem is fully processed
Add `VideoFrameProcessor.registerInputStream()` to signal a new type of input.

And `InputHandler.signalEndOfCurrentInputStream()` to signal to `InputHandler`
partial input stream completion.

Fully processed means after FinalShaderProgramWrapper releases the last frame.

PiperOrigin-RevId: 527356646
2023-04-27 12:28:40 +01:00
tonihei
9128244dc3 Use Util method for common UI play/pause button logic.
This ensures the logic is consistent and can also be easily
used from custom UIs.

PiperOrigin-RevId: 527249127
2023-04-26 15:52:50 +01:00
huangdarwin
97272c139c Effects: Output to texture without surface in VFP.
Allow the VideoFrameProcessor to output to a texture without an output surface.

Tested by updating texture output tests to no longer output to a surface.

PiperOrigin-RevId: 527244605
2023-04-26 15:51:06 +01:00
tofunmi
8612d2820d Update image transcoding pipeline to signal input COLOR_TRANSFER_SRGB
The production code changes are in transformer, but the tests in effect have also been updated to confirm the is no color regression `inputColorInfo.colorTransfer=C.COLOR_TRANSFER_SRGB`

PiperOrigin-RevId: 526950435
2023-04-26 15:46:21 +01:00
claincly
c539cb8575 Add default impl for some InputHandler methods.
And minor fixes.

PiperOrigin-RevId: 526717927
2023-04-26 15:43:46 +01:00
huangdarwin
324115f6cf Effects: Allow BT2020 colors with SDR transfers
Previously, I assumed that SDR contents must be BT709, and HDR contents must be
BT2020. Turns out BT2020 is just wide-gamut, and SDR contents / transfers may be
represented in BT2020 color spaces.

Relax the check, so that we don't throw when valid BT2020 SMPTE 170M contents
are input into effects.

PiperOrigin-RevId: 526668347
2023-04-26 15:41:33 +01:00
sheenachhabra
b11dd106ae Replace MediaFormat with Format class in muxer module
PiperOrigin-RevId: 526655859
2023-04-26 15:40:40 +01:00
claincly
f3c0256bb4 Abstract the interface of DefaultVideoFrameProcessor's input.
PiperOrigin-RevId: 526642898
2023-04-26 15:37:12 +01:00
rohks
8a73d8d3fe Add support to fetch ColorInfo from avcC box in AtomParsers
#minor-release

PiperOrigin-RevId: 526082823
2023-04-24 11:37:55 +01:00
tonihei
0bac4e24e4 Add routing controller id to DeviceInfo
And forward the id to the VolumeProviderCompat and read it from the platform
MediaController for compatibility.

PiperOrigin-RevId: 526046892
2023-04-24 11:35:08 +01:00
tonihei
d9fd8f4310 Add Builder for DeviceInfo
This simplifies the addition of new fields in the future.

Also do some misc clean up for the volume limit values:
 - Add some documentation to mention assumed defaults
 - Add the IntRange annotations to match the ones we have in Player
   already
 - Mention the limits in the relevant Player methods
 - Avoid bundling default values
 - Improve range checks for masking in MediaController

PiperOrigin-RevId: 526029619
2023-04-24 11:33:13 +01:00