20185 Commits

Author SHA1 Message Date
ybai001
6acfa0cc68 Add Dolby Vision Transcoding and Editing Support 2024-06-18 13:56:20 +08:00
ybai001
563f4d845a
Merge pull request #4 from androidx/main
Merge the code from androidx/media main branch
2024-03-18 11:11:27 +08:00
tofunmi
d269b93755 Transformer: Take effects into account when signalling duration
PiperOrigin-RevId: 616224079
2024-03-15 13:21:12 -07:00
huangdarwin
3136deb9b3 Test: Remove extraneous testIds.
PiperOrigin-RevId: 616213378
2024-03-15 12:39:43 -07:00
tofunmi
4d1ede5432 Ultra HDR: release texture after use
PiperOrigin-RevId: 616209205
2024-03-15 12:23:45 -07:00
tofunmi
fe640da5e8 Transformer: add speedChange API
PiperOrigin-RevId: 616163061
2024-03-15 10:02:37 -07:00
tofunmi
762065fae0 Add api to find duration after an effect is applied
PiperOrigin-RevId: 616157067
2024-03-15 09:41:40 -07:00
Googler
415d779c62 Explicitly check that AudioGraph input is PCM 16
AudioGraph implicitly assumes that input will be PCM 16 bit, and not float.
Make the check explicit.

PiperOrigin-RevId: 616149131
2024-03-15 09:14:04 -07:00
tofunmi
b9843af6a0 SpeedChangingAudioProcessor: process all callbacks after audio ends
PiperOrigin-RevId: 616143969
2024-03-15 08:54:26 -07:00
huangdarwin
b126bae93d Effect: Add EGL_EXT_gl_colorspace_bt2020_hlg support, on API 34+
Confirmed that the HLG extension displays properly on Pixel 7 Pro, API 34 and Samsung S24, API 34. On these devices, this fixes the washed out HLG preview issue on API 34, where the PQ ext had a washed out look, and where the HLG ext is supported (this bug didn't occur on API 33, only 34).

More info on manual tests done to sanity-check:
* Test cases: Transformer debug SurfaceView and ExoPlayer.setVideoEffects
* Test inputs: HLG and PQ
* Test devices: Pixel 7 Pro (API 33 & 34), Samsung Galaxy S24 (API 34)
* Added debugging: Logging colorInfo used in GlUtil.createEglSurface

No regressions were seen. HLG extension is used more in API 34, and behavior stays the same on API 33. Only human-visible change without logging is that HLG content looks better on API 34, for Samsung S24 and Pixel 7 Pro.

PiperOrigin-RevId: 616131192
2024-03-15 08:06:49 -07:00
tofunmi
c0ffc94d15 Add GlEffect that asynchronously adjusts input presentation times
Single asset export only effect.

PiperOrigin-RevId: 616114153
2024-03-15 06:56:25 -07:00
ibaker
48cffc849a Fix proguard rule for DefaultVideoFrameProcess.Factory.Builder.build()
Issue: androidx/media#1187

#minor-release

PiperOrigin-RevId: 616112879
2024-03-15 06:50:16 -07:00
ibaker
e9ed874e51 Don't emit a CuesWithTiming for zero-duration Subtitle events
It's a bit arguable whether the `Subtitle` implementation supports
zero-duration events, since `getEventTimeCount` is documented as
effectively "the number of times the cues returns by `getCues(long)`
changes", and zero-duration events violate that. However, the current
`WebvttSubtitle` impl **does** produce zero-duration events, so it
seems safer to handle them gracefully here and then, as a possible
follow-up, fix the `WebvttSubtitle` impl (or remove it completely).

Issue: androidx/media#1177

#minor-release

PiperOrigin-RevId: 616095798
2024-03-15 05:26:21 -07:00
tofunmi
f39fe82bba Support ultra HDR in effect
adding sending gainmap to shader program and applying gainmap to base in shader

PiperOrigin-RevId: 616070582
2024-03-15 03:22:54 -07:00
Copybara-Service
e9a28beb44 Merge pull request #1117 from loliball:dev_wav_align_fix
PiperOrigin-RevId: 615820438
2024-03-14 10:17:49 -07:00
Rohit Singh
c84a3279d3 Add unit test 2024-03-14 16:12:40 +00:00
kimvde
e40ce150bf Implement AudioGraph.flush()
When flushing the AudioGraph, the AudioMixer will be preserved but the
sources will be recreated. This is probably a bit less efficient but
makes the logic simpler. Indeed, if we had to keep the sources alive,
we would need to add a way to reconfigure them with a new timestamp for
seeking. We would also need to change the way sources are ended because
they are currently removed when they are ended. Also, it is acceptable
to have a small delay when seeking, which means that performance is less
critical than for playback.

PiperOrigin-RevId: 615775501
2024-03-14 07:49:07 -07:00
andrewlewis
9da878956a Add short form content demo to project
#minor-release

PiperOrigin-RevId: 615756117
2024-03-14 06:29:01 -07:00
sheenachhabra
80247bc32c Remove deprecated methods from Mp4Muxer class
PiperOrigin-RevId: 615736494
2024-03-14 04:59:02 -07:00
kimvde
3248b7962a Add clipFloatOutput parameter to AudioMixer
PiperOrigin-RevId: 615720340
2024-03-14 03:44:37 -07:00
huangdarwin
ca6031deab Update old method name.
getSupportedEncoderNamesForHdrEditing became getSupportedEncodersForHdrEditing at some point, but this comment wasn't updated before...

PiperOrigin-RevId: 615712707
2024-03-14 03:11:03 -07:00
christosts
5f6e5bcda2 Composition preview: image renderer does not forward VideoSink events
PiperOrigin-RevId: 615479550
2024-03-13 11:10:02 -07:00
sheenachhabra
668a172683 Rename MuxerWrapper.release() method
PiperOrigin-RevId: 615399319
2024-03-13 06:54:19 -07:00
sheenachhabra
644d9a3461 Remove usage of deprecated methdods from Mp4Muxer tests
PiperOrigin-RevId: 615392633
2024-03-13 06:31:00 -07:00
sheenachhabra
dfe9fba17d Remove non actionable TODOs from Mp4Muxer code
PiperOrigin-RevId: 615372415
2024-03-13 05:07:34 -07:00
ibaker
12aa637fa1 Add section comments to settings.gradle
PiperOrigin-RevId: 615005773
2024-03-12 05:38:53 -07:00
ibaker
c41213c273 Move test-session-xxx modules from core_settings to settings
This ensures these modules are only configured when directly working
on the library, rather than when depending on it locally. These modules
only contain tests, they shouldn't be depended on by any apps (and are
not published via Maven).

