Shaka Packager SDK
hls_notifier.h
1 // Copyright 2016 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_HLS_BASE_HLS_NOTIFIER_H_
8 #define PACKAGER_HLS_BASE_HLS_NOTIFIER_H_
9 
10 #include <string>
11 #include <vector>
12 
13 #include "packager/hls/public/hls_params.h"
14 #include "packager/mpd/base/media_info.pb.h"
15 
16 namespace shaka {
17 namespace hls {
18 
19 // TODO(rkuroiwa): Consider merging this with MpdNotifier.
20 class HlsNotifier {
21  public:
22  explicit HlsNotifier(const HlsParams& hls_params) : hls_params_(hls_params) {}
23  virtual ~HlsNotifier() {}
24 
27  virtual bool Init() = 0;
28 
38  virtual bool NotifyNewStream(const MediaInfo& media_info,
39  const std::string& playlist_name,
40  const std::string& stream_name,
41  const std::string& group_id,
42  uint32_t* stream_id) = 0;
43 
50  virtual bool NotifySampleDuration(uint32_t stream_id,
51  uint32_t sample_duration) = 0;
52 
61  virtual bool NotifyNewSegment(uint32_t stream_id,
62  const std::string& segment_name,
63  uint64_t start_time,
64  uint64_t duration,
65  uint64_t start_byte_offset,
66  uint64_t size) = 0;
67 
74  virtual bool NotifyKeyFrame(uint32_t stream_id,
75  uint64_t timestamp,
76  uint64_t start_byte_offset,
77  uint64_t size) = 0;
78 
82  virtual bool NotifyCueEvent(uint32_t stream_id, uint64_t timestamp) = 0;
83 
92  virtual bool NotifyEncryptionUpdate(
93  uint32_t stream_id,
94  const std::vector<uint8_t>& key_id,
95  const std::vector<uint8_t>& system_id,
96  const std::vector<uint8_t>& iv,
97  const std::vector<uint8_t>& protection_system_specific_data) = 0;
98 
101  virtual bool Flush() = 0;
102 
104  const HlsParams& hls_params() const { return hls_params_; }
105 
106  private:
107  const HlsParams hls_params_;
108 };
109 
110 } // namespace hls
111 } // namespace shaka
112 
113 #endif // PACKAGER_HLS_BASE_HLS_NOTIFIER_H_
virtual bool NotifyCueEvent(uint32_t stream_id, uint64_t timestamp)=0
virtual bool NotifyNewStream(const MediaInfo &media_info, const std::string &playlist_name, const std::string &stream_name, const std::string &group_id, uint32_t *stream_id)=0
virtual bool NotifyEncryptionUpdate(uint32_t stream_id, const std::vector< uint8_t > &key_id, const std::vector< uint8_t > &system_id, const std::vector< uint8_t > &iv, const std::vector< uint8_t > &protection_system_specific_data)=0
const HlsParams & hls_params() const
Definition: hls_notifier.h:104
virtual bool Flush()=0
virtual bool NotifySampleDuration(uint32_t stream_id, uint32_t sample_duration)=0
virtual bool Init()=0
virtual bool NotifyKeyFrame(uint32_t stream_id, uint64_t timestamp, uint64_t start_byte_offset, uint64_t size)=0
virtual bool NotifyNewSegment(uint32_t stream_id, const std::string &segment_name, uint64_t start_time, uint64_t duration, uint64_t start_byte_offset, uint64_t size)=0
All the methods that are virtual are virtual for mocking.
HLS related parameters.
Definition: hls_params.h:23