// Copyright 2014 Google Inc. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd #ifndef MPD_BASE_SIMPLE_MPD_NOTIFIER_H_ #define MPD_BASE_SIMPLE_MPD_NOTIFIER_H_ #include #include #include #include "packager/base/gtest_prod_util.h" #include "packager/base/memory/scoped_ptr.h" #include "packager/base/synchronization/lock.h" #include "packager/mpd/base/mpd_notifier.h" #include "packager/mpd/base/mpd_notifier_util.h" namespace shaka { class AdaptationSet; class MpdBuilder; class Representation; class SimpleMpdNotifierTest; struct MpdOptions; /// A simple MpdNotifier implementation which receives muxer listener event and /// generates an Mpd file. class SimpleMpdNotifier : public MpdNotifier { public: SimpleMpdNotifier(DashProfile dash_profile, const MpdOptions& mpd_options, const std::vector& base_urls, const std::string& output_path); ~SimpleMpdNotifier() override; /// @name MpdNotifier implemetation overrides. /// @{ bool Init() override; bool NotifyNewContainer(const MediaInfo& media_info, uint32_t* id) override; bool NotifySampleDuration(uint32_t container_id, uint32_t sample_duration) override; bool NotifyNewSegment(uint32_t id, uint64_t start_time, uint64_t duration, uint64_t size) override; bool NotifyEncryptionUpdate(uint32_t container_id, const std::string& drm_uuid, const std::vector& new_key_id, const std::vector& new_pssh) override; bool AddContentProtectionElement( uint32_t id, const ContentProtectionElement& content_protection_element) override; bool Flush() override; /// @} private: friend class SimpleMpdNotifierTest; // Testing only method. Returns a pointer to MpdBuilder. MpdBuilder* MpdBuilderForTesting() const { return mpd_builder_.get(); } // Testing only method. Sets mpd_builder_. void SetMpdBuilderForTesting(scoped_ptr mpd_builder) { mpd_builder_ = mpd_builder.Pass(); } // MPD output path. std::string output_path_; scoped_ptr mpd_builder_; base::Lock lock_; typedef std::map AdaptationSetMap; AdaptationSetMap adaptation_set_map_; typedef std::map RepresentationMap; RepresentationMap representation_map_; DISALLOW_COPY_AND_ASSIGN(SimpleMpdNotifier); }; } // namespace shaka #endif // MPD_BASE_SIMPLE_MPD_NOTIFIER_H_