7 #include "packager/mpd/base/mpd_notifier_util.h"
9 #include "packager/base/strings/string_number_conversions.h"
10 #include "packager/base/strings/string_util.h"
11 #include "packager/file/file.h"
12 #include "packager/mpd/base/mpd_utils.h"
17 CHECK(!output_path.empty());
21 LOG(ERROR) <<
"Failed to write MPD to string.";
25 if (!File::WriteFileAtomically(output_path.c_str(), mpd)) {
26 LOG(ERROR) <<
"Failed to write mpd to: " << output_path;
33 const bool has_video = media_info.has_video_info();
34 const bool has_audio = media_info.has_audio_info();
35 const bool has_text = media_info.has_text_info();
37 if (MoreThanOneTrue(has_video, has_audio, has_text)) {
38 NOTIMPLEMENTED() <<
"MediaInfo with more than one stream is not supported.";
39 return kContentTypeUnknown;
41 if (!AtLeastOneTrue(has_video, has_audio, has_text)) {
42 LOG(ERROR) <<
"MediaInfo should contain one audio, video, or text stream.";
43 return kContentTypeUnknown;
45 return has_video ? kContentTypeVideo
46 : (has_audio ? kContentTypeAudio : kContentTypeText);
51 std::string input_in_string(input.begin(), input.end());
52 base::Base64Encode(input_in_string, &output);
This class generates DASH MPDs (Media Presentation Descriptions).
std::string Uint8VectorToBase64(const std::vector< uint8_t > &input)
Converts uint8 vector into base64 encoded string.
virtual bool ToString(std::string *output)
ContentType GetContentType(const MediaInfo &media_info)
bool WriteMpdToFile(const std::string &output_path, MpdBuilder *mpd_builder)