76 Commits

Author SHA1 Message Date
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
olly
296efbb395 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: 439453823
2022-04-06 11:58:54 +01:00
olly
21d085f8a9 Reading average and peak bitrates from esds boxes.
This provides better compatibility with MediaExtractor, which does read these fields; we also need them for being able to mux file contents into another mp4 file.

Also, there is a minor refactor included so that we have an actual type for esds box contents instead of a pair.

PiperOrigin-RevId: 438673825
2022-04-06 11:39:05 +01:00
aquilescanta
67acfc67de Support seeking in un-intearleaved tracks in Mp4Extractor
A client can pass the id of the track on which they want to seek.

PiperOrigin-RevId: 437248055
2022-04-06 10:59:41 +01:00
aquilescanta
e8b0971f12 Simplify nullability in Mp4Extractor
PiperOrigin-RevId: 437002406
2022-03-24 15:38:20 +00:00
aquilescanta
7db0d91dd9 Add maxNumRefFrames to NalUnitUtil
Needed for AVI support.

PiperOrigin-RevId: 436991922
2022-03-24 14:41:28 +00:00
aquilescanta
5b4abc31f3 Group NAL type constants in NalUnitUtil
To be shared with AviExtractor in a later CL.

PiperOrigin-RevId: 436430385
2022-03-22 10:32:35 +00:00
olly
5a304fdbd9 FMP4: Fix output of mixed v0 and v1 emsg samples
Issue: google/ExoPlayer#9996
#minor-release
PiperOrigin-RevId: 430773329
2022-03-01 09:35:58 +00:00
olly
9238dc758d Add Matroska Extractor Test Sample For Opus
PiperOrigin-RevId: 429386479
2022-02-18 14:56:25 +00:00
olly
c80d30ebce Avoid Clearing Supplemental Data Flag In MatroskExtractor
PiperOrigin-RevId: 429368911
2022-02-18 14:56:25 +00:00
olly
f1e59f8001 Libopus Support For WebM DiscardPadding
PiperOrigin-RevId: 429364728
2022-02-18 14:56:25 +00:00
Ian Baker
38717ce969 Reformat some javadoc 2022-02-18 14:54:02 +00:00
olly
1af8d57032 Fix Sample Size For Supplemental Data In MatroskaExtractor
For when a track is both encrypted and has supplemental data, the sample size will be equal to `block sample size - encryption data size`.

PiperOrigin-RevId: 427807612
2022-02-17 10:17:19 +00:00