653 Commits

Author SHA1 Message Date
bachinger
08fc89a585 Implement onSubscribe in session demo service
Immediately notify a subscribing client about the availability of child items of
a parent ID to make the client load the children.

PiperOrigin-RevId: 450396690
2022-05-24 11:08:56 +01:00
ibaker
c78c1f5891 Rename nested session callback interfaces to just Callback
This is consistent with other nested callback/listener interfaces like
`Player.Listener`.

PiperOrigin-RevId: 449476261
2022-05-24 10:57:02 +01:00
andrewlewis
a9bdd6e2e9 Attempt to load OpenCV when loading MediaPipe
PiperOrigin-RevId: 449227706
2022-05-24 10:51:36 +01:00
andrewlewis
d8caa2b4c1 Fix initialization of media pipe processors with assets
PiperOrigin-RevId: 449221156
2022-05-24 10:50:41 +01:00
andrewlewis
66b3527a22 Fix demo app crash when media pipe isn't loaded
The toast message about media pipe not loading needs to be shown on the main
(UI) thread.

PiperOrigin-RevId: 449199285
2022-05-24 10:47:57 +01:00
ibaker
25279ad477 Add DefaultMediaSourceFactory.{set,clear}LocalAdInsertionConfig
Deprecate the setAdsLoaderProvider and setAdViewProvider methods these
replace.

PiperOrigin-RevId: 448251423
2022-05-24 10:41:26 +01:00
christosts
7a631f4050 MediaSessionService: define foregroundServiceType
PiperOrigin-RevId: 447467287
2022-05-10 17:49:22 +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
hschlueter
e9919f6da1 Remove redundant attribute from matrix transformation vertex shader.
The texture coordinates can be derived from the frame coordinates.

PiperOrigin-RevId: 446770538
2022-05-09 11:01:33 +01:00
andrewlewis
e6518126ac Add frame processor based on MediaPipe to demo
PiperOrigin-RevId: 446432695
2022-05-09 10:56:08 +01:00
ibaker
931bc70d5f Migrate usages of the deprecated TrackSelectionParameters.CREATOR
PiperOrigin-RevId: 446400192
2022-05-09 10:52:11 +01:00
hschlueter
c94035278c Separate matrix effect specification and implementation.
This change splits AdvancedFrameProcessor into 4 files:
- MatrixTransformationFrameProcessor for the GlFrameProcessor
  implementation
- MatrixTransformation and GlMatrixTransformation for the GlEffect
  specification
- MatrixUtils for the static matrix helpers

PiperOrigin-RevId: 446236384
2022-05-09 10:51:14 +01:00
ibaker
648b085954 Opt some more bits of the main demo app into the unstable API
PiperOrigin-RevId: 446161354
2022-05-09 10:47:52 +01:00
ibaker
9a67b30750 Migrate usages from C.TYPE_* to C.CONTENT_TYPE_*
PiperOrigin-RevId: 446156308
2022-05-09 10:46:04 +01:00
hschlueter
b410a922fe Introduce GlEffect interface for effect specification.
PiperOrigin-RevId: 446143537
2022-05-09 10:44:30 +01:00
ibaker
2a726cfe9f Use cronet for DRM requests in the main demo app
This ensures that both content and licenses are requested using the
same HTTP stack.

#minor-release

PiperOrigin-RevId: 445378940
2022-05-09 10:39:32 +01:00
ibaker
5766cd52ba Add copies of PlayerControlView's public listeners to PlayerView
Developers are expected to (eventually) only use methods on
PlayerView (and not PlayerControlView) to interact with the UI
controller.

PiperOrigin-RevId: 445361488
2022-05-09 10:35:58 +01:00
huangdarwin
0de9955eb2 Transformer: Misc nits
* Add a /* paramName= */ comment
* Remove an unnecessary comma.
* Remove extra "internal " for a b/### link

PiperOrigin-RevId: 445169649
2022-05-09 10:30:18 +01:00
hschlueter
6312cfb221 Fix PeriodicVignetteFrameProcessor javadoc.
The parameter was removed in a previous CL but wasn't removed
from the javadoc yet.

PiperOrigin-RevId: 444879675
2022-05-09 10:23:30 +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
huangdarwin
4cf1207c0c Transformer Demo: Add video with pixelWidthHeightRatio != 1.
This can allow apps to test and demonstrate support for videos with
pixelWidthHeightRatio != 1.

PiperOrigin-RevId: 444815182
2022-05-09 10:17:19 +01:00
hschlueter
5248bbb882 Add context param to GlFrameProcessor initialize().
PiperOrigin-RevId: 442826391
2022-04-26 14:46:24 +01:00
huangdarwin
d629e45cfa Transformer Demo: Add short test video
Add a very short (1 second) video, so that some manual tests / prototyping,
including tests for the start and end of a video, encoder selection, or
changes applied to frames, can finish quickly.

PiperOrigin-RevId: 441756901
2022-04-26 14:38:36 +01:00
hschlueter
f25c912c72 Rename GlFrameProcessor updateProgramAndDraw to drawFrame.
What a minimal implementation should include is now explained in the
interface javadoc while the method name reflects what the method does.

PiperOrigin-RevId: 441432059
2022-04-26 14:34:11 +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
hschlueter
f3b80fd54d Add bitmap overlay effect to transformer demo.
The new demo GlFrameProcessor is based on BitmapOverlayVideoProcessor
from the gl-demo. The demo-only GlFrameProcessor can be deleted once
Transformer supports this functionality.

PiperOrigin-RevId: 440059735
2022-04-26 14:15:31 +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
hschlueter
c235e4f447 Add matrix provider for AdvancedFrameProcessor and examples in demo.
The matrix provider allows the transformation matrix to be updated
for each frame based on the timestamp.

