2023-12-01 17:32:19 +00:00
|
|
|
// Copyright 2016 Google LLC. All rights reserved.
|
2016-03-25 08:39:07 +00:00
|
|
|
//
|
|
|
|
// 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 PACKAGER_HLS_BASE_MASTER_PLAYLIST_H_
|
|
|
|
#define PACKAGER_HLS_BASE_MASTER_PLAYLIST_H_
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
#include <filesystem>
|
2016-03-25 08:39:07 +00:00
|
|
|
#include <list>
|
|
|
|
#include <string>
|
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
namespace shaka {
|
2016-03-25 08:39:07 +00:00
|
|
|
namespace hls {
|
|
|
|
|
|
|
|
class MediaPlaylist;
|
|
|
|
|
|
|
|
/// Class to generate HLS Master Playlist.
|
2016-03-25 08:40:15 +00:00
|
|
|
/// Methods are virtual for mocking.
|
2016-03-25 08:39:07 +00:00
|
|
|
class MasterPlaylist {
|
|
|
|
public:
|
|
|
|
/// @param file_name is the file name of the master playlist.
|
2018-11-20 00:09:24 +00:00
|
|
|
/// @param default_audio_language determines the audio rendition that should
|
|
|
|
/// be tagged with 'DEFAULT'.
|
|
|
|
/// @param default_text_language determines the text rendition that should be
|
|
|
|
/// tagged with 'DEFAULT'.
|
2023-12-01 17:32:19 +00:00
|
|
|
MasterPlaylist(const std::filesystem::path& file_name,
|
2018-11-20 00:09:24 +00:00
|
|
|
const std::string& default_audio_language,
|
2023-12-01 17:32:19 +00:00
|
|
|
const std::string& default_text_language,
|
2024-10-25 16:55:27 +00:00
|
|
|
const bool is_independent_segments,
|
|
|
|
const bool create_session_keys = false);
|
2016-03-25 08:40:15 +00:00
|
|
|
virtual ~MasterPlaylist();
|
2016-03-25 08:39:07 +00:00
|
|
|
|
|
|
|
/// Writes Master Playlist to output_dir + <name of playlist>.
|
|
|
|
/// This assumes that @a base_url is used as the prefix for Media Playlists.
|
|
|
|
/// @param base_url is the prefix for the Media Playlist files. This should be
|
|
|
|
/// in URI form such that base_url+file_name is a valid HLS URI.
|
|
|
|
/// @param output_dir is where the playlist files are written. This is not
|
|
|
|
/// necessarily the same as base_url. It must be in a form that File
|
|
|
|
/// interface can open.
|
2017-06-03 00:05:47 +00:00
|
|
|
/// @return true if the playlist is updated successfully or there is no
|
|
|
|
/// difference since the last write, false otherwise.
|
2016-03-25 08:40:15 +00:00
|
|
|
virtual bool WriteMasterPlaylist(const std::string& base_url,
|
2018-02-02 17:14:46 +00:00
|
|
|
const std::string& output_dir,
|
|
|
|
const std::list<MediaPlaylist*>& playlists);
|
2016-03-25 08:39:07 +00:00
|
|
|
|
|
|
|
private:
|
2018-02-02 17:14:46 +00:00
|
|
|
MasterPlaylist(const MasterPlaylist&) = delete;
|
|
|
|
MasterPlaylist& operator=(const MasterPlaylist&) = delete;
|
|
|
|
|
2017-06-03 00:05:47 +00:00
|
|
|
std::string written_playlist_;
|
2023-12-01 17:32:19 +00:00
|
|
|
const std::filesystem::path file_name_;
|
2018-11-20 00:09:24 +00:00
|
|
|
const std::string default_audio_language_;
|
|
|
|
const std::string default_text_language_;
|
2020-08-19 18:17:21 +00:00
|
|
|
bool is_independent_segments_;
|
2024-10-25 16:55:27 +00:00
|
|
|
bool create_session_keys_;
|
2016-03-25 08:39:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace hls
|
2016-05-20 21:19:33 +00:00
|
|
|
} // namespace shaka
|
2016-03-25 08:39:07 +00:00
|
|
|
|
|
|
|
#endif // PACKAGER_HLS_BASE_MASTER_PLAYLIST_H_
|