120 Commits

Author SHA1 Message Date
kimvde
efce10c873 Simplify FragmentedMp4Extractor sample time logic
PiperOrigin-RevId: 320574671
2020-07-13 14:03:10 +01:00
andrewlewis
1e2ed51f25 Add support for H.263 and MPEG-4 Part 2 in TS
The new reader is named H263Reader as it handles H.263 streams, but
MPEG-4 Part 2 streams are also intended to be handled. The reader's
output format MIME type is video/mp4v as the H.263 streams can be
decoded by decoders supporting this MIME type.

The implementation is based on the framework implementation for
extracting MPEG-4 video in MPEG-TS
(https://cs.android.com/android/platform/superproject/+/master:frameworks/av/media/libstagefright/mpeg2ts/ESQueue.cpp;l=1825;drc=86e363c1fac27302ca4ae33e73296f7797672995)
and is similar to the existing H262Reader.

Issue: #1603
Issue: #5107
PiperOrigin-RevId: 320565337
2020-07-13 14:02:34 +01:00
kimvde
c29fc94540 Fix saiz and senc sample count checks for FMP4
Issue: #7592
PiperOrigin-RevId: 320556981
2020-07-10 09:09:39 +01:00
olly
9b652ac14b Fix TrackSampleTable.durationUs to be 0 for sideloaded tracks
PiperOrigin-RevId: 320006659
2020-07-08 13:55:55 +01:00
kimvde
c06fa144e1 Remove some sanity occurrences in Java files
Remove occurrences in comments and private fields.

ISSUE: #7565
PiperOrigin-RevId: 319828820
2020-07-08 13:54:51 +01:00
kimvde
3612874d19 Miscellaneous fixes to FragmentedMp4Extractor
ISSUE: #7308
PiperOrigin-RevId: 319747742
2020-07-06 16:46:58 +01:00
kimvde
64a24e08fe Add compatible brands to MP4 sniffer
Issue: #7584
PiperOrigin-RevId: 319744023
2020-07-06 16:46:58 +01:00
kimvde
6872910d5a Add support for partially fragmented MP4s
ISSUE: #7308
PiperOrigin-RevId: 319541273
2020-07-06 16:43:26 +01:00
kimvde
ccb337f2e1 MP4: set TrackSampleTable to 0 when there are no samples
Because the stbl atom is mandatory, there is no reason for having a
special C.TIME_UNSET value instead of 0.

PiperOrigin-RevId: 319496999
2020-07-03 15:31:09 +01:00
kimvde
2eab6802c9 Parse stbl in FragmentedMp4Extractor
This will be necessary to support partially fragmented MP4s.

PiperOrigin-RevId: 318798726
2020-06-29 14:38:42 +01:00
kimvde
e9249c3a73 Add methods to get the current sample info in FragmentedMp4Extractor
This enhances readability, particularly as those methods will become
more complex when partially fragmented media will be supported.

PiperOrigin-RevId: 318795536
2020-06-29 13:33:26 +01:00
krocard
78825a41dc Store encodings in Format instead of just pcm encodings
Previously only pcm encoding were stored in Format,
this was an issue as for audio passthrough and offload
lots of code needs to pass complex format informations
(encoding, sample rate, channel count, gapless metadata)
but could not use Format and each function was taking
each as different parameter.

By allowing Format to contain any encoding, and not only
pcmEncoding, it allows to pass a Format everywhere in ExoPlayer
code that needs a Format.

This patch does not have any functional change. It is only an internal refactor.

PiperOrigin-RevId: 318789444
2020-06-29 13:33:09 +01:00
kimvde
8e09cf45c0 Fix bug unseekable FMP4
The seek start position was set to the first mdat but this box was
always skipped because the moof box was not read.

PiperOrigin-RevId: 318762126
2020-06-29 13:32:44 +01:00
kimvde
4227c8f19f Move MP4 getTrackSampleTables to AtomParsers
PiperOrigin-RevId: 318485946
2020-06-29 13:32:28 +01:00
kimvde
aaa7fd114e Remove redundant default parameter in Parameter annotation
PiperOrigin-RevId: 318255509
2020-06-26 11:23:19 +01:00
tonihei
4138e28d62 Move common gradle setup to a setting file.
This removes a lot of duplication from the module configuration,
avoids divergence, and makes sure that only the important differences
to the default are visible in each module file.

PiperOrigin-RevId: 318024823
2020-06-26 11:13:25 +01:00
samrobinson
836babd5d6 Replace usages of Charset.forName with Guava Charsets.
PiperOrigin-RevId: 317672619
2020-06-23 11:07:43 +01:00
tonihei
1836f1df36 Update Checkerframework.
The compat dependency is no longer maintained and we need to keep
it at its old version.

PiperOrigin-RevId: 317658349
2020-06-23 11:07:34 +01:00
olly
f8843441a2 Align flags between the core and extension FLAC extractors
- It seems conceptually simpler for DefaultExtractorsFactory
- It seems unlikely we'll need to diverge the two. In the case of
  workaround flags we can just have them be no-ops in the version
  that doesn't need them.

PiperOrigin-RevId: 317151955
2020-06-23 11:05:37 +01:00
olly
e6b6a86a77 Remove support for MKV invisible flag
We haven't seen it used anywhere in practice. It's a niche feature not
supported by any other extractors, and is one of the very few things
stopping us from simplifying MediaSource implementations to not set the
decodeOnly sample flag. This is a simplification that we want to make,
since the current mechanism doesn't work properly for cases where a
downstream decoder adjusts the buffer presentation timestamps so that
they're different on the output side than on the input side.

PiperOrigin-RevId: 316712302
2020-06-17 14:31:27 +01:00
kimvde
88b36abce6 Sniff all inferred extractors in DefaultHlsExtractorFactory
PiperOrigin-RevId: 315857270
2020-06-11 10:11:40 +01:00
kimvde
1f17756ad2 Optimize DefaultExtractorsFactory order using MIME types
PiperOrigin-RevId: 315485985
2020-06-11 10:10:00 +01:00
kimvde
b1e56304a1 Add support for inferring file format from MIME type
PiperOrigin-RevId: 315283926
2020-06-08 17:41:16 +01:00
kimvde
12a9351781 Miscellaneous renamings in FilenameUtils
PiperOrigin-RevId: 314723830
2020-06-05 13:05:20 +01:00
ibaker
3474c39c10 Add support for non-contiguous Ogg pages
bear_vorbis_gap.ogg is a copy of bear_vorbis.ogg with 10 garbage bytes
(DE AD BE EF DE AD BE EF DE AD) inserted before the second capture
pattern and 3 garbage bytes inserted at the end (DE AD BE).

Issue: #7230
PiperOrigin-RevId: 314715729
2020-06-04 14:16:40 +01:00
kimvde
7c33e2570a Update getFormatFromExtension to take a URI
This allows to handle the last segment retrieval and process the case
where the filename is null in the method.

PiperOrigin-RevId: 314512974
2020-06-04 14:15:55 +01:00
kimvde
7df99381c1 Optimize extractors order using file extension
PiperOrigin-RevId: 314508481
2020-06-04 14:15:45 +01:00
aquilescanta
5b06d89467 Check for section_syntax_indicator in TS tables
Issue:#7325
PiperOrigin-RevId: 314321914
2020-06-02 23:51:59 +01:00
olly
1cfb68bf68 Change order of RawCcExtractor init to call format before endTracks.
This fixes an issue where the output track's sample format is null for rawCC captions when endTracks method is called.

PiperOrigin-RevId: 313622631
2020-05-29 18:34:10 +01:00
krocard
151ea531b1 Make constants more readable with _ separator
Add an `_` in long constants.
Eg: 10000 => 10_000.

I'm proposing this change because I have had multiple
missread due to confusing the number of 0 in a long number.

More specifically, added an underscore to all number matching:
`final.*\ [0-9]{2,}000;`

PiperOrigin-RevId: 313186920
2020-05-27 19:00:36 +01:00
ibaker
2397e7f67a Replace TestUtil.joinByteArrays() with Guava's Bytes.concat()
PiperOrigin-RevId: 312481058
2020-05-21 17:09:22 +01:00
olly
0de9c007af Fix naming to reflect that CEA-708 is supported too
PiperOrigin-RevId: 312131816
2020-05-18 22:39:51 +01:00
samrobinson
cda9417aa6 Allow MP3 files to play with size greater than 2GB.
Issue:#7337
PiperOrigin-RevId: 312042768
2020-05-18 16:13:52 +01:00
aquilescanta
f6d0e34cea Fix Extractor.read throws documentation
PiperOrigin-RevId: 311755157
2020-05-18 16:13:25 +01:00
olly
6e47819be4 Minor copybara fixes
- Remove proguard-rules.txt symlink
- Guard against classes annotated with @ClosedSource but not excluded

PiperOrigin-RevId: 311312671
2020-05-14 22:23:19 +01:00
aquilescanta
f599155bbf Document the sample data format for samples with supplemental data
PiperOrigin-RevId: 311298802
2020-05-14 22:23:01 +01:00
krocard
040a88f4f8 Parse AAC initialisation data in MatroskaExtractor
This aligns mkv with mp4, flv and ts extractors.

This issue was found when AAC in an MKV container was not offloaded
as format.codecs was null.

PiperOrigin-RevId: 310170759
2020-05-06 20:57:53 +01:00
aquilescanta
a8d1de5198 Fix TrackOutput documentation for encryption data format
PiperOrigin-RevId: 309899166
2020-05-05 18:38:05 +01:00
ibaker
922b8a2c15 Add option to FakeTrackOutput to de-duplicate repeated formats
Expose this through ExtractorAsserts via a new AssertionConfig object

PiperOrigin-RevId: 308980701
2020-05-01 19:46:30 +01:00
ibaker
0e6b318138 Remove ExtractorAsserts overloads that take a Context
Also mark the two assertOutput methods private, to make the API surface
smaller.

PiperOrigin-RevId: 308228186
2020-04-27 10:41:49 +01:00
aquilescanta
5d3230d85a Add test for TS with h264 and DTS audio
PiperOrigin-RevId: 307789384
2020-04-27 10:40:01 +01:00
ibaker
11c24ac3e7 Split {Amr,Ogg}ExtractorTest into parameterized & non-parameterized
This avoids the non-parameterized tests being run repeatedly for every
combination of parameters.

PiperOrigin-RevId: 307785770
2020-04-27 10:40:01 +01:00
ibaker
cfa8e19f77 Use parameterization in most extractor tests
Part of what makes these tests hard to deal with (imo) is being
unable to easily run a specific config, or seeing exactly which one
failed (because you always see only the first failure).

I put the parameters as a method on ExtractorAsserts to
reduce the boiler-plate required in each test class.

I'll migrate the extension FlacExtractorTest in a follow-up CL

PiperOrigin-RevId: 307785380
2020-04-27 10:40:01 +01:00
aquilescanta
1b6a32f25a Add test for TsExtractor's FLAG_DETECT_ACCESS_UNITS
PiperOrigin-RevId: 307777265
2020-04-27 10:40:01 +01:00
tonihei
96ccb893f2 Fix timestamp rounding error in fMP4 extractor.
The sample timestamps are currently rounded to milliseconds, only to
be multiplied by 1000 later. This causes rounding errors where the sample
timestamps don't match the timestamps in the seek table (which are already
in microseconds).

