2014-05-08 21:02:36 +00:00
|
|
|
// Copyright 2014 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
|
|
|
|
//
|
2014-06-11 00:33:40 +00:00
|
|
|
// Packager utility functions.
|
2014-05-08 21:02:36 +00:00
|
|
|
|
2017-02-21 18:36:50 +00:00
|
|
|
#ifndef PACKAGER_APP_PACKAGER_UTIL_H_
|
|
|
|
#define PACKAGER_APP_PACKAGER_UTIL_H_
|
2014-05-08 21:02:36 +00:00
|
|
|
|
2016-08-17 17:41:40 +00:00
|
|
|
#include <memory>
|
2014-05-08 21:02:36 +00:00
|
|
|
|
2017-05-22 20:31:41 +00:00
|
|
|
#include "packager/base/optional.h"
|
2017-04-05 20:53:58 +00:00
|
|
|
#include "packager/media/base/fourccs.h"
|
2017-05-22 20:31:41 +00:00
|
|
|
#include "packager/packager.h"
|
2017-04-05 20:53:58 +00:00
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
namespace shaka {
|
2014-09-19 20:41:13 +00:00
|
|
|
|
2017-05-22 20:31:41 +00:00
|
|
|
// TODO(kqyang): Should we consolidate XxxParams and XxxOptions?
|
|
|
|
struct ChunkingParams;
|
|
|
|
struct DecryptionParams;
|
|
|
|
struct EncryptionParams;
|
|
|
|
struct Mp4OutputParams;
|
2014-06-26 01:33:09 +00:00
|
|
|
struct MpdOptions;
|
2017-05-22 20:31:41 +00:00
|
|
|
struct MpdParams;
|
2014-06-26 01:33:09 +00:00
|
|
|
|
2014-05-08 21:02:36 +00:00
|
|
|
namespace media {
|
|
|
|
|
2017-03-21 23:14:46 +00:00
|
|
|
class MediaHandler;
|
2014-08-20 23:51:15 +00:00
|
|
|
class KeySource;
|
2017-02-24 01:17:47 +00:00
|
|
|
struct ChunkingOptions;
|
2017-03-11 02:49:55 +00:00
|
|
|
struct EncryptionOptions;
|
2014-05-28 00:55:36 +00:00
|
|
|
struct MuxerOptions;
|
2014-05-08 21:02:36 +00:00
|
|
|
|
2014-08-20 23:51:15 +00:00
|
|
|
/// Create KeySource based on provided command line options for content
|
|
|
|
/// encryption. Also fetches keys.
|
2017-04-05 20:53:58 +00:00
|
|
|
/// @param protection_scheme specifies the protection scheme to be used for
|
|
|
|
/// encryption.
|
2016-08-17 17:41:40 +00:00
|
|
|
/// @return A std::unique_ptr containing a new KeySource, or nullptr if
|
2014-05-08 21:02:36 +00:00
|
|
|
/// encryption is not required.
|
2017-05-22 20:31:41 +00:00
|
|
|
std::unique_ptr<KeySource> CreateEncryptionKeySource(
|
|
|
|
FourCC protection_scheme,
|
|
|
|
const EncryptionParams& encryption_params);
|
2014-08-20 23:51:15 +00:00
|
|
|
|
|
|
|
/// Create KeySource based on provided command line options for content
|
|
|
|
/// decryption. Does not fetch keys.
|
2016-08-17 17:41:40 +00:00
|
|
|
/// @return A std::unique_ptr containing a new KeySource, or nullptr if
|
|
|
|
/// decryption is not required.
|
2017-05-22 20:31:41 +00:00
|
|
|
std::unique_ptr<KeySource> CreateDecryptionKeySource(
|
|
|
|
const DecryptionParams& decryption_params);
|
2014-05-08 21:02:36 +00:00
|
|
|
|
2017-02-24 01:17:47 +00:00
|
|
|
/// @return MpdOptions from provided command line options.
|
2017-05-22 20:31:41 +00:00
|
|
|
MpdOptions GetMpdOptions(bool on_demand_profile, const MpdParams& mpd_params);
|
2014-06-26 01:33:09 +00:00
|
|
|
|
2017-03-21 23:14:46 +00:00
|
|
|
/// Connect handlers in the vector.
|
|
|
|
/// @param handlers A vector of media handlers to be conncected. the handlers
|
|
|
|
/// are chained from front() to back().
|
|
|
|
/// @return OK on success.
|
|
|
|
Status ConnectHandlers(std::vector<std::shared_ptr<MediaHandler>>& handlers);
|
|
|
|
|
2014-05-08 21:02:36 +00:00
|
|
|
} // namespace media
|
2016-05-20 21:19:33 +00:00
|
|
|
} // namespace shaka
|
2014-05-08 21:02:36 +00:00
|
|
|
|
2017-02-21 18:36:50 +00:00
|
|
|
#endif // PACKAGER_APP_PACKAGER_UTIL_H_
|