88 Commits

Author SHA1 Message Date
michaelkatz
841bdc6efe Add UTF-16 encoded subtitle support to SsaDecoder
Issue: androidx/media#319
PiperOrigin-RevId: 527891646
(cherry picked from commit 06ac2f7990f0cdf691365cc304fade522c983761)
2023-05-15 16:32:36 +01:00
Ian Baker
31492031c1 Merge pull request #313 from pengbins:fix_ts_h265reader_parse_sps
PiperOrigin-RevId: 527259619
(cherry picked from commit fab134f0b3194349aaac702f4c582ee20356b1dc)
2023-05-15 16:26:20 +01:00
rohks
ba6ccee802 Update colr box values to be overridden by bitstream boxes
#minor-release

PiperOrigin-RevId: 523983688
(cherry picked from commit 596a7c7033ba061b48ac4edd5647c6d2fb813a2d)
2023-04-18 15:16:49 +01:00
Rohit Singh
b70b320c49 Merge pull request #11064 from haixia-meta:release-v2
PiperOrigin-RevId: 517128752
(cherry picked from commit 0e3f407e0ec482eecd65b070fbec2d0fe91e255d)
2023-04-18 14:54:34 +01:00
rohks
65d4202f6e Add support to fetch ColorInfo from hvcc box in AtomParsers
#minor-release

PiperOrigin-RevId: 517086016
(cherry picked from commit 8a5fcf82d32268c81b641951d4d270875cbcc62a)
2023-04-18 14:54:34 +01:00
Rohit Singh
60e0546bea Merge pull request #11061 from cedricxperi:dts-udts-support
PiperOrigin-RevId: 517067549
(cherry picked from commit 49d85d625c42177aaf0d6413ba7ee0ae7b4d580e)
2023-04-18 14:54:34 +01:00
rohks
d1d16659a6 Fix javadoc links in media README files
Also fixed the javadoc link in devsite and removed javadoc links from decoder extensions as it is not published yet on developer.android.com.

#minor-release

PiperOrigin-RevId: 520636868
(cherry picked from commit 6a928805d4b0f52f5f07b1f7cd75e2a7357e9397)
2023-03-31 13:35:43 +01:00
ibaker
14b0dcb957 Add missing @param tags
Dackka generates a warning if a method has at least one `@param` tag,
but not all of them are documented.

PiperOrigin-RevId: 513873453
(cherry picked from commit cb7d565fd47fc0b818ec0d5c7529e19df44022b5)
2023-03-14 16:19:20 +00:00
tonihei
dbf737de08 Merge pull request #255 from mayurk2:use_edts_offset_if_it_is_for_entire_file
PiperOrigin-RevId: 513213229
(cherry picked from commit 17499cefcc1b27d90ecdf136bd3b2e4856ddcaf1)
2023-03-02 09:44:16 +00:00
ibaker
ddd5e9bc19 Remove @see tags with <a> tags
These are not supported by Dackka

#minor-release

PiperOrigin-RevId: 513176533
(cherry picked from commit c07cf3dc414b562652cdd4f3b0e91f80493a2c40)
2023-03-02 09:44:16 +00:00
tonihei
631ff809f5 Fix timestamp comparison for seeks in fMP4
When seeking in fMP4, we try to extract as little samples as possible
by only starting at the preceding sync frame. This comparison should
use <= to allow sync frames at exactly the seek position.

Issue: google/ExoPlayer#10941

PiperOrigin-RevId: 505098172
(cherry picked from commit 00436a04a4f0fec8ee9154fc1568ca4013ca5c7d)
2023-02-02 13:22:33 +00:00
rohks
0606ab0cbb Fix javadoc references to writeSampleData
PiperOrigin-RevId: 502821506
(cherry picked from commit 6c14ffc1ecd13393930b9f5ee7ad7a52391d0f65)
2023-01-25 18:18:42 +00:00
Googler
4e7ccd7ffd Throw a ParserException instead of a NullPointerException if the sample table (stbl) is missing a required sample description (stsd).
As per the javadoc for AtomParsers.parseTrack, ParserException should be "thrown if the trak atom can't be parsed."

PiperOrigin-RevId: 499522748
(cherry picked from commit d8ea770e9ba6eed0bdce0b359c54a55be0844fd3)
2023-01-25 18:17:17 +00:00
ibaker
3df6949c52 Add javadoc links to README files
Fix some other link titles and destinations spotted along the way.

#minor-release

