516 Commits

Author SHA1 Message Date
tonihei
ac3017b580 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

#minor-release

PiperOrigin-RevId: 505098172
2023-02-01 14:20:57 +00:00
rohks
8fcd6bbffc Fix javadoc references to writeSampleData
PiperOrigin-RevId: 502821506
2023-01-18 13:26:52 +00:00
Googler
bbe78b10c1 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
2023-01-10 20:04:22 +00:00
Googler
f3832b33d3 Temporal fix to allow proper library shrinking.
PiperOrigin-RevId: 492579961
2022-12-12 12:29:06 +00:00
ibaker
d6c872494b Deprecate C.POSITION_UNSET in favour of C.INDEX_UNSET
These have the same value (`-1`), and basically the same meaning (offset
in an array/list/file/byte stream/etc), but 'position' is an overloaded
term in a media playback library, and there's a risk people assume that
methods like `Player.getCurrentPosition()` may return
`C.POSITION_UNSET`, when in fact unset media times (whether duration or
position) are always represented by `C.TIME_UNSET` which is a) a `long`
(not `int`) and b) a different underlying value. (aside:
`getCurrentPosition()` never returns an unset value, but it's a good
example of the ambiguity of the word 'position' between 'byte offset'
and 'media timestamp'.)

PiperOrigin-RevId: 492493102
2022-12-12 12:24:50 +00:00
ibaker
02fa8aa784 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
2022-12-12 11:54:45 +00:00
Ian Baker
496cfa420d Merge pull request #10750 from Stronger197:subrip_utf_16
PiperOrigin-RevId: 492164739
2022-12-12 11:46:10 +00:00
rohks
5f73984823 Parse and set bitrates in Ac3Reader
PiperOrigin-RevId: 492003800
2022-12-12 11:11:24 +00:00
tonihei
4cf877b814 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
2022-11-29 19:42:25 +00:00
ibaker
043546a034 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
2022-11-29 19:19:43 +00:00
ibaker
bf77290fbe Split up Id3DecoderTest methods
It's clearer if each test method follows the Arrange/Act/Assert pattern

PiperOrigin-RevId: 491299379
2022-11-29 19:08:02 +00:00
Rohit Singh
c827e46c3d Merge pull request #10799 from OxygenCobalt:id3v2-multi-value
PiperOrigin-RevId: 491289028
2022-11-29 19:04:05 +00:00
rohks
67955e0ce3 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
2022-11-29 18:40:08 +00:00
rohks
89e4b8d049 Use ParsableBitArray instead of ParsableByteArray
To avoid complicated bit shifting and masking. Also makes the code more readable.

PiperOrigin-RevId: 490749482
2022-11-29 18:32:10 +00:00
Lev
101b712267 Cleanup 2022-11-26 03:04:35 +03:00
Lev
5e3b817b81 Cleanup 2022-11-26 02:56:58 +03:00
Lev
184761f79e
Merge branch 'dev-v2' into subrip_utf_16 2022-11-26 02:44:17 +03:00
Lev
90e9807ab2 Fixes after review 2022-11-26 02:37:26 +03:00
rohks
8c91a31ced Rollback of ea3552c1a0
*** Original commit ***

Rollback of 01eddb34f5

*** Original commit ***

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

#minor-release

***

***

PiperOrigin-RevId: 490707234
2022-11-24 15:22:45 +00:00
rohks
ea3552c1a0 Rollback of 01eddb34f5
*** Original commit ***

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

#minor-release

***

PiperOrigin-RevId: 490570517
2022-11-24 15:15:12 +00:00
rohks
01eddb34f5 Parse and set peakBitrate for Dolby TrueHD(AC-3) and (E-)AC-3
#minor-release

PiperOrigin-RevId: 490527831
2022-11-24 15:04:03 +00:00
Ian Baker
8a9a66c288 Merge pull request #10786 from TiVo:p-aacutil-test-impl
PiperOrigin-RevId: 490465182
2022-11-24 14:47:25 +00:00
Alexander Capehart
85c4d9870b
Move ID3v2 text frame fallback to ID3v2 decoder
Instead of the ID3v2 text frame falling back to a singleton list of an
empty string when the given values are empty, make that case throw
an exception within the text frame, and move that fallback behavior
into the ID3v2 decoder.
2022-11-22 09:28:05 -07:00
ibaker
4853444f0d 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
2022-11-22 14:23:23 +00:00
Alexander Capehart
46f376e40b
Fix non-updated constructor usage
Fix a constructor usage that tried to use an array instead of a list.
2022-11-21 14:01:01 -07:00
Alexander Capehart
6dd20ed13a
Make text information frame values abstract
Make the values of TextInformationFrame an abstract list instead of an
explicit ImmutableList.
2022-11-21 12:51:47 -07:00
Alexander Capehart
0eb56f65b0
Improve multi-value text frame parsing
Rework the parsing of multi-value text frames to reduce duplication
and increase efficiency.
2022-11-21 11:55:14 -07:00
Alexander Capehart
157f1f0787
Rework ID3v2 text frame values interface
Rework the interface for ID3v2 text frames by:
- Switching from a mutable array to ImmutableList
- Never leaving the array empty, instead filling it with "" if there
are no values

