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-11-18 23:39:20 +00:00
|
|
|
// Funtions used by MpdBuilder class to generate an MPD file.
|
2014-02-14 23:21:05 +00:00
|
|
|
|
2013-11-18 23:39:20 +00:00
|
|
|
#ifndef MPD_BASE_MPD_UTILS_H_
|
|
|
|
#define MPD_BASE_MPD_UTILS_H_
|
|
|
|
|
2014-08-28 18:35:15 +00:00
|
|
|
#include <libxml/tree.h>
|
|
|
|
|
2013-11-18 23:39:20 +00:00
|
|
|
#include <string>
|
|
|
|
|
2014-09-19 20:41:13 +00:00
|
|
|
namespace edash_packager {
|
2013-11-18 23:39:20 +00:00
|
|
|
|
2014-05-22 02:16:17 +00:00
|
|
|
class MediaInfo;
|
2014-03-21 17:26:49 +00:00
|
|
|
struct ContentProtectionElement;
|
2014-05-22 02:16:17 +00:00
|
|
|
struct SegmentInfo;
|
2013-11-18 23:39:20 +00:00
|
|
|
|
|
|
|
bool HasVODOnlyFields(const MediaInfo& media_info);
|
|
|
|
|
|
|
|
bool HasLiveOnlyFields(const MediaInfo& media_info);
|
|
|
|
|
|
|
|
// If |content_protection_element| has 'value' or 'schemeIdUri' set but it's
|
|
|
|
// also in the map, then this removes them from the map.
|
|
|
|
// |content_protection_element| cannot be NULL.
|
|
|
|
void RemoveDuplicateAttributes(
|
|
|
|
ContentProtectionElement* content_protection_element);
|
|
|
|
|
|
|
|
// Returns a 'codecs' string that has all the video and audio codecs joined with
|
|
|
|
// comma.
|
|
|
|
std::string GetCodecs(const MediaInfo& media_info);
|
|
|
|
|
2014-05-22 02:16:17 +00:00
|
|
|
std::string SecondsToXmlDuration(double seconds);
|
2013-11-18 23:39:20 +00:00
|
|
|
|
|
|
|
// Tries to get "duration" attribute from |node|. On success |duration| is set.
|
2014-01-03 00:59:16 +00:00
|
|
|
bool GetDurationAttribute(xmlNodePtr node, float* duration);
|
2013-11-18 23:39:20 +00:00
|
|
|
|
2014-06-06 08:52:06 +00:00
|
|
|
bool MoreThanOneTrue(bool b1, bool b2, bool b3);
|
|
|
|
bool AtLeastOneTrue(bool b1, bool b2, bool b3);
|
|
|
|
bool OnlyOneTrue(bool b1, bool b2, bool b3);
|
|
|
|
|
2014-09-19 20:41:13 +00:00
|
|
|
} // namespace edash_packager
|
2013-11-18 23:39:20 +00:00
|
|
|
|
|
|
|
#endif // MPD_BASE_MPD_UTILS_H_
|