Commit Graph

91 Commits

Author SHA1 Message Date
KongQun Yang bc903d2d83 [HLS] Fix segment URL isn't respecting folder locations
Problem occurs when the media playlists are in a sub-directory under
master playlist. If base_url is not set, media segment URL should be
relative to the media playlist instead of the master playlist.

Also make sure the path separator is "/" in URL instead of "\" on
Windows.

Fixes #253

Change-Id: I8e933750276435d94dd01bfa53ee2bc050dfd193
2017-09-18 19:11:42 +00:00
KongQun Yang b5e6cf36ab Remove the all zero KID in manifest for key rotation
Closes b/64035941

Change-Id: I382b6478889dd73bc422decf0cbf4d32cd9bb68d
2017-08-29 20:44:32 +00:00
KongQun Yang 556ff56559 Consolidate MpdParams into MpdOptions
Change-Id: I7f37277ef87597548c2fbf219963cd8725ae4c05
2017-08-18 11:57:41 -07:00
KongQun Yang eb98a87f7d Move packager/media/file to packager/file
Change-Id: Idc0d75a7ceab7c8ce460ef896fdefdec088124bb
2017-07-17 12:08:28 -07:00
KongQun Yang 2db1867951 Write manifests atomically
In the original manifest updating process, the file was truncated first
before was written with new contents. There is a small chance that
the web server may read back empty file or incomplete file.

The new code makes the update operation atomic (by writing to a temporary
file first then replace the old file with the temporary file).

Fixes #186

Change-Id: I2fd564cb12b922b032c0e9f70d2132a5b12ff098
2017-07-07 11:05:19 -07:00
KongQun Yang b4aa34b803 Support live and event HLS playlists
Closes #114

Change-Id: I6440383c3dc022fba5a9926839f79b9ed8a51f55
2017-06-24 01:09:32 +00:00
KongQun Yang 05a5a41969 Support generation of libpackager.so (shared_library)
Shared libpackager can be built by setting libpackager_type to
shared_library, e.g.

GYP_DEFINES='libpackager_type=shared_library' gclient runhooks
ninja -C out/Debug

will generate libpackager.so in out/Debug/lib directory.

Here is a few other changes to make shared_library builds and
tests pass:

- Add several test parameters to packager.h, which is needed for
  testing.
- Create a protoc.gypi from build/protoc.gypi but depending on
  protobuf_full_do_not_use instead of protobuf_lite, since we need
  protobuf_full_do_not_use for text parsing and generation of media
  info proto. Somehow shared_library build does not allow mixed use
  of protobuf_full_do_not_use and protobuf_lite.
- Remove the use of LazyInstance in version/version.cc and use static
  variable directly. This is because LazyInstance needs AtExitManager
  which may not be easy to setup when calling GetVersion.
- Allow skipping testPackageWvmInputWithoutStrippingParameterSetNalus
  with flag --shared_library, which is needed as shared_library build
  does not support --strip_parameter_set_nalus flag yet.

Fixes #227

Change-Id: Iff05a50baa28134faa7218664c96114cb9e70329
2017-06-13 20:42:32 +00:00
KongQun Yang d28b19788d Remove misleading frame duration message in live mode
frame_duration is not available when the VideoInfo is created, but
it will become available when a media segment arrives.

Change-Id: I2c24852fca4ff77c2b86ff78dbf0963ad0a0afa6
2017-06-08 22:32:06 +00:00
KongQun Yang 18cdbd4121 Deprecate availability_time_offset MPD flag
'availability_time_offset' is not an attribute in MPD specification,
but used to calculate availability_start_time to adjust segment
availability time. A similar effect can be achieved with standard
blessed suggested_presentation_delay flag.

If suggested_presentation_delay is not set, player is expected to
choose a suitable value.

Change-Id: I1d540bd4347b4f04b6cc5ec0778e1a5392009b09
2017-05-22 23:14:16 +00:00
Haoming Chen 27abb208aa Remove the trick_play_factor in media_info.proto.
- Use the playback_rate instead.

Change-Id: I341c39de1c28aacebab5b31aa013bcbbcc2fa9d0
2017-05-17 22:10:49 +00:00
Haoming Chen da8877d8a2 Rename trick play rate to trick play factor.
- Add a "tpf" abbreviation in stream descriptor for
  trick_play_factor.

Change-Id: Ia09313bb9778456b53bdb0a8cc46d2ba8caa2ac2
2017-05-17 21:51:34 +00:00
Haoming Chen 4ba5bec660 Integrate trick play.
- Add trick play adaptation in mpd. This addresses #178.

