124 Commits

Author SHA1 Message Date
michaelkatz
09835006f4 Prepend Ogg ID and Comment Header Pages to offloaded Opus stream
Add Ogg ID Header and Comment Header Pages to the Ogg encapsulated Opus for offload playback. This further matches the RFC 7845 spec and provides initialization data to decoders.

PiperOrigin-RevId: 548080222
(cherry picked from commit 847f6f24d3770b6134a233b62a5fa9413c9bd26c)
2023-07-14 11:41:56 +01:00
rohks
0c6cfea048 Replace BitArray.skipBytes() with BitArray.skipBits()
Based on the spec, ETSI TS 102 366 V1.4.1 Annex F, 6 bits should have skipped instead of 6 bytes.

This correction was pointed out in Issue: androidx/media#474.

PiperOrigin-RevId: 545658365
(cherry picked from commit 07d4e5986b06ef6e362fe00fb97187469f42bc25)
2023-07-05 15:04:50 +01:00
ibaker
bcde7e03c2 Include timing info in some SCTE-35 toString implementations
This was helpful in investigating Issue: androidx/media#471

PiperOrigin-RevId: 545393217
(cherry picked from commit 3456382ae7116a8bb57b4212f449dfb50ea490d9)
2023-07-04 10:09:27 +00:00
ibaker
aa34db41f7 CEA-608: Only truncate to 32 visible characters
We introduced truncation to 32 chars in <unknown commit>
and included indent and offset in the calculation. I think this is
technically correct, but it causes problems with the content in
Issue: google/ExoPlayer#11019 and it doesn't seem a problem to only truncate actual
cue text (i.e. ignore offset and indent).

PiperOrigin-RevId: 544677965
(cherry picked from commit e8fdd83558dcb0a4f886c52c8b32e2c1f3637a48)
2023-06-30 16:35:46 +00:00
tonihei
ec13c42800 Do not trim audio samples by changing their timestamp
MP4 edit lists sometimes ask to start playback between two samples.
If this happens, we currently change the timestamp of the first
sample to zero to trim it (e.g. to display the first frame for a
slightly shorter period of time). However, we can't do this to audio
samples are they have an inherent duration and trimming them this
way is not possible.

PiperOrigin-RevId: 543420218
(cherry picked from commit 232246240415443ff8d3a8cd5930273b4085ddaa)
2023-06-26 13:26:35 +00:00
sheenachhabra
ebfb9cf402 Add support for passing custom metadata via transformer
Changes included:
1. Enable MP4 extractor to read all types of metadata.
2. Allow passing String and Float metadata via Transformer.

Reference to QuickTime spec: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW21

PiperOrigin-RevId: 538783982
(cherry picked from commit 53c174f047ac759e6ff3c44776d7d46fc0aed755)
2023-06-12 09:15:53 +00:00
sheenachhabra
f1d285ed6f Add support for passing creation time via InAppMuxer
PiperOrigin-RevId: 538175466
(cherry picked from commit 7e14811e255b6a5da4e9c3f5bdf7c0f4e783840a)
2023-06-12 09:15:51 +00:00
tianyifeng
1c1ca3edaf Defer outputting the metadata sample when TimestampAdjuster isn't initialized
The sample timestamp carried by the emsg box can have a significant delta when comparing to the earliest presentation timestamp of the segment. Using this timestamp to intialize the timestamp offset in TimestampAdjuster will cause the media sample to have a wrong adjusted timestamp. So we should defer adjusting the metadata sample timestamp until the TimestampAdjuster is initialized with a real media sample.

PiperOrigin-RevId: 538172841
(cherry picked from commit f4bf376e891bb0326b4c569cecec825e870aec92)
2023-06-12 09:15:51 +00:00
Googler
4a90efaf10 Override ParserException#getMessage
PiperOrigin-RevId: 537908595
(cherry picked from commit 83e9080b718d1d063d8efcd9d35c58d5f7bfaac5)
2023-06-12 09:13:53 +00:00
Tofunmi Adigun-Hameed
bd29a3553d Merge pull request #335 from cedricxperi:dts-direct-passthrough-support
Resolved Merge Conflict during cherrypicking

PiperOrigin-RevId: 535255453
(cherry picked from commit c3dd88d715a0ff92d912d1f4145fbfaea86184d5)
2023-05-26 13:58:36 +00:00
christosts
fbd0bae265 Fix seeking bug in opus
Fix a bug when seeking in an opus container. The calculations inside
DefaultOggSeeker may overflow a long primitive.

Issue: androidx/media#391

#minor-release

PiperOrigin-RevId: 534128513
(cherry picked from commit b9a4e614f7cfe863e72dec779b7beb1a8c1e4e2d)
2023-05-26 13:25:08 +00:00
sheenachhabra
d40f37158a Move MdtaMetadataEntry class into container module
This class is to be shared between extractor, transformer
and muxer module.

PiperOrigin-RevId: 533490888
(cherry picked from commit b382a7c2da1452e15d5829113fb39ebc98b87a17)
2023-05-26 13:25:07 +00:00
sheenachhabra
7adca46e4b Move Mp4LocationData from extractor module to container module
This class will be shared between extractor and muxer module.

PiperOrigin-RevId: 532784415
(cherry picked from commit 7b62b33127a617cc3b7b23f21c385f2329e402a3)
2023-05-18 16:07:52 +00:00
sheenachhabra
f5ec1bb6f9 Move NAL unit related methods from common to container module
PiperOrigin-RevId: 532750099
(cherry picked from commit e0d6f67dd90acbe8f1c41ffd9550d18eea2ca129)
2023-05-18 16:07:51 +00:00
huangdarwin
82ede47398 media3: Capitalize "MIME" for MIME types.
Find and replace "mime" to "MIME", where appropriate, throughout media3.

