2014-02-14 23:21:05 +00:00
|
|
|
// 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
|
|
|
|
//
|
2013-12-05 23:13:35 +00:00
|
|
|
// MpdNotifier is responsible for notifying the MpdBuilder class to generate an
|
|
|
|
// MPD file.
|
2014-02-14 23:21:05 +00:00
|
|
|
|
2013-12-05 23:13:35 +00:00
|
|
|
#ifndef MPD_BASE_MPD_NOTIFIER_H_
|
|
|
|
#define MPD_BASE_MPD_NOTIFIER_H_
|
|
|
|
|
|
|
|
#include "base/basictypes.h"
|
|
|
|
|
|
|
|
namespace dash_packager {
|
|
|
|
|
|
|
|
class MediaInfo;
|
2014-05-19 21:30:58 +00:00
|
|
|
struct ContentProtectionElement;
|
2013-12-05 23:13:35 +00:00
|
|
|
|
2014-02-06 21:20:36 +00:00
|
|
|
/// Interface for publish/subscribe publisher class which notifies MpdBuilder
|
|
|
|
/// of media-related events.
|
2013-12-05 23:13:35 +00:00
|
|
|
class MpdNotifier {
|
|
|
|
public:
|
|
|
|
MpdNotifier() {};
|
|
|
|
virtual ~MpdNotifier() {};
|
|
|
|
|
2014-02-06 21:20:36 +00:00
|
|
|
/// Initializes the notifier. For example, if this notifier uses a network for
|
|
|
|
/// notification, then this would set up the connection with the remote host.
|
|
|
|
/// @return true on success, false otherwise.
|
2013-12-05 23:13:35 +00:00
|
|
|
virtual bool Init() = 0;
|
|
|
|
|
2014-02-06 21:20:36 +00:00
|
|
|
/// Notifies the MpdBuilder that there is a new container along with
|
|
|
|
/// @a media_info. Live may have multiple files (segments) but those should be
|
|
|
|
/// notified via NotifyNewSegment().
|
|
|
|
/// @param media_info is the MediaInfo that will be passed to MpdBuilder.
|
|
|
|
/// @param[out] container_id is the numeric ID of the container, possibly for
|
|
|
|
/// NotifyNewSegment() and AddContentProtectionElement(). Only
|
|
|
|
/// populated on success.
|
|
|
|
/// @return true on success, false otherwise.
|
2013-12-05 23:13:35 +00:00
|
|
|
virtual bool NotifyNewContainer(const MediaInfo& media_info,
|
|
|
|
uint32* container_id) = 0;
|
|
|
|
|
2014-02-06 21:20:36 +00:00
|
|
|
/// Notifies MpdBuilder that there is a new segment ready. Used only for live
|
|
|
|
/// profile.
|
|
|
|
/// @param container_id Container ID obtained from calling
|
|
|
|
/// NotifyNewContainer().
|
|
|
|
/// @param start_time is the start time of the new segment, in units of the
|
|
|
|
/// stream's time scale.
|
|
|
|
/// @param duration is the duration of the new segment, in units of the
|
|
|
|
/// stream's time scale..
|
|
|
|
/// @return true on success, false otherwise.
|
2013-12-05 23:13:35 +00:00
|
|
|
virtual bool NotifyNewSegment(uint32 container_id,
|
|
|
|
uint64 start_time,
|
|
|
|
uint64 duration) = 0;
|
|
|
|
|
2014-02-06 21:20:36 +00:00
|
|
|
/// Adds content protection information to the MPD.
|
|
|
|
/// @param container_id is the nummeric container ID obtained from calling
|
|
|
|
/// NotifyNewContainer().
|
|
|
|
/// @param content_protection_element New ContentProtection element
|
|
|
|
/// specification.
|
|
|
|
/// @return true on success, false otherwise.
|
2013-12-05 23:13:35 +00:00
|
|
|
virtual bool AddContentProtectionElement(
|
|
|
|
uint32 container_id,
|
|
|
|
const ContentProtectionElement& content_protection_element) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dash_packager
|
|
|
|
|
|
|
|
#endif // MPD_BASE_MPD_NOTIFIER_H_
|