Shaka Packager SDK
mpd_notifier.h
1 // Copyright 2014 Google LLC. 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 // MpdNotifier is responsible for notifying the MpdBuilder class to generate an
8 // MPD file.
9 
10 #ifndef MPD_BASE_MPD_NOTIFIER_H_
11 #define MPD_BASE_MPD_NOTIFIER_H_
12 
13 #include <cstdint>
14 #include <string>
15 #include <vector>
16 
17 #include <packager/macros/classes.h>
18 #include <packager/macros/compiler.h>
19 #include <packager/mpd/base/mpd_options.h>
20 
21 namespace shaka {
22 
23 class MediaInfo;
24 struct ContentProtectionElement;
25 
28 class MpdNotifier {
29  public:
30  explicit MpdNotifier(const MpdOptions& mpd_options)
31  : mpd_options_(mpd_options) {}
32  virtual ~MpdNotifier() {}
33 
37  virtual bool Init() = 0;
38 
47  virtual bool NotifyNewContainer(const MediaInfo& media_info,
48  uint32_t* container_id) = 0;
49 
55  virtual bool NotifyAvailabilityTimeOffset(uint32_t container_id) {
56  UNUSED(container_id);
57  return true;
58  }
59 
67  virtual bool NotifySampleDuration(uint32_t container_id,
68  int32_t sample_duration) = 0;
69 
75  virtual bool NotifySegmentDuration(uint32_t container_id) {
76  UNUSED(container_id);
77  return true;
78  }
79 
92  virtual bool NotifyNewSegment(uint32_t container_id,
93  int64_t start_time,
94  int64_t duration,
95  uint64_t size,
96  int64_t segment_number) = 0;
97 
109  virtual bool NotifyCompletedSegment(uint32_t container_id,
110  int64_t duration,
111  uint64_t size) {
112  UNUSED(container_id);
113  UNUSED(duration);
114  UNUSED(size);
115  return true;
116  }
117 
123  virtual bool NotifyCueEvent(uint32_t container_id, int64_t timestamp) = 0;
124 
134  virtual bool NotifyEncryptionUpdate(uint32_t container_id,
135  const std::string& drm_uuid,
136  const std::vector<uint8_t>& new_key_id,
137  const std::vector<uint8_t>& new_pssh) = 0;
138 
143  virtual bool NotifyMediaInfoUpdate(uint32_t container_id,
144  const MediaInfo& media_info) = 0;
145 
149  virtual bool Flush() = 0;
150 
152  bool include_mspr_pro() const { return mpd_options_.mpd_params.include_mspr_pro; }
153 
155  DashProfile dash_profile() const { return mpd_options_.dash_profile; }
156 
158  MpdType mpd_type() const { return mpd_options_.mpd_type; }
159 
161  bool use_segment_list() const {
162  return mpd_options_.mpd_params.use_segment_list;
163  }
164 
165  private:
166  const MpdOptions mpd_options_;
167 
168  DISALLOW_COPY_AND_ASSIGN(MpdNotifier);
169 };
170 
171 } // namespace shaka
172 
173 #endif // MPD_BASE_MPD_NOTIFIER_H_
MpdType mpd_type() const
Definition: mpd_notifier.h:158
bool use_segment_list() const
Definition: mpd_notifier.h:161
DashProfile dash_profile() const
Definition: mpd_notifier.h:155
virtual bool NotifySampleDuration(uint32_t container_id, int32_t sample_duration)=0
virtual bool NotifyMediaInfoUpdate(uint32_t container_id, const MediaInfo &media_info)=0
virtual bool NotifyNewSegment(uint32_t container_id, int64_t start_time, int64_t duration, uint64_t size, int64_t segment_number)=0
virtual bool NotifyCompletedSegment(uint32_t container_id, int64_t duration, uint64_t size)
Definition: mpd_notifier.h:109
virtual bool NotifyAvailabilityTimeOffset(uint32_t container_id)
Definition: mpd_notifier.h:55
virtual bool NotifyEncryptionUpdate(uint32_t container_id, const std::string &drm_uuid, const std::vector< uint8_t > &new_key_id, const std::vector< uint8_t > &new_pssh)=0
virtual bool Init()=0
virtual bool NotifyCueEvent(uint32_t container_id, int64_t timestamp)=0
virtual bool NotifySegmentDuration(uint32_t container_id)
Definition: mpd_notifier.h:75
virtual bool NotifyNewContainer(const MediaInfo &media_info, uint32_t *container_id)=0
bool include_mspr_pro() const
Definition: mpd_notifier.h:152
virtual bool Flush()=0
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66
Defines Mpd Options.
Definition: mpd_options.h:25