Commit Graph

312 Commits

Author SHA1 Message Date
Kongqun Yang fae7874c4c Add a runtime flag to use dts in timeline for mp4
This flag is needed to workaround the Chromium bug
https://crbug.com/398130, which uses decoding timestamp
in buffered range.

Closes #113

Change-Id: Ib8f18be7165dd968bdc36c18ce29f694235c0c26
2016-07-19 18:56:08 +00:00
Kongqun Yang f3d35b730c Add version information to generated HLS manifests
- Also refactor the existing version code.

Change-Id: Ib409630c4f87965a37b1d6a1bcec68178a704ce6
2016-07-11 23:26:36 +00:00
Kongqun Yang e0c5874d31 Update encrypted testing content to use common system id
- Also fix a bug in fixed key rotation with empty pssh_data.

Change-Id: I1110b839fc821c5c4778854c0b29032d3ee2d384
2016-07-11 20:10:31 +00:00
Kongqun Yang f27960e00d Add fixed key support for HLS sample-aes encryption
Change-Id: I5a18e014f697561e0741b043e91f70fe2f11d2ce
2016-06-30 19:47:00 +00:00
Jacob Trimble abb1abf5c5 Rename StreamInfo::extra_data to codec_config.
Since the |extra_data| field contains codec-specific configuration
data, it makes sense to call it |codec_config|.

Change-Id: If9e35165a00fe82628cf931df397a8ef06505b0d
2016-06-27 13:16:47 -07:00
Kongqun Yang 0a9de96eb2 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-21 17:17:03 +00:00
Rintaro Kuroiwa 60419f26d0 Add driver program flags for HLS
- Add flags and stream descriptor fields for HLS.
- Remove fields from MuxerOptions. Instead pass them directly to
  HlsNotifyMuxerListener.
- Rebase segment names to the master playlist's path where it makes
  sense.

Change-Id: If4f54bc56ff46dc6140859a79ed66f7b99112ed7
2016-06-13 18:30:24 -07:00
Kongqun Yang d08f6ae0cc Fix cbcs/cens behavior when applied to non video tracks
- Tracks other than video are protected using whole-block full-sample
  encryption as specified in ISO/IEC 23001-7:2016(E) 9.7, which is
  equivalent to a pattern of 1:0. This is different to the non pattern
  encryption counterparts.
- Also updated the code to allow the existence of other protection
  schemes in the original content, which will simply be ignored.
- The internal cryptor used by AesPatternCryptor should not use
  constant iv, add a DCHECK for that.
- Optimize AesPatternCryptor handling on the special pattern 1:0.

Change-Id: Idc704e7bc6b347741336f38c6d3620fc19392960
2016-06-08 17:02:26 +00:00
Kongqun Yang bd1328500c Allow uuid to be a valid top level box
Change-Id: Iec241781321a30fa8eece6a7fc6674d78a02c90f
2016-06-08 00:53:35 +00:00
Kongqun Yang 579678d6a6 Fixed a Opus in Mp4 parsing problem
- Also added end to end test in packager_test.py

Closes Issue #83

Change-Id: I7a8e695a36e654507b75d558710db1ce8867a916
2016-06-01 23:52:33 +00:00
Kongqun Yang 4f9c8ea781 Rename top level namespace to shaka
Issue #103

Change-Id: I67945c8ec6d2c178494d3b5400e5ec0170e9d115
2016-05-24 21:55:55 +00:00
Kongqun Yang 72c3a76699 Update repo url in version string
Issue #103

Change-Id: Iec7db3d155c81cf989f1078ed32692f8e037aa65
2016-05-24 21:55:45 +00:00
Kongqun Yang 940cc43de2 Add support for AudioRollRecoveryEntry
This is part of the effort to support Opus in iso-bmff #83.

Changes in this CL:
- Add support for multiple SampleGroupDescription and SampleToGroup
  boxes in TrackFragment box;
- Add support for SampleGroupDescription and SampleToGroup boxes
  in SampleTable box;
- Add support for AudioRollRecoveryEntry in Sample Group and 'roll'
  sample grouping type;
- Also fix a bug that default length was not set correctly in
  SampleGroupDescription when constant iv is used.

