Commit Graph

505 Commits

Author SHA1 Message Date
Kongqun Yang 9f2da1e028 Update CHANGELOG with proper tag 2016-06-23 18:18:04 -07:00
Kongqun Yang 08f7e9dc37 Update CHANGELOG for v1.4.1
Change-Id: I65ba19b8f5608bdb77657815031c67b4e91b4dc2
2016-06-23 18:04:08 -07:00
Kongqun Yang f63385926b Fix 'senc' bug when encrypting mp4:vp9 with superframe
Although superframe index is not encrypted, it should still be inserted
into subsamples list (with cipher_bytes as 0).

Change-Id: I06b38f8333a22a31a71cd67e0412218dd3aaa5c3
2016-06-22 12:38:50 -07:00
Kongqun Yang 4f794e2350 Update mp4 container check function to be more robust
Consider the file in iso-bmff format if seeing two known
mp4 boxes.

Closes Issue #110

Change-Id: Ifdc76b6c8b7e26a0988ab4f8d4968e1320cb180c
2016-06-22 12:38:09 -07:00
Kongqun Yang 7dc674b3a2 Remove top level box check in BoxReader
Change-Id: I3d0e5865851030264d7174031a98031b413e90ce
2016-06-22 12:36:12 -07:00
Kongqun Yang e9ad85c945 VPCodecConfiguration box should inherit from FullBox instead of Box
Change-Id: If53c6cab009bdeadc37a1bac34272056a2b7d1dc
2016-06-22 12:27:59 -07:00
Jacob Trimble 2ef100e87d Close files in Finalize for WebM segmenters.
Now Finalize() will close all the files used by the segmenters.  This
is important to allow WebMMuxer::FireOnMediaEndEvent to get the
correct size of the media file.

This also changes the WebM muxer to use 64-bit numbers for the init
and index ranges to correctly support >4GB files.

b/28194272

Change-Id: Ia84e4a4b0756f89644efea99a1a51968b22a1338
2016-04-22 11:18:36 -07:00
KongQun Yang b7f457e368 Update CHANGELOG for v1.4.0
Change-Id: Ib4fe35fc47ce34aaae9176d8379bd01704c6bd99
2016-04-08 19:12:03 +00:00
Rintaro Kuroiwa 8ea5df820e Use list of raw pointers rather than scoped_ptr
- Containers with scoped_ptrs break mac builds.

Change-Id: Id4b9aa735511bf27c83aa8465f64a627fb7fa1d2
2016-04-07 12:28:08 -07:00
Rintaro Kuroiwa cfd782ff40 Add PES packet related classes
- Define PesPacket class.
- PesPacketGenerator creates PesPackets from samples.

Change-Id: Icfd3656b498e0075f83ff3c789f95658f98c6144
2016-04-06 18:25:17 -07:00
Jacob Trimble 40e1cc87d1 Fix bug in WebM SeekHead.
The positions in the SeekHead element should be relative to the
Segment payload, not the start of the file.  Also added entries for
Tracks and SegmentInfo.

Change-Id: Id692da25fffc27d78e9f1a06d061431aeb6f1e7c
2016-04-04 15:50:55 -07:00
Jacob Trimble fe6775a509 Fixed off-by-one bug in WebM muxer
There was a bug in the single-segment WebM muxer where the index
range was incorrect.

Closes #99

Change-Id: I7cde98f9b5e88615fcf0ab406b22f65f0b14e15f
2016-04-01 16:26:41 -07:00
Jacob Trimble c9645bc21b Add a utility script used to generate/parse PSSH boxes.
This script can be used to parse and generate PSSH boxes.  This
serves two purposes:

* Parse PSSH boxes into a human readable format.
* Take several arguments to generate PSSH boxes.

This is also able to parse Widevine and PlayReady PSSH data and will
print the parsed data instead of the data as binary.  This can also
generate Widevine PSSH data instead of having the PSSH data passed
as an argument.

Change-Id: I245bd9abf79a259f6fda01d1fc0489b4a4a73db5
2016-04-01 16:19:45 +00:00
KongQun Yang a9e5a2ff4f Refactor and optimize cbc encryption/decryption
- Optimize and clean up encryption and decryption code.
- Consolidate various CBC encryption/decryption schemes into a
  common class.
- Make it a constructor argument whether cipher block chain is
  continuous across Encrypt/Decrypt calls.
