317 Commits

Author SHA1 Message Date
olly
ce17f61899 Add decoder module
PiperOrigin-RevId: 404810682
2021-10-21 18:41:33 +01:00
olly
ea2013948a Finalize text package
PiperOrigin-RevId: 404277755
2021-10-19 17:32:24 +01:00
olly
2ef2206041 Move text classes that don't need to live in common.
PiperOrigin-RevId: 404079772
2021-10-18 23:52:28 +01:00
olly
d601875452 Rename releaseArtifact to releaseArtifactId
PiperOrigin-RevId: 404059404
2021-10-18 22:45:47 +01:00
olly
dd23cb13da Fix moving of DataReader
PiperOrigin-RevId: 403965543
2021-10-18 16:24:57 +01:00
olly
80286b42d6 Move metadata classes that don't need to live in common.
PiperOrigin-RevId: 403945085
2021-10-18 15:45:36 +01:00
olly
a242aa221e Move DataReader to common
PiperOrigin-RevId: 403928449
2021-10-18 15:34:37 +01:00
olly
18cf01cda6 Move DataSource utils into a DataSourceUtil class
PiperOrigin-RevId: 403910535
2021-10-18 15:25:43 +01:00
olly
b2bf9f4d0f Fix missing import
PiperOrigin-RevId: 403113286
2021-10-14 23:23:57 +01:00
kim-vde
059dfaef7c Merge pull request #9496 from DolbyLaboratories:dev-v2-truehd
PiperOrigin-RevId: 403081883
2021-10-14 16:16:05 +01:00
christosts
a18e281275 SubtitleExtractor: optimize calls to ExtractorInput.read()
When ExtractorInput.getLength() returns a defined length, the
SubtitleExtractor will create a buffer of the same length, call
ExtractorInput.read() until it has read the input bytes, plus one more
time where ExtractorInput.read() returns RESULT_END_OF_INPUT. The last
call to ExtractorInput.read() however will make the SubtitleExtractor to
increase its buffer (including a copy) unnecessarily.

This change makes the SubtitleExtractor avoid calling
ExtractorInput.read() if the expected number of bytes have already
been read, so that the internal buffer does not grow.

PiperOrigin-RevId: 402583610
2021-10-12 20:04:46 +01:00
christosts
a56af3d0e0 SubtitleExtractor: mark the limit of the input buffer
Before this change, the SubtitleExtractor did not mark the limit
of the input buffer, thus the SubtitleDecoder attempted to decode
more bytes. If the subtitle file had a new line at the end, this
bug would make the SubtitleDecoder append an line break after the
last subtitle.

PiperOrigin-RevId: 402523039
2021-10-12 19:44:46 +01:00
olly
8a9dcadef3 README updates for misc modules
PiperOrigin-RevId: 402292139
2021-10-12 19:40:44 +01:00
olly
69f2692389 Register modules with common
PiperOrigin-RevId: 402267733
2021-10-11 14:18:37 +01:00
kimvde
84881739ee Map TS stream type 0x80 to H262
Issue: #9472
PiperOrigin-RevId: 400715255
2021-10-04 15:43:47 +01:00
bachinger
014ee8f5d8 Remove fully qualified class names in link tags
PiperOrigin-RevId: 400224459
2021-10-04 11:53:39 +01:00
glass
d6bc49cc54 Add Dolby TrueHD extraction test for MP4 files.
Signed-off-by: glass <glass@dolby.com>
2021-09-30 16:17:57 +02:00
glass
13f4c832da Add MP4 extraction of Dolby TrueHD samples
Extract 16 access units per readSample call to align
with what's done in MKV extraction.

Signed-off-by: glass <glass@dolby.com>
2021-09-30 16:17:56 +02:00
bachinger
6d014cbfd2 Move SubtitleExtractor to text package
PiperOrigin-RevId: 399661676
2021-09-30 11:20:44 +01:00
bachinger
3e7b2d06c1 Move SubtitleExtractor to text package
PiperOrigin-RevId: 399400909
2021-09-28 16:41:08 +01:00
Oliver Woodman
9108dc5b0e Merge pull request #9421 from MarcusWichelmann:hevc-sps-parsing
PiperOrigin-RevId: 398749045
2021-09-24 18:13:01 +01:00
bachinger
4fec4b8f6a Move format specific metadata packages to lib-extractor
PiperOrigin-RevId: 398262695
2021-09-23 15:13:10 +01:00
bachinger
f2a027e068 Move text classes from lib-exoplayer to lib-extractor and lib-common
PiperOrigin-RevId: 398247348
2021-09-23 15:09:07 +01:00
ibaker
ad99a44083 Add empty sdk-version node to all AndroidManifest.xml files
PiperOrigin-RevId: 397772916
2021-09-21 14:17:33 +01:00
kimvde
46d97bdd39 Fix DTS_X audio mime type
Issue: #9429