Change-Id: I7e31386ea6cd17a8ee5e1dca4c1a90937d51368f
2016-05-16 22:25:38 +00:00
Kongqun Yang cf4a2447c1 Add support for Opus specific box in iso-bmff
This is part of the effort to support Opus in iso-bmff #83.

Change-Id: Ib3678b9cb74eac76372ed83ad48ce1f203ba0c35
2016-05-16 22:25:32 +00:00
Kongqun Yang 26cb91e29b Handle preroll and codec_delay when tranmuxing opus
Closes Issue #102

Change-Id: I26aa56a63c17c85298311cc17963dd26f26e501e
2016-05-16 14:51:51 -07:00
Rintaro Kuroiwa e422b4eb0e Handle encryption in TsSegmenter
- Move GetTrackTypeForEncryption() to muxer_util.h.

Change-Id: I315957cb8983f4e7c4acff6907dfdd6ad6907c82
2016-05-11 16:21:05 -07:00
Rintaro Kuroiwa 0ba35147c8 SAMPLE-AES encryption in PesPacketGenerator
- Allow setting a key on PesPacketGenerator.
- Add SAMPLE AES mode to AesPatternCryptor.

Change-Id: Iace2381b4cd3bbce63cd5bdb4cdf3a7cea47537a
2016-05-11 09:56:36 -07:00
Rintaro Kuroiwa 7d8322377e PMT writers for H264 and AAC
- For encrypted segments, PMT specified by SAMPLE-AES specification is
  generated.
- Remove time_scale_ field from TsWriter. It is not used.
- Move ContinuityCounter to a separate file.
- Add ProgramMapTableWriter and implementations.
- continuity_counter is incremented for PAT and PMT.

Change-Id: If0dd0990203cb6990f39a6832048bdc3ff08decd
2016-05-05 15:56:54 -07:00
Kongqun Yang ba42fed9e5 Suppress warning messages when determining containers
- These warning messages are not useful since the code needs to
  loop through various container types to find a matching one.

Change-Id: I1d8eca563faf24e485ac71cce32e09515c174bf2
2016-04-22 09:46:21 -07:00
KongQun Yang 13202f91b6 Fix a few problems in AesCryptor classes
- CBC cryptors should accept IV of size 8 bytes - it will be zero
  extended to 16 bytes.
- Fixed iv() not updated problem in AesPatternCryptor.
- Replace kChainAcrossCalls with ConstantIvFlag enum flags.

Change-Id: I3fb4de0e8abbe891e6271e779373ba53f8df660d
2016-04-20 14:14:04 -07:00
Rintaro Kuroiwa a50b5787dc Use TsMuxer in driver program
- The driver program can output ts files.

Change-Id: I190ba17ded91a0be48cc0a1a8b15e44d20800eec
2016-04-18 19:13:50 +00:00
Rintaro Kuroiwa 300c23104e MuxerOptions and MuxerListener change for HLS
- Add hls_name and hls_group_id fields to MuxerOptions. This is used to
  pass the NAME and GROUP-ID values for EXT-X-MEDIA tag to
  MuxerListener.
- Change MuxerListener::OnEncryptionInfoReady() to take an
  initialization vector.
- Change MuxerListener::OnNewSegment() to take segment name.
- Reworded and formatted MuxerListener comments to Doxygen style.

Issue #85

Change-Id: Iea06e68552a56ae180177ffd6ca315a7cf39456c
2016-04-18 11:40:10 -07:00
KongQun Yang c6445b749c Change AesCbcEncryptor/AesCbcDecryptor kNoPadding behavior
Leave unaligned residual block in clear in stead of rejecting it.

Change-Id: Id5452f32f6147e26ac68d9cddb948e8b4f77d107
2016-04-15 13:31:09 -07:00
KongQun Yang e253747453 Add support for 'cbcs' and 'cens' protection schemes
Issue #78

Change-Id: I9f71b9a92067e2f6b388092494a7d6a84986cdc0
2016-04-14 15:31:11 -07:00
KongQun Yang 2ac57bf9b9 Use FOURCC as protection scheme parameter
- Remove EncryptionMode enums
- Remove AesEncryptor::InitializeWithRandomIv, replaced with
  a static function AesCryptor::GenerateRandomIv, which should
  be called to generate the iv if the iv is empty.

