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 
49  bool output_media_info = false;
54 
57  DecryptionParams decryption_params;
58 
61 
62  // Parameters for testing. Do not use in production.
63  TestParams test_params;
64 };
65 
69  std::string input;
70 
73  std::string stream_selector;
74 
77  std::string output;
79  std::string segment_template;
80 
83  std::string output_format;
86  bool skip_encryption = false;
90  uint32_t trick_play_factor = 0;
94  uint32_t bandwidth = 0;
97  std::string language;
101  std::string hls_name;
104  std::string hls_group_id;
107  std::string hls_playlist_name;
108 };
109 
110 class SHAKA_EXPORT Packager {
111  public:
112  Packager();
113  ~Packager();
114 
119  Status Initialize(
120  const PackagingParams& packaging_params,
121  const std::vector<StreamDescriptor>& stream_descriptors);
122 
126  Status Run();
127 
129  void Cancel();
130 
132  static std::string GetLibraryVersion();
133 
153  static std::string DefaultStreamLabelFunction(
154  int max_sd_pixels,
155  int max_hd_pixels,
156  int max_uhd1_pixels,
157  const EncryptionParams::EncryptedStreamAttributes& stream_attributes);
158 
159  private:
160  Packager(const Packager&) = delete;
161  Packager& operator=(const Packager&) = delete;
162 
163  struct PackagerInternal;
164  std::unique_ptr<PackagerInternal> internal_;
165 };
166 
167 } // namespace shaka
168 
169 #endif // PACKAGER_PACKAGER_H_
std::string stream_selector
Definition: packager.h:73
BufferCallbackParams buffer_callback_params
Buffer callback params.
Definition: packager.h:60
DASH MPD related parameters.
Definition: mpd_params.h:16
Defines a single input/output stream.
Definition: packager.h:67
std::string input
Input/source media file path or network stream URL. Required.
Definition: packager.h:69
HlsParams hls_params
HLS related parameters.
Definition: packager.h:53
ChunkingParams chunking_params
Chunking (segmentation) related parameters.
Definition: packager.h:43
std::string hls_playlist_name
Definition: packager.h:107
HLS related parameters.
Definition: hls_params.h:23
std::string hls_name
Definition: packager.h:101
std::string segment_template
Specifies segment template. Can be empty.
Definition: packager.h:79
bool inject_fake_clock
Definition: packager.h:30
Parameters used for testing.
Definition: packager.h:25
std::string output_format
Definition: packager.h:83
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:51
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:56
uint32_t trick_play_factor
Definition: packager.h:90
Chunking (segmentation) related parameters.
std::string output
Definition: packager.h:77
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:97
std::string hls_group_id
Definition: packager.h:104