DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs
simple_mpd_notifier.h
1 // Copyright 2014 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 MPD_BASE_SIMPLE_MPD_NOTIFIER_H_
8 #define MPD_BASE_SIMPLE_MPD_NOTIFIER_H_
9 
10 #include <map>
11 #include <string>
12 #include <vector>
13 
14 #include "packager/base/gtest_prod_util.h"
15 #include "packager/base/memory/scoped_ptr.h"
16 #include "packager/base/synchronization/lock.h"
17 #include "packager/mpd/base/mpd_notifier.h"
18 #include "packager/mpd/base/mpd_notifier_util.h"
19 
20 namespace edash_packager {
21 
22 class AdaptationSet;
23 class MpdBuilder;
24 class Representation;
25 class SimpleMpdNotifierTest;
26 
27 struct MpdOptions;
28 
32  public:
33  SimpleMpdNotifier(DashProfile dash_profile,
34  const MpdOptions& mpd_options,
35  const std::vector<std::string>& base_urls,
36  const std::string& output_path);
37  virtual ~SimpleMpdNotifier();
38 
41  virtual bool Init() OVERRIDE;
42  virtual bool NotifyNewContainer(const MediaInfo& media_info,
43  uint32_t* id) OVERRIDE;
44  virtual bool NotifySampleDuration(uint32_t container_id,
45  uint32_t sample_duration) OVERRIDE;
46  virtual bool NotifyNewSegment(uint32_t id,
47  uint64_t start_time,
48  uint64_t duration,
49  uint64_t size) OVERRIDE;
50  virtual bool NotifyEncryptionUpdate(
51  uint32_t container_id,
52  const std::string& drm_uuid,
53  const std::vector<uint8_t>& new_key_id,
54  const std::vector<uint8_t>& new_pssh) OVERRIDE;
55  virtual bool AddContentProtectionElement(
56  uint32_t id,
57  const ContentProtectionElement& content_protection_element) OVERRIDE;
58  virtual bool Flush() OVERRIDE;
60 
61  private:
62  friend class SimpleMpdNotifierTest;
63 
64  // Testing only method. Returns a pointer to MpdBuilder.
65  MpdBuilder* MpdBuilderForTesting() const {
66  return mpd_builder_.get();
67  }
68 
69  // Testing only method. Sets mpd_builder_.
70  void SetMpdBuilderForTesting(scoped_ptr<MpdBuilder> mpd_builder) {
71  mpd_builder_ = mpd_builder.Pass();
72  }
73 
74  // MPD output path.
75  std::string output_path_;
76  scoped_ptr<MpdBuilder> mpd_builder_;
77  base::Lock lock_;
78 
79  // [type][lang] = AdaptationSet
80  typedef std::map<ContentType, std::map<std::string, AdaptationSet*> >
81  AdaptationSetMap;
82  AdaptationSetMap adaptation_set_map_;
83 
84  typedef std::map<uint32_t, Representation*> RepresentationMap;
85  RepresentationMap representation_map_;
86 
87  DISALLOW_COPY_AND_ASSIGN(SimpleMpdNotifier);
88 };
89 
90 } // namespace edash_packager
91 
92 #endif // MPD_BASE_SIMPLE_MPD_NOTIFIER_H_
Defines Mpd Options.
Definition: mpd_options.h:13
DashProfile dash_profile() const
Definition: mpd_notifier.h:108
This class generates DASH MPDs (Media Presentation Descriptions).
Definition: mpd_builder.h:56
virtual bool NotifyNewSegment(uint32_t id, uint64_t start_time, uint64_t duration, uint64_t size) OVERRIDE
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) OVERRIDE
virtual bool AddContentProtectionElement(uint32_t id, const ContentProtectionElement &content_protection_element) OVERRIDE
virtual bool NotifySampleDuration(uint32_t container_id, uint32_t sample_duration) OVERRIDE
virtual bool NotifyNewContainer(const MediaInfo &media_info, uint32_t *id) OVERRIDE