- Also align protected region size as required in CENC spec.

Issue #77

Change-Id: I533d92ada3cd80933b532b9c3a1cca105ba66f8e
2016-03-30 17:22:13 -07:00
KongQun Yang a2438554f6 Fix gpylint errors on packager_test.py
Change-Id: I28074c4e9270279ebb83f64b2f9f615b4f705079
2016-03-29 17:37:58 -07:00
Jacob Trimble e7926e7ccb Fixed mac build for H.265 parser.
Another feature that the mac build does not support.  It incorrectly
uses a copy-constructor when creating new values in a std::map.  This
is incorrect and should use an in-place constructor with C++11.

Change-Id: I1e822747e97eb4ae01596d63ea05058cc383cb49
2016-03-29 15:52:03 -07:00
Jacob Trimble cdcfc4c44b Added H.265 parser.
This adds a preliminary H.265 parser.  The parser only support
reading the slice header.  This also attaches the H.265 parser to the
VideoSliceHeaderReader so H.265 frames can have unencrypted headers.

Issue #46
Closes #40

Change-Id: I8b98e1f8bb04e359d9bf896fd5b2939c326b196b
2016-03-29 20:21:46 +00:00
Jacob Trimble 6f8cbf90b9 Add packager flag to include common PSSH with Widevine.
The flag --include_common_pssh will add another PSSH box in addition
to the Widevine one which will contain the key IDs of all the keys.

Closes #88

Change-Id: Ic719b19747530f0e4856cfb36471a644d572a734
2016-03-28 22:27:51 +00:00
Rintaro Kuroiwa 94b4c52bf5 packager test should respect builddir_name
- Use 'builddir_name' environment variable to create the output
  path in test_env.py
- This allows running the packager test with different build
  configs because it doesn't use 'out', e.g. it could use 'out_clang'
  for clang builds.

Change-Id: I843343ec8e2d0a64dffbab2fdbd38aead5c97718
2016-03-26 16:42:00 -07:00
KongQun Yang 0c46943177 Improve handling of unescaped NAL units in byte stream
The new algorithm will parse NAL unit header and only starts a new
NAL unit if it is valid, otherwise it will be considered part of
the previous NAL unit.

Closes #96

Change-Id: I45f2a0f37d51841ee8345d6d0d38fcda57e0a009
2016-03-24 13:15:17 -07:00
Jacob Trimble d5cdd00ba1 Move fixed key encryption code to new FixedKeySource.
KeySource is now an abstract class that is implemented in two
types WidevineKeySource and FixedKeySource.  This also updates
fixed key encryption to use v1 PSSH boxes with the common system
ID.

This also updates the --pssh argument.  Now it accepts full PSSH
boxes rather than data.  Multiple PSSH boxes can be concatenated
together.

Issue #88

Change-Id: I4bd0290f6d8b965f7d118f075c96e0f267d7e831
2016-03-21 10:30:47 -07:00
Bei Li e39c3572af Add support for "AES 128-bit Cipher Block Chaining (CBC-128) Encryption"
- Part 1.

- Add packager command line argument "protection_scheme" to specify
  protection scheme. Plumb through packager code to enable CBC
  encryption/decryption.
- Add scheme type "cbc1" to sinf.
- Refactor AES encryptor and decryptor.
- Need more work in the subsample handling.

Issue #77

Change-Id: I3a9304d89adf5efbfb226b6e805a3077b6cb8c68
2016-03-17 16:51:04 -07:00
KongQun Yang ef81be5f7b Fix a subsample incorrect size bug in mp4 encryption
Clear size was not correctly calculated for non-video slice nal units.

Change-Id: I8371973a4ae346cbe4c1891ab274fb7a86983db8
2016-03-14 17:42:46 -07:00
Jacob Trimble 1863f5a569 Renamed SPS/PPS to Sps/Pps.
H264SPS -> H264Sps
H264PPS -> H264Pps
ParseSPS -> ParseSps
ParsePPS -> ParsePps
GetSPS -> GetSps
GetPPS -> GetPps

Change-Id: Ib658c05d78baabc698af4e52d8b4c77dbfbd6870
2016-03-14 12:44:05 -07:00
Jacob Trimble 43dc6248a3 Renamed H264BitReader to H26xBitReader.
Change-Id: I960a636541a5cadcce5f41e1a75c3ddfbbfaa803
2016-03-14 12:02:21 -07:00
Jacob Trimble 144cdc5e59 Change to use ProtectionSystemSpecificInfo.
* EncryptionKey now contains them rather than a PSSH box.
  * Outputs PSSH boxes for each entry.
  * Outputs a ContentProtection element for each entry.
