2022-08-26 15:44:59 +00:00
|
|
|
// Copyright 2015 Google LLC. All rights reserved.
|
2015-07-16 06:51:24 +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 MPD_BASE_MOCK_MPD_BUILDER_H_
|
|
|
|
#define MPD_BASE_MOCK_MPD_BUILDER_H_
|
|
|
|
|
|
|
|
#include <gmock/gmock.h>
|
|
|
|
|
2023-08-05 03:45:21 +00:00
|
|
|
#include "absl/synchronization/mutex.h"
|
|
|
|
#include "packager/macros.h"
|
2017-12-13 01:26:37 +00:00
|
|
|
#include "packager/mpd/base/adaptation_set.h"
|
2015-07-16 06:51:24 +00:00
|
|
|
#include "packager/mpd/base/content_protection_element.h"
|
|
|
|
#include "packager/mpd/base/mpd_builder.h"
|
2017-12-14 01:00:11 +00:00
|
|
|
#include "packager/mpd/base/period.h"
|
2017-12-13 01:26:37 +00:00
|
|
|
#include "packager/mpd/base/representation.h"
|
2015-07-16 06:51:24 +00:00
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
namespace shaka {
|
2015-07-16 06:51:24 +00:00
|
|
|
|
|
|
|
class MockMpdBuilder : public MpdBuilder {
|
|
|
|
public:
|
2016-12-21 23:28:56 +00:00
|
|
|
MockMpdBuilder();
|
2015-07-22 23:40:45 +00:00
|
|
|
~MockMpdBuilder() override;
|
2015-07-16 06:51:24 +00:00
|
|
|
|
2018-01-03 00:10:54 +00:00
|
|
|
MOCK_METHOD1(GetOrCreatePeriod, Period*(double start_time_in_seconds));
|
2015-07-16 06:51:24 +00:00
|
|
|
MOCK_METHOD1(ToString, bool(std::string* output));
|
|
|
|
};
|
|
|
|
|
2017-12-14 01:00:11 +00:00
|
|
|
class MockPeriod : public Period {
|
|
|
|
public:
|
2018-01-03 00:10:54 +00:00
|
|
|
MockPeriod(uint32_t period_id, double start_time_in_seconds);
|
2017-12-14 01:00:11 +00:00
|
|
|
|
|
|
|
MOCK_METHOD2(GetOrCreateAdaptationSet,
|
|
|
|
AdaptationSet*(const MediaInfo& media_info,
|
|
|
|
bool content_protection_in_adaptation_set));
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Only for constructing the super class. Not used for testing.
|
2018-07-23 22:24:20 +00:00
|
|
|
uint32_t sequence_counter_ = 0;
|
2017-12-14 01:00:11 +00:00
|
|
|
};
|
|
|
|
|
2015-07-16 06:51:24 +00:00
|
|
|
class MockAdaptationSet : public AdaptationSet {
|
|
|
|
public:
|
2018-01-25 23:04:59 +00:00
|
|
|
MockAdaptationSet();
|
2015-07-22 23:40:45 +00:00
|
|
|
~MockAdaptationSet() override;
|
2015-07-16 06:51:24 +00:00
|
|
|
|
|
|
|
MOCK_METHOD1(AddRepresentation, Representation*(const MediaInfo& media_info));
|
2018-01-29 18:37:50 +00:00
|
|
|
MOCK_METHOD1(CopyRepresentation,
|
|
|
|
Representation*(const Representation& representation));
|
2015-07-22 06:57:21 +00:00
|
|
|
MOCK_METHOD1(AddContentProtectionElement,
|
|
|
|
void(const ContentProtectionElement& element));
|
2015-09-24 22:03:52 +00:00
|
|
|
MOCK_METHOD2(UpdateContentProtectionPssh,
|
|
|
|
void(const std::string& drm_uuid, const std::string& pssh));
|
2015-08-05 23:00:02 +00:00
|
|
|
MOCK_METHOD1(AddRole, void(AdaptationSet::Role role));
|
2015-10-29 20:58:36 +00:00
|
|
|
MOCK_METHOD1(ForceSetSegmentAlignment, void(bool segment_alignment));
|
2018-01-25 23:04:59 +00:00
|
|
|
MOCK_METHOD1(AddAdaptationSetSwitching,
|
|
|
|
void(const AdaptationSet* adaptation_set));
|
|
|
|
MOCK_METHOD1(AddTrickPlayReference,
|
|
|
|
void(const AdaptationSet* adaptation_set));
|
2015-07-22 06:57:21 +00:00
|
|
|
|
2015-07-16 06:51:24 +00:00
|
|
|
private:
|
|
|
|
// Only for constructing the super class. Not used for testing.
|
2018-07-23 22:24:20 +00:00
|
|
|
uint32_t sequence_counter_ = 0;
|
2015-07-16 06:51:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class MockRepresentation : public Representation {
|
|
|
|
public:
|
|
|
|
// |representation_id| is the numeric ID for the <Representation>.
|
|
|
|
explicit MockRepresentation(uint32_t representation_id);
|
2015-07-22 23:40:45 +00:00
|
|
|
~MockRepresentation() override;
|
2015-07-16 06:51:24 +00:00
|
|
|
|
|
|
|
MOCK_METHOD1(AddContentProtectionElement,
|
|
|
|
void(const ContentProtectionElement& element));
|
2015-09-24 22:03:52 +00:00
|
|
|
MOCK_METHOD2(UpdateContentProtectionPssh,
|
|
|
|
void(const std::string& drm_uuid, const std::string& pssh));
|
2015-07-16 06:51:24 +00:00
|
|
|
MOCK_METHOD3(AddNewSegment,
|
2018-06-22 01:14:34 +00:00
|
|
|
void(int64_t start_time, int64_t duration, uint64_t size));
|
2021-08-25 15:38:05 +00:00
|
|
|
MOCK_METHOD0(SetSegmentDuration, void());
|
|
|
|
MOCK_METHOD0(SetAvailabilityTimeOffset, void());
|
2021-08-04 18:56:44 +00:00
|
|
|
MOCK_METHOD1(SetSampleDuration, void(int32_t sample_duration));
|
2018-01-03 00:10:54 +00:00
|
|
|
MOCK_CONST_METHOD0(GetMediaInfo, const MediaInfo&());
|
2015-07-16 06:51:24 +00:00
|
|
|
};
|
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
} // namespace shaka
|
2015-07-16 06:51:24 +00:00
|
|
|
|
|
|
|
#endif // MPD_BASE_MOCK_MPD_BUILDER_H_
|