mirror of
https://github.com/shaka-project/shaka-packager.git
synced 2026-04-06 21:32:10 +00:00
This change introduces support for signaling CEA-608 and CEA-708 closed captions in DASH. (Equivalent of https://github.com/shaka-project/shaka-packager/pull/1532) It reuses the existing --closed_captions command-line flag. Note that some options (name, autoselect, and default) are not used for DASH. ``` --closed_captions 'channel=CC1,lang=fra;channel=CC2,lang=eng;channel=SERVICE1,lang=eng' ``` For Dash this adds an Accessibility tag in each video AdaptationSet. Example output : ``` <AdaptationSet id="1" contentType="video" ....> <Accessibility schemeIdUri="urn:scte:dash:cc:cea-608:2015" value="CC1=fra"/> <Accessibility schemeIdUri="urn:scte:dash:cc:cea-608:2015" value="CC2=eng"/> <Accessibility schemeIdUri="urn:scte:dash:cc:cea-708:2015" value="1=lang:eng"/> ``` HLS changes : * We force the language to 2 characters to be consistent with the language of the audio files, for example. * closed_captions is now in packaging_params
92 lines
3.9 KiB
C++
92 lines
3.9 KiB
C++
// Copyright 2017 Google LLC. 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
|
|
|
|
#ifndef PACKAGER_PUBLIC_HLS_PARAMS_H_
|
|
#define PACKAGER_PUBLIC_HLS_PARAMS_H_
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include <packager/cea_caption.h>
|
|
|
|
namespace shaka {
|
|
|
|
/// Defines the EXT-X-PLAYLIST-TYPE in the HLS specification. For
|
|
/// HlsPlaylistType of kLive, EXT-X-PLAYLIST-TYPE tag is omitted.
|
|
enum class HlsPlaylistType {
|
|
kVod,
|
|
kEvent,
|
|
kLive,
|
|
};
|
|
|
|
/// HLS related parameters.
|
|
struct HlsParams {
|
|
/// HLS playlist type. See HLS specification for details.
|
|
HlsPlaylistType playlist_type = HlsPlaylistType::kVod;
|
|
/// Convert event stream to VOD once end of stream is detected
|
|
bool event_to_vod_on_end_of_stream = false;
|
|
/// HLS master playlist output path.
|
|
std::string master_playlist_output;
|
|
/// The base URL for the Media Playlists and media files listed in the
|
|
/// playlists. This is the prefix for the files.
|
|
std::string base_url;
|
|
/// Defines the live window, or the guaranteed duration of the time shifting
|
|
/// buffer for 'live' playlists.
|
|
double time_shift_buffer_depth = 0;
|
|
/// Segments outside the live window (defined by 'time_shift_buffer_depth'
|
|
/// above) are automatically removed except for the most recent X segments
|
|
/// defined by this parameter. This is needed to accommodate latencies in
|
|
/// various stages of content serving pipeline, so that the segments stay
|
|
/// accessible as they may still be accessed by the player. The segments are
|
|
/// not removed if the value is zero.
|
|
size_t preserved_segments_outside_live_window = 0;
|
|
/// Defines the key uri for "identity" and "com.apple.streamingkeydelivery"
|
|
/// key formats. Ignored if the playlist is not encrypted or not using the
|
|
/// above key formats.
|
|
std::string key_uri;
|
|
/// The renditions tagged with this language will have 'DEFAULT' set to 'YES'
|
|
/// in 'EXT-X-MEDIA' tag. This allows the player to choose the correct default
|
|
/// language for the content.
|
|
/// This applies to both audio and text tracks. The default language for text
|
|
/// tracks can be overriden by 'default_text_language'.
|
|
std::string default_language;
|
|
/// Same as above, but this overrides the default language for text tracks,
|
|
/// i.e. subtitles or close-captions.
|
|
std::string default_text_language;
|
|
// Indicates that all media samples in the media segments can be decoded
|
|
// without information from other segments.
|
|
bool is_independent_segments;
|
|
/// This is the target segment duration requested by the user. The actual
|
|
/// segment duration may be different to the target segment duration. It will
|
|
/// be populated from segment duration specified in ChunkingParams if not
|
|
/// specified.
|
|
double target_segment_duration = 0;
|
|
/// Custom EXT-X-MEDIA-SEQUENCE value to allow continuous media playback
|
|
/// across packager restarts. See #691 for details.
|
|
uint32_t media_sequence_number = 0;
|
|
/// Sets EXT-X-START on the media playlists to specify the preferred point
|
|
/// at wich the player should start playing.
|
|
/// A positive number indicates a time offset from the beginning of the
|
|
/// playlist. A negative number indicates a negative time offset from the end
|
|
/// of the last media segment in the playlist.
|
|
std::optional<double> start_time_offset;
|
|
/// Create EXT-X-SESSION-KEY in master playlist
|
|
bool create_session_keys;
|
|
/// Add EXT-X-PROGRAM-DATE-TIME tag to the playlist. The date time is derived
|
|
/// from the current wall clock.
|
|
bool add_program_date_time = false;
|
|
/// If true, TARGETDURATION will be calculated locally in MediaPlaylist.
|
|
bool per_playlist_target_duration = false;
|
|
/// CEA-608 / CEA-708 captions.
|
|
std::vector<CeaCaption> closed_captions;
|
|
};
|
|
|
|
} // namespace shaka
|
|
|
|
#endif // PACKAGER_PUBLIC_HLS_PARAMS_H_
|