200 Commits

Author SHA1 Message Date
bachinger
8ce3d4dc72 Exclude Metadata from Format when bundling from TrackGroup
#minor-release

PiperOrigin-RevId: 463062454
2022-08-08 08:00:51 +00:00
ibaker
2deb435625 Annotate methods that always return this with @CanIgnoreReturnValue
It's always safe to ignore the result of these methods, because the
caller already has a reference to the returned value.

PiperOrigin-RevId: 462388947
2022-08-08 07:55:25 +00:00
tonihei
f9eec0c0e8 Add Util helper methods to work with Futures
This adds two methods that are helpful when working with Futures.
One is a version of postOrRun that can indicate completion by a
Future and the other is a simplified version of Guava's
Futures.transformAsync (which can't be used as it's in Beta).

PiperOrigin-RevId: 461896598
2022-07-21 12:51:22 +00:00
ibaker
e1fde5d530 Add fail-fast null checks to the stable Player API
This will help developers self-diagnose issues like Issue: google/ExoPlayer#10392
where the NPE occurs far from the original null value because a field
gets assigned to null.

This change aims to ensure that every stable method on Player,
ExoPlayer and ExoPlayer.Builder that takes a non-null type will fail
with an NPE before returning.

#minor-release

PiperOrigin-RevId: 461846580
2022-07-21 12:46:05 +00:00
huangdarwin
ba9c9bb964 HDR: Use FP16 color representation for texture processors.
* Introduced `useHdr` for `GlEffect#toGlTextureProcessor`, so
  `TextureProcessor` implementations can decide how to handle HDR.
* Creating FP16 color textures for HDR input.

Tested via manual testing, adding a no-op GlEffectWrapper to the transformation to
force use of intermediate textures, adding a linear ramp to the fragment shader,
and trying to ascertain that there's a real reduction in posterization when
switching from 4-bit to 8-bit unsigned bytes, and again from 8-bit unsigned bytes
to 16-bit floating point.

PiperOrigin-RevId: 461613117
2022-07-21 12:42:32 +00:00
rohks
be27daebc4 Version bump to exoplayer:2.18.1 and media3:1.0.0-beta02
#minor-release

PiperOrigin-RevId: 461162552
2022-07-15 10:20:58 +00:00
Rohit Singh
bd8723e35a Merge pull request #10185 from TiVo:p-custom-logger
PiperOrigin-RevId: 460689252
2022-07-13 17:45:54 +00:00
ibaker
ad46cb1c81 Group COMMAND_SET_MEDIA_ITEM and COMMAND_CHANGE_MEDIA_ITEMS together
I don't think it's useful to keep these in numerical order, it makes
more sense to keep them grouped into a 'logical' ordering.

#minor-release

PiperOrigin-RevId: 460453464
2022-07-12 15:14:12 +00:00
hschlueter
a5ff4ef17f HDR: Check whether EXT_YUV_target extension is supported.
This extension is needed for editing HDR input with OpenGL, as the
ExternalTextureProcessor samples raw YUV values from the
external texture for HDR and converts them to RGB itself rather than
relying on the OpenGL driver to do this automatically as for SDR.

PiperOrigin-RevId: 460424154
2022-07-12 15:11:21 +00:00
huangdarwin
7078ce312d HDR: Remove ColorInfo.SDR constant
The SDR constant also specified a color space and range, in addition to
C.COLOR_TRANSFER_SDR. However, it turns out that SDR videos may use different color
space and range values, so following prior ExoPlayer conventions to have `null`
mean "generic SDR" is preferable here.

PiperOrigin-RevId: 459296746
2022-07-07 16:45:00 +00:00
Rohit Singh
f00f93a96e Merge pull request #10260 from sr1990:clearkey_parse_licenseurl
PiperOrigin-RevId: 459215225
2022-07-07 16:43:14 +00:00
huangdarwin
ab7747d953 HDR: Throw error if attempting HDR editing under API 31.
HDR editing is not supported under API 31

PiperOrigin-RevId: 459211106
2022-07-07 16:42:21 +00:00
huangdarwin
1869855c90 HDR: Remove unused EGL_GL_COLORSPACE_KHR attribute.
PiperOrigin-RevId: 459106221
2022-07-07 16:39:27 +00:00
hschlueter
9c8dcb402b Fallback to SDR if encoder doesn't support HDR (HLG only).
If the input is HDR (HLG), check encoder capabilities for HDR support
and request tone-mapping to SDR during decoder configuration otherwise.
Capabilities are only checked for API 31 and above, as HDR editing is
not supported before.

