Output SegmentList for some text streams.
This allows us to have presentationTimeOffset for text streams since this needs to appear on a SegmentList/SegmentBase/SegmentTemplate. Issue #832 Change-Id: Id3ab3308029185815d50a6cb1142e6a97f744d4f
This commit is contained in:
parent
c4a11aaed4
commit
346c844e42
|
@ -377,7 +377,10 @@ bool RepresentationXmlNode::AddAudioInfo(const AudioInfo& audio_info) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RepresentationXmlNode::AddVODOnlyInfo(const MediaInfo& media_info) {
|
bool RepresentationXmlNode::AddVODOnlyInfo(const MediaInfo& media_info) {
|
||||||
if (media_info.has_media_file_url()) {
|
const bool use_segment_list_text =
|
||||||
|
media_info.has_text_info() && media_info.has_presentation_time_offset();
|
||||||
|
|
||||||
|
if (media_info.has_media_file_url() && !use_segment_list_text) {
|
||||||
XmlNode base_url("BaseURL");
|
XmlNode base_url("BaseURL");
|
||||||
base_url.SetContent(media_info.media_file_url());
|
base_url.SetContent(media_info.media_file_url());
|
||||||
|
|
||||||
|
@ -387,22 +390,23 @@ bool RepresentationXmlNode::AddVODOnlyInfo(const MediaInfo& media_info) {
|
||||||
const bool need_segment_base =
|
const bool need_segment_base =
|
||||||
media_info.has_index_range() || media_info.has_init_range() ||
|
media_info.has_index_range() || media_info.has_init_range() ||
|
||||||
(media_info.has_reference_time_scale() && !media_info.has_text_info());
|
(media_info.has_reference_time_scale() && !media_info.has_text_info());
|
||||||
|
DCHECK(!need_segment_base || !use_segment_list_text);
|
||||||
|
|
||||||
if (need_segment_base) {
|
if (need_segment_base || use_segment_list_text) {
|
||||||
XmlNode segment_base("SegmentBase");
|
XmlNode child(need_segment_base ? "SegmentBase" : "SegmentList");
|
||||||
if (media_info.has_index_range()) {
|
if (media_info.has_index_range()) {
|
||||||
RCHECK(segment_base.SetStringAttribute(
|
RCHECK(child.SetStringAttribute("indexRange",
|
||||||
"indexRange", RangeToString(media_info.index_range())));
|
RangeToString(media_info.index_range())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (media_info.has_reference_time_scale()) {
|
if (media_info.has_reference_time_scale()) {
|
||||||
RCHECK(segment_base.SetIntegerAttribute(
|
RCHECK(child.SetIntegerAttribute("timescale",
|
||||||
"timescale", media_info.reference_time_scale()));
|
media_info.reference_time_scale()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (media_info.has_presentation_time_offset()) {
|
if (media_info.has_presentation_time_offset()) {
|
||||||
RCHECK(segment_base.SetIntegerAttribute(
|
RCHECK(child.SetIntegerAttribute("presentationTimeOffset",
|
||||||
"presentationTimeOffset", media_info.presentation_time_offset()));
|
media_info.presentation_time_offset()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (media_info.has_init_range()) {
|
if (media_info.has_init_range()) {
|
||||||
|
@ -410,10 +414,17 @@ bool RepresentationXmlNode::AddVODOnlyInfo(const MediaInfo& media_info) {
|
||||||
RCHECK(initialization.SetStringAttribute(
|
RCHECK(initialization.SetStringAttribute(
|
||||||
"range", RangeToString(media_info.init_range())));
|
"range", RangeToString(media_info.init_range())));
|
||||||
|
|
||||||
RCHECK(segment_base.AddChild(std::move(initialization)));
|
RCHECK(child.AddChild(std::move(initialization)));
|
||||||
}
|
}
|
||||||
|
|
||||||
RCHECK(AddChild(std::move(segment_base)));
|
if (use_segment_list_text) {
|
||||||
|
XmlNode media_url("SegmentURL");
|
||||||
|
RCHECK(
|
||||||
|
media_url.SetStringAttribute("media", media_info.media_file_url()));
|
||||||
|
RCHECK(child.AddChild(std::move(media_url)));
|
||||||
|
}
|
||||||
|
|
||||||
|
RCHECK(AddChild(std::move(child)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue