From 675f2631b8d33fb7c415c902872f232b23bd2ebc Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Wed, 2 Aug 2017 13:37:47 -0700 Subject: [PATCH] Move HlsParams to hls_params.h Change-Id: I25189623512834da8bd998c388c4cb0edebc6f47 --- packager/app/packager_util.cc | 1 - packager/hls/base/hls_notifier.h | 2 +- packager/hls/base/media_playlist.h | 2 +- packager/hls/base/simple_hls_notifier.h | 2 +- .../hls/base/simple_hls_notifier_unittest.cc | 6 --- packager/hls/hls.gyp | 2 +- packager/hls/public/hls_params.h | 38 +++++++++++++++++++ packager/hls/public/hls_playlist_type.h | 22 ----------- packager/packager.cc | 9 ++--- packager/packager.h | 16 +------- 10 files changed, 47 insertions(+), 53 deletions(-) create mode 100644 packager/hls/public/hls_params.h delete mode 100644 packager/hls/public/hls_playlist_type.h diff --git a/packager/app/packager_util.cc b/packager/app/packager_util.cc index 9d6c4d7768..741a40c0c2 100644 --- a/packager/app/packager_util.cc +++ b/packager/app/packager_util.cc @@ -19,7 +19,6 @@ #include "packager/media/chunking/chunking_handler.h" #include "packager/media/crypto/encryption_handler.h" #include "packager/mpd/base/mpd_options.h" -#include "packager/packager.h" #include "packager/status.h" namespace shaka { diff --git a/packager/hls/base/hls_notifier.h b/packager/hls/base/hls_notifier.h index b5f92137eb..073e8963c9 100644 --- a/packager/hls/base/hls_notifier.h +++ b/packager/hls/base/hls_notifier.h @@ -10,7 +10,7 @@ #include #include -#include "packager/hls/public/hls_playlist_type.h" +#include "packager/hls/public/hls_params.h" #include "packager/mpd/base/media_info.pb.h" namespace shaka { diff --git a/packager/hls/base/media_playlist.h b/packager/hls/base/media_playlist.h index 896627baa2..ed4168b806 100644 --- a/packager/hls/base/media_playlist.h +++ b/packager/hls/base/media_playlist.h @@ -12,7 +12,7 @@ #include #include "packager/base/macros.h" -#include "packager/hls/public/hls_playlist_type.h" +#include "packager/hls/public/hls_params.h" #include "packager/mpd/base/media_info.pb.h" namespace shaka { diff --git a/packager/hls/base/simple_hls_notifier.h b/packager/hls/base/simple_hls_notifier.h index 31efddf8c4..a14b1814dd 100644 --- a/packager/hls/base/simple_hls_notifier.h +++ b/packager/hls/base/simple_hls_notifier.h @@ -18,7 +18,7 @@ #include "packager/hls/base/hls_notifier.h" #include "packager/hls/base/master_playlist.h" #include "packager/hls/base/media_playlist.h" -#include "packager/hls/public/hls_playlist_type.h" +#include "packager/hls/public/hls_params.h" namespace shaka { namespace hls { diff --git a/packager/hls/base/simple_hls_notifier_unittest.cc b/packager/hls/base/simple_hls_notifier_unittest.cc index 9e880a4c64..70eca844c1 100644 --- a/packager/hls/base/simple_hls_notifier_unittest.cc +++ b/packager/hls/base/simple_hls_notifier_unittest.cc @@ -79,12 +79,6 @@ const char kSampleAesProtectionScheme[] = "cbca"; } // namespace -// : notifier_(profile, -// kTestTimeShiftBufferDepth, -// kTestPrefix, -// kAnyOutputDir, -// kMasterPlaylistName), - class SimpleHlsNotifierTest : public ::testing::Test { protected: SimpleHlsNotifierTest() : SimpleHlsNotifierTest(kVodPlaylist) {} diff --git a/packager/hls/hls.gyp b/packager/hls/hls.gyp index ffa13853d9..cc54e4f939 100644 --- a/packager/hls/hls.gyp +++ b/packager/hls/hls.gyp @@ -20,7 +20,7 @@ 'base/media_playlist.h', 'base/simple_hls_notifier.cc', 'base/simple_hls_notifier.h', - 'public/hls_playlist_type.h', + 'public/hls_params.h', ], 'dependencies': [ '../base/base.gyp:base', diff --git a/packager/hls/public/hls_params.h b/packager/hls/public/hls_params.h new file mode 100644 index 0000000000..44c50195cf --- /dev/null +++ b/packager/hls/public/hls_params.h @@ -0,0 +1,38 @@ +// Copyright 2017 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#ifndef PACKAGER_HLS_PUBLIC_HLS_PARAMS_H_ +#define PACKAGER_HLS_PUBLIC_HLS_PARAMS_H_ + +#include + +namespace shaka { + +/// Defines the EXT-X-PLAYLIST-TYPE in the HLS specification. For +/// HlsPlaylistType of kLive, EXT-X-PLAYLIST-TYPE tag is omitted. +enum class HlsPlaylistType { + kVod, + kEvent, + kLive, +}; + +/// HLS related parameters. +struct HlsParams { + /// HLS playlist type. See HLS specification for details. + HlsPlaylistType playlist_type = HlsPlaylistType::kVod; + /// HLS master playlist output path. + std::string master_playlist_output; + /// The base URL for the Media Playlists and media files listed in the + /// playlists. This is the prefix for the files. + std::string base_url; + /// Defines the live window, or the guaranteed duration of the time shifting + /// buffer for 'live' playlists. + double time_shift_buffer_depth = 0; +}; + +} // namespace shaka + +#endif // PACKAGER_HLS_PUBLIC_HLS_PARAMS_H_ diff --git a/packager/hls/public/hls_playlist_type.h b/packager/hls/public/hls_playlist_type.h deleted file mode 100644 index 06e8912135..0000000000 --- a/packager/hls/public/hls_playlist_type.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2017 Google Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd - -#ifndef PACKAGER_HLS_PUBLIC_HLS_PLAYLIST_TYPE_H_ -#define PACKAGER_HLS_PUBLIC_HLS_PLAYLIST_TYPE_H_ - -namespace shaka { - -/// Defines the EXT-X-PLAYLIST-TYPE in the HLS specification. For -/// HlsPlaylistType of kLive, EXT-X-PLAYLIST-TYPE tag is omitted. -enum class HlsPlaylistType { - kVod, - kEvent, - kLive, -}; - -} // namespace shaka - -#endif // PACKAGER_HLS_PUBLIC_HLS_PLAYLIST_TYPE_H_ diff --git a/packager/packager.cc b/packager/packager.cc index a18cd34881..b15211a8a3 100644 --- a/packager/packager.cc +++ b/packager/packager.cc @@ -582,11 +582,6 @@ Status Packager::Initialize( std::unique_ptr internal(new PackagerInternal); - const bool on_demand_dash_profile = - stream_descriptors.begin()->segment_template.empty(); - MpdOptions mpd_options = - media::GetMpdOptions(on_demand_dash_profile, packaging_params.mpd_params); - // Create encryption key source if needed. if (packaging_params.encryption_params.key_provider != KeyProvider::kNone) { internal->encryption_key_source = CreateEncryptionKeySource( @@ -599,6 +594,10 @@ Status Packager::Initialize( const MpdParams& mpd_params = packaging_params.mpd_params; if (!mpd_params.mpd_output.empty()) { + const bool on_demand_dash_profile = + stream_descriptors.begin()->segment_template.empty(); + MpdOptions mpd_options = media::GetMpdOptions(on_demand_dash_profile, + packaging_params.mpd_params); if (mpd_params.generate_dash_if_iop_compliant_mpd) { internal->mpd_notifier.reset(new DashIopMpdNotifier(mpd_options)); } else { diff --git a/packager/packager.h b/packager/packager.h index d599c3bab6..dd9f749317 100644 --- a/packager/packager.h +++ b/packager/packager.h @@ -11,7 +11,7 @@ #include #include -#include "packager/hls/public/hls_playlist_type.h" +#include "packager/hls/public/hls_params.h" #include "packager/media/public/chunking_params.h" #include "packager/media/public/crypto_params.h" #include "packager/media/public/mp4_output_params.h" @@ -20,20 +20,6 @@ namespace shaka { -/// HLS related parameters. -struct HlsParams { - /// HLS playlist type. See HLS specification for details. - HlsPlaylistType playlist_type = HlsPlaylistType::kVod; - /// HLS master playlist output path. - std::string master_playlist_output; - /// The base URL for the Media Playlists and media files listed in the - /// playlists. This is the prefix for the files. - std::string base_url; - /// Defines the live window, or the guaranteed duration of the time shifting - /// buffer for 'live' playlists. - double time_shift_buffer_depth = 0; -}; - /// Parameters used for testing. struct TestParams { /// Whether to dump input stream info.