692 Commits

Author SHA1 Message Date
andrewlewis
342ae31a00 Add missing variant to package transformations
PiperOrigin-RevId: 512002735
(cherry picked from commit 1ef70cd6a02aabf302a7d3c37785e928d93973c3)
2023-02-28 18:05:41 +00:00
bachinger
b1b9c1207b Request notification permission in demo app for API 33+
Starting with API 33 the POST_NOTIFICATION permission needs to be
requested at runtime or the notification is not shown.

Note that with an app with targetSdkVersion < 33
but on a device with API 33 the notification permission is automatically
requested when the app starts for the first time. If the user does not
grant the permission, requesting the permission at runtime result in
an empty array of grant results.

Issue: google/ExoPlayer#10884
PiperOrigin-RevId: 501320632
(cherry picked from commit 6bacbaac548d612e85647b4d13c22dae0401447e)
2023-01-25 18:29:36 +00:00
ibaker
1e97da9472 Enable RTL support in the demo app
We might as well keep this enabled by default, rather than having to
manually toggle it on to investigate RTL issues like Issue: androidx/media#227.

PiperOrigin-RevId: 497159744
(cherry picked from commit 010c6b96e74979370f139f8126c176ea7b279313)
2023-01-25 18:29:35 +00:00
ibaker
54d3dbf014 Reformat demo build.gradle file
PiperOrigin-RevId: 488376715
(cherry picked from commit 30b73c85c53cce0d21e8df21ee680406aa0ad1d7)
2022-11-17 10:03:11 +00:00
ibaker
dd49f2455f Reformat demo build.gradle file
PiperOrigin-RevId: 487539107
(cherry picked from commit 0383b723b7c26da107a719a16a05da459ae971ee)
2022-11-17 10:03:11 +00:00
christosts
386e2aff3a Set targetSdkVersion of main demo app to 29
#minor-release

PiperOrigin-RevId: 487479366
(cherry picked from commit 09bee98b8f94a608fc994f96f2f538458a96b8d9)
2022-11-10 10:33:41 +00:00
huangdarwin
39d9aef04d HDR: Implement ForceInterpretHdrVideoAsSdr
Also, document that we tone map when no HDR features are explicitly set

PiperOrigin-RevId: 487310971
(cherry picked from commit 8bdd2784d330c0c9f493f092825d08f8a5cc4305)
2022-11-09 20:05:24 +00:00
bachinger
f06e8ee736 Make adding ad live breaks more robust
This change makes adding ad events in live streams more robust by allowing ad
groups to grow in number of ads if more ad events are received than initially
announced by the SDK.

With the IMA prefetch feature, an AdPod can grow in size in certain conditions
like from initially 2 ads to 4 ads being part of the ad group. With this change,
if an additional ad event arrives while the ad group is still being played,
the ad group is expanded. If the event arrives late and the ad group is already
completed, a new group is created for the remaining ads.

This also covers the case where we join the live stream while an ad is being
played and we missed at least one LOADED event from the SDK. Ads of the group
before the first LOADED event are ignored in such a case.

PiperOrigin-RevId: 484214760
(cherry picked from commit 136addf640e451602163be9e4272d1e27b8ed5b8)
2022-10-27 11:10:10 +00:00
Googler
81b3e4040d Mute input video player in transformer demo
PiperOrigin-RevId: 483969411
(cherry picked from commit 8181b3c6a1aba32459d4a5975cc708cbf224b397)
2022-10-26 15:01:30 +00:00
bachinger
6f94b8efe5 Map lib-effect from androidx to exoplayer2
PiperOrigin-RevId: 482179761
(cherry picked from commit 28c4be2f6bd56205e3b8128bf710c34b3b3d65e9)
2022-10-19 12:38:14 +00:00
Googler
a8921b7449 Fix blank toast in Transformer Demo
PiperOrigin-RevId: 480847967
(cherry picked from commit 446c9943f935541d7b76fc1dfa62ee969d775f60)
2022-10-13 10:32:32 +00:00
huangdarwin
4198ddebe2 Demo: Shorten trim range from 60 seconds to 10 seconds.
Most demo videos aren't very long, and the default demo video is only 10 seconds.

Shorten the maximum trim duration to 10 seconds, to demonstrate transformer functionality more easily, and allow this to be used more easily when trimming short sections of a longer video (ex. to make test clips)

PiperOrigin-RevId: 480602037
(cherry picked from commit 3142a2127dc224e4c2124989b952a8bd1e06d510)
2022-10-12 12:58:12 +00:00
huangdarwin
2244549146 Demo: Hide player controls by default.
Player controls are somewhat distracting when showing the difference between the
input and output video, as they obscure and darken the video players.

