235 Commits

Author SHA1 Message Date
ibaker
1c4ba5d9f6 Delete VorbisUtil.CodeBook since it's not used
PiperOrigin-RevId: 513186205
2023-03-01 17:26:31 +00:00
ibaker
c07cf3dc41 Remove @see tags with <a> tags
These are not supported by Dackka

#minor-release

PiperOrigin-RevId: 513176533
2023-03-01 17:25:48 +00:00
Mayur K
0761641d9f Use edts media time offset if edits list duration is entire media duration. 2023-02-24 18:18:16 +05:30
michaelkatz
4854e771d7 Encapsulate Opus frames in Ogg during audio offload
PiperOrigin-RevId: 508053559
2023-02-08 14:12:06 +00:00
tonihei
00436a04a4 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 10:26:52 +00:00
rohks
6c14ffc1ec Fix javadoc references to writeSampleData
PiperOrigin-RevId: 502821506
2023-01-18 12:05:08 +00:00
Googler
d8ea770e9b 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-04 21:58:17 +00:00
ibaker
636a4a8538 Add javadoc links to README files
Fix some other link titles and destinations spotted along the way.

#minor-release

PiperOrigin-RevId: 493276172
2022-12-12 11:19:23 +00:00
Googler
c14b250445 Temporal fix to allow proper library shrinking.
PiperOrigin-RevId: 492579961
2022-12-12 11:10:18 +00:00
ibaker
3efc62b512 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 11:09:18 +00:00
ibaker
e4fb663b23 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 10:57:18 +00:00
Ian Baker
a919141805 Merge pull request #10750 from Stronger197:subrip_utf_16
PiperOrigin-RevId: 492164739
2022-12-12 10:55:15 +00:00
rohks
c7aa54cb41 Parse and set bitrates in Ac3Reader
PiperOrigin-RevId: 492003800
2022-12-12 10:47:12 +00:00
tonihei
568fa1e1fa 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 18:48:04 +00:00
ibaker
5292e408a6 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 18:40:42 +00:00
ibaker
fc5d17832f Split up Id3DecoderTest methods
It's clearer if each test method follows the Arrange/Act/Assert pattern

PiperOrigin-RevId: 491299379
2022-11-29 18:37:08 +00:00
Rohit Singh
b81d5f304e Merge pull request #10799 from OxygenCobalt:id3v2-multi-value
PiperOrigin-RevId: 491289028
2022-11-29 18:35:59 +00:00
rohks
4066970ce7 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:28:49 +00:00
rohks
3d31e094a9 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:26:34 +00:00
rohks
82711630ed 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
2022-11-24 14:55:08 +00:00
rohks
427329175e Rollback of 76df06a7a3
*** Original commit ***

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

#minor-release

***

PiperOrigin-RevId: 490570517
2022-11-24 14:53:04 +00:00
rohks
76df06a7a3 Parse and set peakBitrate for Dolby TrueHD(AC-3) and (E-)AC-3
#minor-release

PiperOrigin-RevId: 490527831
2022-11-24 14:49:50 +00:00
Ian Baker
a32b82f7bd Merge pull request #10786 from TiVo:p-aacutil-test-impl
PiperOrigin-RevId: 490465182
2022-11-24 14:41:58 +00:00
ibaker
ff48faec5f 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:19:45 +00:00
samrobinson
59aedcf309 Handle buffers in DefaultAudioSink with AudioProcessingPipeline.
PiperOrigin-RevId: 488412695
2022-11-16 12:07:58 +00:00
ibaker
be7dd95692 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 11:23:25 +00:00
andrewlewis
3069d8130b Upgrade dackka and fix some generation errors
#minor-release

PiperOrigin-RevId: 484483080
2022-10-31 11:46:58 +00:00
ibaker
8c0f7827e2 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 11:36:34 +00:00
ibaker
c9a0aa9db0 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 11:30:27 +00:00
ibaker
fb75570872 Fix some incorrect comments in Cea608DecoderTest
Also used all-caps consistently

PiperOrigin-RevId: 483317405
2022-10-24 10:53:29 +00:00
ibaker
706b129904 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-17 15:53:36 +00:00
ibaker
91caf7a650 Document the allowed values of TsPayloadReader.Flags IntDef
PiperOrigin-RevId: 479569806
2022-10-17 15:37:28 +00:00
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