blob: b2fca6f7f18a9d4d274e20fcc7b9442dd56910e8 [file] [log] [blame]
Hongguang600a6ae2021-07-08 18:51:51 -07001/*
2 * Copyright 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "DemuxTests.h"
18
Kensuke Miyagi73b18ac2022-11-07 10:49:09 -080019AssertionResult DemuxTests::getDemuxIds(std::vector<int32_t>& demuxIds) {
20 ndk::ScopedAStatus status;
21 status = mService->getDemuxIds(&demuxIds);
22 return AssertionResult(status.isOk());
23}
24
Hongguang600a6ae2021-07-08 18:51:51 -070025AssertionResult DemuxTests::openDemux(std::shared_ptr<IDemux>& demux, int32_t& demuxId) {
26 std::vector<int32_t> id;
27 auto status = mService->openDemux(&id, &mDemux);
28 if (status.isOk()) {
29 demux = mDemux;
30 demuxId = id[0];
31 }
32 return AssertionResult(status.isOk());
33}
34
Kensuke Miyagi73b18ac2022-11-07 10:49:09 -080035AssertionResult DemuxTests::openDemuxById(int32_t demuxId, std::shared_ptr<IDemux>& demux) {
36 auto status = mService->openDemuxById(demuxId, &mDemux);
37 if (status.isOk()) {
38 demux = mDemux;
39 }
40 return AssertionResult(status.isOk());
41}
42
Hongguang600a6ae2021-07-08 18:51:51 -070043AssertionResult DemuxTests::setDemuxFrontendDataSource(int32_t frontendId) {
44 EXPECT_TRUE(mDemux) << "Test with openDemux first.";
45 auto status = mDemux->setFrontendDataSource(frontendId);
46 return AssertionResult(status.isOk());
47}
48
49AssertionResult DemuxTests::getDemuxCaps(DemuxCapabilities& demuxCaps) {
Hongguang600a6ae2021-07-08 18:51:51 -070050 auto status = mService->getDemuxCaps(&demuxCaps);
51 return AssertionResult(status.isOk());
52}
53
Kensuke Miyagi73b18ac2022-11-07 10:49:09 -080054AssertionResult DemuxTests::getDemuxInfo(int32_t demuxId, DemuxInfo& demuxInfo) {
55 auto status = mService->getDemuxInfo(demuxId, &demuxInfo);
56 return AssertionResult(status.isOk());
57}
58
Hongguang600a6ae2021-07-08 18:51:51 -070059AssertionResult DemuxTests::getAvSyncId(std::shared_ptr<IFilter> filter, int32_t& avSyncHwId) {
60 EXPECT_TRUE(mDemux) << "Demux is not opened yet.";
61
62 auto status = mDemux->getAvSyncHwId(filter, &avSyncHwId);
63 return AssertionResult(status.isOk());
64}
65
66AssertionResult DemuxTests::getAvSyncTime(int32_t avSyncId) {
67 EXPECT_TRUE(mDemux) << "Demux is not opened yet.";
68
69 int64_t syncTime;
70 auto status = mDemux->getAvSyncTime(avSyncId, &syncTime);
71 return AssertionResult(status.isOk());
72}
73
74AssertionResult DemuxTests::closeDemux() {
75 EXPECT_TRUE(mDemux) << "Test with openDemux first.";
76 auto status = mDemux->close();
77 mDemux = nullptr;
78 return AssertionResult(status.isOk());
79}