Change-Id: Id6cc08c788eda074c261d0274768051837b84541
2017-05-09 13:33:11 -07:00
Rintaro Kuroiwa a3b5e7d01a Widevine HLS new key format manifest side
- This changes the manifest side for the new key format.

Change-Id: I329f3c84605e5d2180e219643cb17282152f687b
2017-04-10 19:05:23 +00:00
Rintaro Kuroiwa 92280bf214 Full vtt in mp4 path
Change-Id: I7f49dbfed188ff7a451b0b4fbd6947590e8935d1
2017-03-29 18:52:25 +00:00
sylt 81beb8aeb2 Don't do timeshift SlideWindow() logic for static MPD (#218)
This is a fix for issue #216 where the Representation::SlideWindow() logic was
still active even though a static MPD was being asked to be generated (using
the option -generate_static_mpd). This could cause static streams longer than
1800 seconds to start playing at (end-position-for-stream - 1800 seconds).

This change is in compliance with the current usage documentation for the
shaka-packager, which suggests that -time_shift_buffer_depth only is relevant
for dynamic media presentations.
2017-03-24 10:37:13 -07:00
Joey Parrish 924d6d4693 Add HLS audio language support
Before this, HLS output did not contain language information.
Now, media playlists are properly tagged with a language in the
master playlist.

b/36134267

Change-Id: I172e946dbedd096a44cb2f917b007cc004756228
2017-03-10 16:14:14 -08:00
Kongqun Yang 6235352bf4 Fix mpd duration not set in static live manifest
Closes #201

Change-Id: Ie9ab58ec58e1b135931a6576fb46145454b0f049
2017-02-11 00:52:32 +00:00
Kongqun Yang 5aaae303e8 Part one of supporting live profile with static mpd
- Added two new fields in MpdOptions: dash_profile and mpd_type
- Updated MpdBuilder to support LiveProfile with static mpd
- Command line arguments will be updated in the next CL

Issue #142

Change-Id: Ibd35e5c9e1b1ef98043392e3f04a0af4700135c1
2017-01-13 19:59:49 +00:00
Kongqun Yang af0904e428 Fix AdaptationSet switching signaling
Current mechanism of using AdaptationSet @group is not spec compliant.

The spec compliant mechanism is to use supplemental descriptor with
schemeIdUri: urn:mpeg:dash:adaptation-set-switching:2016 as specified
in ISO/IEC 23009-1:2014/Amd.4:2016.

Fixes #156

Change-Id: I4d97648547a23315ba9c09dcadb14e18c99a45fc
2016-12-19 20:12:27 +00:00
Kongqun Yang f5dc908a0d Implement utility function DoubleToString
Implement our own DoubleToString as base::DoubleToString uses
third_party library dmg_fp.

Change-Id: I0d3d706cfd3de4f833b201110954419e585a21dd
2016-09-30 21:36:11 +00:00
Joey Parrish cda495fb57 Add default_language flag
Setting this flag will tag any matching tracks with kRoleMain.
The player will then know which tracks should be default when there
is not a language match.

Closes #155

Change-Id: I827304c49e345d07b1e76f7a46421b60f228f0ba
2016-09-29 22:59:34 +00:00
Kongqun Yang c3d1dc1733 Deprecate STLDeleter and string_as_array
1. Replace STLDeleter with unique_ptr in container, which is
   supported in C++11
2. Replace string_as_array with &string[0] which is guaranteed
   to work in C++11

Change-Id: I7f39c0e51fc8a3fcbb41313094a0ca6b33db7bf3
2016-09-01 17:39:11 +00:00
Kongqun Yang 23f2913248 Update DEPS to fix mac build failure
Change-Id: I1cf95d5da8e3b950300cd61cd9286e957ef653ce
2016-08-19 13:49:41 -07:00
Kongqun Yang 644629c616 Replace scoped_ptr with std::unique_ptr
Change-Id: I1ed18bf876b6154d08a1f7913aa7e76c525451f9
2016-08-18 17:12:36 -07:00
Thomas Inskip 336ea5cb34 Windows build working
Change-Id: I6d9cfa0a310c4c6125c839e4d6a085903e981c9c
2016-08-18 08:30:26 -07: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 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 bbcca29013 Move all code inside top level namespace
Change-Id: I83bc081f523dbc5071796a79c2d89b7367ed8d27
2016-05-24 21:55:21 +00:00
Kongqun Yang a217cdce29 Misc cleanup in MediaInfo proto usage
- Replaces SerializeToString with SerializeAsString.
- Construct StringPiece instead of doing implicit conversion when
  doing Base64Encode.

