blob: 4f6f16cc5b3fd5ab8217ebcc96794800e3cfbd0a [file] [log] [blame]
shubang23aa3ac2020-09-07 18:56:28 -07001/**
2 * Copyright (c) 2020, 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#define LOG_TAG "TunerService"
18
19#include <android/binder_manager.h>
20#include <utils/Log.h>
21#include "TunerService.h"
Amy Zhanga046eee2021-01-12 14:44:58 -080022#include "TunerFrontend.h"
23#include "TunerLnb.h"
shubangae56a2e2021-01-21 07:29:55 -080024#include "TunerDemux.h"
Amy Zhangb2989b52021-02-05 12:27:25 -080025#include "TunerDescrambler.h"
shubang23aa3ac2020-09-07 18:56:28 -070026
Amy Zhang70de35a2020-10-12 20:13:16 -070027using ::aidl::android::media::tv::tuner::TunerFrontendAnalogCapabilities;
28using ::aidl::android::media::tv::tuner::TunerFrontendAtsc3Capabilities;
29using ::aidl::android::media::tv::tuner::TunerFrontendAtscCapabilities;
30using ::aidl::android::media::tv::tuner::TunerFrontendCableCapabilities;
31using ::aidl::android::media::tv::tuner::TunerFrontendCapabilities;
32using ::aidl::android::media::tv::tuner::TunerFrontendDvbsCapabilities;
33using ::aidl::android::media::tv::tuner::TunerFrontendDvbtCapabilities;
34using ::aidl::android::media::tv::tuner::TunerFrontendIsdbs3Capabilities;
35using ::aidl::android::media::tv::tuner::TunerFrontendIsdbsCapabilities;
36using ::aidl::android::media::tv::tuner::TunerFrontendIsdbtCapabilities;
shubang6d266262020-10-09 00:15:04 -070037using ::android::hardware::tv::tuner::V1_0::DemuxFilterAvSettings;
38using ::android::hardware::tv::tuner::V1_0::DemuxFilterMainType;
39using ::android::hardware::tv::tuner::V1_0::DemuxFilterSettings;
40using ::android::hardware::tv::tuner::V1_0::DemuxFilterType;
41using ::android::hardware::tv::tuner::V1_0::DemuxTsFilterType;
shubang23aa3ac2020-09-07 18:56:28 -070042using ::android::hardware::tv::tuner::V1_0::FrontendId;
Amy Zhang70de35a2020-10-12 20:13:16 -070043using ::android::hardware::tv::tuner::V1_0::FrontendType;
Amy Zhanga046eee2021-01-12 14:44:58 -080044using ::android::hardware::tv::tuner::V1_0::IFrontend;
45using ::android::hardware::tv::tuner::V1_0::ILnb;
46using ::android::hardware::tv::tuner::V1_0::LnbId;
shubang23aa3ac2020-09-07 18:56:28 -070047using ::android::hardware::tv::tuner::V1_0::Result;
Amy Zhang5af84142021-02-04 18:36:54 -080048using ::android::hardware::tv::tuner::V1_1::FrontendDtmbCapabilities;
shubang23aa3ac2020-09-07 18:56:28 -070049
50namespace android {
51
shubang23aa3ac2020-09-07 18:56:28 -070052TunerService::TunerService() {}
53TunerService::~TunerService() {}
54
55void TunerService::instantiate() {
Amy Zhanga046eee2021-01-12 14:44:58 -080056 shared_ptr<TunerService> service =
shubang23aa3ac2020-09-07 18:56:28 -070057 ::ndk::SharedRefBase::make<TunerService>();
58 AServiceManager_addService(service->asBinder().get(), getServiceName());
shubang6d266262020-10-09 00:15:04 -070059}
60
Amy Zhang5af84142021-02-04 18:36:54 -080061bool TunerService::hasITuner() {
62 ALOGD("hasITuner");
shubang6d266262020-10-09 00:15:04 -070063 if (mTuner != nullptr) {
64 return true;
65 }
Amy Zhang0f04c452020-10-30 13:36:44 -070066 mTuner = ITuner::getService();
67 if (mTuner == nullptr) {
shubang6d266262020-10-09 00:15:04 -070068 ALOGE("Failed to get ITuner service");
69 return false;
Amy Zhang0f04c452020-10-30 13:36:44 -070070 }
shubang6d266262020-10-09 00:15:04 -070071 return true;
72}
73
Amy Zhang5af84142021-02-04 18:36:54 -080074bool TunerService::hasITuner_1_1() {
75 ALOGD("hasITuner_1_1");
76 if (mTuner_1_1 != nullptr) {
77 return true;
78 }
79 if (!hasITuner()) {
80 return false;
81 }
82 mTuner_1_1 = ::android::hardware::tv::tuner::V1_1::ITuner::castFrom(mTuner);
83 if (mTuner_1_1 == nullptr) {
84 ALOGE("Failed to get ITuner_1_1 service");
85 return false;
86 }
87 return true;
88}
89
shubangae56a2e2021-01-21 07:29:55 -080090Status TunerService::openDemux(
91 int /* demuxHandle */, std::shared_ptr<ITunerDemux>* _aidl_return) {
shubang6d266262020-10-09 00:15:04 -070092 ALOGD("openDemux");
Amy Zhang5af84142021-02-04 18:36:54 -080093 if (!hasITuner()) {
shubangae56a2e2021-01-21 07:29:55 -080094 return Status::fromServiceSpecificError(static_cast<int32_t>(Result::NOT_INITIALIZED));
shubang6d266262020-10-09 00:15:04 -070095 }
shubang6d266262020-10-09 00:15:04 -070096 Result res;
97 uint32_t id;
shubangae56a2e2021-01-21 07:29:55 -080098 sp<IDemux> demuxSp = nullptr;
Amy Zhangce2cb402021-01-21 12:50:47 -080099 shared_ptr<ITunerDemux> tunerDemux = nullptr;
shubang6d266262020-10-09 00:15:04 -0700100 mTuner->openDemux([&](Result r, uint32_t demuxId, const sp<IDemux>& demux) {
101 demuxSp = demux;
102 id = demuxId;
103 res = r;
104 ALOGD("open demux, id = %d", demuxId);
105 });
106 if (res == Result::SUCCESS) {
Amy Zhangce2cb402021-01-21 12:50:47 -0800107 tunerDemux = ::ndk::SharedRefBase::make<TunerDemux>(demuxSp, id);
108 *_aidl_return = tunerDemux->ref<ITunerDemux>();
shubangae56a2e2021-01-21 07:29:55 -0800109 return Status::ok();
shubang6d266262020-10-09 00:15:04 -0700110 }
111
Amy Zhang07428dc2021-02-04 15:58:02 -0800112 ALOGW("open demux failed, res = %d", res);
113 return Status::fromServiceSpecificError(static_cast<int32_t>(res));
114}
115
116Status TunerService::getDemuxCaps(TunerDemuxCapabilities* _aidl_return) {
117 ALOGD("getDemuxCaps");
Amy Zhang5af84142021-02-04 18:36:54 -0800118 if (!hasITuner()) {
Amy Zhang07428dc2021-02-04 15:58:02 -0800119 return Status::fromServiceSpecificError(static_cast<int32_t>(Result::NOT_INITIALIZED));
120 }
121 Result res;
122 DemuxCapabilities caps;
123 mTuner->getDemuxCaps([&](Result r, const DemuxCapabilities& demuxCaps) {
124 caps = demuxCaps;
125 res = r;
126 });
127 if (res == Result::SUCCESS) {
128 *_aidl_return = getAidlDemuxCaps(caps);
129 return Status::ok();
130 }
131
132 ALOGW("Get demux caps failed, res = %d", res);
shubangae56a2e2021-01-21 07:29:55 -0800133 return Status::fromServiceSpecificError(static_cast<int32_t>(res));
shubang6d266262020-10-09 00:15:04 -0700134}
135
Amy Zhangce2cb402021-01-21 12:50:47 -0800136Status TunerService::getFrontendIds(vector<int32_t>* ids) {
Amy Zhang5af84142021-02-04 18:36:54 -0800137 if (!hasITuner()) {
Amy Zhanga046eee2021-01-12 14:44:58 -0800138 return Status::fromServiceSpecificError(
shubang6d266262020-10-09 00:15:04 -0700139 static_cast<int32_t>(Result::NOT_INITIALIZED));
shubang23aa3ac2020-09-07 18:56:28 -0700140 }
141 hidl_vec<FrontendId> feIds;
Amy Zhangce2cb402021-01-21 12:50:47 -0800142 Result res = getHidlFrontendIds(feIds);
shubang23aa3ac2020-09-07 18:56:28 -0700143 if (res != Result::SUCCESS) {
Amy Zhanga046eee2021-01-12 14:44:58 -0800144 return Status::fromServiceSpecificError(static_cast<int32_t>(res));
shubang23aa3ac2020-09-07 18:56:28 -0700145 }
146 ids->resize(feIds.size());
Amy Zhanga046eee2021-01-12 14:44:58 -0800147 copy(feIds.begin(), feIds.end(), ids->begin());
shubang23aa3ac2020-09-07 18:56:28 -0700148
Amy Zhang0f04c452020-10-30 13:36:44 -0700149 return Status::ok();
shubang23aa3ac2020-09-07 18:56:28 -0700150}
151
Amy Zhang5af84142021-02-04 18:36:54 -0800152Status TunerService::getFrontendInfo(int32_t id, TunerFrontendInfo* _aidl_return) {
153 if (!hasITuner()) {
Amy Zhang0f04c452020-10-30 13:36:44 -0700154 ALOGE("ITuner service is not init.");
155 return ::ndk::ScopedAStatus::fromServiceSpecificError(
156 static_cast<int32_t>(Result::UNAVAILABLE));
Amy Zhang70de35a2020-10-12 20:13:16 -0700157 }
158
Amy Zhang70de35a2020-10-12 20:13:16 -0700159 FrontendInfo info;
Amy Zhang5af84142021-02-04 18:36:54 -0800160 Result res = getHidlFrontendInfo(id, info);
Amy Zhang70de35a2020-10-12 20:13:16 -0700161 if (res != Result::SUCCESS) {
Amy Zhang0f04c452020-10-30 13:36:44 -0700162 return Status::fromServiceSpecificError(static_cast<int32_t>(res));
Amy Zhang70de35a2020-10-12 20:13:16 -0700163 }
164
Amy Zhang1d28bbb2021-01-13 18:11:15 -0800165 TunerFrontendInfo tunerInfo = convertToAidlFrontendInfo(info);
Amy Zhang70de35a2020-10-12 20:13:16 -0700166 *_aidl_return = tunerInfo;
Amy Zhang0f04c452020-10-30 13:36:44 -0700167 return Status::ok();
168}
169
Amy Zhang5af84142021-02-04 18:36:54 -0800170Status TunerService::getFrontendDtmbCapabilities(
171 int32_t id, TunerFrontendDtmbCapabilities* _aidl_return) {
172 if (!hasITuner_1_1()) {
173 ALOGE("ITuner_1_1 service is not init.");
174 return ::ndk::ScopedAStatus::fromServiceSpecificError(
175 static_cast<int32_t>(Result::UNAVAILABLE));
176 }
177
178 Result res;
179 FrontendDtmbCapabilities dtmbCaps;
180 mTuner_1_1->getFrontendDtmbCapabilities(id,
181 [&](Result r, const FrontendDtmbCapabilities& caps) {
182 dtmbCaps = caps;
183 res = r;
184 });
185 if (res != Result::SUCCESS) {
186 return Status::fromServiceSpecificError(static_cast<int32_t>(res));
187 }
188
189 TunerFrontendDtmbCapabilities aidlDtmbCaps{
190 .transmissionModeCap = (int)dtmbCaps.transmissionModeCap,
191 .bandwidthCap = (int)dtmbCaps.bandwidthCap,
192 .modulationCap = (int)dtmbCaps.modulationCap,
193 .codeRateCap = (int)dtmbCaps.codeRateCap,
194 .guardIntervalCap = (int)dtmbCaps.guardIntervalCap,
195 .interleaveModeCap = (int)dtmbCaps.interleaveModeCap,
196 };
197
198 *_aidl_return = aidlDtmbCaps;
199 return Status::ok();
200}
201
Amy Zhang0f04c452020-10-30 13:36:44 -0700202Status TunerService::openFrontend(
Amy Zhanga046eee2021-01-12 14:44:58 -0800203 int32_t frontendHandle, shared_ptr<ITunerFrontend>* _aidl_return) {
Amy Zhang5af84142021-02-04 18:36:54 -0800204 if (!hasITuner()) {
Amy Zhang0f04c452020-10-30 13:36:44 -0700205 ALOGE("ITuner service is not init.");
Amy Zhanga046eee2021-01-12 14:44:58 -0800206 return Status::fromServiceSpecificError(static_cast<int32_t>(Result::UNAVAILABLE));
Amy Zhang0f04c452020-10-30 13:36:44 -0700207 }
208
Amy Zhanga046eee2021-01-12 14:44:58 -0800209 Result status;
210 sp<IFrontend> frontend;
211 int id = getResourceIdFromHandle(frontendHandle, FRONTEND);
212 mTuner->openFrontendById(id, [&](Result result, const sp<IFrontend>& fe) {
213 frontend = fe;
214 status = result;
215 });
216 if (status != Result::SUCCESS) {
217 return Status::fromServiceSpecificError(static_cast<int32_t>(status));
218 }
219 *_aidl_return = ::ndk::SharedRefBase::make<TunerFrontend>(frontend, id);
220 return Status::ok();
221}
222
Amy Zhanga046eee2021-01-12 14:44:58 -0800223Status TunerService::openLnb(int lnbHandle, shared_ptr<ITunerLnb>* _aidl_return) {
Amy Zhang5af84142021-02-04 18:36:54 -0800224 if (!hasITuner()) {
Amy Zhangce2cb402021-01-21 12:50:47 -0800225 ALOGD("get ITuner failed");
Amy Zhanga046eee2021-01-12 14:44:58 -0800226 return Status::fromServiceSpecificError(static_cast<int32_t>(Result::UNAVAILABLE));
227 }
228
229 Result status;
230 sp<ILnb> lnb;
231 int id = getResourceIdFromHandle(lnbHandle, LNB);
232 mTuner->openLnbById(id, [&](Result result, const sp<ILnb>& lnbSp){
233 lnb = lnbSp;
234 status = result;
235 });
236 if (status != Result::SUCCESS) {
237 return Status::fromServiceSpecificError(static_cast<int32_t>(status));
238 }
239
240 *_aidl_return = ::ndk::SharedRefBase::make<TunerLnb>(lnb, id);
241 return Status::ok();
242}
243
244Status TunerService::openLnbByName(const string& lnbName, shared_ptr<ITunerLnb>* _aidl_return) {
Amy Zhang5af84142021-02-04 18:36:54 -0800245 if (!hasITuner()) {
Amy Zhangce2cb402021-01-21 12:50:47 -0800246 ALOGE("get ITuner failed");
Amy Zhanga046eee2021-01-12 14:44:58 -0800247 return Status::fromServiceSpecificError(static_cast<int32_t>(Result::UNAVAILABLE));
248 }
249
250 int lnbId;
251 Result status;
252 sp<ILnb> lnb;
253 mTuner->openLnbByName(lnbName, [&](Result r, LnbId id, const sp<ILnb>& lnbSp) {
254 status = r;
255 lnb = lnbSp;
256 lnbId = (int)id;
257 });
258 if (status != Result::SUCCESS) {
259 return Status::fromServiceSpecificError(static_cast<int32_t>(status));
260 }
261
262 *_aidl_return = ::ndk::SharedRefBase::make<TunerLnb>(lnb, lnbId);
Amy Zhang0f04c452020-10-30 13:36:44 -0700263 return Status::ok();
Amy Zhang70de35a2020-10-12 20:13:16 -0700264}
265
Amy Zhangb2989b52021-02-05 12:27:25 -0800266Status TunerService::openDescrambler(int32_t /*descramblerHandle*/,
267 std::shared_ptr<ITunerDescrambler>* _aidl_return) {
Amy Zhang5af84142021-02-04 18:36:54 -0800268 if (!hasITuner()) {
Amy Zhangb2989b52021-02-05 12:27:25 -0800269 ALOGD("get ITuner failed");
270 return Status::fromServiceSpecificError(static_cast<int32_t>(Result::UNAVAILABLE));
271 }
272
273 Result status;
274 sp<IDescrambler> descrambler;
275 //int id = getResourceIdFromHandle(descramblerHandle, DESCRAMBLER);
276 mTuner->openDescrambler([&](Result r, const sp<IDescrambler>& descramblerSp) {
277 status = r;
278 descrambler = descramblerSp;
279 });
280 if (status != Result::SUCCESS) {
281 return Status::fromServiceSpecificError(static_cast<int32_t>(status));
282 }
283
284 *_aidl_return = ::ndk::SharedRefBase::make<TunerDescrambler>(descrambler);
285 return Status::ok();
286}
287
Amy Zhangce2cb402021-01-21 12:50:47 -0800288Status TunerService::updateTunerResources() {
Amy Zhang5af84142021-02-04 18:36:54 -0800289 if (!hasITuner()) {
Amy Zhangce2cb402021-01-21 12:50:47 -0800290 return Status::fromServiceSpecificError(static_cast<int32_t>(Result::UNAVAILABLE));
291 }
292
293 // Connect with Tuner Resource Manager.
294 ::ndk::SpAIBinder binder(AServiceManager_getService("tv_tuner_resource_mgr"));
295 mTunerResourceManager = ITunerResourceManager::fromBinder(binder);
296
297 updateFrontendResources();
298 updateLnbResources();
299 // TODO: update Demux, Descrambler.
300 return Status::ok();
301}
302
303void TunerService::updateFrontendResources() {
304 hidl_vec<FrontendId> ids;
305 Result res = getHidlFrontendIds(ids);
306 if (res != Result::SUCCESS) {
307 return;
308 }
309 vector<TunerFrontendInfo> infos;
310 for (int i = 0; i < ids.size(); i++) {
311 FrontendInfo frontendInfo;
312 Result res = getHidlFrontendInfo((int)ids[i], frontendInfo);
313 if (res != Result::SUCCESS) {
314 continue;
315 }
316 TunerFrontendInfo tunerFrontendInfo{
317 .handle = getResourceHandleFromId((int)ids[i], FRONTEND),
318 .type = static_cast<int>(frontendInfo.type),
319 .exclusiveGroupId = static_cast<int>(frontendInfo.exclusiveGroupId),
320 };
321 infos.push_back(tunerFrontendInfo);
322 }
323 mTunerResourceManager->setFrontendInfoList(infos);
324}
325
326void TunerService::updateLnbResources() {
327 vector<int> handles = getLnbHandles();
328 if (handles.size() == 0) {
329 return;
330 }
331 mTunerResourceManager->setLnbInfoList(handles);
332}
333
334vector<int> TunerService::getLnbHandles() {
335 vector<int> lnbHandles;
336 if (mTuner != NULL) {
337 Result res;
338 vector<LnbId> lnbIds;
339 mTuner->getLnbIds([&](Result r, const hardware::hidl_vec<LnbId>& ids) {
340 lnbIds = ids;
341 res = r;
342 });
343 if (res != Result::SUCCESS || lnbIds.size() == 0) {
344 } else {
345 for (int i = 0; i < lnbIds.size(); i++) {
346 lnbHandles.push_back(getResourceHandleFromId((int)lnbIds[i], LNB));
347 }
348 }
349 }
350
351 return lnbHandles;
352}
353
354Result TunerService::getHidlFrontendIds(hidl_vec<FrontendId>& ids) {
355 if (mTuner == NULL) {
356 return Result::NOT_INITIALIZED;
357 }
358 Result res;
359 mTuner->getFrontendIds([&](Result r, const hidl_vec<FrontendId>& frontendIds) {
360 ids = frontendIds;
361 res = r;
362 });
363 return res;
364}
365
366Result TunerService::getHidlFrontendInfo(int id, FrontendInfo& info) {
367 if (mTuner == NULL) {
368 return Result::NOT_INITIALIZED;
369 }
370 Result res;
371 mTuner->getFrontendInfo(id, [&](Result r, const FrontendInfo& feInfo) {
372 info = feInfo;
373 res = r;
374 });
375 return res;
376}
377
Amy Zhang07428dc2021-02-04 15:58:02 -0800378TunerDemuxCapabilities TunerService::getAidlDemuxCaps(DemuxCapabilities caps) {
379 TunerDemuxCapabilities aidlCaps{
380 .numDemux = (int)caps.numDemux,
381 .numRecord = (int)caps.numRecord,
382 .numPlayback = (int)caps.numPlayback,
383 .numTsFilter = (int)caps.numTsFilter,
384 .numSectionFilter = (int)caps.numSectionFilter,
385 .numAudioFilter = (int)caps.numAudioFilter,
386 .numVideoFilter = (int)caps.numVideoFilter,
387 .numPesFilter = (int)caps.numPesFilter,
388 .numPcrFilter = (int)caps.numPcrFilter,
389 .numBytesInSectionFilter = (int)caps.numBytesInSectionFilter,
390 .filterCaps = (int)caps.filterCaps,
391 .bTimeFilter = caps.bTimeFilter,
392 };
393 aidlCaps.linkCaps.resize(caps.linkCaps.size());
394 copy(caps.linkCaps.begin(), caps.linkCaps.end(), aidlCaps.linkCaps.begin());
395 return aidlCaps;
396}
397
Amy Zhang1d28bbb2021-01-13 18:11:15 -0800398TunerFrontendInfo TunerService::convertToAidlFrontendInfo(FrontendInfo halInfo) {
399 TunerFrontendInfo info{
Amy Zhang70de35a2020-10-12 20:13:16 -0700400 .type = (int)halInfo.type,
401 .minFrequency = (int)halInfo.minFrequency,
402 .maxFrequency = (int)halInfo.maxFrequency,
403 .minSymbolRate = (int)halInfo.minSymbolRate,
404 .maxSymbolRate = (int)halInfo.maxSymbolRate,
405 .acquireRange = (int)halInfo.acquireRange,
406 .exclusiveGroupId = (int)halInfo.exclusiveGroupId,
407 };
408 for (int i = 0; i < halInfo.statusCaps.size(); i++) {
409 info.statusCaps.push_back((int)halInfo.statusCaps[i]);
410 }
411
412 TunerFrontendCapabilities caps;
413 switch (halInfo.type) {
414 case FrontendType::ANALOG: {
415 TunerFrontendAnalogCapabilities analogCaps{
416 .typeCap = (int)halInfo.frontendCaps.analogCaps().typeCap,
417 .sifStandardCap = (int)halInfo.frontendCaps.analogCaps().sifStandardCap,
418 };
419 caps.set<TunerFrontendCapabilities::analogCaps>(analogCaps);
420 break;
421 }
422 case FrontendType::ATSC: {
423 TunerFrontendAtscCapabilities atscCaps{
424 .modulationCap = (int)halInfo.frontendCaps.atscCaps().modulationCap,
425 };
426 caps.set<TunerFrontendCapabilities::atscCaps>(atscCaps);
427 break;
428 }
429 case FrontendType::ATSC3: {
430 TunerFrontendAtsc3Capabilities atsc3Caps{
431 .bandwidthCap = (int)halInfo.frontendCaps.atsc3Caps().bandwidthCap,
432 .modulationCap = (int)halInfo.frontendCaps.atsc3Caps().modulationCap,
433 .timeInterleaveModeCap =
434 (int)halInfo.frontendCaps.atsc3Caps().timeInterleaveModeCap,
435 .codeRateCap = (int)halInfo.frontendCaps.atsc3Caps().codeRateCap,
436 .demodOutputFormatCap = (int)halInfo.frontendCaps.atsc3Caps().demodOutputFormatCap,
437 .fecCap = (int)halInfo.frontendCaps.atsc3Caps().fecCap,
438 };
439 caps.set<TunerFrontendCapabilities::atsc3Caps>(atsc3Caps);
440 break;
441 }
442 case FrontendType::DVBC: {
443 TunerFrontendCableCapabilities cableCaps{
444 .modulationCap = (int)halInfo.frontendCaps.dvbcCaps().modulationCap,
Amy Zhang5af84142021-02-04 18:36:54 -0800445 .codeRateCap = (int64_t)halInfo.frontendCaps.dvbcCaps().fecCap,
Amy Zhang70de35a2020-10-12 20:13:16 -0700446 .annexCap = (int)halInfo.frontendCaps.dvbcCaps().annexCap,
447 };
448 caps.set<TunerFrontendCapabilities::cableCaps>(cableCaps);
449 break;
450 }
451 case FrontendType::DVBS: {
452 TunerFrontendDvbsCapabilities dvbsCaps{
453 .modulationCap = (int)halInfo.frontendCaps.dvbsCaps().modulationCap,
454 .codeRateCap = (long)halInfo.frontendCaps.dvbsCaps().innerfecCap,
455 .standard = (int)halInfo.frontendCaps.dvbsCaps().standard,
456 };
457 caps.set<TunerFrontendCapabilities::dvbsCaps>(dvbsCaps);
458 break;
459 }
460 case FrontendType::DVBT: {
461 TunerFrontendDvbtCapabilities dvbtCaps{
462 .transmissionModeCap = (int)halInfo.frontendCaps.dvbtCaps().transmissionModeCap,
463 .bandwidthCap = (int)halInfo.frontendCaps.dvbtCaps().bandwidthCap,
464 .constellationCap = (int)halInfo.frontendCaps.dvbtCaps().constellationCap,
465 .codeRateCap = (int)halInfo.frontendCaps.dvbtCaps().coderateCap,
466 .hierarchyCap = (int)halInfo.frontendCaps.dvbtCaps().hierarchyCap,
467 .guardIntervalCap = (int)halInfo.frontendCaps.dvbtCaps().guardIntervalCap,
468 .isT2Supported = (bool)halInfo.frontendCaps.dvbtCaps().isT2Supported,
469 .isMisoSupported = (bool)halInfo.frontendCaps.dvbtCaps().isMisoSupported,
470 };
471 caps.set<TunerFrontendCapabilities::dvbtCaps>(dvbtCaps);
472 break;
473 }
474 case FrontendType::ISDBS: {
475 TunerFrontendIsdbsCapabilities isdbsCaps{
476 .modulationCap = (int)halInfo.frontendCaps.isdbsCaps().modulationCap,
477 .codeRateCap = (int)halInfo.frontendCaps.isdbsCaps().coderateCap,
478 };
479 caps.set<TunerFrontendCapabilities::isdbsCaps>(isdbsCaps);
480 break;
481 }
482 case FrontendType::ISDBS3: {
483 TunerFrontendIsdbs3Capabilities isdbs3Caps{
484 .modulationCap = (int)halInfo.frontendCaps.isdbs3Caps().modulationCap,
485 .codeRateCap = (int)halInfo.frontendCaps.isdbs3Caps().coderateCap,
486 };
487 caps.set<TunerFrontendCapabilities::isdbs3Caps>(isdbs3Caps);
488 break;
489 }
490 case FrontendType::ISDBT: {
491 TunerFrontendIsdbtCapabilities isdbtCaps{
492 .modeCap = (int)halInfo.frontendCaps.isdbtCaps().modeCap,
493 .bandwidthCap = (int)halInfo.frontendCaps.isdbtCaps().bandwidthCap,
494 .modulationCap = (int)halInfo.frontendCaps.isdbtCaps().modulationCap,
495 .codeRateCap = (int)halInfo.frontendCaps.isdbtCaps().coderateCap,
496 .guardIntervalCap = (int)halInfo.frontendCaps.isdbtCaps().guardIntervalCap,
497 };
498 caps.set<TunerFrontendCapabilities::isdbtCaps>(isdbtCaps);
499 break;
500 }
501 default:
502 break;
503 }
504
505 info.caps = caps;
506 return info;
507}
shubang23aa3ac2020-09-07 18:56:28 -0700508} // namespace android