The following example effects using this were added to the demo:
* a zoom-in transition for the start of the video,
* cropping a rotating rectangular frame portion,
* rotating the frame around the y-axis in 3D.

PiperOrigin-RevId: 439791592
2022-04-26 14:06:36 +01:00
huangdarwin
59f87a5134 Transformer Demo: Disable SDR button for API <31.
This makes it more clear to users of the demo that this is only available under API 31.

PiperOrigin-RevId: 439358674
2022-04-06 11:57:58 +01:00
huangdarwin
f6808c9645 Transformer Demo: Open source previously-internal demo video files.
PiperOrigin-RevId: 439267827
2022-04-06 11:52:58 +01:00
christosts
2adf0f67d8 Fix NPE in PlayerActivity
PiperOrigin-RevId: 438010395
2022-04-06 11:21:21 +01:00
ibaker
0096b40b75 More demo app unstable API opt-in and reshuffling
Follow-up to a5330d43d4

PiperOrigin-RevId: 437777871
2022-04-06 11:13:42 +01:00
ibaker
e4556d76a9 Replace Util.SDK_INT with Build.VERSION.SDK_INT in the demo app
Util.SDK_INT will not be part of the stable API. This change only
touches those parts of the main demo app that will not be opted-in to
the unstable API for other reasons (e.g. download use-cases).

PiperOrigin-RevId: 437777687
2022-04-06 11:12:44 +01:00
andrewlewis
d2a9419ad3 Add support for requesting color transfer to SDR
From Android T onwards `MediaCodec` supports requesting tone-mapping down to
SDR. Add an option to request this behavior and document that it isn't
supported before T. Also add an option in the demo app to try it out.

Tested manually on a prerelease build.

PiperOrigin-RevId: 437765325
2022-04-06 11:10:06 +01:00
ibaker
1b52739dfb Switch the demo app from Util.areEqual to Guava's Objects.equals
Util.areEqual will not be part of the stable API.

PiperOrigin-RevId: 437723080
2022-04-06 11:06:45 +01:00
huangdarwin
6858fe9116 Transformer Demo: Add 8k24fps video option.
This can help allow Transformer be more aware of issues in high-res videos.

PiperOrigin-RevId: 437313282
2022-04-06 11:04:52 +01:00
ibaker
a5330d43d4 Opt uncontroversial bits of the main demo app into unstable APIs
None of these components/features are planned to be part of the initial
stable API, so these suppressions will need to be in place when we
enable the warnings.

PiperOrigin-RevId: 437256731
2022-04-06 11:02:47 +01:00
ibaker
dc4dbe6a40 Demo: Move DownloadService calls to new method in SampleChooserActivity
This allows the whole startDownloadService() method to be opted into the
unstable media3 API in a follow-up change.

PiperOrigin-RevId: 437228776
2022-03-25 14:09:37 +00:00
ibaker
a11adbc08c Switch the main demo app to use Guava's Preconditions
ExoPlayer's internal Assertions class will not be part of the stable
API.

PiperOrigin-RevId: 437008634
2022-03-24 16:07:42 +00:00
ibaker
079e79540d Switch demo apps from HttpDataSource to DataSource
All the (Http)DataSource interactions can be done with the DataSource
interface and don't need HttpDataSource.

PiperOrigin-RevId: 436521036
2022-03-22 18:12:00 +00:00
ibaker
54d3e45473 Switch DRM and download components from HttpDataSource to DataSource
All the (Http)DataSource interactions can be done with the DataSource
interface and don't need HttpDataSource.

PiperOrigin-RevId: 436520898
2022-03-22 18:11:31 +00:00
huangdarwin
2a14e3c604 FrameProcessor: Add a ScaleToFitFrameProcessor builder.
This allows us to input scale and rotation in an easier-to-use manner.

PiperOrigin-RevId: 436175982
2022-03-21 12:08:18 +00:00
olly
5d8ac644a6 Move TrackGroupArray back to ExoPlayer
PiperOrigin-RevId: 435325454
2022-03-17 13:08:56 +00:00
hschlueter
682a5ca77b Clarify GlProgram parameter name.
PiperOrigin-RevId: 434441008
2022-03-14 12:52:16 +00:00
olly
08b861b61a Decouple UI module from ExoPlayer
This change rewrites the UI module's track selection
components to depend on the Player API, allowing us to
finally remove the UI module's dependency on ExoPlayer
as a concrete player implementation.

PiperOrigin-RevId: 432989318
2022-03-09 15:04:11 +00:00
christosts
1023b9d55e Start playback from notification
This change fixes two bugs where MediaSessionServe shows a notification
with the Play icon but tapping it will not start playback:
1. After playback ends: we need to seek to the beginning of the media
   item.
2. After adding media items to the player but not starting playback:
   We need to call Player.prepare() too.

PiperOrigin-RevId: 432469953
2022-03-04 17:52:46 +00:00
hschlueter
cf85d1bdc8 Only allow HEVC output MIME selection in demo for API>=24.
The muxer doesn't support HEVC below API 24. The is documented in
the TransformationRequest javadoc and the Transformer.Builder will
throw if HEVC is requested below API 24 so the option should not
be part of the demo for those devices.

#mse-bug-week

PiperOrigin-RevId: 429343805
2022-02-18 14:56:25 +00:00
Ian Baker
38717ce969 Reformat some javadoc 2022-02-18 14:54:02 +00:00
samrobinson
061aac7ab2 Add new public 4k60 portrait video to the demo application.
#mse-bug-week

PiperOrigin-RevId: 429323642
2022-02-18 14:52:48 +00:00