As the encoder capabilities check needs to happen before selecting the
encoder to use (as this may depend on the resolution output by the
effects chain), the EncoderWrapper checks all candidate encoders
for the MIME type for HDR capabilities and only requests fallback to
SDR if none of them support it.

When the actual encoder is selected, the wrapper checks that it matches
one of the encoders is checked capabilities for.

PiperOrigin-RevId: 458511599
2022-07-04 19:55:45 +00:00
huangdarwin
a0870a42be HDR: Configure GL shaders and encoder.
Configure the GL shaders and encoder to take in HDR metadata.

This mostly just consists of passing the Format.colorInfo through
the VideoTranscodingSamplePipeline down to the encoder, rather than passing
the PQ-ness down to the GL step.

Due to b/237674316, this will remove HDR10+ support temporarily to introduce
support for HLG10.

Manually tested to confirm that HLG10 operations that don't affect color display
correctly after this CL with "HDR editing" in the demo checked, and continue to display incorrectly (as before this CL) without the option unchecked.

PiperOrigin-RevId: 458490810
2022-07-04 19:55:02 +00:00
ibaker
6f9ce4056c Consider shuffle order in Timeline.equals()
Previously two timelines that differed only in shuffle order were
considered equal, which resulted in no call to
Player.Listener.onTimelineChanged when calling
ExoPlayer.setShuffleOrder. This in turn resulted in no call to
MediaControllerCompat.Callback.onQueueChanged.

Also make a small fix inside ExoPlayerImpl.setShuffleOrder, to ensure
that the new shuffle order is used when constructing the masked
timeline.

Issue: google/ExoPlayer#9889
#minor-release
PiperOrigin-RevId: 457703727
2022-07-04 19:41:19 +00:00
rohks
b2831d8559 Add timestamp to Metadata
`MetadataRenderer` is updated to output `Metadata` with its presentation time, in microseconds.

PiperOrigin-RevId: 457444718
2022-07-04 19:36:57 +00:00
rohks
74d61bbffb Add timestamp to CueGroup
`TextRenderer` is updated to output `CueGroup`, which contains the presentation time of the cues, in microseconds.

PiperOrigin-RevId: 456531399
2022-06-27 10:38:20 +01:00
christosts
7563bd2792 Misc improvement in Util
#minor-release

PiperOrigin-RevId: 455380010
2022-06-16 17:42:31 +00:00
bachinger
1c0b4b32a4 Version bump to exoplayer:2.18.0 and media3:1.0.0-beta01
#minor-release

PiperOrigin-RevId: 455350486
2022-06-16 11:25:41 +00:00
olly
691b392b24 Don't export broadcast receivers that don't require it
Issue: google/ExoPlayer#10287
PiperOrigin-RevId: 455131138
2022-06-15 15:34:53 +00:00
olly
99cdc515ae Cleanup: Remove unnecessary self-refs in Util
PiperOrigin-RevId: 455121899
2022-06-15 15:33:10 +00:00
Marc Baechinger
ad3348cc69 Merge pull request #9915 from dburckh:avi
PiperOrigin-RevId: 455094147
2022-06-15 15:28:22 +00:00
bachinger
29bf4c8aab Add lint base to make gradle lint run without errors
PiperOrigin-RevId: 454951844
2022-06-15 15:27:34 +00:00
Marc Baechinger
970eb4444c Merge pull request #10322 from DolbyLaboratories:dev-v2-multichannel
PiperOrigin-RevId: 454641746
2022-06-14 17:10:08 +00:00
olly
ab56f865ea Suppress an ExtendsObjects violation
to support enabling this as a compile-time error.

More information: go/lsc-extends-object

PiperOrigin-RevId: 454582570
2022-06-14 17:09:08 +00:00
olly
b5f53e7710 Fix permissions request for media provider content URIs
We need to request the external storage permission to access these

PiperOrigin-RevId: 454160546
2022-06-13 11:12:23 +00:00
hschlueter
d6a6b44715 Combine all native GL errors in a GlException instead of logging.
The native GL errors are in an arbitrary order according to
https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glGetError.xml
This means any of them could contain the most useful message
so it's better to use all for the GlException's message rather than
picking the last message and logging all others.