This change is to prepare support for CBCS and CENS pattern-based
protection schemes.

Issue #77

Change-Id: Icba35089d6e451cbea7ebbf5dd5674079f206390
2016-04-12 16:06:49 -07:00
KongQun Yang 0218d9c690 Move fourccs.h and rcheck.h to media/base
- FOURCC is not a mp4 only concept. It is also used elsewhere.
- RCHECK has been used outside formats/mp4.

Also updated the FOURCC enum names to match the actual fourcc code, e.g.
FOURCC_mdat for "mdat".

Change-Id: I5be02f12695882c0fb41d359305fb8ec01303a06
2016-04-12 21:28:37 +00:00
KongQun Yang 1d74988159 Implement AesPatternCryptor for pattern encryption/decryption
Issue #78

Change-Id: If0fadf6f83ef67dd39af29080bab6ed71fb35290
2016-04-12 17:09:25 +00:00
KongQun Yang 5fc09763ce More cleanups in AesEncryptor and AesDecryptor
- Create AesCryptor class as the common base
- AesCryptor::Crypt function will serve as an Encrypt function for
  encryptor and a Decrypt function for Decryptor.

Change-Id: Ie91fb14964b5091786705bf510656f40d73af160
2016-04-11 23:30:32 +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
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
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
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
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
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
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 a01b07fbfd Log an error when PushSample fails
Change-Id: I7911881a42af0edac10b36ad82158e103418714a
2016-02-24 12:44:10 -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
Anders Hasselqvist db7bebe3fa MacOSX: Solve libbase.a conflict link error
On Linux the generated ninja files use path/libbase.a as target name.
In the Mac ninja file the target is just libbase.a.
As we have two libbase.a (base/base.gyp and media/base/media_base.gyp) the linking stage fails to include both libs.

Solve by renaming media_base.gyp's base target to media_base
2016-01-22 18:50:05 -08:00
KongQun Yang 2c3aed4842 Handle possible NewSampleEvent before ParserInitEvent
For WebM contents, it is possible that we may receive some NewSampleEvent
before receiving ParserInitEvent. This is because init event is fired
after analyzing a video block which could come after an audio block.

Also modified Flush() function to return a bool to indicate whether the
the flush is successful and whether the samples are handled correctly.

And added macro to ensure Flush() and Parse() results are handled.

Fixes #71

Change-Id: I2294d6f529f54e4578344916559bb1bc116c745a
2016-01-22 17:50:54 -08:00
KongQun Yang 22498e125a Add WebM decryption support
- Also refactor decryptor management code out of mp4_media_parser.cc
- Move decryptor managment logic to DecryptorSource class to make it
  available for webm as well
- Remove data_offset member from DecryptConfig which is not useful
- Add widevine_pssh_data.proto file

Closes #72

Change-Id: I1d32baf4013ebd3382b5372c7433fae5033a260e
2016-01-21 16:59:58 -08:00
Bei Li 8563db4cff Support Dolby audio Enhanced AC3 in ISO BMFF (Part 2)
- Box definitions for box type DEC3.
- Parser/muxer changes to support Enhanced-AC3 audio codecs.
- MPD signaling will come in Part 3.

Issue #64

Change-Id: Ifcd5efa1f61b470ec225127925631e4329853259
2016-01-15 14:44:06 -08:00
Jacob Trimble d1d75f477c Add encryption support to WebM.
This does not support key-rotation and will give an error.  This is
because WebM does not have a way to indicate a change in key ID using
media segments.

b/22463551

Change-Id: I9b3dac818dc370302a5afc0d25d8a060b64d30cd
2016-01-15 11:51:41 -08:00
Bei Li 58b95fd3d5 Support Dolby audio AC3 in ISO BMFF (Part 1)
- Box definitions for box type DAC3.
- Parser/muxer changes to support AC3 audio codecs.
- EC3 audio sample entry will come in Part 2.
- MPD signaling will come in Part 3.

Issue #64

