161 Commits

Author SHA1 Message Date
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
hschlueter
63dcdf5803 Add listener for FrameProcessingExceptions.
This listener replaces
FrameProcessorChain#getAndRethrowBackgroundExceptions.
The listener uses a new exception type FrameProcessingException
separate from TransformationException as the frame processing
components will be made reusable outside of transformer soon.

PiperOrigin-RevId: 447455746
2022-05-10 17:47:22 +01:00
hschlueter
2e544224c2 Fix GlUtil vector size constant name.
This constant is used for https://docs.gl/es2/glVertexAttribPointer
which takes the number of components per generic vertex attribute
(meaning the size of the individual coordinate vectors here) not the
number of attributes (the number of vertices that the old constant
name referred to).

PiperOrigin-RevId: 447427241
2022-05-10 17:42:39 +01:00
huangdarwin
337b7f769d GL: Update exoplayer to use bindTexture.
Refactoring change only.

PiperOrigin-RevId: 446475708
2022-05-09 10:57:54 +01:00
ibaker
931bc70d5f Migrate usages of the deprecated TrackSelectionParameters.CREATOR
PiperOrigin-RevId: 446400192
2022-05-09 10:52:11 +01:00
christosts
90600e985e Use Android 12L APIs directly
Some APIs from Android 12L were used either via reflection or
constants values were hard-coded. We can now use these APIs directly
since we upgraded the compile SDK version to 32.

PiperOrigin-RevId: 446167543
2022-05-09 10:48:43 +01:00
ibaker
1bde777122 Allow stable API users to bundle/unbundle TrackSelectionParameters
It's reasonable to serialize this type to support backgrounding
use-cases, as demonstrated by the main demo app.

PiperOrigin-RevId: 446161300
2022-05-09 10:46:53 +01:00
ibaker
9a67b30750 Migrate usages from C.TYPE_* to C.CONTENT_TYPE_*
PiperOrigin-RevId: 446156308
2022-05-09 10:46:04 +01:00
olly
21448ba302 Add MIDI mime types to decoder_midi and api.txt
PiperOrigin-RevId: 445445952
2022-05-09 10:42:46 +01:00
ibaker
abbd7652b1 Add more UI symbols (and some others) to the stable API
These are used by the main demo app and would be reasonably used by
other relatively simple media playback apps.

PiperOrigin-RevId: 445371266
2022-05-09 10:37:42 +01:00
ibaker
0789e2780c Add some Util methods to the stable API
These are used in the main demo app

PiperOrigin-RevId: 445369540
2022-05-09 10:36:57 +01:00
ibaker
1ceccc94ac Prefix @ContentType values with CONTENT_
PiperOrigin-RevId: 445356625
2022-05-09 10:35:12 +01:00
ibaker
1b2e9da0af Rename CONTENT_TYPE_ @AudioContentType values to AUDIO_CONTENT_TYPE_*
This is consistent with the IntDef name, and frees up the CONTENT_TYPE_
prefix for the @ContentType values (which are currently just TYPE_*,
and therefore ambiguous with lots of other 'type' values in C).

PiperOrigin-RevId: 445356476
2022-05-09 10:34:27 +01:00
ibaker
a756121c9c Fix Util.inferContentTypeForExtension to handle .ism (smooth streaming)
This method was introduced in e414f0d2ac
as a replacement for Util.inferContentType(String) but it incorrectly
didn't return TYPE_SS when passed "ism" or "isml".

PiperOrigin-RevId: 445217167
2022-05-09 10:32:02 +01:00
ibaker
fd6b57469d Fix calculations that may lose precision compared to their target type
PiperOrigin-RevId: 444861268
2022-05-09 10:21:44 +01:00
ibaker
e414f0d2ac Clean up Util.inferContentType methods
This fixes some small niggles:
1. `inferContentType(String)` is documented to take a path, but in the
   tests we're passing full URIs.
2. A `String` parameter is usually a path, but also a MIME type or an
   extension. In the new methods, the meaning of a `String` parameter
   is always clear from the name of the method.
3. `inferContentType(String)` is always passed an extension in
   'production' code (which has to be manually prefixed with a dot).
4. `inferContentType(Uri, @Nullable String)` always ignores the Uri if
   the String is non-null. IMO this logic is clearer to a reader if it's
   just in-lined at the call-site.

These methods are used from the demo apps, so will be part of the stable
API.

PiperOrigin-RevId: 444826053
2022-05-09 10:19:01 +01:00
hschlueter
6939464f91 Don't use API 26 SurfaceTexture constructor in frame processor tests.
After this change the test will use EGL_NO_SURFACE or a pixel buffer surface if using no surface is not supported.

PiperOrigin-RevId: 443113794
2022-04-26 14:53:31 +01:00
ibaker
5186798db9 Rename Player.COMMAND_GET_TRACK_INFOS to COMMAND_GET_TRACKS
`Player.getCurrentTracksInfo` was renamed to `Player.getCurrentTracks` in
83daa052cb.

PiperOrigin-RevId: 441825078
2022-04-26 14:41:41 +01:00
olly
d9f0c2c071 Tracks.Group/TrackGroup variable naming disambiguation
PiperOrigin-RevId: 441712166
2022-04-26 14:37:35 +01:00
olly
83daa052cb Rename TracksInfo and TrackGroupInfo
1. TracksInfo is renamed to Tracks
2. TracksInfo.TrackGroupInfo is renamed to Tracks.Group