PiperOrigin-RevId: 493276172
(cherry picked from commit 636a4a8538ccfb235eeca7d9131d4b5d4d95e9aa)
2023-01-25 18:01:21 +00:00
ibaker
102873b6e1 Split SubripDecoder and ParsableByteArray tests
In some cases we split a test method, and in other cases we just add
line breaks to make the separation between arrange/act/assert more
clear.

PiperOrigin-RevId: 492182769
(cherry picked from commit e4fb663b23e38eb6e41b742681bf80b872baad24)
2023-01-25 17:50:39 +00:00
Ian Baker
6e58ca6baa Merge pull request #10750 from Stronger197:subrip_utf_16
PiperOrigin-RevId: 492164739
(cherry picked from commit a9191418051a19681ddf884163ac5553871ec658)
2023-01-25 17:50:39 +00:00
rohks
8932c52122 Parse and set bitrates in Ac3Reader
PiperOrigin-RevId: 492003800
(cherry picked from commit c7aa54cb411e485c2c17e630779d9e27d758a550)
2023-01-25 17:49:34 +00:00
tonihei
e85e497911 Add configuration to support OPUS offload
To support OPUS offload, we need to provide a few configuration values
that are currently not set due to the lack of devices supporting
OPUS offload.

PiperOrigin-RevId: 491613716
(cherry picked from commit 568fa1e1fa479fd1659abf1d83d71e01227ab9cf)
2023-01-25 17:49:30 +00:00
ibaker
289f0cf00b Remove impossible UnsupportedEncodingException from Id3Decoder
The list of charsets is already hard-coded, and using `Charset` types
ensures they will all be present at run-time, hence we will never
encounter an 'unsupported' charset.

PiperOrigin-RevId: 491324466
(cherry picked from commit 5292e408a6fd000c1a125519e22a7c18460eed59)
2023-01-25 17:41:44 +00:00
ibaker
26f5e9b83c Split up Id3DecoderTest methods
It's clearer if each test method follows the Arrange/Act/Assert pattern

PiperOrigin-RevId: 491299379
(cherry picked from commit fc5d17832f90f36eb30ee0058204d110e27adcc9)
2023-01-25 17:41:43 +00:00
Rohit Singh
887179f50a Merge pull request #10799 from OxygenCobalt:id3v2-multi-value
PiperOrigin-RevId: 491289028
(cherry picked from commit b81d5f304e2f5fc55577e31c31ff6df5ce7d0ef5)
2023-01-25 17:41:39 +00:00
rohks
30dce91fc0 Convert bitrates to bps before setting it
Format expects the values of `averageBitrate` and `peakBitrate` in bps and the value fetched from AC3SpecificBox and EC3SpecificBox is in kbps.

PiperOrigin-RevId: 490756581
(cherry picked from commit 4066970ce7292642794f4a3954f8d0fde78dd310)
2023-01-25 17:41:00 +00:00
rohks
5ebbdc52cb Use ParsableBitArray instead of ParsableByteArray
To avoid complicated bit shifting and masking. Also makes the code more readable.

PiperOrigin-RevId: 490749482
(cherry picked from commit 3d31e094a9e802354dce2f3dc5f33062f7624248)
2023-01-25 17:41:00 +00:00
rohks
fda132f926 Rollback of 427329175e
*** Original commit ***

Rollback of 76df06a7a3

*** Original commit ***

Parse and set `peakBitrate` for Dolby TrueHD(AC-3) and (E-)AC-3

#minor-release

***

***

PiperOrigin-RevId: 490707234
(cherry picked from commit 82711630ed1afbe7417aad95244a91135e24c27f)
2023-01-25 17:41:00 +00:00
rohks
32f7a8b807 Rollback of 76df06a7a3
*** Original commit ***

Parse and set `peakBitrate` for Dolby TrueHD(AC-3) and (E-)AC-3

#minor-release

***

PiperOrigin-RevId: 490570517
(cherry picked from commit 427329175e87a7f3173791c59e6c2d4c4ed8dea4)
2023-01-25 17:41:00 +00:00
rohks
101a2498a0 Parse and set peakBitrate for Dolby TrueHD(AC-3) and (E-)AC-3
#minor-release

PiperOrigin-RevId: 490527831
(cherry picked from commit 76df06a7a364c580dfe07d9f069237cd77c5174c)
2023-01-25 17:41:00 +00:00
Ian Baker
a98efd8b97 Merge pull request #10786 from TiVo:p-aacutil-test-impl
PiperOrigin-RevId: 490465182
(cherry picked from commit a32b82f7bd14161b4ba204db28ca842f1dd0bb12)
2023-01-25 17:41:00 +00:00
ibaker
dddb72b269 Add DefaultExtractorsFactory.setTsSubtitleFormats
ExoPlayer is unable to detect the presence of subtitle tracks in some
MPEG-TS files that don't fully declare them. It's possible for a
developer to provide the list instead, but doing so is quite awkward
without this helper method. This is consistent for how
`DefaultExtractorsFactory` allows other aspects of the delegate
`Extractor` implementations to be customised.

