380 Commits

Author SHA1 Message Date
olly
1bc4ba29f5 FMP4: Fix output of mixed v0 and v1 emsg samples
Issue: google/ExoPlayer#9996
#minor-release
PiperOrigin-RevId: 430773329
2022-03-01 09:46:31 +00:00
olly
d622598285 Add Matroska Extractor Test Sample For Opus
PiperOrigin-RevId: 429386479
2022-02-18 15:03:10 +00:00
olly
e32809cf08 Avoid Clearing Supplemental Data Flag In MatroskExtractor
PiperOrigin-RevId: 429368911
2022-02-18 15:03:02 +00:00
olly
bdcc9ea163 Libopus Support For WebM DiscardPadding
PiperOrigin-RevId: 429364728
2022-02-18 15:03:02 +00:00
Ian Baker
87d8ca0af2 Reformat some javadoc 2022-02-18 15:02:33 +00:00
olly
d5cb100762 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:42:28 +00:00
tonihei
17050e8b59 Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 427131569
2022-02-08 12:34:06 +00:00
olly
2db8807aac Revert of b19ced30c4c2853b09af3382b86f84c31b3a5af5
PiperOrigin-RevId: 426996878
2022-02-08 12:33:53 +00:00
Ian Baker
60d9ae4758 Merge pull request #9924 from jruesga:cea708-decoder-honor-service-block-size
PiperOrigin-RevId: 426953267
2022-02-08 10:56:39 +00:00
ibaker
b19ced30c4 Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 426855255
2022-02-07 11:17:31 +00:00
ibaker
75932a0216 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 11:10:11 +00:00
ibaker
0c2e77daca 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 15:07:19 +00:00
ibaker
564c3bcb49 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 10:16:43 +00:00
ibaker
032df64f15 Fix parameter comments
PiperOrigin-RevId: 425874534
2022-02-04 09:52:19 +00:00
Jorge Ruesga
bb7cab0cfd
Cea708Decoder: Honor service block size
The current implementation of ExoPlayer Cea708 is processing the whole service block without
taking into account the defined service block size, which could cause the execution of
unwanted command.

The following set of Cea708 represents a real use case of the above.

``` hex
FC9420FD152FFF0929FE8CFCFE9818FEE332FE731FFE1044FE8B03FE8CFCFE0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000
FC942CFD1520FF4649FE8CFEFE9918FEE332FE731FFE1000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000
FC942FFD9470FF8924FE8B03FE8CFCFE4A92FE0300FE9005FE0091FE2A00FE0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000
FC9420FD97A1FFC829FE8CFEFE9918FEE332FE731FFE1043FE9203FE0100FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000
FC94D6FDCEEFFF082AFE9202FE0C90FE0500FE912AFE0000FE424EFE6F00FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000
FCC168FD20F4FF4422FE4168FE4220FE7400FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000
FC2C20FDE520FF8422FE2C20FE4265FE2000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000
FC64EFFD70EFFFC422FE646FFE4270FE6F00FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000
FC6EA7FD6E67FF0422FE6E27FE426EFE6700FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000
FCF420FD6173FF4422FE7420FE4261FE7300FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000
FC67E5FD206DFF8422FE6765FE4220FE6D00FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000
FCF480FD7579FFC422FE7403FE4275FE7900FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000FA0000
```

The above frames should be displaying the following text on the screen (or at least the first part of it).

```
Ah, don't get
all sappy about it
```

ExoPlayer is currently parsing this block as follow (in parentheses the defined service block size):