* Removed SystemName and UUID from KeySource.
* Removed --scheme_id_uri packager argument.

Issue #88

Change-Id: I2651784c3220fd64f5b1773fdcd70285690cf8c0
2016-03-11 17:56:25 +00:00
Joey Parrish f3e19fc002 Split AdaptationSets by content type, container, codec, and language
This adds a new function to key AdaptationSets based on the
characteristics that require separate sets.

With this, we are now able to package multi-codec assets at once
(AVC1/MP4 and VP9/WebM in the same manifest, but in different
AdaptationSets).

Fixes b/27534371

Change-Id: Ie82fd096d2ef99fd23e323d60fd0849b1e8d7500
2016-03-10 15:53:17 -08:00
Joey Parrish b6718a37c5 Accept language subtags
When normalizing language tags to their shortest form, we need to
split off subtags and treat them as separate components that do not
get changed.

Furthermore, MP4 can only store language tags without subtags.  So
only store the main language in MP4 output.

Fixes b/27533973

Change-Id: I96049e274aae9841e321c53039ef6464a2e61574
2016-03-09 23:23:12 +00:00
Jacob Trimble 591650e61d Removed the use of emplace_back.
This does not currently work on our mac builds, so this replaces it
with push_back.

Change-Id: Iecd292969daac059bdd23d1ad937ff4366a7943f
2016-03-09 10:51:57 -08:00
Jacob Trimble c4246d04fd Change FetchKey usages.
Add another overload to fetch by key ID directly, used by WebM.
Changed the one using PSSH data in favor of the entire PSSH box.

This also moves the Widevine proto to media base.  Now, the
Widevine key source handles creating the Widevine specific PSSH
data.

Change-Id: I6f4633facad39207809ffbad970635d1f9d70983
2016-03-08 21:45:05 +00:00
Rintaro Kuroiwa 90731d79df Unit stream to byte stream converter
Change-Id: Iafe1989019e306281f17d80faa348262043cd3b8
2016-03-07 19:10:42 -08:00
Jacob Trimble 9d67f545ed Add support for v1 PSSH boxes.
This moves pssh parsing to its own class in media base.  This type
can be used to parse and generate pssh boxes.  This new type also
supports both v0 an v1 boxes.

This also modifies the pssh box definition to only have the |raw_box|
and moves all pssh parsing and handling into mp4 media parser.

A follow-up change will replace the remaining usages of 'raw' pssh
box data with the new type.

Issue #88

Change-Id: Ic2436ecb5df8b3558b81e600dc095b0efd122ab1
2016-03-07 14:45:01 -08:00
Jacob Trimble 0ca1160474 Moved common code out of H264Parser.
This moves common parsing code out of the H.264 parser.  This is in
preparation for the H.265 parser to use.

Change-Id: Id05b55f6adc2ea31e97c8a9f22023e851808a8a7
2016-03-04 13:25:54 -08:00
Jacob Trimble 0803e31836 Read SPS/PPS Nalus from decoder configurations.
Now the AVCDecoderConfiguration and HEVCDecoderConfiguration classes
will read the Nalu from the blocks, meaning they will store a
vector of Nalu objects for the data.

Also added H.265 to the Nalu class and added argument to NaluReader
to read H.264 vs H.265 Nalus.

Change-Id: I8d8194a90fd72a30af66e9776e01379f8428542c
2016-03-04 18:41:50 +00:00
KongQun Yang b318eb40f7 [Travis CI] Upload release build binary to Github release automatically
Change-Id: I23fa6d75db04e1649ba0fbf5191591ffa0038257
2016-03-04 18:30:55 +00:00
KongQun Yang 91b43773fd Update hevc test file to have more than one key frames
This is needed to test encryption in end to end test since the video
is segmented in gop boundary by default. Due to the existence of clear
lead, the first segment is always left in clear.

Change-Id: Ie8d37a1740f9061515298cb9fb7b58983592cc5b
2016-03-03 17:34:24 -08:00
KongQun Yang cef1729652 Replace vector_as_array(...) with vector::data()
vector::data() introduced in C++11 does exactly what vector_as_array does.