Change-Id: I790b46ae8179b933bb8f7da9cdd38591fe8da43d
2016-01-08 15:56:48 -08:00
KongQun Yang e0040a4910 Add version information in generated outputs
For mp4 outputs, a metadata box with version information is added to
moov box.

For mpd outputs, a text comment with version information is added in
the beginning of mpd file.

Issue #60

Change-Id: I783ba370781c0a8f77c910ff1172bad2e7edff75
2016-01-08 19:08:56 +00:00
KongQun Yang b3e85ff810 Enable '-Wimplicit-fallthrough' and fix issues
Change-Id: I9e1e09f3924dcd8f59af2fbc952456b81e2d7c4e
2016-01-06 17:12:49 -08:00
Bei Li bb073cef51 Add support for DTS in ESDS. Needed to handle DTS audio generated by FFMPEG.
Issue #52

Change-Id: Ibd97054bce0b7ccb344f4bb34370399b8e051f30
2016-01-06 22:30:52 +00:00
KongQun Yang a4659c40dd Fix AssetId overflow for classic WVM decryption
Javascript/JSON does not support int64_t or unsigned numbers. asset_id,
if greater than 0x80000000 will be converted to negative number. Use
double to represent asset_id instead as 32-bit integer can be lossless
represented using double.

Bug: 26309000

Change-Id: I3e800c396a1231375776295154fb0d96156e980b
2016-01-06 20:18:42 +00:00
Jacob Trimble c0df6b3239 Cleaned up Status class.
Change-Id: I1ff470410b38d32ad828618f756487585660a272
2016-01-05 01:02:34 +00:00
KongQun Yang 814d2414e3 Implement vp8 bit stream parser.
Change-Id: I8b7997ceb8e7484399442f7c1072f4d5aa33ff4e
2015-12-30 21:40:10 +00:00
KongQun Yang 94401d750a VP9 codec string from bitstream and subsample encryption support
- Parse vp9 bitstream to get vpx codec configuration
- Add subsample encryption for vp9
- Also fixed a bug in VP9 parser if segmentation update_map is enabled

Change-Id: I69dc97088aa38c94c6d37fdbcf3d9cfc942a3df6
2015-12-30 21:39:34 +00:00
Rintaro Kuroiwa 09d1c2ce9f Box definitions for WebVTT
Change-Id: I94d38bef918eed18df7cd312126e2d589aadf9c7
2015-12-22 14:05:50 -08:00
Jacob Trimble 05f5682728 Added stream descriptor for output format.
Added two stream descriptors that are both used to tell the output
format.  If it is not given, the packager will use the output file
extension to determine the output format.

Change-Id: Ib8d5dcf52956c2d451e77ea6a90d9502d4a77064
2015-12-16 15:10:35 -08:00
Rintaro Kuroiwa 1cdce29343 WebVttMediaParser and TextStreamInfo
- Add WebVttMediaParser which parses and creates MediaSamples from text
  WebVtt inputt

Change-Id: Ia7bb7474df7f15e454e887b8c291fdfdc3195e46
2015-12-14 13:58:21 -08:00
KongQun Yang e7a4dde677 Replace "pixel aspect ratio" with "pixel_aspect_ratio" in stream info msg
Change-Id: Ia70b084df9b1b4bdf94a308bcc746f3ad2b5ad8e
2015-12-09 23:55:01 +00:00
Bei Li 2806dffb47 Support DTS audio in MP4 - Part 1
Issue #52

Change-Id: I5061e2a674d5c1b039a49729e53d4d15a4120a5c
2015-12-08 23:06:52 +00:00
Bei Li c647c25d5f Revert "Support DTS audio in MP4 - Part 1"
This reverts commit 9b0d4abece.

Change-Id: I3897fffde2ab162638876df1eafa7a4058573e49
2015-12-07 19:35:11 +00:00
Bei Li 9b0d4abece Support DTS audio in MP4 - Part 1
Change-Id: I4464f869552f5cd0cb77d1b3e97c8efc4b00c552
2015-12-04 16:03:16 -08:00
Rintaro Kuroiwa ef7b136116 Better TTML input check
- Check whether if it can be parsed by libxml2 and check if the root
  element is a 'tt' element.