issue:#7086
PiperOrigin-RevId: 307630559
2020-04-27 10:19:23 +01:00
aquilescanta
7839955f31 Separate encryption data into a new TrackOutput method
Allows media parser to populate crypto data.

PiperOrigin-RevId: 307616083
2020-04-27 10:19:13 +01:00
olly
cb51a1bfe6 Fix H265Reader to correctly output SEI and AUD NAL units
Issue: #7113
PiperOrigin-RevId: 307380133
2020-04-20 13:30:02 +01:00
olly
9a7290000c Noop naming generalization for H265Reader
This change generalizes the concept of "reading parameter sets" to
"reading prefix NAL units", ahead of a change that will treat AUD
and suffix SEI NAL units in the same way.

The change also introduces some static isXxxNalUnit methods for
clarity.

Issue: #7113
PiperOrigin-RevId: 307376967
2020-04-20 13:29:53 +01:00
Oliver Woodman
ad3fb3d05c Merge pull request #7247 from vadimdolgachev:subtitle_track_name_for_matroska
PiperOrigin-RevId: 307368176
2020-04-20 13:29:34 +01:00
kimvde
63da73df00 Add tests for ID3 in Mp3Extractor
PiperOrigin-RevId: 306844582
2020-04-17 10:44:32 +01:00