53 Commits

Author SHA1 Message Date
ibaker
2deb435625 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
2022-08-08 07:55:25 +00:00
rohks
704aa2531a 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
2022-07-13 17:38:02 +00:00
rohks
05e728a31e Add tests for extracting MP4 with large bitrates
Also added the test to `MP4PlaybackTest`.

PiperOrigin-RevId: 459492188
2022-07-07 16:49:08 +00:00
rohks
21638fa378 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.

#minor-release

PiperOrigin-RevId: 458423162
2022-07-04 19:47:51 +00:00
rohks
42f13c331f 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
2022-07-04 19:47:02 +00:00
olly
6dc85dc241 Fix parsing H265 short term reference picture sets
Issue: google/ExoPlayer#10316
PiperOrigin-RevId: 456084302
2022-06-27 10:35:27 +01:00
Marc Baechinger
ad3348cc69 Merge pull request #9915 from dburckh:avi
PiperOrigin-RevId: 455094147
2022-06-15 15:28:22 +00:00
ibaker
1282175808 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
2022-05-31 13:55:14 +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
tonihei
287182952d Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 427131569
2022-02-08 11:07:50 +00:00
olly
1f7174e731 Revert of 87420e5f9bd1671cd3068185f7358f5faba53e71
PiperOrigin-RevId: 426996878
2022-02-08 11:07:43 +00:00
Ian Baker
77315b6596 Merge pull request #9924 from jruesga:cea708-decoder-honor-service-block-size
PiperOrigin-RevId: 426953267
2022-02-08 10:26:23 +00:00
ibaker
87420e5f9b Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 426855255
2022-02-07 10:49:31 +00:00
ibaker
01c814e2f0 Mark all public 'rarely used' IntDefs as only TYPE_USE
This is a breaking change if the annotation itself is in use in Kotlin
code. It's judged that the IntDefs in this commit are unlikely to be
referred to often in Kotlin code. This is because they're either:
- Related to esoteric parts of the library, or
- In a common part of the library but only returned from methods (and
  never passed to callback methods).

A follow-up change will fix the positions of existing usages to match
this new config.

#minor-release

PiperOrigin-RevId: 426410237
2022-02-07 10:47:50 +00:00
ibaker
8149ac8922 Mark all non-public IntDefs as only TYPE_USE
This only changes IntDefs that cannot be used by apps because they're
either private or package-private.

A follow-up change will fix the positions of existing usages to match
this new config.

#minor-release

PiperOrigin-RevId: 426372273
2022-02-04 14:51:52 +00:00
ibaker
92a6cc10a4 Mark some unreleased IntDefs as TYPE_USE only
The longer list of targets is only necessary for backwards
compatibility with existing Kotlin code that will stop compiling
if the position of the annotation becomes 'wrong' by marking it only
TYPE_USE. Since none of these IntDefs have been released (except in
media3 alpha1) we don't need to maintain this compatibility.

Also add a comment to all the places that *do* need the longer list of
targets, in order to explain why it's there and discourage copy-pasting
when defining new IntDefs in future.

Also fix some single-element arrays to remove the array notation.

#minor-release

PiperOrigin-RevId: 426108537
2022-02-04 09:38:55 +00:00
ibaker
daa45a16bd Fix parameter comments
PiperOrigin-RevId: 425874534
2022-02-04 09:32:39 +00:00
Andrew Lewis
497f55a4bb Merge pull request #9893 from moneytoo:mkv-vtt
PiperOrigin-RevId: 424382031
2022-01-28 08:45:44 +00:00
Andrew Lewis
b2152f1988 Merge pull request #9864 from OxygenCobalt:vorbis-comments
PiperOrigin-RevId: 424355325
2022-01-28 08:42:33 +00:00
olly
d9fd85aa63 Parse CryptoInfo from simpleTag and set it into DrmInitData.
PiperOrigin-RevId: 418960700
2022-01-05 12:15:27 +00:00
Ian Baker
d94bb08211 Merge pull request #9709 from Marksss:release-v2
PiperOrigin-RevId: 415272874
2021-12-10 11:19:44 +00:00
olly
6f63701307 Fix 1 ErrorProneStyle finding
PiperOrigin-RevId: 413188534
2021-12-02 11:55:55 +00:00
kimvde
f9d3bedb0b Fix inconsistency with spec in H.265 SPS nal units parsing
Issue: google/ExoPlayer#9719

#minor-release

PiperOrigin-RevId: 412424558
2021-12-02 11:55:44 +00:00
christosts
d5b6250350 Populate ICY headers into MediaMetadata
Populate ICY headers into MediaMetadata so that they can
propagate to the app via AnalyticsListener#onMediaMetadataChanged().
This change copies IcyHeaders.name into MediaMetadata.description
and IcyHeaders.genre into MediaMetadata.genre.

Note: MediaItem.metadata maintain their precedence and overwrite any
ICY headers parsed.

Issue: google/ExoPlayer#9677

#minor-release

PiperOrigin-RevId: 410495676
2021-11-19 14:55:51 +00:00
Ian Baker
5ce54179aa Merge pull request #9543 from KasemJaffer:rf64
PiperOrigin-RevId: 408816643
2021-11-19 14:29:19 +00:00
kimvde
f4d85ac247 WavExtractor: skip unknown chunks consistently
#minor-release

PiperOrigin-RevId: 408550935
2021-11-19 14:23:48 +00:00
kimvde
7168f93829 WavExtractor: split header reading state into 2 states
This refactoring is the basis to support RF64 (see
Issue: google/ExoPlayer#9543).

#minor-release

PiperOrigin-RevId: 407301056
2021-11-09 10:09:13 +00:00
aquilescanta
ab9741aced Parse HDR static metadata from MP4 files
#minor-release

PiperOrigin-RevId: 407136922
2021-11-09 10:09:13 +00:00
tonihei
d1e13b629d Fix rounding error in fMP4 presentation time calculation
The presentation time in fMP4 is calculated by adding and subtracting
3 values. All 3 values are currently converted to microseconds first
before the calculation, leading to rounding errors. The rounding errors
can be avoided by doing the conversion to microseconds as the last step.

For example:
In timescale 96000:  8008+8008-16016 = 0
Rounding to us first: 83416+83416-166833=-1

#minor-release

PiperOrigin-RevId: 406809844
2021-11-09 10:07:30 +00:00
kimvde
8586127d88 WavExtractor: split read stages into states
This refactoring is the basis to support RF64 (see
Issue: google/ExoPlayer#9543).

#minor-release

PiperOrigin-RevId: 406377924
2021-11-09 10:07:00 +00:00
christosts
9d5fd4f402 DefaultExtractorsFactory: lazily load flac extension
PiperOrigin-RevId: 406332026
2021-11-09 10:06:11 +00:00
ibaker
a60843ead5 Migrate callers of deprecated C.java methods to Util.java
#minor-release

PiperOrigin-RevId: 406166670
2021-11-08 15:17:26 +00:00