#minor-release

PiperOrigin-RevId: 397717740
2021-09-20 13:02:53 +01:00
ibaker
73aece6356 Improve AdtsExtractor#sniff when trying different sync word offsets
The previous implementation did the following (after skipping any ID3
headers at the start of the stream):
1. Skip forward byte-by-byte looking for a sync word (0xFFF)
2. Assume this indicates the start of an ADTS frame and read the size
  a) If frameSize <= 6 immediately return false
3. Skip forward by frameSize and expect to find another ADTS sync word
   (with no further scanning).
   b) If we find one, great! Loop from step 2.
   a) If we don't find one then assume the **last** sync word we found
      wasn't actually one, so loop from step 1 starting one extra byte
      into the stream. This means we're looking for a sync word we would
      have skipped over in step 3.

The asymmetry here comes from the different handling of frameSize <= 6
(immediately return false) and frameSize being 'wrong because it doesn't
lead to another sync word' (scan the file again from the beginning for
alternative sync words).

With this change both these cases are handled symmetrically (always scan
for alternative sync words). Step 2a) becomes the same as 3b): Loop back
to the beginning of the stream with an incremented offset and scan for
another sync word.

#minor-release

PiperOrigin-RevId: 397285756
2021-09-17 13:10:58 +01:00
bachinger
f7abce6aea Move FlacConstant to lib-extractor
PiperOrigin-RevId: 397156268
2021-09-16 22:39:14 +01:00
krocard
92bf5d80c7 Add nullness annotations to TsExtractors
#exofixit

PiperOrigin-RevId: 396658717
2021-09-14 21:35:08 +01:00
olly
f8d60e2bbb Add flag for constant bitrate seeking even if input length is unknown
PiperOrigin-RevId: 396363113
2021-09-14 12:11:48 +01:00
andrewlewis
469c0e756a Use @C.TrackType more widely
Also add `TYPE_USE` target on the @IntDef (and fix @Targets for other
@IntDefs).

#exofixit

PiperOrigin-RevId: 396333212
2021-09-14 12:04:11 +01:00
Marcus Wichelmann
65001cc0e5
Added javadoc comments to HevcConfig 2021-09-13 16:48:08 +02:00
Marcus Wichelmann
dbc7088716
Keep the existing parseSpsNalUnit (and similar) methods to avoid breaking changes 2021-09-13 12:30:21 +02:00
Marcus Wichelmann
296074fbea
Extend SPS parsing when building the initial MP4 HevcConfig and include the PAR for propagating it into the Format 2021-09-13 10:27:55 +02:00
apodob
837667dea1 Add seeking support to the SubtitleExtractor
SubtitleExtractor is using IndexSeekMap with only one position to
indicate that its output is seekable. SubtitleExtractor is keeping Cues
in memory anyway so more seek points are not needed. SubtitleExtractor
gets notified about seek occurrence through seek() method. Inside that
method extractor saves seekTimeUs, and on the next call to read()
extractor outputs all cues that should be displayed at this time and
later.

PiperOrigin-RevId: 395477127
2021-09-08 17:16:31 +01:00
apodob
66335ab6f5 Redesign states of the SubtitleExtractor.
Simplifies the SubtitleExtractor implementation. Makes the extractor
more aligned with the Extractor interface documentation by removing
STATE_DECODING in which extractor was doing nothing in term of input
and output while returning RESULT_CONTINUE at the same time.

PiperOrigin-RevId: 395267468
2021-09-07 20:24:16 +01:00
olly
97b717b8dc Duration readers: Return TIME_UNSET rather than a negative value
This typically happens if there's a discontinuity in the stream.
It's better to say we don't know, than it is to return a negative
position.

Issue: #8346
#exofixit
#minor-release
PiperOrigin-RevId: 395224088
2021-09-07 17:46:47 +01:00
andrewlewis
d05c15dee0 Add open @IntDef for track types
Also add handling of `C.TRACK_TYPE_IMAGE` in a couple of places where it was
missing.

#exofixit

PiperOrigin-RevId: 395078312
2021-09-06 15:04:47 +01:00
apodob
095c63933b Fix the preparation of Extractor inside the init() method
Extractor was not calling endTracks() and seekMap() on the
extractorOutput which are required to finish the preparation.
At that point extractor does not support seeking.

