818 Commits

Author SHA1 Message Date
claincly
dc4f20ed84 Fix image seeking
Queue image again after position reset, and reset timestamp iterator.

PiperOrigin-RevId: 635049953
2024-05-18 07:41:14 -07:00
tofunmi
25e56474bc Check for .heif extension in File types inference
PiperOrigin-RevId: 634409758
2024-05-16 08:42:14 -07:00
kimvde
7b2a1b4443 Fix image not ignored for non-images in setImageDurationMs
PiperOrigin-RevId: 634345071
2024-05-16 05:48:41 -07:00
tofunmi
7b357337d2 Support AVIF in exoplayer
https://developer.android.com/media/platform/supported-formats#image-formats was updated to include AVIF support in API 34+, so <unknown commit> updated our associated Util's to reflect this. After that change, ExoPlayer's BitmapFactoryImageDecoder will be able to decode AVIF, but the player won't be able to detect or extract it. Add this support for completeness, so that ExoPlayer can continue to say it supports all formats in https://developer.android.com/media/platform/supported-formats#image-formats.

PiperOrigin-RevId: 633956245
2024-05-15 08:04:41 -07:00
tofunmi
f7390faeb0 Update supported image formats in line with platform standards
This treats heic as a separate mimetype to heif (even though heic files are a subset of heif files). This is in line with other platform classes like android.content.ContentResolver

https://developer.android.com/media/platform/supported-formats#image-formats was updated to include avif support or API level 34, so added this MimeType as well and updated our associated util.

solves Issue: androidx/media#1373

PiperOrigin-RevId: 633616214
2024-05-14 09:50:38 -07:00
tonihei
2175c432d7 Add error code for codec reclaim
This allows apps to better detect when the platform
reclaims a codec. This requires adding the error code
to MediaCodecDecoderException.

PiperOrigin-RevId: 633588914
2024-05-14 08:12:51 -07:00
tonihei
cf1f9b04cf Add more predefined priority values
Also add documentation that suggests to use them in
PriorityTaskManager and adjust codec priorities in
Transformer's DefaultDe/EncoderFactory accordingly.

PiperOrigin-RevId: 633272667
2024-05-13 11:18:41 -07:00
tonihei
1a5cf6718b Use BaseAudioProcessor format tracking in SilenceSkippingAudioProcessor
The class currently tracks the input format itself, updating it too
early in onConfigure() instead of onFlush(). This causes issues when
the format changes and the new values are applied to the silence
skipping logic of the old format. The fix is to use the base class
input format handling instead.

Issue: androidx/media#1352
PiperOrigin-RevId: 633232368
2024-05-13 09:17:28 -07:00
tonihei
d52a32aadc Add method to obtain media duration from playout duration
This is the inverse operation of the already existing method.

PiperOrigin-RevId: 633207017
2024-05-13 07:47:14 -07:00
tonihei
e1d8044ccc Fix flushing logic of SpeedChangingAudioProcessor
When the processor is flushed, it needs to reset its internal state
in preparation for receiving fresh input data.

Flushing the internal SonicAudioProcessor on the other hand should
not go through the parent flush() method and instead flush the
internal processor only when needed.

PiperOrigin-RevId: 632530395
2024-05-10 10:12:03 -07:00
tonihei
971486f5f9 Round bytesToNextSpeedChange up instead of down
Rounding down means that very small diferrences (e.g. 1 us) result
in bytesToNextSpeedChange==0, which stalls progress forever as no
new bytes are read. Rounding up instead ensures that we always read
at least one audio frame if nextSpeedChangeTimeUs is in the future.

PiperOrigin-RevId: 632116560
2024-05-09 05:36:49 -07:00
tonihei
9ece3932e8 Add time unit to variable names and methods
This helps with readability of the code

PiperOrigin-RevId: 631771454
2024-05-08 05:54:16 -07:00
Copybara-Service
c5964d197c Merge pull request #1055 from AradiPatrik:z-order-fix
PiperOrigin-RevId: 631616905
2024-05-07 18:45:09 -07:00
Luyuan Chen
766ff44a2c Fix review comment 2024-05-08 00:11:21 +00:00
Luyuan Chen
0403e5881d Format with google-java-format 2024-05-08 00:07:38 +00:00
Patrik Aradi
51a9bcca61 Refactor according to reviews. 2024-05-08 00:07:38 +00:00
Patrik Aradi
52adaf8d26 implement top down approach for passing input source id 2024-05-08 00:07:38 +00:00
Luyuan Chen
3cccecf368 Format with google-java-format 2024-05-08 00:07:38 +00:00
Patrik Aradi
177f1f33d0 Fix indeterminate z-order of EditedMediaItemSequences by passing sequenceIndex when registeringInput 2024-05-08 00:07:37 +00:00
tonihei
6ac60c6dff Disable enhanced Java 8 desugaring
This avoids that apps have to depend on this additional config