PiperOrigin-RevId: 454130460
2022-06-13 11:11:31 +00:00
hschlueter
cc1f32d094 Make GlUtil.GlException checked and remove flag to disable it.
Transformer always enabled glAssertionsEnabled, so there should
be no functional change.

ExoPlayer previously disabled glAssertionsEnabled, so GlUtil logged
GlExceptions instead of throwing them. The GlExceptions are now
caught and logged by the callers so that there should also be no
functional change overall.

This change also replaces EGLSurfaceTexture#GlException with
GlUtil#GlException.

PiperOrigin-RevId: 453963741
2022-06-09 18:47:46 +00:00
tonihei
5333c67d08 Add COMMAND_SET_MEDIA_ITEM to Player.Commands
Some Player implementations have no playlist capability but can still
set a MediaItem for playback. Examples are a MediaController connected
to a legacy MediaSession, ExoPlayer up to 2.12 or MediaPlayer.

To indicate this capability, we need an allowed command in addition
to COMMAND_CHANGE_MEDIA_ITEMS that just allows to set a single item
that replaces everything that is currently played.

#minor-release

PiperOrigin-RevId: 453879626
2022-06-09 17:46:14 +00:00
hschlueter
457f446114 Implement default GlTextureProcessor in SingleFrameGlTextureProcessor.
SingleFrameGlTextureProcessor is now an abstract class containing a
default implementation of the more flexible GlTextureProcessor interface
while still exposing the same simple abstract methods for single frame
processing it previously did.

FrameProcessorChain and GlEffect will be changed to use
GlTextureProcessor in follow-ups.

PiperOrigin-RevId: 453633000
2022-06-09 17:41:09 +00:00
ibaker
814e43dbb9 Use a shared keyForField implementation in track selection parameters
The current setup with distinct, private `keyForField` implementations,
leaves open the (theoretical) possibility of a clash in the `Bundle`
keys used by the superclass and subclass. This change brings
consistency with our only other extensible `Bundleable` type
(`PlaybackException`).

#minor-release

PiperOrigin-RevId: 453385875
2022-06-07 16:31:09 +00:00
ibaker
247c2d845d Rename DefaultTrackSelector.ParametersBuilder to Parameters.Builder
We generally nest the `Builder` for `Foo` inside `Foo`. In this case,
there's already a `DefaultTrackSelector.Parameters.Builder` type visible
to a developer, it just happens to be the 'common'
`TrackSelectorParameters.Builder`, so using it is a bit weird. For
example this code snippet doesn't compile because
`DefaultTrackSelector.Parameters.Builder#build()` returns
`TrackSelectionParameters`. This CL fixes that problem and the code
snippet now compiles.

```java
DefaultTrackSelector.Parameters params =
   new DefaultTrackSelector.Parameters.Builder(context).build()
```

#minor-release

PiperOrigin-RevId: 453215702
2022-06-07 16:29:17 +00:00
ibaker
39674bec78 Fix HiddenTypedefConstant Metalava error on PlaybackException
This is done by removing the `@FieldNumber` IntDef completely. It's not
really adding much value anyway, because it's `open` so there's no real
enforcement to prevent passing 'incorrect' values.

#minor-release

PiperOrigin-RevId: 452108972
2022-06-07 16:24:35 +00:00
ibaker
b8ca5b8951 Add @deprecated javadoc to all @Deprecated @Override methods
This ensures the 'use X instead' message is easily visible in the
generated HTML for the overriding method. Currently it's not, e.g.:
https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/BasePlayer.html#getCurrentWindowIndex()

#minor-release

PiperOrigin-RevId: 452002224
2022-05-31 10:44:48 +00:00
tonihei
581c6b5429 Remove MediaMetadata.mediaUrl
This value only existed to allow setting media URLs from external sources
(e.g. in a MediaController) so that a player can start playing this item.
Now that we have MediaItem.RequestMetadata.mediaUrl we can remove this value
from MediaMetadata because it's request metadata, not media metadata.

PiperOrigin-RevId: 451857413
2022-05-30 16:49:28 +00:00
tonihei
6d776a5ae4 Add RequestMetadata to MediaItem
These fields can be used to transport additional request properties
when the requester doesn't know the details needed for the actual
playback (i.e. the LocalConfiguration).