PiperOrigin-RevId: 615004801
2024-03-12 05:35:31 -07:00
michaelkatz
8b219b0ae6 Start playing period-enabled renderers when setting playWhenReady true
Renderers may be enabled for subsequent media items as soon as the current media item's renderer's isEnded() returns true. Currently, when a player is set to pause, it stops all renderers that are `STATE_STARTED`. When a player is set to play, it starts all renderers that are enabled. This would include renderers that were enabled early for the subsequent media item. The solution is to only start renderers that are enabled by the current playing period.

Issue: androidx/media#1017
PiperOrigin-RevId: 614734437
2024-03-11 11:31:12 -07:00
tonihei
cbed80ecf3 Always set PARAMETER_KEY_TUNNEL_PEEK when tunneling
This should already be the default, but some devices seem
to not adhere to this contract and assume the default is unset.

Issue: androidx/media#1169
PiperOrigin-RevId: 614697283
2024-03-11 09:49:09 -07:00
christosts
6f109ffa6a Composition preview: play multiple images
PiperOrigin-RevId: 614690669
2024-03-11 09:28:40 -07:00
christosts
e399ea19bb Composition preview: move audio and video components
PiperOrigin-RevId: 614673253
2024-03-11 08:29:38 -07:00
sheenachhabra
aba395ca8b Add Mp4OrientationData class
Mp4Muxer now has a single method to accept different
types of metadata.

PiperOrigin-RevId: 614646331
2024-03-11 06:45:15 -07:00
tonihei
e4a55844d0 Add device-specific opt-ins for async MediaCodecAdapter
Some devices just don't work very well with the synchronous
model, but are currently still excluded from our approximate
API 31 check. This change allows to include additional devices
or device groups by passing in the Context to the default
adapter.

It also adopts the workaround added in ebceee08c6
for Fire TV Smart devices that exhibit this issue.

PiperOrigin-RevId: 614642545
2024-03-11 06:29:46 -07:00
tonihei
410c0492cc Force external surround sound flag if requested by device
Some FireOS6 devices ask to force the external surround global
flag and ignore any signals from the HDMI connection.

