Shaka Packager SDK
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/file/public/buffer_callback_params.h"
15 #include "packager/hls/public/hls_params.h"
16 #include "packager/media/public/ad_cue_generator_params.h"
17 #include "packager/media/public/chunking_params.h"
18 #include "packager/media/public/crypto_params.h"
19 #include "packager/media/public/mp4_output_params.h"
20 #include "packager/mpd/public/mpd_params.h"
21 #include "packager/status.h"
22 
23 namespace shaka {
24 
26 struct TestParams {
28  bool dump_stream_info = false;
31  bool inject_fake_clock = false;
35 };
36 
40  std::string temp_dir;
46  uint32_t transport_stream_timestamp_offset_ms = 0;
49 
52 
55  bool output_media_info = false;
60 
63  DecryptionParams decryption_params;
64 
67 
68  // Parameters for testing. Do not use in production.
69  TestParams test_params;
70 };
71 
75  std::string input;
76 
79  std::string stream_selector;
80 
83  std::string output;
85  std::string segment_template;
86 
89  std::string output_format;
92  bool skip_encryption = false;
97  std::string drm_label;
101  uint32_t trick_play_factor = 0;
105  uint32_t bandwidth = 0;
108  std::string language;
109 
113  std::string hls_name;
116  std::string hls_group_id;
119  std::string hls_playlist_name;
125  std::vector<std::string> hls_characteristics;
126 };
127 
128 class SHAKA_EXPORT Packager {
129  public:
130  Packager();
131  ~Packager();
132 
137  Status Initialize(
138  const PackagingParams& packaging_params,
139  const std::vector<StreamDescriptor>& stream_descriptors);
140 
144  Status Run();
145 
147  void Cancel();
148 
150  static std::string GetLibraryVersion();
151 
171  static std::string DefaultStreamLabelFunction(
172  int max_sd_pixels,
173  int max_hd_pixels,
174  int max_uhd1_pixels,
175  const EncryptionParams::EncryptedStreamAttributes& stream_attributes);
176 
177  private:
178  Packager(const Packager&) = delete;
179  Packager& operator=(const Packager&) = delete;
180 
181  struct PackagerInternal;
182  std::unique_ptr<PackagerInternal> internal_;
183 };
184 
185 } // namespace shaka
186 
187 #endif // PACKAGER_PACKAGER_H_
std::string stream_selector
Definition: packager.h:79
BufferCallbackParams buffer_callback_params
Buffer callback params.
Definition: packager.h:66
DASH MPD related parameters.
Definition: mpd_params.h:16
Defines a single input/output stream.
Definition: packager.h:73
std::string input
Input/source media file path or network stream URL. Required.
Definition: packager.h:75
HlsParams hls_params
HLS related parameters.
Definition: packager.h:59
ChunkingParams chunking_params
Chunking (segmentation) related parameters.
Definition: packager.h:48
std::string hls_playlist_name
Definition: packager.h:119
HLS related parameters.
Definition: hls_params.h:23
std::string hls_name
Definition: packager.h:113
std::string segment_template
Specifies segment template. Can be empty.
Definition: packager.h:85
bool inject_fake_clock
Definition: packager.h:31
Parameters used for testing.
Definition: packager.h:26
std::string output_format
Definition: packager.h:89
bool dump_stream_info
Whether to dump input stream info.
Definition: packager.h:28
All the methods that are virtual are virtual for mocking.
std::string injected_library_version
Definition: packager.h:34
MpdParams mpd_params
DASH MPD related parameters.
Definition: packager.h:57
std::string drm_label
Definition: packager.h:97
MP4 (ISO-BMFF) output related parameters.
AdCueGeneratorParams ad_cue_generator_params
Out of band cuepoint parameters.
Definition: packager.h:51
std::string temp_dir
Specify temporary directory for intermediate temporary files.
Definition: packager.h:40
Cuepoint generator related parameters.
Mp4OutputParams mp4_output_params
MP4 (ISO-BMFF) output related parameters.
Definition: packager.h:42
EncryptionParams encryption_params
Encryption and Decryption Parameters.
Definition: packager.h:62
Chunking (segmentation) related parameters.
std::string output
Definition: packager.h:83
Decryption parameters.
Encryption parameters.
std::vector< std::string > hls_characteristics
Definition: packager.h:125
Encrypted stream information that is used to determine stream label.
std::string hls_iframe_playlist_name
Definition: packager.h:122
Packaging parameters.
Definition: packager.h:38
Buffer callback params.
std::string language
Definition: packager.h:108
std::string hls_group_id
Definition: packager.h:116