Change-Id: I9a9d4a138b0d949447396387adc599c7cde0b9f4
2016-05-17 13:28:22 -07:00
Kongqun Yang 855d1b028f Correctly generate ContentProtection value for non-cenc protection schemes
Change-Id: Ie5469a7f192cc6167f029befd9cca7f9ab0d1f27
2016-04-26 17:27:04 +00: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
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
Anders Hasselqvist 4195c5e505 MacOSX: Fix run_all_unittests target name conflict
There is a target name conflict between packager/base/base.gyp:run_all_unittests and
media_test.gyp:run_all_unittests. Change to media_test.gyp:run_tests_with_atexit_manager to
resolve the conflict.
2016-01-22 18:50:05 -08:00
Jacob Trimble cd74066bb4 Outputs default_KID for non-MP4 ContentProtection elements.
Now outputs cenc:default_KID attributes on all ContentProtection
elements for non-MP4 streams.  For MP4 streams, it will still output
the default ContentProtection element.

Closes #69

Change-Id: I38b24297aa3c2ccbcbde38b44279b56c37a388f7
2016-01-22 21:47:42 +00:00
Rintaro Kuroiwa 5ad076d92c Fix schematron validation problem for live
- From DASH spec 2014, MPD@publishTime and Period@id are required for
  'dynamic' MPD.
- Period@id is always set to "0".
- MPD@publishTime is set to the time when the MPD is output.

Issue #55

Change-Id: I5e50aa11067176e69a2343fbc82ca42129703e1b
2016-01-14 16:53:25 -08:00
KongQun Yang b4e9b5ac2b Set codec string for webm contents correctly
The new codec strings may not be accepted by old versions of browsers.

Change-Id: Ic1bdde80f204f56674fca1f959a3897146953bcf
2016-01-13 19:29:04 +00:00
Rintaro Kuroiwa 2909a53568 Remove redundant attributes from Representation
- @width, @height, @frameRate for Representation element will not be
  set if the attributes are set at AdaptationSet level.

Issue #55

Change-Id: Ib4e669142874f9e8f0ca773df9f87a3fef01b729
2016-01-08 16:42:10 -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
Rintaro Kuroiwa 62a70e71ee Add MPD schema validation for subsegmentAlignment
- No tests checked the MPD output with AdaptationSet@subsegmentAlignment
  set.

Change-Id: Id45d2bf6865c4550b57c6be1d423b527d3f45cfb
2016-01-07 20:28:20 +00:00
Rintaro Kuroiwa a9b039c3f9 Fix MPD validation problems
- Replaced urn:mpeg:DASH:schema:MPD:2011 with
  urn:mpeg:dash:schema:mpd:2011. The former is from the old spec.
- Replaced the MPD schema with the latest one.
- Fixed subSegmentAlignment typo with subsegmentAlignment.

Issue #55

Change-Id: Icffa9872ffc462627b81900a48f59e7b76687c11
2016-01-05 13:50:32 -08:00
KongQun Yang e1bf322b83 s/::STLElementDeleter/STLElementDeleter/ to improve portability
Change-Id: I5234b415a6ae88ba26da571f56cc8b16748203ae
2015-12-11 15:14:26 -08:00
Rintaro Kuroiwa d3c52cffd9 Use alias template for ScopedXmlPtr
- Also renamed to scoped_xml_ptr to match other smart pointers.

Change-Id: Idb998aa3252d4f3a50068a09e26a05f124e94a2f
2015-11-17 22:07:10 +00:00
Rintaro Kuroiwa 981041a3a8 Remove locks from MpdBuilder and lock at MpdNotifier level
- Since most use cases use notifier implementations that already uses
  locks, removing locks from MpdBuilder.
- Added locks to MpdNotifier::Flush() implementations. Multiple threads
  were able to write to the same file.

Issue #45, #49

Change-Id: I6e39824485672f40e6c947da97f1743fac174167
2015-11-16 11:29:06 -08:00
Rintaro Kuroiwa 8c53995335 Text support for MpdBuilder
Change-Id: I75e1da391356e9edfcb520941029341941c31332
2015-11-03 17:55:50 -08:00
Rintaro Kuroiwa 749571fc07 Do MpdBuilder test TODOs
- Added factory methods for creating Representation and AdaptationSet in
  tests.
- Since most tests only needed access to the constructors for
  Representation and AdaptationSet, instead of using
  FRIEND_TEST_ALL_PREFIXES() for each test case, added factory methods
  on the test class.
- Check the 'frameRate' attribute in
  CommonMpbBuilderTest.SetSampleDuration.

Change-Id: I57bd3a90b397f90c3a3a91de03eb96000f58ef58
2015-10-30 14:48:30 -07: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 2080973f17 Fix an xml include in xml_compare.cc
Change-Id: I06867c8405b0b7ff55f17622e409a42d3eceacc0
2015-09-30 17:45:46 -07:00