Add method to set AdaptationSet@group
Change-Id: Iba147806417aa2a87525318b00a4980b68c38c39
This commit is contained in:
parent
5c8efd332e
commit
4e2b70c939
|
@ -35,6 +35,8 @@ using xml::AdaptationSetXmlNode;
|
|||
|
||||
namespace {
|
||||
|
||||
const int kAdaptationSetGroupNotSet = -1;
|
||||
|
||||
std::string GetMimeType(const std::string& prefix,
|
||||
MediaInfo::ContainerType container_type) {
|
||||
switch (container_type) {
|
||||
|
@ -565,7 +567,8 @@ AdaptationSet::AdaptationSet(uint32_t adaptation_set_id,
|
|||
representation_counter_(counter),
|
||||
id_(adaptation_set_id),
|
||||
lang_(lang),
|
||||
mpd_options_(mpd_options) {
|
||||
mpd_options_(mpd_options),
|
||||
group_(kAdaptationSetGroupNotSet) {
|
||||
DCHECK(counter);
|
||||
}
|
||||
|
||||
|
@ -664,6 +667,9 @@ xml::ScopedXmlPtr<xmlNode>::type AdaptationSet::GetXml() {
|
|||
|
||||
if (picture_aspect_ratio_.size() == 1)
|
||||
adaptation_set.SetStringAttribute("par", *picture_aspect_ratio_.begin());
|
||||
|
||||
if (group_ >= 0)
|
||||
adaptation_set.SetIntegerAttribute("group", group_);
|
||||
return adaptation_set.PassScopedPtr();
|
||||
}
|
||||
|
||||
|
|
|
@ -175,6 +175,15 @@ class AdaptationSet {
|
|||
/// NULL ScopedXmlPtr.
|
||||
xml::ScopedXmlPtr<xmlNode>::type GetXml();
|
||||
|
||||
/// Sets the AdaptationSet@group attribute.
|
||||
/// Passing a negative value to this method will unset the attribute.
|
||||
/// Note that group=0 is a special group, as mentioned in the DASH MPD
|
||||
/// specification.
|
||||
/// @param group_number is the value of AdaptatoinSet@group.
|
||||
void set_group(int group_number) {
|
||||
group_ = group_number;
|
||||
}
|
||||
|
||||
// Must be unique in the Period.
|
||||
uint32_t id() const { return id_; }
|
||||
|
||||
|
@ -187,6 +196,7 @@ class AdaptationSet {
|
|||
CheckAdaptationSetAudioContentType);
|
||||
FRIEND_TEST_ALL_PREFIXES(CommonMpdBuilderTest,
|
||||
CheckAdaptationSetTextContentType);
|
||||
FRIEND_TEST_ALL_PREFIXES(CommonMpdBuilderTest, SetAdaptationSetGroup);
|
||||
|
||||
/// @param adaptation_set_id is an ID number for this AdaptationSet.
|
||||
/// @param representation_counter is a Counter for assigning ID numbers to
|
||||
|
@ -212,6 +222,11 @@ class AdaptationSet {
|
|||
const std::string lang_;
|
||||
const MpdOptions& mpd_options_;
|
||||
|
||||
// The group attribute for the AdaptationSet. If the value is negative,
|
||||
// no group number is specified.
|
||||
// Note that group 0 is a special group number.
|
||||
int group_;
|
||||
|
||||
// Video widths and heights of Representations. Note that this is a set; if
|
||||
// there is only 1 resolution, then @width & @height should be set, otherwise
|
||||
// @maxWidth & @maxHeight should be set for DASH IOP.
|
||||
|
|
|
@ -325,6 +325,24 @@ class TimeShiftBufferDepthTest : public SegmentTemplateTest {
|
|||
}
|
||||
};
|
||||
|
||||
// Verify that AdaptationSet@group can be set and unset.
|
||||
TEST_F(CommonMpdBuilderTest, SetAdaptationSetGroup) {
|
||||
base::AtomicSequenceNumber sequence_counter;
|
||||
AdaptationSet adaptation_set(
|
||||
kAnyAdaptationSetId, "", MpdOptions(), &sequence_counter);
|
||||
adaptation_set.set_group(1);
|
||||
|
||||
xml::ScopedXmlPtr<xmlNode>::type xml_with_group(adaptation_set.GetXml());
|
||||
EXPECT_NO_FATAL_FAILURE(
|
||||
ExpectAttributeEqString("group", "1", xml_with_group.get()));
|
||||
|
||||
// Unset by passing a negative value.
|
||||
adaptation_set.set_group(-1);
|
||||
xml::ScopedXmlPtr<xmlNode>::type xml_without_group(adaptation_set.GetXml());
|
||||
EXPECT_NO_FATAL_FAILURE(
|
||||
ExpectAttributeNotSet("group", xml_without_group.get()));
|
||||
}
|
||||
|
||||
// Verify that Representation::Init() works with all "required" fields of
|
||||
// MedieInfo proto.
|
||||
TEST_F(CommonMpdBuilderTest, ValidMediaInfo) {
|
||||
|
|
Loading…
Reference in New Issue