```
(2) 22416842207400
G0 A
G0 h
G0 B
G0 \u0020
G0 t
C0 COMMAND_NUL

(2) 222C2042652000
G0 ,
G0 \u0020
G0 B
G0 e
G0 \u0020
C0 COMMAND_NUL

(2) 22646F42706F00
G0 d
G0 o
G0 B
G0 p
G0 o
C0 COMMAND_NUL

(2) 226E27426E6700
G0 n
G0 '
G0 B
G0 n
G0 g
C0 COMMAND_NUL

(2) 22742042617300
G0 t
G0 \u0020
G0 B
G0 a
G0 s
C0 COMMAND_NUL

(2) 22676542206D00
G0 g
G0 e
G0 B
G0 \u0020
G0 m
C0 COMMAND_NUL

(2) 22740342757900
G0 t
C0 COMMAND_ETX
G0 B
G0 u
G0 y
C0 COMMAND_NUL

(2) 2392030C4220730000
C1 COMMAND_SPL
G0 B
G0 \u0020
G0 s
C0 COMMAND_NUL
C0 COMMAND_NUL

(2) 22616C42656E00
G0 a
G0 l
G0 B
G0 e
G0 n
C0 COMMAND_NUL
```

So it ended up processing the following cue text (additional unwanted commands could be executed as well)

```
AhB t, Be doBpon'Bngt BasgeB mt
BuyB salBen
```

If instead the parsing logic take into account the service block size

```
(2) 22416842207400
G0 A
G0 h

(2) 222C2042652000
G0 ,
G0 \u0020

(2) 22646F42706F00
G0 d
G0 o

(2) 226E27426E6700
G0 n
G0 '

(2) 22742042617300
G0 t
G0 \u0020

(2) 22676542206D00
G0 g
G0 e

(2) 22740342757900
G0 t
C0 COMMAND_ETX

(2) 2392030C4220730000
C1 COMMAND_SPL

(2) 22616C42656E00
G0 a
G0 l
```

