Also, document that we tone map when no HDR features are explicitly set
PiperOrigin-RevId: 487310971
(cherry picked from commit 2ff5dab0039c44d767dc831fec92724254e5e0aa)
The folder type is useful metadata to understand programmatically
what criterion was used to create the folder.
PiperOrigin-RevId: 486653317
(cherry picked from commit ab9f0608cd3d779b71623e4fa8ff2df149affb64)
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 64e9e888230be1874720ced001e8112fc3ee407b)
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 f35bda3524408d8bf560c080bd6a80698c7c08e1)
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 51edb329a124e5af302e1ebbd3527300619ac86a)
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 fb5cd18dcd8b8e2a6baa308d6907f2e02751474e)
PlayableFolderActivity currently uses two seperate commands
to set the playlist and then seek to the requested item.
This is slightly inefficient and also causes analytics
listeners to believe the first item in the playlist was
briefly active.
#minor-release
Issue: androidx/media#180
PiperOrigin-RevId: 480031682
(cherry picked from commit 5d6d069e4e946a46884a838482567ff085e88283)
Replacing remaining usage of MoreExecutors.directExecutor. This allows the service to be switched to run in another process and the app still works the same as if it is running in the same process.
Issue: androidx/media#100
PiperOrigin-RevId: 471547177
(cherry picked from commit 9a6745431a285a4403e66aa4227f6fc1d118ba75)
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 d260b0c2a008c4ff9b3763f32feb87b353fc23f2)
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 97e6a86d2b1f72de9f95658f90ea40d1e1e4fac2)
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 ec6ed0d55f59c9387aa09b1514bea9951a6206f8)
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 7dc05edbab233dcd631a4a78ad65f1c30a1e9734)
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 480c129c54777780f298d7e5dbd9fa23a371f660)
This allows non-GL effects to be passed to custom FrameProcessor
implementations.
PiperOrigin-RevId: 463696384
(cherry picked from commit 580e44fc47ec5b62da5a133d12048a20d716e94f)
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 4adf19939839baa3eaf018fef0d1b58049fd3b91)
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 30e5bc9837e2423cd2bb426c5797211e0f6ad76b)
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 2f977eeec93be5cc71fda57f80362c1bc639c041)
* 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 ba9c9bb96471a9589d391ae498ebb0c194a5b41e)
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 794e366b3661e9dfec01abcbd4598a26bec9e235)
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 cd0e5b99de9577ff1af0da15a9ea6c9041f38361)
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 69ab79418ef21033ca25cebdf5a5e80752818ab5)
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 555ab97e34d6586d38a9979bc0595a4818b7ecb8)
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 931562c24380ff8bd1f8fad6b2c0bb3581dc65e5)
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 a105d033a7d44b8c3afb0e8134ad65f624caf256)