Shaka Packager SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
packager.h
1 // Copyright 2017 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef PACKAGER_PACKAGER_H_
8 #define PACKAGER_PACKAGER_H_
9 
10 #include <memory>
11 #include <string>
12 #include <vector>
13 
14 #include "packager/hls/public/hls_params.h"
15 #include "packager/file/public/buffer_callback_params.h"
16 #include "packager/media/public/chunking_params.h"
17 #include "packager/media/public/crypto_params.h"
18 #include "packager/media/public/mp4_output_params.h"
19 #include "packager/mpd/public/mpd_params.h"
20 #include "packager/status.h"
21 
22 namespace shaka {
23 
25 struct TestParams {
27  bool dump_stream_info = false;
30  bool inject_fake_clock = false;
34 };
35 
39  std::string temp_dir;
44 
47  bool output_media_info = false;
52 
55  DecryptionParams decryption_params;
56 
59 
60  // Parameters for testing. Do not use in production.
61  TestParams test_params;
62 };
63 
67  std::string input;
68 
71  std::string stream_selector;
72 
75  std::string output;
77  std::string segment_template;
78 
81  std::string output_format;
84  bool skip_encryption = false;
89  std::string drm_label;
93  uint32_t trick_play_factor = 0;
97  uint32_t bandwidth = 0;
100  std::string language;
104  std::string hls_name;
107  std::string hls_group_id;
110  std::string hls_playlist_name;
111 };
112 
113 class SHAKA_EXPORT Packager {
114  public:
115  Packager();
116  ~Packager();
117 
122  Status Initialize(
123  const PackagingParams& packaging_params,
124  const std::vector<StreamDescriptor>& stream_descriptors);
125 
129  Status Run();
130 
132  void Cancel();
133 
135  static std::string GetLibraryVersion();
136 
156  static std::string DefaultStreamLabelFunction(
157  int max_sd_pixels,
158  int max_hd_pixels,
159  int max_uhd1_pixels,
160  const EncryptionParams::EncryptedStreamAttributes& stream_attributes);
161 
162  private:
163  Packager(const Packager&) = delete;
164  Packager& operator=(const Packager&) = delete;
165 
166  struct PackagerInternal;
167  std::unique_ptr<PackagerInternal> internal_;
168 };
169 
170 } // namespace shaka
171 
172 #endif // PACKAGER_PACKAGER_H_
std::string stream_selector
Definition: packager.h:71
BufferCallbackParams buffer_callback_params
Buffer callback params.
Definition: packager.h:58
DASH MPD related parameters.
Definition: mpd_params.h:16
Defines a single input/output stream.
Definition: packager.h:65
std::string input
Input/source media file path or network stream URL. Required.
Definition: packager.h:67
HlsParams hls_params
HLS related parameters.
Definition: packager.h:51
ChunkingParams chunking_params
Chunking (segmentation) related parameters.
Definition: packager.h:43
std::string hls_playlist_name
Definition: packager.h:110
HLS related parameters.
Definition: hls_params.h:23
std::string hls_name
Definition: packager.h:104
std::string segment_template
Specifies segment template. Can be empty.
Definition: packager.h:77
bool inject_fake_clock
Definition: packager.h:30
Parameters used for testing.
Definition: packager.h:25
std::string output_format
Definition: packager.h:81
bool dump_stream_info
Whether to dump input stream info.
Definition: packager.h:27
std::string injected_library_version
Definition: packager.h:33
MpdParams mpd_params
DASH MPD related parameters.
Definition: packager.h:49
std::string drm_label
Definition: packager.h:89
MP4 (ISO-BMFF) output related parameters.
std::string temp_dir
Specify temporary directory for intermediate temporary files.
Definition: packager.h:39
Mp4OutputParams mp4_output_params
MP4 (ISO-BMFF) output related parameters.
Definition: packager.h:41
EncryptionParams encryption_params
Encryption and Decryption Parameters.
Definition: packager.h:54
uint32_t trick_play_factor
Definition: packager.h:93
Chunking (segmentation) related parameters.
std::string output
Definition: packager.h:75
Decryption parameters.
Encryption parameters.
Encrypted stream information that is used to determine stream label.
Packaging parameters.
Definition: packager.h:37
Buffer callback params.
std::string language
Definition: packager.h:100
std::string hls_group_id
Definition: packager.h:107