New TunerService implemented by AIDL HAL.
TODO: add backward HIDL HAL support to separate files.
Bug: 191825295
Test: atest android.media.tv.tuner.cts
Change-Id: I8400fd75080971ee897e1e2dc35e2bab45ec1659
diff --git a/services/tuner/TunerService.cpp b/services/tuner/TunerService.cpp
index 5b4129a..0703700 100644
--- a/services/tuner/TunerService.cpp
+++ b/services/tuner/TunerService.cpp
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2020, The Android Open Source Project
+ * Copyright (c) 2021, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,60 +14,63 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
#define LOG_TAG "TunerService"
+#include "TunerService.h"
+
+#include <aidl/android/hardware/tv/tuner/IDemux.h>
+#include <aidl/android/hardware/tv/tuner/IDescrambler.h>
+#include <aidl/android/hardware/tv/tuner/IFrontend.h>
+#include <aidl/android/hardware/tv/tuner/ILnb.h>
+#include <aidl/android/hardware/tv/tuner/Result.h>
+#include <aidl/android/media/tv/tunerresourcemanager/TunerFrontendInfo.h>
#include <android/binder_manager.h>
#include <android/content/pm/IPackageManagerNative.h>
#include <binder/IServiceManager.h>
#include <utils/Log.h>
-#include "TunerService.h"
-#include "TunerFrontend.h"
-#include "TunerLnb.h"
+
#include "TunerDemux.h"
#include "TunerDescrambler.h"
+#include "TunerFrontend.h"
+#include "TunerLnb.h"
-using ::aidl::android::media::tv::tuner::TunerFrontendAnalogCapabilities;
-using ::aidl::android::media::tv::tuner::TunerFrontendAtsc3Capabilities;
-using ::aidl::android::media::tv::tuner::TunerFrontendAtscCapabilities;
-using ::aidl::android::media::tv::tuner::TunerFrontendCableCapabilities;
-using ::aidl::android::media::tv::tuner::TunerFrontendCapabilities;
-using ::aidl::android::media::tv::tuner::TunerFrontendDvbsCapabilities;
-using ::aidl::android::media::tv::tuner::TunerFrontendDvbtCapabilities;
-using ::aidl::android::media::tv::tuner::TunerFrontendIsdbs3Capabilities;
-using ::aidl::android::media::tv::tuner::TunerFrontendIsdbsCapabilities;
-using ::aidl::android::media::tv::tuner::TunerFrontendIsdbtCapabilities;
-using ::android::hardware::tv::tuner::V1_0::DemuxFilterAvSettings;
-using ::android::hardware::tv::tuner::V1_0::DemuxFilterMainType;
-using ::android::hardware::tv::tuner::V1_0::DemuxFilterSettings;
-using ::android::hardware::tv::tuner::V1_0::DemuxFilterType;
-using ::android::hardware::tv::tuner::V1_0::DemuxTsFilterType;
-using ::android::hardware::tv::tuner::V1_0::FrontendId;
-using ::android::hardware::tv::tuner::V1_0::FrontendType;
-using ::android::hardware::tv::tuner::V1_0::IFrontend;
-using ::android::hardware::tv::tuner::V1_0::ILnb;
-using ::android::hardware::tv::tuner::V1_0::LnbId;
-using ::android::hardware::tv::tuner::V1_0::Result;
-using ::android::hardware::tv::tuner::V1_1::FrontendDtmbCapabilities;
+using ::aidl::android::hardware::tv::tuner::IDemux;
+using ::aidl::android::hardware::tv::tuner::IDescrambler;
+using ::aidl::android::hardware::tv::tuner::IFrontend;
+using ::aidl::android::hardware::tv::tuner::Result;
+using ::aidl::android::media::tv::tunerresourcemanager::TunerFrontendInfo;
+using ::android::defaultServiceManager;
+using ::android::IBinder;
+using ::android::interface_cast;
+using ::android::IServiceManager;
+using ::android::sp;
+using ::android::String16;
+using ::android::binder::Status;
+using ::android::content::pm::IPackageManagerNative;
+namespace aidl {
namespace android {
+namespace media {
+namespace tv {
+namespace tuner {
TunerService::TunerService() {
sp<IServiceManager> serviceMgr = defaultServiceManager();
- sp<content::pm::IPackageManagerNative> packageMgr;
+ sp<IPackageManagerNative> packageMgr;
if (serviceMgr.get() == nullptr) {
ALOGE("%s: Cannot find service manager", __func__);
return;
} else {
sp<IBinder> binder = serviceMgr->waitForService(String16("package_native"));
- packageMgr = interface_cast<content::pm::IPackageManagerNative>(binder);
+ packageMgr = interface_cast<IPackageManagerNative>(binder);
}
- bool hasFeature = false;
if (packageMgr != nullptr) {
- binder::Status status = packageMgr->hasSystemFeature(FEATURE_TUNER, 0, &hasFeature);
+ bool hasFeature = false;
+ Status status = packageMgr->hasSystemFeature(FEATURE_TUNER, 0, &hasFeature);
if (!status.isOk()) {
- ALOGE("%s: hasSystemFeature failed: %s",
- __func__, status.exceptionMessage().c_str());
+ ALOGE("%s: hasSystemFeature failed: %s", __func__, status.exceptionMessage().c_str());
return;
}
if (!hasFeature) {
@@ -93,231 +96,149 @@
}
bool TunerService::hasITuner() {
- ALOGD("hasITuner");
+ ALOGV("hasITuner");
if (mTuner != nullptr) {
return true;
}
- mTuner = ITuner::getService();
- if (mTuner == nullptr) {
- ALOGE("Failed to get ITuner service");
+ const string statsServiceName = string() + ITuner::descriptor + "/default";
+ if (AServiceManager_isDeclared(statsServiceName.c_str())) {
+ ::ndk::SpAIBinder binder(AServiceManager_waitForService(statsServiceName.c_str()));
+ mTuner = ITuner::fromBinder(binder);
+ } else {
+ mTuner = nullptr;
+ ALOGE("Failed to get Tuner HAL Service");
return false;
}
- mTunerVersion = TUNER_HAL_VERSION_1_0;
- mTuner_1_1 = ::android::hardware::tv::tuner::V1_1::ITuner::castFrom(mTuner);
- if (mTuner_1_1 != nullptr) {
- mTunerVersion = TUNER_HAL_VERSION_1_1;
- } else {
- ALOGE("Failed to get ITuner_1_1 service");
- }
+
+ mTunerVersion = TUNER_HAL_VERSION_2_0;
+ // TODO: Enable this after Tuner HAL is frozen.
+ // if (mTuner->getInterfaceVersion(&mTunerVersion).isOk()) {
+ // // Tuner AIDL HAL version 1 will be Tuner HAL 2.0
+ // mTunerVersion = (mTunerVersion + 1) << 16;
+ //}
+
return true;
}
-bool TunerService::hasITuner_1_1() {
- ALOGD("hasITuner_1_1");
- hasITuner();
- return (mTunerVersion == TUNER_HAL_VERSION_1_1);
-}
-
-Status TunerService::openDemux(
- int /* demuxHandle */, std::shared_ptr<ITunerDemux>* _aidl_return) {
- ALOGD("openDemux");
+::ndk::ScopedAStatus TunerService::openDemux(int32_t /* in_demuxHandle */,
+ shared_ptr<ITunerDemux>* _aidl_return) {
+ ALOGV("openDemux");
if (!hasITuner()) {
- return Status::fromServiceSpecificError(static_cast<int32_t>(Result::NOT_INITIALIZED));
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(
+ static_cast<int32_t>(Result::UNAVAILABLE));
}
- Result res;
- uint32_t id;
- sp<IDemux> demuxSp = nullptr;
- shared_ptr<ITunerDemux> tunerDemux = nullptr;
- mTuner->openDemux([&](Result r, uint32_t demuxId, const sp<IDemux>& demux) {
- demuxSp = demux;
- id = demuxId;
- res = r;
- ALOGD("open demux, id = %d", demuxId);
- });
- if (res == Result::SUCCESS) {
- tunerDemux = ::ndk::SharedRefBase::make<TunerDemux>(demuxSp, id);
- *_aidl_return = tunerDemux->ref<ITunerDemux>();
- return Status::ok();
+ vector<int32_t> id;
+ shared_ptr<IDemux> demux;
+ auto status = mTuner->openDemux(&id, &demux);
+ if (status.isOk()) {
+ *_aidl_return = ::ndk::SharedRefBase::make<TunerDemux>(demux, id[0]);
}
- ALOGW("open demux failed, res = %d", res);
- return Status::fromServiceSpecificError(static_cast<int32_t>(res));
+ return status;
}
-Status TunerService::getDemuxCaps(TunerDemuxCapabilities* _aidl_return) {
- ALOGD("getDemuxCaps");
+::ndk::ScopedAStatus TunerService::getDemuxCaps(DemuxCapabilities* _aidl_return) {
+ ALOGV("getDemuxCaps");
if (!hasITuner()) {
- return Status::fromServiceSpecificError(static_cast<int32_t>(Result::NOT_INITIALIZED));
- }
- Result res;
- DemuxCapabilities caps;
- mTuner->getDemuxCaps([&](Result r, const DemuxCapabilities& demuxCaps) {
- caps = demuxCaps;
- res = r;
- });
- if (res == Result::SUCCESS) {
- *_aidl_return = getAidlDemuxCaps(caps);
- return Status::ok();
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(
+ static_cast<int32_t>(Result::UNAVAILABLE));
}
- ALOGW("Get demux caps failed, res = %d", res);
- return Status::fromServiceSpecificError(static_cast<int32_t>(res));
+ return mTuner->getDemuxCaps(_aidl_return);
}
-Status TunerService::getFrontendIds(vector<int32_t>* ids) {
+::ndk::ScopedAStatus TunerService::getFrontendIds(vector<int32_t>* ids) {
if (!hasITuner()) {
- return Status::fromServiceSpecificError(
- static_cast<int32_t>(Result::NOT_INITIALIZED));
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(
+ static_cast<int32_t>(Result::UNAVAILABLE));
}
- hidl_vec<FrontendId> feIds;
- Result res = getHidlFrontendIds(feIds);
- if (res != Result::SUCCESS) {
- return Status::fromServiceSpecificError(static_cast<int32_t>(res));
- }
- ids->resize(feIds.size());
- copy(feIds.begin(), feIds.end(), ids->begin());
- return Status::ok();
+ return mTuner->getFrontendIds(ids);
}
-Status TunerService::getFrontendInfo(int32_t id, TunerFrontendInfo* _aidl_return) {
+::ndk::ScopedAStatus TunerService::getFrontendInfo(int32_t id, FrontendInfo* _aidl_return) {
if (!hasITuner()) {
ALOGE("ITuner service is not init.");
return ::ndk::ScopedAStatus::fromServiceSpecificError(
static_cast<int32_t>(Result::UNAVAILABLE));
}
- FrontendInfo info;
- Result res = getHidlFrontendInfo(id, info);
- if (res != Result::SUCCESS) {
- return Status::fromServiceSpecificError(static_cast<int32_t>(res));
- }
-
- TunerFrontendInfo tunerInfo = convertToAidlFrontendInfo(info);
- *_aidl_return = tunerInfo;
- return Status::ok();
+ return mTuner->getFrontendInfo(id, _aidl_return);
}
-Status TunerService::getFrontendDtmbCapabilities(
- int32_t id, TunerFrontendDtmbCapabilities* _aidl_return) {
- if (!hasITuner_1_1()) {
- ALOGE("ITuner_1_1 service is not init.");
+::ndk::ScopedAStatus TunerService::openFrontend(int32_t frontendHandle,
+ shared_ptr<ITunerFrontend>* _aidl_return) {
+ if (!hasITuner()) {
+ ALOGE("ITuner service is not init.");
return ::ndk::ScopedAStatus::fromServiceSpecificError(
static_cast<int32_t>(Result::UNAVAILABLE));
}
- Result res;
- FrontendDtmbCapabilities dtmbCaps;
- mTuner_1_1->getFrontendDtmbCapabilities(id,
- [&](Result r, const FrontendDtmbCapabilities& caps) {
- dtmbCaps = caps;
- res = r;
- });
- if (res != Result::SUCCESS) {
- return Status::fromServiceSpecificError(static_cast<int32_t>(res));
- }
-
- TunerFrontendDtmbCapabilities aidlDtmbCaps{
- .transmissionModeCap = (int)dtmbCaps.transmissionModeCap,
- .bandwidthCap = (int)dtmbCaps.bandwidthCap,
- .modulationCap = (int)dtmbCaps.modulationCap,
- .codeRateCap = (int)dtmbCaps.codeRateCap,
- .guardIntervalCap = (int)dtmbCaps.guardIntervalCap,
- .interleaveModeCap = (int)dtmbCaps.interleaveModeCap,
- };
-
- *_aidl_return = aidlDtmbCaps;
- return Status::ok();
-}
-
-Status TunerService::openFrontend(
- int32_t frontendHandle, shared_ptr<ITunerFrontend>* _aidl_return) {
- if (!hasITuner()) {
- ALOGE("ITuner service is not init.");
- return Status::fromServiceSpecificError(static_cast<int32_t>(Result::UNAVAILABLE));
- }
-
- Result status;
- sp<IFrontend> frontend;
int id = getResourceIdFromHandle(frontendHandle, FRONTEND);
- mTuner->openFrontendById(id, [&](Result result, const sp<IFrontend>& fe) {
- frontend = fe;
- status = result;
- });
- if (status != Result::SUCCESS) {
- return Status::fromServiceSpecificError(static_cast<int32_t>(status));
+ shared_ptr<IFrontend> frontend;
+ auto status = mTuner->openFrontendById(id, &frontend);
+ if (status.isOk()) {
+ *_aidl_return = ::ndk::SharedRefBase::make<TunerFrontend>(frontend, id);
}
- *_aidl_return = ::ndk::SharedRefBase::make<TunerFrontend>(frontend, id);
- return Status::ok();
+
+ return status;
}
-Status TunerService::openLnb(int lnbHandle, shared_ptr<ITunerLnb>* _aidl_return) {
+::ndk::ScopedAStatus TunerService::openLnb(int lnbHandle, shared_ptr<ITunerLnb>* _aidl_return) {
if (!hasITuner()) {
ALOGD("get ITuner failed");
- return Status::fromServiceSpecificError(static_cast<int32_t>(Result::UNAVAILABLE));
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(
+ static_cast<int32_t>(Result::UNAVAILABLE));
}
- Result status;
- sp<ILnb> lnb;
+ shared_ptr<ILnb> lnb;
int id = getResourceIdFromHandle(lnbHandle, LNB);
- mTuner->openLnbById(id, [&](Result result, const sp<ILnb>& lnbSp){
- lnb = lnbSp;
- status = result;
- });
- if (status != Result::SUCCESS) {
- return Status::fromServiceSpecificError(static_cast<int32_t>(status));
+ auto status = mTuner->openLnbById(id, &lnb);
+ if (status.isOk()) {
+ *_aidl_return = ::ndk::SharedRefBase::make<TunerLnb>(lnb, id);
}
- *_aidl_return = ::ndk::SharedRefBase::make<TunerLnb>(lnb, id);
- return Status::ok();
+ return status;
}
-Status TunerService::openLnbByName(const string& lnbName, shared_ptr<ITunerLnb>* _aidl_return) {
+::ndk::ScopedAStatus TunerService::openLnbByName(const string& lnbName,
+ shared_ptr<ITunerLnb>* _aidl_return) {
if (!hasITuner()) {
ALOGE("get ITuner failed");
- return Status::fromServiceSpecificError(static_cast<int32_t>(Result::UNAVAILABLE));
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(
+ static_cast<int32_t>(Result::UNAVAILABLE));
}
- int lnbId;
- Result status;
- sp<ILnb> lnb;
- mTuner->openLnbByName(lnbName, [&](Result r, LnbId id, const sp<ILnb>& lnbSp) {
- status = r;
- lnb = lnbSp;
- lnbId = (int)id;
- });
- if (status != Result::SUCCESS) {
- return Status::fromServiceSpecificError(static_cast<int32_t>(status));
+ vector<int32_t> id;
+ shared_ptr<ILnb> lnb;
+ auto status = mTuner->openLnbByName(lnbName, &id, &lnb);
+ if (status.isOk()) {
+ *_aidl_return = ::ndk::SharedRefBase::make<TunerLnb>(lnb, id[0]);
}
- *_aidl_return = ::ndk::SharedRefBase::make<TunerLnb>(lnb, lnbId);
- return Status::ok();
+ return ::ndk::ScopedAStatus::ok();
}
-Status TunerService::openDescrambler(int32_t /*descramblerHandle*/,
- std::shared_ptr<ITunerDescrambler>* _aidl_return) {
+::ndk::ScopedAStatus TunerService::openDescrambler(int32_t /*descramblerHandle*/,
+ shared_ptr<ITunerDescrambler>* _aidl_return) {
if (!hasITuner()) {
ALOGD("get ITuner failed");
- return Status::fromServiceSpecificError(static_cast<int32_t>(Result::UNAVAILABLE));
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(
+ static_cast<int32_t>(Result::UNAVAILABLE));
}
- Result status;
- sp<IDescrambler> descrambler;
- //int id = getResourceIdFromHandle(descramblerHandle, DESCRAMBLER);
- mTuner->openDescrambler([&](Result r, const sp<IDescrambler>& descramblerSp) {
- status = r;
- descrambler = descramblerSp;
- });
- if (status != Result::SUCCESS) {
- return Status::fromServiceSpecificError(static_cast<int32_t>(status));
+ shared_ptr<IDescrambler> descrambler;
+ // int id = getResourceIdFromHandle(descramblerHandle, DESCRAMBLER);
+ auto status = mTuner->openDescrambler(&descrambler);
+ if (status.isOk()) {
+ *_aidl_return = ::ndk::SharedRefBase::make<TunerDescrambler>(descrambler);
}
- *_aidl_return = ::ndk::SharedRefBase::make<TunerDescrambler>(descrambler);
- return Status::ok();
+ return status;
}
void TunerService::updateTunerResources() {
- if (!hasITuner() || mTunerResourceManager == NULL) {
+ if (!hasITuner() || mTunerResourceManager == nullptr) {
ALOGE("Failed to updateTunerResources");
return;
}
@@ -327,29 +248,30 @@
// TODO: update Demux, Descrambler.
}
-Status TunerService::getTunerHalVersion(int* _aidl_return) {
+::ndk::ScopedAStatus TunerService::getTunerHalVersion(int* _aidl_return) {
hasITuner();
*_aidl_return = mTunerVersion;
- return Status::ok();
+ return ::ndk::ScopedAStatus::ok();
}
void TunerService::updateFrontendResources() {
- hidl_vec<FrontendId> ids;
- Result res = getHidlFrontendIds(ids);
- if (res != Result::SUCCESS) {
+ vector<int32_t> ids;
+ auto status = mTuner->getFrontendIds(&ids);
+ if (!status.isOk()) {
return;
}
+
vector<TunerFrontendInfo> infos;
for (int i = 0; i < ids.size(); i++) {
FrontendInfo frontendInfo;
- Result res = getHidlFrontendInfo((int)ids[i], frontendInfo);
- if (res != Result::SUCCESS) {
+ auto res = mTuner->getFrontendInfo(ids[i], &frontendInfo);
+ if (!res.isOk()) {
continue;
}
TunerFrontendInfo tunerFrontendInfo{
- .handle = getResourceHandleFromId((int)ids[i], FRONTEND),
- .type = static_cast<int>(frontendInfo.type),
- .exclusiveGroupId = static_cast<int>(frontendInfo.exclusiveGroupId),
+ .handle = getResourceHandleFromId((int)ids[i], FRONTEND),
+ .type = static_cast<int>(frontendInfo.type),
+ .exclusiveGroupId = frontendInfo.exclusiveGroupId,
};
infos.push_back(tunerFrontendInfo);
}
@@ -357,26 +279,21 @@
}
void TunerService::updateLnbResources() {
- vector<int> handles = getLnbHandles();
+ vector<int32_t> handles = getLnbHandles();
if (handles.size() == 0) {
return;
}
mTunerResourceManager->setLnbInfoList(handles);
}
-vector<int> TunerService::getLnbHandles() {
- vector<int> lnbHandles;
- if (mTuner != NULL) {
- Result res;
- vector<LnbId> lnbIds;
- mTuner->getLnbIds([&](Result r, const hardware::hidl_vec<LnbId>& ids) {
- lnbIds = ids;
- res = r;
- });
- if (res != Result::SUCCESS || lnbIds.size() == 0) {
- } else {
+vector<int32_t> TunerService::getLnbHandles() {
+ vector<int32_t> lnbHandles;
+ if (mTuner != nullptr) {
+ vector<int32_t> lnbIds;
+ auto res = mTuner->getLnbIds(&lnbIds);
+ if (res.isOk()) {
for (int i = 0; i < lnbIds.size(); i++) {
- lnbHandles.push_back(getResourceHandleFromId((int)lnbIds[i], LNB));
+ lnbHandles.push_back(getResourceHandleFromId(lnbIds[i], LNB));
}
}
}
@@ -384,186 +301,8 @@
return lnbHandles;
}
-Result TunerService::getHidlFrontendIds(hidl_vec<FrontendId>& ids) {
- if (mTuner == NULL) {
- return Result::NOT_INITIALIZED;
- }
- Result res;
- mTuner->getFrontendIds([&](Result r, const hidl_vec<FrontendId>& frontendIds) {
- ids = frontendIds;
- res = r;
- });
- return res;
-}
-
-Result TunerService::getHidlFrontendInfo(int id, FrontendInfo& info) {
- if (mTuner == NULL) {
- return Result::NOT_INITIALIZED;
- }
- Result res;
- mTuner->getFrontendInfo(id, [&](Result r, const FrontendInfo& feInfo) {
- info = feInfo;
- res = r;
- });
- return res;
-}
-
-TunerDemuxCapabilities TunerService::getAidlDemuxCaps(DemuxCapabilities caps) {
- TunerDemuxCapabilities aidlCaps{
- .numDemux = (int)caps.numDemux,
- .numRecord = (int)caps.numRecord,
- .numPlayback = (int)caps.numPlayback,
- .numTsFilter = (int)caps.numTsFilter,
- .numSectionFilter = (int)caps.numSectionFilter,
- .numAudioFilter = (int)caps.numAudioFilter,
- .numVideoFilter = (int)caps.numVideoFilter,
- .numPesFilter = (int)caps.numPesFilter,
- .numPcrFilter = (int)caps.numPcrFilter,
- .numBytesInSectionFilter = (int)caps.numBytesInSectionFilter,
- .filterCaps = (int)caps.filterCaps,
- .bTimeFilter = caps.bTimeFilter,
- };
- aidlCaps.linkCaps.resize(caps.linkCaps.size());
- copy(caps.linkCaps.begin(), caps.linkCaps.end(), aidlCaps.linkCaps.begin());
- return aidlCaps;
-}
-
-TunerFrontendInfo TunerService::convertToAidlFrontendInfo(FrontendInfo halInfo) {
- TunerFrontendInfo info{
- .type = (int)halInfo.type,
- .minFrequency = (int)halInfo.minFrequency,
- .maxFrequency = (int)halInfo.maxFrequency,
- .minSymbolRate = (int)halInfo.minSymbolRate,
- .maxSymbolRate = (int)halInfo.maxSymbolRate,
- .acquireRange = (int)halInfo.acquireRange,
- .exclusiveGroupId = (int)halInfo.exclusiveGroupId,
- };
- for (int i = 0; i < halInfo.statusCaps.size(); i++) {
- info.statusCaps.push_back((int)halInfo.statusCaps[i]);
- }
-
- TunerFrontendCapabilities caps;
- switch (halInfo.type) {
- case FrontendType::ANALOG: {
- if (FrontendInfo::FrontendCapabilities::hidl_discriminator::analogCaps
- == halInfo.frontendCaps.getDiscriminator()) {
- TunerFrontendAnalogCapabilities analogCaps{
- .typeCap = (int)halInfo.frontendCaps.analogCaps().typeCap,
- .sifStandardCap = (int)halInfo.frontendCaps.analogCaps().sifStandardCap,
- };
- caps.set<TunerFrontendCapabilities::analogCaps>(analogCaps);
- }
- break;
- }
- case FrontendType::ATSC: {
- if (FrontendInfo::FrontendCapabilities::hidl_discriminator::atscCaps
- == halInfo.frontendCaps.getDiscriminator()) {
- TunerFrontendAtscCapabilities atscCaps{
- .modulationCap = (int)halInfo.frontendCaps.atscCaps().modulationCap,
- };
- caps.set<TunerFrontendCapabilities::atscCaps>(atscCaps);
- }
- break;
- }
- case FrontendType::ATSC3: {
- if (FrontendInfo::FrontendCapabilities::hidl_discriminator::atsc3Caps
- == halInfo.frontendCaps.getDiscriminator()) {
- TunerFrontendAtsc3Capabilities atsc3Caps{
- .bandwidthCap = (int)halInfo.frontendCaps.atsc3Caps().bandwidthCap,
- .modulationCap = (int)halInfo.frontendCaps.atsc3Caps().modulationCap,
- .timeInterleaveModeCap =
- (int)halInfo.frontendCaps.atsc3Caps().timeInterleaveModeCap,
- .codeRateCap = (int)halInfo.frontendCaps.atsc3Caps().codeRateCap,
- .demodOutputFormatCap
- = (int)halInfo.frontendCaps.atsc3Caps().demodOutputFormatCap,
- .fecCap = (int)halInfo.frontendCaps.atsc3Caps().fecCap,
- };
- caps.set<TunerFrontendCapabilities::atsc3Caps>(atsc3Caps);
- }
- break;
- }
- case FrontendType::DVBC: {
- if (FrontendInfo::FrontendCapabilities::hidl_discriminator::dvbcCaps
- == halInfo.frontendCaps.getDiscriminator()) {
- TunerFrontendCableCapabilities cableCaps{
- .modulationCap = (int)halInfo.frontendCaps.dvbcCaps().modulationCap,
- .codeRateCap = (int64_t)halInfo.frontendCaps.dvbcCaps().fecCap,
- .annexCap = (int)halInfo.frontendCaps.dvbcCaps().annexCap,
- };
- caps.set<TunerFrontendCapabilities::cableCaps>(cableCaps);
- }
- break;
- }
- case FrontendType::DVBS: {
- if (FrontendInfo::FrontendCapabilities::hidl_discriminator::dvbsCaps
- == halInfo.frontendCaps.getDiscriminator()) {
- TunerFrontendDvbsCapabilities dvbsCaps{
- .modulationCap = (int)halInfo.frontendCaps.dvbsCaps().modulationCap,
- .codeRateCap = (long)halInfo.frontendCaps.dvbsCaps().innerfecCap,
- .standard = (int)halInfo.frontendCaps.dvbsCaps().standard,
- };
- caps.set<TunerFrontendCapabilities::dvbsCaps>(dvbsCaps);
- }
- break;
- }
- case FrontendType::DVBT: {
- if (FrontendInfo::FrontendCapabilities::hidl_discriminator::dvbtCaps
- == halInfo.frontendCaps.getDiscriminator()) {
- TunerFrontendDvbtCapabilities dvbtCaps{
- .transmissionModeCap = (int)halInfo.frontendCaps.dvbtCaps().transmissionModeCap,
- .bandwidthCap = (int)halInfo.frontendCaps.dvbtCaps().bandwidthCap,
- .constellationCap = (int)halInfo.frontendCaps.dvbtCaps().constellationCap,
- .codeRateCap = (int)halInfo.frontendCaps.dvbtCaps().coderateCap,
- .hierarchyCap = (int)halInfo.frontendCaps.dvbtCaps().hierarchyCap,
- .guardIntervalCap = (int)halInfo.frontendCaps.dvbtCaps().guardIntervalCap,
- .isT2Supported = (bool)halInfo.frontendCaps.dvbtCaps().isT2Supported,
- .isMisoSupported = (bool)halInfo.frontendCaps.dvbtCaps().isMisoSupported,
- };
- caps.set<TunerFrontendCapabilities::dvbtCaps>(dvbtCaps);
- }
- break;
- }
- case FrontendType::ISDBS: {
- if (FrontendInfo::FrontendCapabilities::hidl_discriminator::isdbsCaps
- == halInfo.frontendCaps.getDiscriminator()) {
- TunerFrontendIsdbsCapabilities isdbsCaps{
- .modulationCap = (int)halInfo.frontendCaps.isdbsCaps().modulationCap,
- .codeRateCap = (int)halInfo.frontendCaps.isdbsCaps().coderateCap,
- };
- caps.set<TunerFrontendCapabilities::isdbsCaps>(isdbsCaps);
- }
- break;
- }
- case FrontendType::ISDBS3: {
- if (FrontendInfo::FrontendCapabilities::hidl_discriminator::isdbs3Caps
- == halInfo.frontendCaps.getDiscriminator()) {
- TunerFrontendIsdbs3Capabilities isdbs3Caps{
- .modulationCap = (int)halInfo.frontendCaps.isdbs3Caps().modulationCap,
- .codeRateCap = (int)halInfo.frontendCaps.isdbs3Caps().coderateCap,
- };
- caps.set<TunerFrontendCapabilities::isdbs3Caps>(isdbs3Caps);
- }
- break;
- }
- case FrontendType::ISDBT: {
- if (FrontendInfo::FrontendCapabilities::hidl_discriminator::isdbtCaps
- == halInfo.frontendCaps.getDiscriminator()) {
- TunerFrontendIsdbtCapabilities isdbtCaps{
- .modeCap = (int)halInfo.frontendCaps.isdbtCaps().modeCap,
- .bandwidthCap = (int)halInfo.frontendCaps.isdbtCaps().bandwidthCap,
- .modulationCap = (int)halInfo.frontendCaps.isdbtCaps().modulationCap,
- .codeRateCap = (int)halInfo.frontendCaps.isdbtCaps().coderateCap,
- .guardIntervalCap = (int)halInfo.frontendCaps.isdbtCaps().guardIntervalCap,
- };
- caps.set<TunerFrontendCapabilities::isdbtCaps>(isdbtCaps);
- }
- break;
- }
- default:
- break;
- }
-
- info.caps = caps;
- return info;
-}
-} // namespace android
+} // namespace tuner
+} // namespace tv
+} // namespace media
+} // namespace android
+} // namespace aidl