Issue: androidx/media#1312
PiperOrigin-RevId: 631447767
2024-05-07 09:26:36 -07:00
tofunmi
cb4b2ea55c remove degammaing: change setSdrWorkingColorSpace default
The second stage of the changes remove the conversion to linear colors in the SDR effects pipeline by default.

also resolves Issue: androidx/media#1050

PiperOrigin-RevId: 630108296
2024-05-02 10:35:48 -07:00
tonihei
c9aab56d9c Add Mp4 object type for JPEG
PiperOrigin-RevId: 629683068
2024-05-01 04:05:42 -07:00
tonihei
344fc8a8c0 Add IntDef for priority values
This makes it easier to reference these values in documentation
and method parameters.

PiperOrigin-RevId: 629072314
2024-04-29 08:14:20 -07:00
bachinger
0e3b05c67d Add metadata field durationMs
PiperOrigin-RevId: 628038241
2024-04-25 05:05:42 -07:00
claincly
124c70ac26 Add MIME type to match any image
PiperOrigin-RevId: 627486539
2024-04-23 13:27:42 -07:00
tonihei
11257ecacb Forward presumed no-op seeks to handler methods in (Simple)BasePlayer
Some seek operations are currently filtered in the base classes if
the target index is not explicitly specified and the implicitly
assumed operation doesn't have an obvious target index. (Example:
calling seekToNext() at the last item in a playlist)

This is too opinionated because the actual player implementation
using this base class may be able to handle this seek request (e.g.
by adding new items on the fly or using other logic to select
the most suitable next item).

This can be solved by forwarding all seek requests to the respective
handler methods even if they are a presumed no-op. Also clarify the
Javadoc that the provided index is just an assumption if it wasn't
provided explicitly in the method call.

PiperOrigin-RevId: 624887116
2024-04-15 02:38:29 -07:00
kimvde
71e7e0f2cf Make VideoFrameProcessor.flush() more resilient
Allow flush to be called before registerInputStream. It's less error
prone to allow methods to be called in any order.

PiperOrigin-RevId: 624873772
2024-04-15 01:43:13 -07:00
huangdarwin
25e99af9e7 More strongly discourage use of DebugSurfaceView
This was always intended as a debug API only, but its inclusion in media3.common and public visibility has led to partners sometimes experimenting with this API and complaining when it doesn't work as expected.

PiperOrigin-RevId: 624158798
2024-04-12 06:34:06 -07:00
ibaker
556ddf4b30 Remove SVG link TODOs now exoplayer2 is no longer published
This removes the TODOs without updating the links, because the
DAC-hosted images are not co-located with the hosted javadoc (unlike
when these images were referenced on exoplayer.dev before 10342507f7),
and therefore we would need to include the full path anyway, at which
point it seems clearer and more robust to keep using a fully-qualified
URL with the domain too.

PiperOrigin-RevId: 623452217
2024-04-10 04:40:33 -07:00
michaelkatz
2622e566d3 Version bump to media3:1.4.0-alpha01
#minor-release

PiperOrigin-RevId: 623185060
2024-04-09 09:09:22 -07:00
sheenachhabra
2a5b9afb88 Update Media3 version number
PiperOrigin-RevId: 622211426
2024-04-05 10:15:38 -07:00
huangdarwin
0730a5976b Color: Add undefined values to toString methods
This way, we can identify the undefined values later, if they're in use often.

PiperOrigin-RevId: 619967637
2024-03-28 09:54:48 -07:00
tofunmi
828f6d87f9 Make calculateSpeedAdjustedTime() output monotonically increasing
calculate based on the output of consecutive calls rather than the speed provider speed change point to ensure the timestamps are monotonically increasing.

PiperOrigin-RevId: 619584001
2024-03-27 10:55:59 -07:00
Copybara-Service
8fe70332ee Merge pull request #1054 from jekopena:main
PiperOrigin-RevId: 619573181
2024-03-27 10:24:32 -07:00
tonihei
6e0f8e3b0d Remove decode-only flag
No known component is using this flag anymore and it has been
deprecated for a while for custom renderers and decoders.