PiperOrigin-RevId: 441232373
2022-04-26 14:30:14 +01:00
olly
c007068ddb Expect PresentationTime Discontinuity During Stream Transitions
PiperOrigin-RevId: 440378974
2022-04-26 14:21:36 +01:00
huangdarwin
8a7fcb4eae FrameProcessor: Add setCrop to Presentation.
PiperOrigin-RevId: 440325693
2022-04-26 14:19:38 +01:00
christosts
43709c6211 Filter media notification actions
The DefaultMediaNotificationProvider checks if a command is available
before putting the respective action in the notification.

PiperOrigin-RevId: 440114422
2022-04-26 14:17:35 +01:00
hschlueter
f5792dab92 Add periodic dimming effect to transformer demo.
PeriodicDimmingFrameProcessor is an example of how a custom fragment
shader can be used to apply color changes that change over time.

PiperOrigin-RevId: 439840609
2022-04-26 14:08:55 +01:00
Ian Baker
ea61511a24 Merge pull request #10047 from LuGO0:9432/added-filtering-for-forced-text-tracks
PiperOrigin-RevId: 439262085
2022-04-06 11:50:35 +01:00
olly
f8f8b75500 Exclude TrackGroup fields/methods from the stable API
App code should get all of this information from TrackGroupInfo,
and should only need TrackGroup as a key to use for overrides.

PiperOrigin-RevId: 438840925
2022-04-06 11:46:49 +01:00
ibaker
ad387378b2 Add @ContentType IntDef to Util.getAdaptiveMimeTypeForContentType
Also add a case for RTSP, otherwise lint complains.

PiperOrigin-RevId: 438805903
2022-04-06 11:42:01 +01:00
olly
21d085f8a9 Reading average and peak bitrates from esds boxes.
This provides better compatibility with MediaExtractor, which does read these fields; we also need them for being able to mux file contents into another mp4 file.

Also, there is a minor refactor included so that we have an actual type for esds box contents instead of a pair.

PiperOrigin-RevId: 438673825
2022-04-06 11:39:05 +01:00
hschlueter
839f342e55 Use placeholder surface to configure OpenGL and frame processors.
The placeholder surface is either EGL_NO_SURFACE or a 1x1 pbuffer
depending on whether the device supports EGL_KHR_surfaceless_context.

PiperOrigin-RevId: 438541846
2022-04-06 11:32:38 +01:00
ibaker
22ca225fa3 Stabilise MIME types that can be passed to MediaItem.Builder
This is basically 'container' and 'subtitle' MIME types

I previously avoided stabilising any 'custom' MIME types (those
containing '/x-') but it certainly seems reasonable to expect
developers to use APPLICATION_M3U8 and so then it also makes sense
to stabilise other 'similar' custom MIME types too.

PiperOrigin-RevId: 438501642
2022-04-06 11:29:22 +01:00
hschlueter
d97de5b9f0 Use microseconds not nanoseconds for GlFrameProcessor.
This requires an additional nanos to micros conversion because
the SurfaceTexture uses nanos. But as the timestamps from the
MediaCodec decoder (propagated in DefaultCodec#releaseOutputBuffer) are
in microseconds no precision is lost here.

Also add test that checks output video duration.

PiperOrigin-RevId: 438010490
2022-04-06 11:22:22 +01:00
Ian Baker
f48babb4ed Merge pull request #35 from ittiam-systems:rtp-mpeg4
PiperOrigin-RevId: 438000682
2022-04-06 11:19:08 +01:00
ibaker
f722114fc0 Add a Kotlin example for opting-in to the unstable API
PiperOrigin-RevId: 437962027
2022-04-06 11:16:07 +01:00
hschlueter
0724e2b99f Check if there is a current context before generating textures/FBOs.
This avoids silent failures where the generated identifiers are 0.

PiperOrigin-RevId: 437775689
2022-04-06 11:10:56 +01:00
hschlueter
5f573ad3ad Remove old TODOs and reassign another TODO.
* The AdvancedFrameProcessor calls use() in updateProgramAndDraw().
* The AdvancedFrameProcessor has the same input and output dimensions.

PiperOrigin-RevId: 437231350
2022-03-25 14:10:47 +00:00
hschlueter
ecfbc65a0d Convert FrameEditor to a FrameProcessorChain.
The FrameProcessorChain manages a List<GlFrameProcessor>.
FrameProcessorChainDataProcessingTest now tests chaining ScaleToFit-
and AdvancedFrameProcessors.

PiperOrigin-RevId: 436468037
2022-03-22 14:29:53 +00:00
huangdarwin
481b9bd63d Transformer: Split javadoc summary fragment and descriptive text.
PiperOrigin-RevId: 435368283
2022-03-17 16:33:35 +00:00
bachinger
3848595377 Remove rounding errors of ad durations when converting from double
#minor-release

PiperOrigin-RevId: 435360232
2022-03-17 16:02:00 +00:00
olly
5d8ac644a6 Move TrackGroupArray back to ExoPlayer
PiperOrigin-RevId: 435325454
2022-03-17 13:08:56 +00:00
hschlueter
c74b16e9f4 Add missing exception checks after EGL14 calls in GlUtil.
PiperOrigin-RevId: 435308470
2022-03-17 11:23:46 +00:00