This is the equivalent change of e341944d1e

PiperOrigin-RevId: 614634499
2024-03-11 05:55:43 -07:00
tonihei
0e42c8945f Automatically add icon drawables for icon constants
Having a default icon available allows apps to only specify the
icon constant without having to define an icon drawable themselves
as Media3 can fill in the icon resource for backwards compatibility.

The switch util method allows R8 to easily remove unused icons, so
having default icons won't affect APK size unless the constants are
used to set up the CommandButtons.

PiperOrigin-RevId: 614623909
2024-03-11 05:06:21 -07:00
tonihei
18cbbf3850 Reorder audio capability checks
Using the more accurate check available on later API versions
first is likely better than falling back to a fallback solution
from older API versions.

PiperOrigin-RevId: 614612628
2024-03-11 04:17:35 -07:00
tonihei
eb6f607717 Document MergingMediaSource tag contract
Issue: androidx/media#883

#minor-release

PiperOrigin-RevId: 613970048
2024-03-08 10:16:23 -08:00
tofunmi
a975c75748 SpeedChangingAudioProcessor: fix outputTime calculation
minor fix for arithmetic error in calculated added in f4c60c52b9 (speed is outputTime (change in y) divided by inputTime (change in x), this calculation is inverted in code).

Changed test to cover the case.

PiperOrigin-RevId: 613966027
2024-03-08 10:01:55 -08:00
ibaker
4bca1ac47b Add opt-in flag for the MIDI module for apps with a local dependency
PiperOrigin-RevId: 613938538
2024-03-08 08:17:02 -08:00
claincly
16ef146482 Allow playing mixed input types.
These input types include images, video without audio, and video with audio.
While playing these inputs, the video frame presentation is always synced with
audio.

PiperOrigin-RevId: 613921719
2024-03-08 07:02:51 -08:00
ibaker
f9032a5893 Add checkNotNull(uri) to DataSpec constructor
This check is already present in `DataSpec.Builder.build()` but there
are many public constructors which bypass the builder (only some of
which are deprecated), so this adds an additional check.

PiperOrigin-RevId: 613908358
2024-03-08 05:59:10 -08:00
tofunmi
f4c60c52b9 Calculate outputTime based on inputTime and audio speed change
PiperOrigin-RevId: 613894863
2024-03-08 04:47:12 -08:00
ibaker
7f5b1a98e9 Use Guava's toByteArray & fromByteArray methods where possible
Also remove intermediate object allocations in
`Util.toByteArray(int...)`.

`Util.toByteArray(InputStream)` is kept (but deprecated) because it's
been part of the library for a while and might be in use by some apps.
The others are much newer, so the chance of usages outside the library
is very low, so we just remove them directly.

PiperOrigin-RevId: 613878453
2024-03-08 03:27:29 -08:00
christosts
9f9d955f0d Preview clipped media in composition preview
PiperOrigin-RevId: 613609878
2024-03-07 09:32:11 -08:00
ibaker
5b48ef4e53 Add tests for Util.toByteArray
The implementation of these methods is changed in a follow-up CL, and
these tests help to ensure nothing breaks.

This doesn't include tests for `toByteArray(InputStream)` or
`toByteArray(int)` because these implementations are fully replaced by
Guava equivalents in a follow-up CL.

PiperOrigin-RevId: 613581845
2024-03-07 07:51:04 -08:00
ibaker
ab8b77a6d3 Use try-with-resources for input and output streams in TestUtil
Many of these streams were previously never closed.

PiperOrigin-RevId: 613580471
2024-03-07 07:47:59 -08:00
claincly
0f72126c20 Add getLastTimestampUs() method
PiperOrigin-RevId: 613579674
2024-03-07 07:44:58 -08:00
ibaker
914874566e Remove unused TestUtil.getBitmap method
PiperOrigin-RevId: 613579444
2024-03-07 07:41:14 -08:00
ibaker
0ff80d7da0 Statically import Assertions methods in FakeExoMediaDrm
PiperOrigin-RevId: 613578959
2024-03-07 07:37:50 -08:00
ibaker
a604600126 Add workarounds for NoSuchMethodError from DRM framework exceptions
Issue: androidx/media#1145

#minor-release

PiperOrigin-RevId: 613573868
2024-03-07 07:16:28 -08:00