forked from youtube/cobalt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
player_test_util.h
126 lines (107 loc) · 4.44 KB
/
player_test_util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// Copyright 2020 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef STARBOARD_NPLB_PLAYER_TEST_UTIL_H_
#define STARBOARD_NPLB_PLAYER_TEST_UTIL_H_
#include <string>
#include <tuple>
#include <vector>
#include "starboard/configuration_constants.h"
#include "starboard/player.h"
#include "starboard/shared/starboard/media/media_util.h"
#include "starboard/shared/starboard/player/video_dmp_reader.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace starboard {
namespace nplb {
struct SbPlayerTestConfig {
SbPlayerTestConfig(const char* audio_filename,
const char* video_filename,
SbPlayerOutputMode output_mode,
const char* key_system)
: audio_filename(audio_filename),
video_filename(video_filename),
output_mode(output_mode),
key_system(key_system),
max_video_capabilities("") {}
SbPlayerTestConfig(const char* audio_filename,
const char* video_filename,
SbPlayerOutputMode output_mode,
const char* key_system,
const char* max_video_capabilities)
: audio_filename(audio_filename),
video_filename(video_filename),
output_mode(output_mode),
key_system(key_system),
max_video_capabilities(max_video_capabilities) {}
const char* audio_filename;
const char* video_filename;
SbPlayerOutputMode output_mode;
const char* key_system;
const char* max_video_capabilities;
};
std::vector<const char*> GetAudioTestFiles();
std::vector<const char*> GetVideoTestFiles();
std::vector<SbPlayerOutputMode> GetPlayerOutputModes();
std::vector<const char*> GetKeySystems();
std::vector<SbPlayerTestConfig> GetSupportedSbPlayerTestConfigs(
const char* key_system = "");
std::string GetSbPlayerTestConfigName(
::testing::TestParamInfo<SbPlayerTestConfig> info);
void DummyDeallocateSampleFunc(SbPlayer player,
void* context,
const void* sample_buffer);
void DummyDecoderStatusFunc(SbPlayer player,
void* context,
SbMediaType type,
SbPlayerDecoderState state,
int ticket);
void DummyPlayerStatusFunc(SbPlayer player,
void* context,
SbPlayerState state,
int ticket);
void DummyErrorFunc(SbPlayer player,
void* context,
SbPlayerError error,
const char* message);
SbPlayer CallSbPlayerCreate(
SbWindow window,
SbMediaVideoCodec video_codec,
SbMediaAudioCodec audio_codec,
SbDrmSystem drm_system,
const shared::starboard::media::AudioStreamInfo* audio_stream_info,
const char* max_video_capabilities,
SbPlayerDeallocateSampleFunc sample_deallocate_func,
SbPlayerDecoderStatusFunc decoder_status_func,
SbPlayerStatusFunc player_status_func,
SbPlayerErrorFunc player_error_func,
void* context,
SbPlayerOutputMode output_mode,
SbDecodeTargetGraphicsContextProvider* context_provider);
void CallSbPlayerWriteSamples(
SbPlayer player,
SbMediaType sample_type,
shared::starboard::player::video_dmp::VideoDmpReader* dmp_reader,
int start_index,
int number_of_samples_to_write,
int64_t timestamp_offset = 0,
const std::vector<int64_t>& discarded_durations_from_front = {},
const std::vector<int64_t>& discarded_durations_from_back = {});
bool IsOutputModeSupported(SbPlayerOutputMode output_mode,
SbMediaAudioCodec audio_codec,
SbMediaVideoCodec video_codec,
const char* key_system = "");
bool IsPartialAudioSupported();
bool IsAudioPassthroughUsed(const SbPlayerTestConfig& config);
} // namespace nplb
} // namespace starboard
#endif // STARBOARD_NPLB_PLAYER_TEST_UTIL_H_