PiperOrigin-RevId: 480597804
(cherry picked from commit 91a61cecbe37f4c5595f534ee237011289c0ac18)
2022-10-12 12:26:07 +00:00
huangdarwin
abefef9b59 Demo: Read long values from trim slider.
Before, slider values were read as `floor()`'ed `longValue()`s, so that trimming to
intervals less than one second would be interpreted as a request for a zero-
duration trim.

Also, rename `radiusRange` references here to `trimRange`, since this is not a
radius range.

PiperOrigin-RevId: 480401556
(cherry picked from commit 6c59f9ece40f6450405d29acd559492145158409)
2022-10-11 17:57:01 +00:00
Googler
5d8daba5c5 Add local file picker to ConfigurationActivity
PiperOrigin-RevId: 480349627
(cherry picked from commit 225d0dcdd1e7e7f1f41d8ac1d2dee7340c40cf3a)
2022-10-11 14:21:12 +00:00
Googler
997cdf377b Add button to show/hide input player in TransformerActivity
PiperOrigin-RevId: 479003655
(cherry picked from commit 20c1ae141185d8f0e69977c82598488ae12e3b30)
2022-10-05 10:26:27 +00:00
Googler
c3a6943373 Add second player for input video
PiperOrigin-RevId: 478510687
(cherry picked from commit 6f2bc16b609265160154b173df6bd687bc5bcb17)
2022-10-03 15:27:33 +00:00
samrobinson
9639f82879 Demo: Split video Effect generation out of createTransformer.
PiperOrigin-RevId: 477524540
(cherry picked from commit 26a73605f811acad1bc5de6dbc5f651036f35e13)
2022-09-28 19:39:09 +00:00
Googler
3b97b99230 Fix checkboxes on configuration page
PiperOrigin-RevId: 477166507
(cherry picked from commit bcea7bd355b7c33e6c56b4c911817de1f2f34e0e)
2022-09-27 14:31:59 +00:00
huangdarwin
c9f019eb15 HDR: Update gamma comments to linear.
Comment-only change.

PiperOrigin-RevId: 476873286
(cherry picked from commit f3d132141e2c40797b80fab674e9ed8f4062e7ba)
2022-09-26 13:00:17 +00:00
leonwind
8b807432ca Add example CLUT to demo.
PiperOrigin-RevId: 476390089
(cherry picked from commit 29cf09316e8056e3703809d6b6ac8eea890e2e4e)
2022-09-23 16:28:25 +00:00
leonwind
61a2cc76aa Add HSL Adjustments to the demo.
PiperOrigin-RevId: 476373520
(cherry picked from commit 5725ebbeeaf1cbb1a1ffc156d67472640059bd0a)
2022-09-23 15:11:52 +00:00
leonwind
109ab70e00 Add RGB Adjustments to transformer demo.
PiperOrigin-RevId: 476049125
(cherry picked from commit cfc0eef24ec4a24bc00b0a657f3dad07e9c29ade)
2022-09-22 10:04:42 +00:00
leonwind
7cb2b54bab Add sepia, grayscale, and inverted filters to the demo app.
PiperOrigin-RevId: 471782565
(cherry picked from commit 87926f0ba8480f39baeb9f9d0ccf8f3576e4fd0e)
2022-09-02 13:10:29 +00:00
rohks
e56f59514f Switch incorrectly configured native multidex to legacy for demos
Native multidex can only be used for binaries with minSdkVersion of 21 or higher, but minSdkVersion was specified to 16.

PiperOrigin-RevId: 470004102
(cherry picked from commit a395b23d985dd4a118b125c3d121a7e39e2e5435)
2022-08-25 16:09:00 +00:00
leonwind
e8b5976d87 Delete glPrograms in Contrast and RgbMatrix.
Remove unecessary null checks.

PiperOrigin-RevId: 469999952
(cherry picked from commit f454c9aa7490e40d0ea5fdda6aa5698e7e6f6065)
2022-08-25 15:49:13 +00:00
rohks
0e7227df23 Fix missing id error
PiperOrigin-RevId: 469750922
(cherry picked from commit 2c70383d38a50482df57f6558b55b2057cbe56c7)
2022-08-24 16:40:39 +00:00
huangdarwin
c5b4cbed75 HDR: Update limited range and add full range YUV to RGB color transforms.
PiperOrigin-RevId: 467910378
(cherry picked from commit 130a536287f705ea823c9351d053f01512bf7e3c)
2022-08-16 13:33:32 +00:00
Googler
4a4bfc7b96 Avoid spinning in between intermediate texture processors.
This change adds a new method onReadyToAcceptInputFrame to
GlTextureProcesssor.InputListener and changes maybeQueueInputFrame
to queueInputFrame, removing the boolean return value.
This avoids the re-trying in ChainingGlTextureProcessorListener
by allowing it to only feed frames from the producing to the consuming
GlTextureProcessor when there is capacity.