* Issue: google/ExoPlayer#10175
* Issue: google/ExoPlayer#10505

#minor-release

PiperOrigin-RevId: 490214619
(cherry picked from commit ff48faec5f9230355907a8be24e44068ec294982)
2023-01-25 17:37:32 +00:00
ibaker
6871de23a4 Fix Dackka javadoc errors in protected methods
If there's an @param javadoc tag in a supertype then all overrides
of this method that don't also override the javadoc must use the same
parameter name.

PiperOrigin-RevId: 485857711
(cherry picked from commit be7dd956929578c1ad05889a389581a8b1c9dbd3)
2022-11-03 13:35:39 +00:00
andrewlewis
690ebb3dcd Upgrade dackka and fix some generation errors
#minor-release

PiperOrigin-RevId: 484483080
(cherry picked from commit 3069d8130be1bef156bef2d0b3541648fd5dbf9a)
2022-10-28 10:03:56 +00:00
ibaker
add9013df4 Fix Cea608Decoder handling of service switch commands in field 2
From ANSI-CTA-608-E R-2014 section 8.4:
> When closed captioning is used on line 21, field 2, it shall conform
> to all of the applicable specifications and recommended practices as
> defined for field 1 services with the following differences:
> 1. The non-printing character of the miscellaneous control-character
>    pairs that fall in the range of 0x14, 0x20 to 0x14, 0x2F in field 1,
>    shall be replaced with 0x15, 0x20 to 0x15, 0x2F when used in field
>    2.
> 2. The non-printing character of the miscellaneous control-character
>    pairs that fall in the range of 0x1C, 0x20 to 0x1C, 0x2F in field
>    1, shall be replaced with 0x1D, 0x20 to 0x1D, 0x2F when used in
>    field 2.

This basically means that `cc1=0x15` in field 2 should be interpreted as
`cc1=0x14` in field 1, and same for `0x1D -> 0x1C`.

The `isMiscCode`  method above already handles this by ignoring the LSB
(the only difference between `0x14` and `0x15`, and `0x1C` and `0x1D`)
by AND-ing with `0xF6` instead of `0xF7`. This change uses the same
trick in `isServiceSwitchCommand`.

Issue: google/ExoPlayer#10666
#minor-release
PiperOrigin-RevId: 483927506
(cherry picked from commit 8c0f7827e262c7c4609e0b677a173a1e71ef2bb0)
2022-10-26 11:09:04 +00:00
ibaker
7ed20efae4 Use int for an unsigned byte value in Cea608Decoder
This is a no-op, but it's more 'correct' because it avoids any potential
sign mix-ups that come from storing an unsigned byte (with a
potentially set MSB) in a signed java byte variable.

PiperOrigin-RevId: 483409798
(cherry picked from commit c9a0aa9db0a44555727660957901cc601d32b16c)
2022-10-24 16:51:08 +00:00
ibaker
c38543478a Fix some incorrect comments in Cea608DecoderTest
Also used all-caps consistently