- Added unit tests for determining TTML and WebVTT.

Change-Id: I4fea1881f0ab70970700601d8d7cea32cc04752c
2015-11-18 19:02:04 +00:00
Rintaro Kuroiwa 29e14a3d6b VOD text support
Change-Id: Ic69169c31d0a54de4895d49ff8b4a758039733a7
2015-11-11 12:26:25 -08:00
KongQun Yang 4c10755d40 Support HEVC in mp4 parser and muxer
Issue #46

Change-Id: I36bf8418a335181ad71509e6e0cccdce210467f0
2015-11-04 17:18:41 -08:00
KongQun Yang c577e6132f Implement initial support for vpx in iso-bmff
Also update the code to generate CompressorName in VideoSampleEntry
for both AVC1 and various VP codecs.

Change-Id: I2355f8008a72806e852aa1ec6c80e9141b97d963
2015-11-04 00:34:00 +00:00
KongQun Yang 8fc7f51d81 Move AVCDecoderConfiguration parsing to media/filters
Change-Id: I7daa616e53bdef2206ce145f907b8f55cde87740
2015-10-28 00:31:43 +00:00
KongQun Yang 845766f69a Make webm parser compile and unittest pass
Change-Id: Ib93fbb3eba6f0638f3aa57a9a47e73e8738792d1
2015-10-16 15:51:56 -07:00
KongQun Yang 732e06fde0 Adjust webm code for packager
- Adding namespace edash_packager
- Fix includes
- (u)int(8|16|32|64) to (u)int(8|16|32|64)_t
- Remove MEDIA_EXPORT
- Remove MediaLog

Change-Id: Ifa116d966ab70ae1b3c299ae1f6f7044d7ae0cc6
2015-10-16 15:46:36 -07:00
KongQun Yang 87993c5dc7 Add WebM parser code from Chromium
Also includes its dependencies, like media/base/text_track_config.*
and media/filters/webvtt_util.h

Change-Id: I5b26245daf004da19b912b7c5b2c21ce4ba85688
2015-10-16 15:46:36 -07:00
Kongqun Yang 9c0ae378bc Switch to boringssl. Also update curl accordingly.
Boringssl and yasm gyp and patches will follow in a separate cl.

Bug: 22463853

Change-Id: I87b91ac089866db58ac433def006fe9ac4744bd6
2015-10-16 20:10:38 +00:00
Kongqun Yang 47c79d08ce Update code to resolve problems due to base updates.
Notably deprecate of OVERRIDE, to be replaced with C++11 override.

Bug: 22463130
Bug: 22664127

Change-Id: I12c82e092e9e8eb0870da4363307c3563a3531b7
2015-10-16 20:09:56 +00:00
KongQun Yang 93e6c4fc92 Reduce test file sizes and remove unused test files
Change-Id: I7e3b24e92b2a16de857e0424c85232cc31444182
2015-10-12 20:16:03 +00:00
KongQun Yang 3677042a7c Cleanup producer_consumer_queue_unittest
Uses EXPECT_NEAR for comparison with an acceptable error bound. Also
increases error bound to 50ms.

Change-Id: I8fc61b3b915a50f8fe33b9ea72e123aefee25a80
2015-10-01 10:31:27 -07:00
KongQun Yang 8c202047fb Make edash-packager outputs predictable for testing
- Added --iv to inject iv for fixed key encryption.
- Added support for key rotation in fixed key encryption.
- Added --use_fake_clock_for_muxer to set timestamp to 0 in the output.

Also updates stream info dump message:
- Modified pixel_width: %d\n pixel_height: %d to pixel aspect ratio: %d:%d
- Removed language from video stream info.

These flags should only be used for testing.

Change-Id: Iedf8d6d6492226219f49fe44d932645f557010e4
2015-09-29 17:19:59 +00:00
Kongqun Yang 3a5fdd2d9c Fix incorrect width/height in VisualSampleEntry for mp2t stream with cropping
Cropping is necessary if width/height are not exactly disivible by 16 due
to 16x16 macroblock size.