MediaPipeProcessor still needs re-trying when processing isn't 1:1.

PiperOrigin-RevId: 466626369
(cherry picked from commit 9c366b3cfdd06cad046dd5ce1b0ecad21c5c44ba)
2022-08-10 09:56:24 +00:00
huangdarwin
b84945db62 Demo: Add legacy external storage permission for intents.
Without this permission, files in `/sdcard` or other directories cannot be read by the demo, as they're not in the transformer demo's scoped storage container.

For more information, see https://developer.android.com/training/data-storage/use-cases

Tested by uninstalling and re-installing the demo app, granting permission by
starting a transformation, and launching an intent using a local file in `/sdcard`
to start another transformation. Without this CL, this threw an error, and with
this CL it succeeded.

PiperOrigin-RevId: 466399023
(cherry picked from commit 051dee68e362b8d610a42ac01f7ed9cc5f6b894a)
2022-08-09 17:28:31 +00:00
Googler
c33a8e3d3a Split GlTextureProcessor.Listener into input/output/error listener.
This simplifies ChainingGlTextureProcessor as it now only connects a
consuming and a producing GlTextureProcessor rather than a previous,
current, and next GlTextureProcessor.

Also use default no-op implementations of the listeners in
SingleFrameGlTextureProcessor and MediaPipeProcessor to avoid
null-checks.

PiperOrigin-RevId: 466301642
(cherry picked from commit a2166a414212a4e10c31b72dfa21ff45367ee31a)
2022-08-09 10:05:14 +00:00
Googler
03b490b47f Fix ConcurrentHashMap usage in demo MediaPipeProcessor.
PiperOrigin-RevId: 465563540
(cherry picked from commit 6e4fc4752248f1a1d233dea041305718cae08cd0)
2022-08-05 14:56:54 +00:00
Googler
db2545b8a1 Use multiple output frames in transformer MediaPipe demo pre API 23.
PiperOrigin-RevId: 465545764
(cherry picked from commit 6da0a3543491a9d9bb3dbfaf1b203a04f7a19f5c)
2022-08-05 12:58:48 +00:00
Googler
89a2685052 Move effects functionality out of transformer to effects module.
PiperOrigin-RevId: 465038852
(cherry picked from commit 707b0618384db17f6d9d4947a445c0eed1c9c630)
2022-08-03 13:19:15 +00:00
Googler
63db89793a Move FrameProcessor and related interfaces to common.
This will allow effects preview in ExoPlayer to use the
Effect and FrameProcessor interface (and the interfaces
they depend on) without depending on transformer or the
future effects module.

PiperOrigin-RevId: 464060047
(cherry picked from commit 06d41c2775137158f831a1b2f19f137efb1e08b0)
2022-07-29 12:54:30 +00:00
leonwind
21c0eb3d68 Add slider option for contrast in demo app
PiperOrigin-RevId: 464050072
(cherry picked from commit 9df0d40583f868ec923a066bbe2609c7ba862760)
2022-07-29 11:30:44 +00:00
Googler
5c7dcf42a0 Add Effect marker interface.
This allows non-GL effects to be passed to custom FrameProcessor
implementations.

PiperOrigin-RevId: 463696384
(cherry picked from commit 66dde42989dbc8fedeee59897a05644d86240cf6)
2022-07-27 22:40:20 +00:00
Googler
3483131a88 Replace Size with Pair in effects.
Size requires API 21. Using Pair instead will allow effects to be
used from API 18 during previewing once they are moved out of
transformer.

PiperOrigin-RevId: 463206474
(cherry picked from commit b994f8bfa06c82fbfe96044b986cd7b8d243acdd)
2022-07-25 23:39:59 +00:00
hschlueter
b9f6df79cb Allow stream offset passed to GlEffectsFrameProcessor to change.
This is needed for applying effects to a playlist.

The effects are applied based on the presentation time of the
frame in its corresponding media item and the offset is added
back before encoding.

Each time the offset changes, end of input stream is signalled
to the texture processors. This is needed because the texture
processors can expect monotonically increasing timestamp within
the same input stream but when the offset changes, the timstamps
jump back to 0.