which is translated to (again I didn't processed all the frames, just a few of them)

```
Ah, don't get
al
```

which is what we are looking for.

This PR modifies service block parsing logic to honor service block size instead of read the full service block buffer.

Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2022-02-02 16:53:54 +00:00
Andrew Lewis
e58ffc0682 Merge pull request #9893 from moneytoo:mkv-vtt
PiperOrigin-RevId: 424382031
2022-01-28 09:33:35 +00:00
Andrew Lewis
fe7e5b8181 Merge pull request #9864 from OxygenCobalt:vorbis-comments
PiperOrigin-RevId: 424355325
2022-01-28 09:22:51 +00:00
Marcel Dopita
6b3187ccf1 Support MKV embedded WebVTT captions 2022-01-24 18:12:43 +01:00
OxygenCobalt
f6bee303e7
Swap inheritance hierarchy between vorbis types
Instead of having types in flac inherit types in vorbis, make types in
vorbis inherit types in flac. This is a bit of a hack and somewhat
messy, but it retains backwards compatibility.
2022-01-18 06:18:58 -07:00
OxygenCobalt
9c1018679a
Fix nitpicks
Fix some more nitpicks I encountered.
2022-01-17 15:10:25 -07:00
OxygenCobalt
a4682cbff5
Fix FlacStreamMetadata compile failure
Comment concatenation was accidentally not added previously, which
results in a testing failure.
2022-01-17 10:34:49 -07:00
OxygenCobalt
fc08f866ce
Rework vorbis comment parsing
Collapse the two variations of `VorbisUtil.buildMetadata` into a single
method called `VorbisUtil.parseVorbisComments` that only takes a list
of vorbis strings, compared to previously where it would take strings
and picture frame instance. Any code that relied on the old signature
now either concatenates picture frames and vorbis comments or copies
vorbis comments into an existing metadata instance.
2022-01-17 09:59:20 -07:00
OxygenCobalt
7a88829ea6
Misc cleanup
Group up some other minor changes with the vorbis comment utils.
2022-01-17 09:17:45 -07:00
OxygenCobalt
b9191615ee
Rework OPUS comment header parsing
Simplify how the comment header is parsed and eliminate a few possible
bugs in the process, such as:
- Metadata being overwritten directly by the comments header.
- The packet being rewound to 0 if it cannot find a comment header,
which might result in the cursor being moved to a bad position.
2022-01-17 09:09:01 -07:00
OxygenCobalt
9597ecbb31
Clean up VorbisUtil
Try to eliminate some nitpicks regarding VorbisUtil.
2022-01-17 08:04:34 -07:00
OxygenCobalt
0ea8567b6b
Superclass deprecated vorbis metadata types
In the old `flac` module, superclass the deprecated types under the
moved types in the `vorbis` module. This ensures backwards compat
with existing library users.
2022-01-17 07:54:39 -07:00
OxygenCobalt
49967483f6
Merge remote-tracking branch 'origin/dev-v2' into vorbis-comments
Line up this branch with the dev branch instead of the release branch.
2022-01-15 19:05:49 -07:00
OxygenCobalt
29d978fdd4
Cleanup VorbisUtil
Slightly cleanup VorbisUtil.
2022-01-09 18:52:54 -07:00
OxygenCobalt
90b3056820
Refactor changes
Refactor the overall module to place the unified vorbis tags into a
single package called `vorbis`. Also re-intoduce the vorbis tags
in their original `flac` module, but deprecate them.
2022-01-09 16:16:20 -07:00
OxygenCobalt
435e7d5a81
Add opus metadata parsing
Add metadata parsing for the Opus format.
2022-01-09 15:54:24 -07:00
OxygenCobalt
60df845d4a
Fix vorbis tests
The vorbis tests did not expect metadata normally. Now they do.
2022-01-09 11:52:33 -07:00
OxygenCobalt
d7a40679de
Refactor vorbis metadata parsing into xiph
Move all picture and vorbis frame parsing into a new xiph module. This
commit also adds cover frame parsing from vorbis comments as well.
2022-01-09 11:29:18 -07:00
OxygenCobalt
d6eae9ad5f
Add vorbis comment parsing to OggReader
Change how OggReader handles the CommentsHeader instance, enabling
VorbisComment tags to be parsed from it.
2022-01-09 10:50:04 -07:00
olly
1380655747 Parse CryptoInfo from simpleTag and set it into DrmInitData.
PiperOrigin-RevId: 418960700
2022-01-04 17:17:29 +00:00
Oliver Woodman
0744989db9 Merge pull request #9709 from Marksss:release-v2
PiperOrigin-RevId: 415272874
2021-12-10 16:50:34 +00:00
shenxl
c8fa51c7c8 length->bytesLeft 2021-12-07 10:03:00 +08:00
olly
0fdbff43e0 Fix 1 ErrorProneStyle finding
PiperOrigin-RevId: 413188534
2021-12-02 15:21:02 +00:00
Marksss
13eb9c5908 fix ArrayIndexOutOfBoundsException when playing flv 2021-12-01 16:56:42 +08:00
kimvde
dbec03b543 Fix inconsistency with spec in H.265 SPS nal units parsing
Issue: google/ExoPlayer#9719

#minor-release

PiperOrigin-RevId: 412424558
2021-11-26 16:19:51 +00:00
christosts
16e31a8495 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

PiperOrigin-RevId: 410495676
2021-11-18 14:20:26 +00:00
christosts
349160a5cf 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-18 13:13:27 +00:00
tonihei
eec8d31544 Merge pull request #9543 from KasemJaffer:rf64
PiperOrigin-RevId: 408816643
2021-11-11 13:34:48 +00:00
kimvde
334fe47b60 WavExtractor: skip unknown chunks consistently
#minor-release

PiperOrigin-RevId: 408550935
2021-11-11 13:34:37 +00:00
tonihei
04517e17d4 Merge pull request #9543 from KasemJaffer:rf64
PiperOrigin-RevId: 408816643
2021-11-11 10:21:29 +00:00
kimvde
4082d8a63d WavExtractor: skip unknown chunks consistently
#minor-release

PiperOrigin-RevId: 408550935
2021-11-09 15:09:42 +00:00
kimvde
9e247d287f 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-03 15:57:39 +00:00
aquilescanta
be4ea151c4 Parse HDR static metadata from MP4 files
#minor-release

PiperOrigin-RevId: 407136922
2021-11-03 15:57:11 +00:00
kimvde
1139399193 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-03 15:21:28 +00:00
aquilescanta
41e338229a Parse HDR static metadata from MP4 files
#minor-release

PiperOrigin-RevId: 407136922
2021-11-03 15:07:30 +00:00
tonihei
4803ab3bd1 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-01 17:36:49 +00:00