This makes the surface safer and more in line with the rest of the
module.
2022-11-21 11:35:05 -07:00
Alexander Capehart
c96b55029d
Add ID3v2 multi-value tests
Add tests for ID3v2 multi-value text frames.
2022-11-20 18:28:46 -07:00
Alexander Capehart
4510210ad7
Merge branch 'multi-value-id3v2' into dev-v2 2022-11-20 18:05:45 -07:00
Alexander Capehart
d8729e552c
Fix second-order issues
Fix second-order issues stemming from the addition of multi-value tags.
2022-11-20 18:02:45 -07:00
psharma
0feace5faf Detect if less than 24 audio sampling frequency bits are present.
ISO ISO14496-3 allows setting of an arbitrary audio sampling frequency in compliant streams.
When samplingFrequencyIndex is set to 0xf (escape value) we expect no less than 24 bits
to read sampling informtion from (See section 1.6.2.1)
2022-11-16 14:18:01 -08:00
samrobinson
52f3ee81d4 Handle buffers in DefaultAudioSink with AudioProcessingPipeline.
PiperOrigin-RevId: 488412695
2022-11-16 12:10:21 +00:00
ibaker
b8e5d708fc 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
2022-11-08 14:05:57 +00:00
Lev
5609efd0e0 Added UTF-16 (LE) and UTF-16 (BE) support for subrip subtitles. 2022-11-05 10:40:01 +03:00
andrewlewis
fc1eca10f4 Upgrade dackka and fix some generation errors
#minor-release

PiperOrigin-RevId: 484483080
2022-10-31 16:37:04 +00:00
ibaker
7c6d492ff1 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
2022-10-31 16:11:03 +00:00
ibaker
3d0f43a149 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
2022-10-31 15:53:01 +00:00
ibaker
6dcb9aaaa8 Fix some incorrect comments in Cea608DecoderTest
Also used all-caps consistently

PiperOrigin-RevId: 483317405
2022-10-24 11:03:20 +00:00
ibaker
6052212c15 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
2022-10-20 01:50:25 +00:00
ibaker
7c68b8d450 Document the allowed values of TsPayloadReader.Flags IntDef
PiperOrigin-RevId: 479569806
2022-10-20 01:10:09 +00:00
Alexander Capehart
b054813e6d
Rename eos terminology
Rename indexOfEos to indexOfTerminator to better reflect how a
terminator != the end of a frame now.
2022-09-07 22:11:06 -06:00
Alexander Capehart
0cdece3a3f
Clarify comments
Clarify that null-termianted multi-value separators are specific to
ID3v2.4.
2022-09-07 20:58:11 -06:00
Alexander Capehart
b125a2b0b3
Add support for ID3v2.4 multi-value tags
Add support for multi-value tags based on null terminators.

These are specific to ID3v2.4, but is backwards compatible with
ID3v2.3, so no version checks are needed.
2022-09-07 20:40:10 -06:00
ibaker
21cab6124d 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-07-25 22:19:11 +01:00
rohks
0f665fbeb8 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:47:51 +00:00
rohks
a1665841fc Add tests for extracting MP4 with large bitrates
Also added the test to `MP4PlaybackTest`.

PiperOrigin-RevId: 459492188
2022-07-07 18:30:04 +00:00
rohks
9e10286b5e 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-07 17:23:16 +00:00
rohks
5095ff160b 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-07 17:19:49 +00:00
rohks
43eb3d0fc8 Add tests for extracting MP4 with large bitrates
Also added the test to `MP4PlaybackTest`.

PiperOrigin-RevId: 459492188
(cherry picked from commit a1665841fc90e979af427f9da0b8398d56cc6632)
2022-07-07 13:04:29 +00:00