PiperOrigin-RevId: 462714966
(cherry picked from commit 46ab06b816d93c2a034c182552fa4483a6d82cba)
2022-07-22 23:18:55 +01:00
huangdarwin
83bebd3339 HDR: Implement HLG EOTF and OETF.
This allows us to use BT.2020 RGB linear for intermediate shaders, which also
allows us to re-enable PeriodicVignetteProcessor, which should work properly in
linear color-spaces.

Manually tested by adding a GlEffectsWrapper, and confirming that HLG HDR editing still looks correct.

PiperOrigin-RevId: 462265821
(cherry picked from commit 1ecf1eb7bfdd469fe855edf6126b2822b52ff07f)
2022-07-21 00:24:41 +00:00
olly
8a848db2fb Add ContrastProcessor for contrast adjustments.
PiperOrigin-RevId: 462232813
(cherry picked from commit 7ef41c73218ec70ee9a5c372369d308273fddd8b)
2022-07-20 21:38:10 +00:00
huangdarwin
76093e25db 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
(cherry picked from commit f67c1a73f443f411771676b761ceb03e7a0d48e4)
2022-07-18 14:21:17 +00:00
andrewlewis
ce3cdf8577 Update demo HDR10 video URL
The old URL doesn't correctly signal the HDR10 color info in the container.

The new URL signals ST2084 (PQ) transfer function and BT.2020 color space as expected.

PiperOrigin-RevId: 461560107
(cherry picked from commit 405be80fe5aed5cbc315a128010e6e6ecd7c2c73)
2022-07-18 08:51:54 +00:00
hschlueter
25ece32dda Move DebugViewProvider out of Transformer class.
The GlEffectsFrameProcessor that will be part of the effects module
uses the DebugViewProvider. So it does not make sense for it
to be an inner interface of Transformer.

PiperOrigin-RevId: 458014932
(cherry picked from commit f41e6796ce39469f9fc3a844ec88725ab56d3356)
2022-06-29 17:56:53 +00:00
hschlueter
9ad2d7123e Rename setVideoFrameEffects to setVideoEffects.
PiperOrigin-RevId: 457023382
(cherry picked from commit 20d220193e4051811e307b67a7e631b290449e23)
2022-06-24 17:04:45 +01:00
samrobinson
1ba723a89f Add a Builder for DefaultEncoderFactory.
PiperOrigin-RevId: 456728032
(cherry picked from commit 19bdff96ba9e053110bd701724c671ac10ae7cef)
2022-06-23 11:37:19 +01:00
hschlueter
6edd1d2a2f Use GlTextureProcessor to avoid redundant copy in MediaPipeProcessor.
After this change GlEffects can use any GlTextureProcessor not just
SingleFrameGlTextureProcessor.
MediaPipeProcessor now implements GlTextureProcessor directly which
allows it to reuse MediaPipe's output texture for its output texture
and avoids an extra copy shader step.

PiperOrigin-RevId: 456530718
(cherry picked from commit e25bf811959baf1066ba18adc37e8bbdaad4791a)
2022-06-22 17:16:54 +01:00
hschlueter
f96a6c71b8 Support chaining async GlTextureProcessors in FrameProcessorChain.
After this change, FrameProcessorChain chains any GlTextureProcessors
instead of only SingleFrameGlTextureProcessors.

The GlTextureProcessors are chained in a bidirectional manner using
ChainingGlTextureProcessorListener to feed input and output related
events forward and release events backwards.

PiperOrigin-RevId: 456478414
(cherry picked from commit 3a966916545f92c5ce08a640c912054ede215152)
2022-06-22 12:03:41 +01:00
hschlueter
6cc442debf Add option to disable debug preview.
This is useful for testing Transformer in the same way as it is used
in tests and to see only the real transformation time.

PiperOrigin-RevId: 456058466
(cherry picked from commit a444bb8ca2d59650811ea3f1c1274140b0be86c6)
2022-06-20 13:50:16 +01:00
hschlueter
e4605583bc Check targetSdkVersion for frame dropping workaround.
Based on
https://developer.android.com/reference/android/media/MediaCodec#using-an-output-surface,
frame dropping behaviour depends on the target SDK version.
After this change transformer will only use
MediaFormat#KEY_ALLOW_FRAME_DROP if both the target and system SDK
version are at least 29 and default to its pre 29 behaviour where each
decoder output frame must be processed before a new one is rendered
to prevent frame dropping otherwise.

Also remove deprecated Transformer.Builder constructor without a
context and the context setter.

PiperOrigin-RevId: 453971097
(cherry picked from commit 3f718b0d10e1d577620cca9ec76d0af38efc542c)
2022-06-09 18:22:39 +00:00