The width and height fields in VisualSampleEntry must correctly document
the cropped frame dimentions (visual presentation size) of the AVC stream
that is described by that entry.

Also fixes width/height in input mp4 and wvm streams if the values in
VisualSampleEntry / metadata do not match with the values in
AVCDecoderConfigurationRecord (SPS).

Issue: 39

Change-Id: Id55c5acf245bee3f4e66302b2042eb7d9c488c19
2015-09-18 17:42:52 +00:00
Kongqun Yang 2a95367dd4 Move SAR extraction out of video_stream_info.cc
This fixes a circular dependency of media_base depends on filter and
filter depends on media_base.

Also added code to extract sar in WvmMediaParser if it is not yet
extracted when setting extra_data.

Change-Id: I1b5aef2444e4134c9b6663911ac5e5c4c220404a
2015-08-24 23:16:49 +00:00
Kongqun Yang 0614caed83 Fix a memory leak in mpd compare code
This only affects unittests.

Change-Id: I5deba5ce08c08970ec8b2de9ff5f6f7a7a5a436a
2015-08-20 19:24:52 +00:00
Kongqun Yang e5b6096857 Generate tkhd and pasp boxes properly with non-square pixels
- Width/Height in tkhd box should be display resolution instead of
  coded resolution.
- pasp was not generated earlier.
- Assuming SAR as 1:1 if it failed to be extracted successfully.
- Also update test files for mp4_media_parser_unittest.

This fixes Issue #35.

Change-Id: Iedbe6a44465aac6723b6ea2de30aed180821eccd
2015-08-07 21:46:08 +00:00
Rintaro Kuroiwa 5c8efd332e Pass content protection information to MuxerListener
- The UUID and DRM name can be fetched from KeySource.
- Add ProtectedContent message to MediaInfo. The message contains basic
  information for the protected content, such as the default key ID for
  the content.
- The message is required to separate Representations with different
  content protection information into different AdaptationSets.

Change-Id: Ib9dc834ae0abf93b7ca0acdf52a865b1394a4816
2015-07-13 19:03:44 -07:00
Rintaro Kuroiwa c3c971ebd9 Add pixel_{width,height} to VideoStreamInfo
- Added logic to container parsers to extract pixel width and height.
- If the container doesn't contain the pixel width and height of the
  stream and the stream is H264, this parses the SPS to get the
  sar_width and sar_height.
- If extracted sar_width and sar_height are 0s then they imply 1s.
- Add hb2_v_frag.mp4 for test media. This does not have a
  'pasp' box and has sar_width = 8 sar_height = 9.

Change-Id: I4a06ce95582547bec19adb7905e7612c5a1f359e
2015-06-29 11:17:28 -07:00
Kongqun Yang b87d27a23b Use variants of the PKCS#1 PSS functions that specify the MGF1 hash
BoringSSL removes the variants that had been used, in which the hash
is given a default value. This change makes the code more compatible
with BoringSSL.

Change-Id: I665084c2e71593db1afd6baf182224fe0d23c944
2015-06-09 18:34:32 -07:00
Thomas Inskip 4cb5326355 Added missing VideoStreamInfo::trick_play_rate() accessor.
Change-Id: I88656efcb510d7ed2650fdea960ab1fe7e0c2b36
2015-06-03 09:53:48 -07:00
Thomas Inskip a14ea461fb Added trick_play_rate to VideoStreamInfo.
Added ability to query the Demuxer for the container name (type).