PiperOrigin-RevId: 619154299
2024-03-26 05:28:27 -07:00
tofunmi
65e94480f4 Transformer: add single-asset ultraHDR image to HLG HDR vid transcoding
PiperOrigin-RevId: 619138202
2024-03-26 04:06:41 -07:00
tonihei
ab0391167c Include nullness of MediaMetadata.extras in equals method
This ensures MediaMetadata with just non-null extras is not
considered equal to MediaMetadata.EMPTY. This makes sure the
contents are bundled when a controller sets the extras in a
new MediaItem

Issue: androidx/media#1176

#minor-release

PiperOrigin-RevId: 618876642
2024-03-25 10:05:15 -07:00
tonihei
73c0ebb214 Additional clean-up and formatting 2024-03-25 15:02:31 +00:00
Juan Carlos Penalver
8673e6d39a Removing label from toLogString. 2024-03-25 12:00:14 +00:00
Juan Carlos Penalver
0a04e7908b Addressing PR feedback. 2024-03-25 12:00:14 +00:00
Juan Carlos Penalver
591020065a Adding IllegalStateException to Format build and unit tests. 2024-03-25 12:00:14 +00:00
Juan Carlos Penalver
e9e47f4fe6 Removing id from Label and ensuring label/labels consistency in Format.Builder. 2024-03-25 12:00:14 +00:00
Juan Carlos Penalver
63fb68e99e Reverting breaking changes by keeping label and adding labels. 2024-03-25 12:00:14 +00:00
Juan Carlos Penalver
df763220c8 Replacing label with a list of Label elements in Format. 2024-03-25 12:00:14 +00:00
tonihei
ed505df2ca Partial revert of 3a7d31a599
The original change did not set the color info in the codec
for standard SDR infos. This was meant to help with consistency
to avoid a situation where the information is partially set and
later the bitstream provides slightly different values (all in
standard SDR though).

We can revert this part because the bitstream may change anyway
and the decoder needs to handle this internally. And more
importantly, it also avoids removing this information when encoding
the format again in Transformer.

PiperOrigin-RevId: 617582066
2024-03-20 11:51:25 -07:00
tonihei
3a7d31a599 Don't set codec color info for default SDR
Some media can read color info values from the bitstream
and may partially set some of the SDR default values in
Format.ColorInfo. Setting these default values for SDR can
confuse some codecs and may also prevent adaptive ABR
switches if not all ColorInfo values are set in exactly the
same way.

We can avoid any influence of HDR color info handling by
disabling setting the color info MediaFormat keys for SDR
video and also avoid codec reset at format changes if both
formats are SDR with slightly different ColorInfo settings.

To identify "SDR" ColorInfo instances, we need to do some
fuzzy matching as many of the default values are assumed to
match the SDR profile even if not set.

Issue: androidx/media#1158
PiperOrigin-RevId: 617473937
2024-03-20 04:58:13 -07:00
tofunmi
762065fae0 Add api to find duration after an effect is applied
PiperOrigin-RevId: 616157067
2024-03-15 09:41:40 -07:00
tofunmi
b9843af6a0 SpeedChangingAudioProcessor: process all callbacks after audio ends
PiperOrigin-RevId: 616143969
2024-03-15 08:54:26 -07:00
huangdarwin
b126bae93d Effect: Add EGL_EXT_gl_colorspace_bt2020_hlg support, on API 34+
Confirmed that the HLG extension displays properly on Pixel 7 Pro, API 34 and Samsung S24, API 34. On these devices, this fixes the washed out HLG preview issue on API 34, where the PQ ext had a washed out look, and where the HLG ext is supported (this bug didn't occur on API 33, only 34).

More info on manual tests done to sanity-check:
* Test cases: Transformer debug SurfaceView and ExoPlayer.setVideoEffects
* Test inputs: HLG and PQ
* Test devices: Pixel 7 Pro (API 33 & 34), Samsung Galaxy S24 (API 34)
* Added debugging: Logging colorInfo used in GlUtil.createEglSurface

No regressions were seen. HLG extension is used more in API 34, and behavior stays the same on API 33. Only human-visible change without logging is that HLG content looks better on API 34, for Samsung S24 and Pixel 7 Pro.

PiperOrigin-RevId: 616131192
2024-03-15 08:06:49 -07:00
tofunmi
f39fe82bba Support ultra HDR in effect
adding sending gainmap to shader program and applying gainmap to base in shader

PiperOrigin-RevId: 616070582
2024-03-15 03:22:54 -07:00