PiperOrigin-RevId: 531122121
2023-05-11 10:05:01 +00:00
michaelkatz
06ac2f7990 Add UTF-16 encoded subtitle support to SsaDecoder
Issue: androidx/media#319
PiperOrigin-RevId: 527891646
2023-05-03 17:04:35 +01:00
Ian Baker
fab134f0b3 Merge pull request #313 from pengbins:fix_ts_h265reader_parse_sps
PiperOrigin-RevId: 527259619
2023-04-26 15:53:58 +01:00
Ian Baker
171c224bc6 Add a release note for MPEG-TS H.265 SPS parsing fix
Also clean-up a comment about skipping the NAL start code
2023-04-25 18:17:44 +01:00
Ian Baker
e88fa7c52e Reformat with google-java-format 2023-04-25 09:15:26 +01:00
peng bin
d7acae20c0 Use parseH265SpsNalUnit instead of parseH265SpsNalUnitPayload
To consistent with the other callsites of NalUnitUtil for parsing H265 SPS
2023-04-25 09:15:26 +01:00
peng bin
6ae8c8c041 Use NalUnitUtil.parseH265SpsNalUnitPayload when parsing MPEG-TS files
This implicitly fixes a bug by removing the buggy implementation in H265Reader in favour of a working one. This change also adds tests to confirm the parsing bug is fixed.
2023-04-25 09:15:25 +01:00
peng bin
114020c2d8 Fix previousNumDeltaPocs in skipShortTermRefPicSets 2023-04-25 09:15:25 +01:00
Ian Baker
75d81c7630 Derive previousNumDeltaPocs from numNegativePics and numPositivePics
This more closely matches the equations in equations 7-61 and 7-62 in
See H.265/HEVC (2014) section 7.4.8.
2023-04-25 09:15:25 +01:00
peng bin
a65b5a5c2b Fix previousNumDeltaPocs in skipShortTermRefPicSets 2023-04-25 09:15:25 +01:00
peng bin
b08120d752 Fix used_by_curr_pic_flag to align with H.265 spec 2023-04-25 09:15:25 +01:00
peng bin
bc0dc01a69 Add a test sample for ts+h265 2023-04-25 09:15:25 +01:00
rohks
8a73d8d3fe Add support to fetch ColorInfo from avcC box in AtomParsers
#minor-release

PiperOrigin-RevId: 526082823
2023-04-24 11:37:55 +01:00
rohks
596a7c7033 Update colr box values to be overridden by bitstream boxes
#minor-release

PiperOrigin-RevId: 523983688
2023-04-13 16:30:45 +01:00
ibaker
642d34ffc7 Update comment on Track.nalUnitLengthFieldLength
This field is also non-zero for h.265 tracks.

PiperOrigin-RevId: 523676455
2023-04-12 17:01:21 +01:00
sheenachhabra
28aa5e847b Move NAL unit utility classes into common
Need to use NAL unit util methods in muxer module.

PiperOrigin-RevId: 521772831
2023-04-05 15:45:35 +01:00
rohks
6a928805d4 Fix javadoc links in media README files
Also fixed the javadoc link in devsite and removed javadoc links from decoder extensions as it is not published yet on developer.android.com.

#minor-release

PiperOrigin-RevId: 520636868
2023-03-30 17:26:40 +00:00
ibaker
43ad45dbef Remove all RawCC references from media3
RawCC is a Google-internal subtitle format that is no longer directly
supported by this library (since 4f616d6003).

PiperOrigin-RevId: 520591591
2023-03-30 17:25:20 +00:00
sheenachhabra
669008f437 Use FakeExtractorOutput in Mp4MuxerMetadataTest
The FakeExtractorOutput dumps data in more readable format
so using that where ever possible.

The MdtaMetadataEntry which contains key and value dumped only "key".
Added fix to dump "value" as well.

PiperOrigin-RevId: 517968996
2023-03-21 14:19:12 +00:00
Rohit Singh
0e3f407e0e Merge pull request #11064 from haixia-meta:release-v2
PiperOrigin-RevId: 517128752
2023-03-16 15:37:02 +00:00
rohks
8a5fcf82d3 Add support to fetch ColorInfo from hvcc box in AtomParsers
#minor-release

PiperOrigin-RevId: 517086016
2023-03-16 15:34:28 +00:00
Rohit Singh
49d85d625c Merge pull request #11061 from cedricxperi:dts-udts-support
PiperOrigin-RevId: 517067549
2023-03-16 15:33:38 +00:00
sheenachhabra
2f01f9c53b Add support for reading location data in MP4 extractor
The geodata is stored in the "udta" box as per MediaMuxer reference
https://cs.android.com/android/platform/superproject/+/master:frameworks/av/media/libstagefright/MPEG4Writer.cpp;drc=master;l=5588

PiperOrigin-RevId: 515095127
2023-03-14 07:46:28 +00:00
ibaker
cb7d565fd4 Add missing @param tags
Dackka generates a warning if a method has at least one `@param` tag,
but not all of them are documented.

#minor-release

PiperOrigin-RevId: 513873453
2023-03-07 11:49:24 +00:00
tonihei
17499cefcc Merge pull request #255 from mayurk2:use_edts_offset_if_it_is_for_entire_file
PiperOrigin-RevId: 513213229
2023-03-01 17:27:15 +00:00
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