Change-Id: Iab436b6f1ce7db7678bd240256d9ae80208be07b
2016-03-02 10:22:15 -08:00
KongQun Yang 583f1f3352 Don't fetch git histories in docker
Change-Id: I02e5db18d49d1978960ee3d66cb48d681e5e858e
2016-03-02 18:01:36 +00:00
Jacob Trimble 53e6d2d149 Renamed Nalu |data_size| to |payload_size|.
This member refers to the size of the payload (the data after the
header).  Since the pointer is called |data|, calling this size
|data_size| is confusing.

Change-Id: I9174cf6c5c402beddaebbce7c16514470ba0c3da
2016-02-26 16:11:30 -08:00
Jacob Trimble e0e0925b31 Add error messages for when a WebM Cluster is too large.
Issue #90

Change-Id: I7fe8393df931a12e999724e3604648b97de24da7
2016-02-26 19:21:52 +00:00
KongQun Yang a01b07fbfd Log an error when PushSample fails
Change-Id: I7911881a42af0edac10b36ad82158e103418714a
2016-02-24 12:44:10 -08:00
Jacob Trimble 0d3951ff74 Moved Nalu data pointer position.
Now the Nalu data pointer points to the start of the NALU header
rather than pointing to the start code.  Added a new method on
NaluReader to check whether the stream starts with a start code.

Change-Id: Ifaecbe0c911aa5cffdf0a966028e6cada8621cc3
2016-02-23 10:48:14 -08:00
Jacob Trimble 96abd90ca2 Only encrypt video slice NAL units.
For non-video slices, the data is not encrypted.  This also skips the
frame headers for H.264; support for H.265 will be added later.

Issue #40

Change-Id: Id0cb0fb9ddb6adedf63ef4aef6b3a26260a21654
2016-02-22 21:52:05 +00:00
KongQun Yang 74951e3405 Add Travis configuration for continous testing
Closes #81

Change-Id: I448420568b26a5335b6780289e9118fcf3ef7828
2016-02-18 22:07:55 +00:00
KongQun Yang 0b0a8a721a Fix unittest break in Mac due to C++11 incompatibility
Fixes Issue #80

Change-Id: I17bb0706cf99b77fa879f86805017462e5027537
2016-02-17 16:41:35 -08:00
Jacob Trimble 890c601dce Split NALU enumeration into its own class.
Removed the code for NALU splitting in the H.264 parser and moved
it to its own class.  Also added support for length-prefixed
NALU splitting for use with the encrypting fragmenter.

Change-Id: I1e91266681f1b117fb2382cf80590651efc06619
2016-02-17 00:59:38 +00:00
KongQun Yang 6f3e5c77b7 Fix generate_version_string errors with old versions of git
Change-Id: I870bc65849906a52a94f8e562e780c8bf7924118
2016-02-11 18:01:00 -08:00
Bei Li 9ddf9276ce MPD signaling for Dolby Enhanced AC3 audio.
Parse channel layout value from dec3 box. Pass it through audio stream
info. MPD builder forms audio channel configuration to signal ec-3
codec.
Specs: 1) ETSI TS 102 366 V1.3.1 Digital Audio Compression (AC-3,
Enhanced AC-3) Standard E.1.3.1.8.
2) DASH-IF Interoperability Points v3.0 9.2.1.2.

Issue #64

Change-Id: Ia2c22dd3d82e757ba5a88ba1de35c5d593f5005e
2016-02-08 16:22:01 -08:00
KongQun Yang 38c30bd7a1 Allow other text sample entries than wvtt
Before this change, the media file will fail to be parsed if it contains
non-wvtt text streams. This change allows demuxing of video and audio
streams in these media files even though the text stream is ignored.

Fixes #74.

Change-Id: I7ef108a51125c4965fe48c39efe9638f3a0e4759
2016-02-04 11:36:44 -08:00
Jacob Trimble bb3918e62b Sets the duration of the last frame in WebM Cluster.
This also changes the way frames are written in the WebM muxer.  Now,
frames are stored and written on the next call to AddSample.  So each
call to AddSample will write the previous frame.  This is needed to
determine whether the given frame is the last one in the cluster.

Closes #70

Change-Id: Ic69ebad3c4729cdaa2017c9c7f497048501ac907
2016-01-27 20:08:08 +00:00