7 #include <packager/mpd/base/mpd_notifier_util.h>
9 #include <absl/log/check.h>
10 #include <absl/log/log.h>
12 #include <packager/file.h>
13 #include <packager/macros/logging.h>
14 #include <packager/mpd/base/mpd_utils.h>
19 CHECK(!output_path.empty());
23 LOG(ERROR) <<
"Failed to write MPD to string.";
27 if (!File::WriteFileAtomically(output_path.c_str(), mpd)) {
28 LOG(ERROR) <<
"Failed to write mpd to: " << output_path;
35 const bool has_video = media_info.has_video_info();
36 const bool has_audio = media_info.has_audio_info();
37 const bool has_text = media_info.has_text_info();
39 if (MoreThanOneTrue(has_video, has_audio, has_text)) {
40 NOTIMPLEMENTED() <<
"MediaInfo with more than one stream is not supported.";
41 return kContentTypeUnknown;
43 if (!AtLeastOneTrue(has_video, has_audio, has_text)) {
44 LOG(ERROR) <<
"MediaInfo should contain one audio, video, or text stream.";
45 return kContentTypeUnknown;
47 return has_video ? kContentTypeVideo
48 : (has_audio ? kContentTypeAudio : kContentTypeText);
53 std::string input_in_string(input.begin(), input.end());
54 absl::Base64Escape(input_in_string, &output);
This class generates DASH MPDs (Media Presentation Descriptions).
virtual bool ToString(std::string *output)
All the methods that are virtual are virtual for mocking.
std::string Uint8VectorToBase64(const std::vector< uint8_t > &input)
Converts uint8 vector into base64 encoded string.
ContentType GetContentType(const MediaInfo &media_info)
bool WriteMpdToFile(const std::string &output_path, MpdBuilder *mpd_builder)