PiperOrigin-RevId: 483317405
(cherry picked from commit fb755708720c133960e35d76188b70e265be29f2)
2022-10-24 09:18:36 +00:00
ibaker
3575b68020 Add Cea608DecoderTest
When debugging and fixing Issue: google/ExoPlayer#10666 I wanted to write a regression
test, but needed to add a test first... This is just a small bit of
coverage to start with. It checks the field/channel filtering works
correctly, but doesn't check any styling info. It also doesn't test
'pop on' subtitles (i.e. when the subtitle isn't shown until a 'end of
subtitle' signal is received).

PiperOrigin-RevId: 480644568
(cherry picked from commit 706b1299049b23dbc71a7407ffbaf8598f56b610)
2022-10-12 16:31:35 +00:00
ibaker
110fe2b61b Document the allowed values of TsPayloadReader.Flags IntDef
PiperOrigin-RevId: 479569806
(cherry picked from commit 91caf7a650a688eec9d2d8e976ae6e90a4be322c)
2022-10-07 13:50:28 +00:00
ibaker
878279425b Annotate methods that always return this with @CanIgnoreReturnValue
It's always safe to ignore the result of these methods, because the
caller already has a reference to the returned value.

PiperOrigin-RevId: 462388947
(cherry picked from commit 2deb435625c7569cb0bd250848adaa846884dc50)
2022-07-21 15:24:07 +00:00
rohks
396b55a341 Ignore reserved bit in parsing NAL unit type
`HevcConfig.parse` misreads reserved bit to determine NAL unit type. This is currently meant to be always set to 0, but could be given some kind of meaning in a future revision.

Issue: google/ExoPlayer#10366
PiperOrigin-RevId: 460487613
(cherry picked from commit 704aa2531adac1a73cc284baa1a2f5e22f0c2a0b)
2022-07-12 16:53:03 +00:00
rohks
c40d669c51 Add tests for extracting MP4 with large bitrates
Also added the test to `MP4PlaybackTest`.

PiperOrigin-RevId: 459492188
(cherry picked from commit 05e728a31eb85b82610a5eb83622ee2670582a26)
2022-07-07 13:04:29 +00:00
rohks
1ec7148c96 Fix MP4 parser issue in reading bitrates from esds boxes.
As per MP4 spec, bitrates in esds boxes can be a 32 bit number which doesn't fits in Java int type, so now reading it as a long value. Our class for holding media format, only allows bitrates value to be an int as we don't expect the bitrates to be greater than or equal to 2^31. So we're limiting the values for bitrates to Integer.MAX_VALUE.

PiperOrigin-RevId: 458423162
(cherry picked from commit 21638fa3784078170af3be545316e062313a30b5)
2022-07-01 09:52:45 +00:00
rohks
4d6781be2c Fix MP4 parser issue in reading length of URL array from esds boxes.
As per MP4 spec, the length of URL array is a 8 bit number.

#minor-release

PiperOrigin-RevId: 458421436
(cherry picked from commit 42f13c331f8c7e28505edcd1e033c5525e5c22f2)
2022-07-01 09:39:11 +00:00
olly
4e51ef5a2c Fix parsing H265 short term reference picture sets
Issue: google/ExoPlayer#10316
PiperOrigin-RevId: 456084302
(cherry picked from commit 6dc85dc241dca8f0783d3ffbb3448840b0e75b60)
2022-06-20 16:46:15 +01:00
Marc Baechinger
080b1862c2 Merge pull request #9915 from dburckh:avi
PiperOrigin-RevId: 455094147
(cherry picked from commit ad3348cc69d240ed3a1248496938fda57e20368e)
2022-06-15 16:52:51 +00:00
ibaker
f6f4bf5e6b Permit duplicate Opus headers
This reinstates the permissive behaviour removed by
fe7e5b8181

Test file created by opening bear.opus in a hex editor and naively
duplicating the two header packets, starting at (and including) the
first `OggS` in the file and ending just before the third `OggS`.

#minor-release

Issue: google/ExoPlayer#10038
PiperOrigin-RevId: 452015662
(cherry picked from commit 1282175808210f0496a4b18ae4e02312dbdf4553)
2022-05-31 14:07:20 +00:00
hmzh
efb49f285e Refactor MIDI and Flac extractor loaders for deduplication
Add MIDI filetype information for use in the ExtractorsFactory

PiperOrigin-RevId: 447976272
2022-05-24 10:33:06 +01:00
ibaker
4f616d6003 Remove ExoPlayer's RawCcExtractor
RawCC is a Google-internal subtitle format, and is no longer used with
ExoPlayer.

PiperOrigin-RevId: 446950691
2022-05-09 11:02:25 +01:00
ibaker
e7e466f729 Remove empty <p> tag from WebvttDecoder
PiperOrigin-RevId: 445217294
2022-05-09 10:32:48 +01:00
olly
a16c0b3068 Reading AV1 initialization data.
We add an entire class like we do for parsing other codec initialization formats; it's currently not doing any parsing though (... initialization data is really simple for AV1 though: just the entire contents of the box).

For testing, we add the sample file, having been re-encoded with ffmpeg (and we also happen to have another av1 file, too).

PiperOrigin-RevId: 444890282
2022-05-09 10:24:18 +01:00
ibaker
fd6b57469d Fix calculations that may lose precision compared to their target type
PiperOrigin-RevId: 444861268
2022-05-09 10:21:44 +01:00
Ian Baker
2898d41f4a Merge pull request #9967 from jruesga:cea708-handle-multiple-service-blocks
PiperOrigin-RevId: 444816821
2022-05-09 10:18:14 +01:00
Ian Baker
9369348d6f Merge pull request #10150 from egor-n:dev-v2-8435-outlinecolour
PiperOrigin-RevId: 444787307
2022-05-09 10:15:05 +01:00