PiperOrigin-RevId: 451857093
2022-05-30 16:46:02 +00:00
ibaker
cad1440e66 Wrap framework AudioAttributes in new AudioAttributesV21 class
PiperOrigin-RevId: 451831531
2022-05-30 16:44:27 +00:00
hschlueter
0705a4e34d Replace frame processor with texture processor in TODO comment.
PiperOrigin-RevId: 451142799
2022-05-30 16:32:06 +00:00
ibaker
8f3b4f590f Fix typos flagged by lint
PiperOrigin-RevId: 451135097
2022-05-30 16:30:11 +00:00
ibaker
591eaef756 Fix some inconsistencies in the MediaItem API
* Rename (via deprecation)
  `MediaItem.DrmConfiguration.Builder#forceSessionsForAudioAndVideoTracks`
  to `setForceSessionsForAudioAndVideoTracks`. This is more consistent
  with existing 'force' method names both in this class and in
  `TrackSelectionParameters.Builder`.
* Add missing `@Nullable` annotation to the parameter for
  `MediaItem.SubtitleConfiguration.Builder#setMimeType`. This annotation
  is already present on the `MediaItem.SubtitleConfiguration#mimeType`
  field that this setter corresponds to.

PiperOrigin-RevId: 450941336
2022-05-26 11:57:21 +00:00
ibaker
c6ed7c4bcb Make Rating.RATING_UNSET package-private
This value is only needed by subclasses of `Rating`, all of which are
in this package (the `Rating` constructor is already package-private to
ensure this).

PiperOrigin-RevId: 450886872
2022-05-26 11:54:20 +00:00
tonihei
9463efef4b Wrap TelephonyCallback in nested class to avoid class loading issues.
PiperOrigin-RevId: 450643824
2022-05-26 11:49:21 +00:00
tonihei
38b1338844 Remove 5G-NSA detection on API 29/30.
This detection relies on an unsupported workaround and may trigger
permission warnings in tools analyzing permission usage although
no permission is needed or requested by app code.

Given the majority of 5G-NSA playbacks are on API 31+ by now,
we can remove this path to avoid the permission confusion and the
unsupported detection workaround.

PiperOrigin-RevId: 450382586
2022-05-24 11:06:09 +01:00
ibaker
7c235d2b84 Remove all null-tolerant methods from BundleableUtil.
In most cases it's clearer to in-line these null-checks with ternary
operators.

PiperOrigin-RevId: 449474621
2022-05-24 10:56:01 +01:00
rohks
c728647290 Create new class to store cues and timestamp.
We need to pass timestamp for the list of cues so we are defining a new class CueGroup which will store both cues and timestamp.

PiperOrigin-RevId: 449212054
2022-05-24 10:49:48 +01:00
tonihei
9345c1addc Add replacement for deprecated network type override constant
The MMWAVE constant was deprecated in favour of a new constant
with a better name. Thus, we need to check for both constants now.

PiperOrigin-RevId: 449018959
2022-05-24 10:47:05 +01:00
tonihei
0724f5b5a5 Add language normalization for "arb" (Standard Arabic)
This is an individual language (ISO 639-3) part of the Arabic
macrolanguage ("ar" in ISO 639-1). Add this mapping to our
existing list similar to other individual to macrolanguage
mappings we have already.

Issue: Issue: google/ExoPlayer#10255
PiperOrigin-RevId: 448911950
2022-05-24 10:45:09 +01:00
hschlueter
d59186e53c Combine multiple matrix transformations in one shader.
When using a MatrixTransformationFrameProcessor per transformation
matrix, each frame processor's shader applies the matrix to the
vertices and clips the result to the NDC range when drawing the
output frame.
This change combines consecutive MatrixTransformations into a single
MatrixTransformationFrameProcessor by multiplying the individual
matrices while updating and clipping the visible polygon after
each matrix and mapping the resulting visible polygon back to the
input space so that its vertices and the combined transformation
matrix can be used in the shader.

PiperOrigin-RevId: 448521068
2022-05-24 10:44:15 +01:00
hmzh
efb49f285e Refactor MIDI and Flac extractor loaders for deduplication
Add MIDI filetype information for use in the ExtractorsFactory

PiperOrigin-RevId: 447976272
2022-05-24 10:33:06 +01:00