Change-Id: I328215f7c5badfe117c5419dd42f5262c568112a
2015-06-02 22:54:13 +00:00
Thomas Inskip a0dc98c13e Added support for ISO-BMFF files with trailing 'moov' boxes.
Change-Id: Icdc9058179a998617f865566d635ecdbd0e422c5
2015-05-22 14:11:46 -07:00
Kongqun Yang 57e3e79a3d Add info logging when packaging starts/finishes
Change-Id: I6adc2490e779242a34e3d2db11d349bd0c97eb9f
2015-05-15 09:23:36 -07:00
Kongqun Yang 8277236fe7 Add ProgressListener for progress updates
Bug: 19730025
Change-Id: If60d7629c69d84b245f0c96fb564704d7af82ea2
2015-05-14 19:09:02 -07:00
Kongqun Yang e9f402a328 Drop media::event namespace
Change-Id: I736a645a604a22ef5ce969aeb7533e003a386172
2015-05-07 14:06:16 -07:00
Kongqun Yang 71e39e40ad Let SetMuxerListener() take ownership of listeners
Change-Id: Id7a9d6f6768556ac4bcaa9c000792a61ee6b758f
2015-05-05 17:32:33 -07:00
Thomas Inskip 14a1e06542 Changes for source code portability.
Change-Id: I06ebb0bb0cbf16c85eff066e606af5ec9033a206
2015-03-24 22:35:53 +00:00
KongQun Yang 7cac9da421 Fix various misc build issues in Windows
This is part of the effort to get edash_packager builds on Windows.

Change-Id: I1339f8f41a30ad3d5808ab19276d46ee902065e2
2015-03-24 13:52:18 -07:00
Thomas Inskip e3d18b684c Added static initialization and cleanup of libxml and libcurl.
Change-Id: I31cfc9a76c3c90c66059998ffc77371619a43acc
2015-03-24 11:01:10 -07:00
KongQun Yang 299bb97490 Read enough bytes before detecting the container type
The input source may produce inputs with very small sizes. Demuxer
needs to accumulate enough bytes before trying to detect the container
type.

Issue: https://github.com/google/edash-packager/issues/11
Change-Id: Ie25339832a826e78f39b3b25abb98c1ad89e3021
2015-03-20 11:45:49 -07:00
Matt Brannock 6a7c6a3f7a Use bytes_read == 0 instead of EoF()
Due to various libraries' inconsistencies with using EoF, this change
will instead continue to read a file until the number of bytes read is
0. It considers bytes_read == 0 to mean end of file.

Change-Id: I90a592d6ae2b9879fe21bd0c4f9e1c9cbc680afe
2015-03-18 16:38:53 +00:00
KongQun Yang daac38db98 Fix DCHECK failure for UDP streams
Change-Id: I45816058bcf01b9db26a1fd1a88131303ff1623e
2015-02-09 16:14:07 -08:00
Matt Brannock 26a4969ea2 Increase packager input/output file buffers to 2MB
Increases the read/write buffers for packager input and output files to
2MB from 256KB, which helps throughput when using network file systems.

Change-Id: Iff5d1b796ba4648f1436e0559c0ca2d353b6c4b5
2015-02-09 15:04:31 -08:00
Thomas Inskip cf0a1878f7 Added ability to cancel a Demuxer or Muxer run.
Change-Id: Ic4c040ef5084c4ec48206403b6abf8ca3d367ad3
2015-02-09 12:56:52 -08:00
Joey Parrish 3cc86c62b5 Add a stream descriptor field for language.
If a stream has no language metadata, or has the wrong metadata, this
field allows the user to override this on the command-line.

This also maps all specified languages on the command-line to ISO-639-2
tags as required by the MP4 muxer, so that ISO-639-1 tags specified on
the command-line do not cause a DCHECK to fail.

b/18613148

Change-Id: I473baeecbb3d388db5e06d080179ec6a332b4794
2015-02-04 13:36:04 -08:00
KongQun Yang 5462b350ae Optimize BitReader::SkipBits for large skips
Change-Id: Ic3a383a7112f21602755d6caa6b24b2857d62ebf
2015-01-31 00:56:14 +00:00
Ramji Chandramouli a99af5a015 Modify WVM media parser to support encrypted media sample.
Change-Id: I8e696527a09fcec22b6c9713e0d1d3096720ce9c
2015-01-14 00:30:14 +00:00
KongQun Yang f66ebe82bb Fix packager crash with corrupted media file
The corrupted media file contains an invalid chunk offset box.

Bug: 18411271

Change-Id: I3d7f51c3647134bd7d0846d0992e10e398784475
2014-12-23 14:29:59 -08:00
KongQun Yang 7798a1b845 move mpd_options to its own file
Also always generates sidx box for segments for now.

Change-Id: I61f71ebd281195b737902b57557a345c8e0b0c66
2014-12-15 19:04:40 +00:00
KongQun Yang fe9c4201f3 Remove the restriction that key response contains all keys
Also set fragment_duration in mvex.

