639 Commits

Author SHA1 Message Date
olly
3748cc8a82 Fix handling of content URIs by demo apps
PiperOrigin-RevId: 453510883
(cherry picked from commit 21ad8cfd6b55096029556b5c7fe226891173a8fb)
2022-06-07 20:23:51 +00:00
andrewlewis
6e735ac297 Create withMediaPipe variant only if AAR is present
This should fix running `./gradlew clean test` if MediaPipe hasn't been built, for example.

PiperOrigin-RevId: 452033698
(cherry picked from commit 14ed32c68f091328bb5feaa472b4bd359e11f41d)
2022-05-31 14:06:59 +00:00
bachinger
49c5e324fd Remove deprecated calls
#minor-release

PiperOrigin-RevId: 452006137
(cherry picked from commit 5460ac8e60095131dfd3ec0c6ec01d05a30cc43b)
2022-05-31 13:50:40 +00:00
hschlueter
541460a01d Fix handling clipping in transformer renderers.
Decode-only video frames (needed when the frame at / first frame after the
clipping start is not a key frame) need to be decoded but not passed to
the frame processor chain or encoder.

The clipping start offset needs to be removed from the frame timestamps
in the passthrough and video pipelines.
There are no changes needed for this in the audio pipeline, as it doesn't
use the input timestamps -- it uses its own timestamps derived from the
buffer sizes instead.

Also add demo option to try this out.

#minor-release

PiperOrigin-RevId: 451353609
2022-05-30 17:11:57 +00:00
hschlueter
d37cf34131 Rename GlFrameProcessor to SingleFrameGlTextureProcessor.
Also update names of implementations to match design doc.
In follow-ups, SingleFrameGlTextureProcessor will become
an abstract implementation of a new GlTextureProcessor
interface.

Texture processor makes sense as it processes OpenGL textures.
The term frame processor will be used for something else in
follow-ups.

PiperOrigin-RevId: 451142085
2022-05-30 17:01:17 +00:00
ibaker
b8769b2717 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 13:07:37 +00:00
ibaker
e39a324b19 Add DefaultMediaSourceFactory.setDataSourceFactory
Also add this to the stable API instead of the constructor that takes
`DataSource.Factory`.

PiperOrigin-RevId: 450414119
2022-05-23 13:26:05 +01:00
andrewlewis
4277ac3835 Reorder demo samples
Put cloud storage samples at the top to avoid having a sample at the top of the list where we don't control the server.

Also update labels not to mention progressive container type, as it's irrelevant for Transformer, which always transmuxes even if it doesn't transcode.

#ame-bug-week

PiperOrigin-RevId: 450403784
2022-05-24 12:23:50 +01:00
andrewlewis
bea17b4357 Attempt to load OpenCV when loading MediaPipe
PiperOrigin-RevId: 449227706
2022-05-24 11:33:49 +01:00
andrewlewis
d6dc3c5351 Fix initialization of media pipe processors with assets
PiperOrigin-RevId: 449221156
2022-05-24 11:30:29 +01:00
andrewlewis
578afa883d 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 11:20:08 +01:00
ibaker
938728ce00 Add DefaultMediaSourceFactory.{set,clear}LocalAdInsertionConfig
Deprecate the setAdsLoaderProvider and setAdViewProvider methods these
replace.

PiperOrigin-RevId: 448251423
2022-05-24 10:59:01 +01:00
hschlueter
f08fdf6ab2 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-09 14:46:53 +01:00
hschlueter
e89189e35f 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 18:02:20 +01:00
hschlueter
ff1305cd19 Remove redundant attribute from matrix transformation vertex shader.
The texture coordinates can be derived from the frame coordinates.

PiperOrigin-RevId: 446770538
2022-05-05 19:24:44 +01:00
andrewlewis
ee3a183041 Add frame processor based on MediaPipe to demo
PiperOrigin-RevId: 446432695
2022-05-04 13:48:56 +01:00
ibaker
8bb11f3f2b Migrate usages of the deprecated TrackSelectionParameters.CREATOR
PiperOrigin-RevId: 446400192
2022-05-04 10:13:35 +01:00
hschlueter
0bba5c6329 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-03 18:58:59 +01:00
ibaker
eb1dc508a5 Opt some more bits of the main demo app into the unstable API
PiperOrigin-RevId: 446161354
2022-05-09 13:30:13 +01:00
ibaker
1809a0b9f9 Migrate usages from C.TYPE_* to C.CONTENT_TYPE_*
PiperOrigin-RevId: 446156308
2022-05-09 12:00:38 +01:00
hschlueter
76627d7138 Introduce GlEffect interface for effect specification.
PiperOrigin-RevId: 446143537
2022-05-09 11:53:52 +01:00
ibaker
b0df946f67 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 11:34:42 +01:00
ibaker
a840f9732f 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 11:21:14 +01:00
huangdarwin
c67d69100d Transformer: Misc nits
* Add a /* paramName= */ comment
* Remove an unnecessary comma.
* Remove extra "internal " for a b/### link

PiperOrigin-RevId: 445169649
2022-05-09 11:01:12 +01:00
hschlueter
3874245d3d 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:37:11 +01:00
ibaker
754eb1527a 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:23:38 +01:00
huangdarwin
a5adc8d7d0 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:16:12 +01:00
hschlueter
7e76f773e6 Add context param to GlFrameProcessor initialize().
PiperOrigin-RevId: 442826391
2022-04-26 15:48:51 +01:00
huangdarwin
ef96932ea1 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 15:24:17 +01:00
hschlueter
fe7e330fe8 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 15:10:15 +01:00
olly
0ad508b14f 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:59:00 +01:00
hschlueter
8e57d3715f 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-07 17:56:02 +01:00
hschlueter
7bd650b315 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-07 17:34:45 +01:00
hschlueter
09f9a44d0f 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-07 17:27:17 +01:00
huangdarwin
188e0c70f1 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-07 17:16:46 +01:00
huangdarwin
ffeff69236 Transformer Demo: Open source previously-internal demo video files.
PiperOrigin-RevId: 439267827
2022-04-07 16:58:35 +01:00
christosts
d0d0935f3f Fix NPE in PlayerActivity
PiperOrigin-RevId: 438010395
2022-04-07 15:19:59 +01:00
ibaker
544bb8546c More demo app unstable API opt-in and reshuffling
Follow-up to <unknown commit>

PiperOrigin-RevId: 437777871
2022-04-07 14:59:09 +01:00
ibaker
1168c419d1 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-07 14:55:40 +01:00
andrewlewis
35528fd1bf 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-07 14:44:59 +01:00
ibaker
a8896c3996 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-07 14:34:32 +01:00
huangdarwin
083aa7b29d 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-07 14:27:43 +01:00
ibaker
9c2ee5a224 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:39:34 +00:00
ibaker
84eaa5801a 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
cfb8289c5a 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
8ea00b3a47 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
ea470893cd 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
hschlueter
255007623d Clarify GlProgram parameter name.
PiperOrigin-RevId: 434441008
2022-03-15 00:45:50 +00:00
olly
b2a5298e27 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:16:18 +00:00
hschlueter
4760a03444 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 15:03:02 +00:00