PiperOrigin-RevId: 393994848
2021-09-02 09:38:30 +01:00
kimvde
97466ab779 TsExtractor: handle packets without PTS
#minor-release
Issue: #9294
PiperOrigin-RevId: 392844983
2021-08-25 10:59:58 +01:00
andrewlewis
654a320792 Remove stray symlinks
These are unneeded for the external project

#minor-release

PiperOrigin-RevId: 392835942
2021-08-25 10:58:20 +01:00
apodob
cbd6527926 Set format.sampleMimeType to TEXT_EXOPLAYER_CUES in SubtitleExtractor.
Samples are serialized using our custom CueEncoder. Information in
which format samples are encoded is needed by Renderer to decide which
decoder to use. Extractor receives Format object in the constructor and
prepares new Format object with sampleMimeType moved to codecs field
and new sampleMimeType set to "custom serialized exoplayer Cue".

PiperOrigin-RevId: 391739866
2021-08-20 11:44:06 +01:00
apodob
afc549fba4 Release subtitle outputBuffer after decoding.
PiperOrigin-RevId: 391509443
2021-08-19 10:51:34 +01:00
apodob
80d9d47d1c Add Extractor#release() implementation.
SubtitleExtractor.release() releases the underlying SubtitleDecoder.
This change introduces the STATE_RELEASED state. The extractor
handles the new state in the read() and seek() methods.

PiperOrigin-RevId: 391046478
2021-08-17 15:41:03 +01:00
olly
88a637bc45 Move format util classes to extractor package
PiperOrigin-RevId: 390577072
2021-08-13 11:45:37 +01:00
apodob
c5b01b2f7b Add SubtitleExtractor which wraps a SubtitleDecoder.
SubtitleExtractor is a component that extracts subtitle data taken from
ExtractorInput into samples. Samples are pushed into an ExtractorOutput
(usually SampleQueue). As a temporary solution SubtitleExtractor uses
SubtitleDecoder to extract Cues from input data.

PiperOrigin-RevId: 390319875
2021-08-12 16:33:14 +01:00
olly
7e8ba03147 Deprecate final non-nested Factory classes in upstream
PiperOrigin-RevId: 389661768
2021-08-09 20:07:24 +01:00
ibaker
db1fe8041b Remove @DoNotInstrument from test classes
This isn't needed now we've updated to Robolectric 4.6

Follow-up to 0df0df9aee

PiperOrigin-RevId: 389616471
2021-08-09 20:02:05 +01:00
olly
a34809bb9d Tweak use of TimestampAdjuster for seeking
- Fix use of getTimestampOffsetUs in TsExtractor where
  getFirstSampleTimestampUs should have been used.
- Don't reset TimestampAdjuster if it's in no-offset mode.
- Improve comment clarity

#minor-release

PiperOrigin-RevId: 388682711
2021-08-04 18:40:45 +01:00
olly
f726212180 Simplify TimestampAdjuster logic
- Use timestampOffsetUs == C.TIME_UNSET directly as the way of
  determining whether the adjuster has determined the offset,
  rather than relying on lastSampleTimestampUs checks for this.
- Remove comment referring to lastSampleTimestampUs as holding
  the "adjusted PTS". Its value may not have originated from a PTS
  timestamp. It's also confusing to refer to it as "adjusted"
  given timestampOffsetUs has not been applied to it.
- Fix PassthroughSectionPayloadReader to make sure it'll never
  output a sample with an unset timestamp.

#minor-release

PiperOrigin-RevId: 388226180
2021-08-02 19:19:28 +01:00
andrewlewis
9c27cfcda7 Fix parameter names on overridden methods
The dokka javadoc generation tool complains when parameter names don't match between a method and its override. This change updates occurrences where there is currently a mismatch.

Notable renamings that might be controversial:
- `onPlaybackStateChanged(int state)` to `onPlaybackStateChanged(int playbackState)` affected a lot of lines but seems more consistent with other '-Changed' methods.
- `handleMessage(int messageType, Object payload)` to `handleMessage(int messageType, Object message)`
- `ExtractorInput` and `DataSource` inherit `DataReader` which had `read(byte[] target, ...`, while data sources normally called the first parameter `buffer`. I have standardized these all to use `buffer` even though it looks out of place in the `ExtractorInput` interface (which has more `read` methods with `target`).

PiperOrigin-RevId: 387290360
2021-07-28 09:15:29 +01:00