Change-Id: I9584c17569b2eb9b75d060284288c44f64b76821
2014-11-06 15:24:38 -08:00
KongQun Yang f5e71b62b5 Fix two packager crash bug with invalid arguments
Fix b/18005827 Packager crashes in debug mode with widevine decryption
enabled given a non-existing file.

Fix b/18005632 Packager crashes with invalid fixed_key_encryption
parameters.

Also cleans up some code.

Change-Id: I097f5c8dc113eb6d33b42b19a4bf5de125c47c30
2014-10-16 12:40:31 -07:00
KongQun Yang 8336801ffc Refactor WidevineKeySource to pass signer in setter instead
Since signer is now optional, it makes more sense to pass it in setter
function.

Also fix a problem in command line that if a signer or key source is
not specified correctly, the program should return immediately.

Change-Id: I3be6a4e2ba7bf7b8d5589ac8268390a0fe08a626
2014-10-14 19:50:14 -07:00
KongQun Yang b270e9fe0c Allow query stream info without decryption
Also fixes packager_test script due to path change and adding unittests.

Bug: 17977484

Change-Id: I57d1eb9f8ae8039dc5320ffa4141299d42b0e603
2014-10-15 01:32:40 +00:00
KongQun Yang e72d12c54f Make RequestSigner optional for WidevineKeySource
Change-Id: I4298d5c5ba1d8539c5cd28130266b1a988308f0b
2014-10-10 15:55:39 -07:00
KongQun Yang e685dd1a73 Move test files in media/base to test directory
Also rename mpd/base/bandwidth_estimator_test.cc to
bandwidth_estimator_unittest.cc for consistency.

And remove mpd/base/simple_vod_mpd_notifier.* as they are not used
anywhere.

Change-Id: Iaeb096aef9259837a4eb356c18d5ca15f08d2376
2014-10-10 10:33:17 -07:00
Ramji Chandramouli 8cc29520b0 KeyFetcher interface and HTTP impl to retrieve keys from the Widevine
License Service.

Change-Id: Icb1af3fd26a5243293dd089888d4b396539fd768
2014-10-09 18:19:22 -07:00
Thomas Inskip e7e86d684a Fixed various bugs:
- 17932674 Packager crashes when an incorrect key is provided to wvm.

- 17932293 Packager crashes if no key source is provided for wvm input.

- 17932868 StreamInfo is cast to AudioStreamInfo unconditionally and corrupts memory in wvm_media_parser

- 17932033 input: wvm --enable_fixed_key_decryption Segmentation Fault.

Change-Id: I7fc774c87a33314a4c92bc907f06c17f0c269a16
2014-10-09 14:23:57 -07:00
KongQun Yang 9158f4a543 Remove (D)CHECK_OK and usage of MemoryMappedFile
Change-Id: Ifb46a0fe063dfe8fdd770d830f9fb7bf2cf31901
2014-10-08 16:19:31 -07:00
KongQun Yang 8ffb41df76 Fix various errors discovered during integration
Change-Id: I927ba02bbe99bf6e6c9877968a4554ad949cf07f
2014-10-06 12:44:54 -07:00
Ramji Chandramouli 6a1805129d Enabled WVM test with mocks for WidevineKeySource.
Change-Id: I4b9f8acacca6a334087e10d47b96be15fc3cafec
2014-10-03 13:46:07 -07:00
KongQun Yang 15ae26e12f Modify include headers to have "packager" in the path
This is a follow up to previous CL.

Generated using command:
find {media,app,mpd} -type f -exec sed -r -i 's/#include "(.*)"/#include
"packager\/\1"/' {} \;

common.gypi and mpd.gyp are also modified to take the path change into
consideration.

Change-Id: I1fb102b4eb73ae5fde5f4ab303a12cec09b05c33
2014-10-02 12:53:29 -07:00
KongQun Yang b8126bc9da Move source code into packager directory
Make it easier to be included and integrated into other code.

Change-Id: I609881688cc20f8fac676cbd91fde4753af32ee5
2014-10-02 12:32:14 -07:00