shubang | 23aa3ac | 2020-09-07 18:56:28 -0700 | [diff] [blame] | 1 | /** |
| 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> |
Devin Moore | 95bd53d | 2021-01-21 14:03:40 -0800 | [diff] [blame^] | 20 | #include <fmq/ConvertMQDescriptors.h> |
shubang | 23aa3ac | 2020-09-07 18:56:28 -0700 | [diff] [blame] | 21 | #include <utils/Log.h> |
| 22 | #include "TunerService.h" |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 23 | #include "TunerFrontend.h" |
| 24 | #include "TunerLnb.h" |
shubang | ae56a2e | 2021-01-21 07:29:55 -0800 | [diff] [blame] | 25 | #include "TunerDemux.h" |
shubang | 23aa3ac | 2020-09-07 18:56:28 -0700 | [diff] [blame] | 26 | |
Amy Zhang | 70de35a | 2020-10-12 20:13:16 -0700 | [diff] [blame] | 27 | using ::aidl::android::media::tv::tuner::TunerFrontendAnalogCapabilities; |
| 28 | using ::aidl::android::media::tv::tuner::TunerFrontendAtsc3Capabilities; |
| 29 | using ::aidl::android::media::tv::tuner::TunerFrontendAtscCapabilities; |
| 30 | using ::aidl::android::media::tv::tuner::TunerFrontendCableCapabilities; |
| 31 | using ::aidl::android::media::tv::tuner::TunerFrontendCapabilities; |
| 32 | using ::aidl::android::media::tv::tuner::TunerFrontendDvbsCapabilities; |
| 33 | using ::aidl::android::media::tv::tuner::TunerFrontendDvbtCapabilities; |
| 34 | using ::aidl::android::media::tv::tuner::TunerFrontendIsdbs3Capabilities; |
| 35 | using ::aidl::android::media::tv::tuner::TunerFrontendIsdbsCapabilities; |
| 36 | using ::aidl::android::media::tv::tuner::TunerFrontendIsdbtCapabilities; |
shubang | 23aa3ac | 2020-09-07 18:56:28 -0700 | [diff] [blame] | 37 | using ::android::hardware::hidl_vec; |
shubang | 6d26626 | 2020-10-09 00:15:04 -0700 | [diff] [blame] | 38 | using ::android::hardware::tv::tuner::V1_0::DemuxFilterAvSettings; |
| 39 | using ::android::hardware::tv::tuner::V1_0::DemuxFilterMainType; |
| 40 | using ::android::hardware::tv::tuner::V1_0::DemuxFilterSettings; |
| 41 | using ::android::hardware::tv::tuner::V1_0::DemuxFilterType; |
| 42 | using ::android::hardware::tv::tuner::V1_0::DemuxTsFilterType; |
shubang | 23aa3ac | 2020-09-07 18:56:28 -0700 | [diff] [blame] | 43 | using ::android::hardware::tv::tuner::V1_0::FrontendId; |
Amy Zhang | 70de35a | 2020-10-12 20:13:16 -0700 | [diff] [blame] | 44 | using ::android::hardware::tv::tuner::V1_0::FrontendType; |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 45 | using ::android::hardware::tv::tuner::V1_0::IFrontend; |
| 46 | using ::android::hardware::tv::tuner::V1_0::ILnb; |
| 47 | using ::android::hardware::tv::tuner::V1_0::LnbId; |
shubang | 23aa3ac | 2020-09-07 18:56:28 -0700 | [diff] [blame] | 48 | using ::android::hardware::tv::tuner::V1_0::Result; |
| 49 | |
| 50 | namespace android { |
| 51 | |
shubang | 23aa3ac | 2020-09-07 18:56:28 -0700 | [diff] [blame] | 52 | TunerService::TunerService() {} |
| 53 | TunerService::~TunerService() {} |
| 54 | |
| 55 | void TunerService::instantiate() { |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 56 | shared_ptr<TunerService> service = |
shubang | 23aa3ac | 2020-09-07 18:56:28 -0700 | [diff] [blame] | 57 | ::ndk::SharedRefBase::make<TunerService>(); |
| 58 | AServiceManager_addService(service->asBinder().get(), getServiceName()); |
shubang | 6d26626 | 2020-10-09 00:15:04 -0700 | [diff] [blame] | 59 | } |
| 60 | |
shubang | 6d26626 | 2020-10-09 00:15:04 -0700 | [diff] [blame] | 61 | bool TunerService::getITuner() { |
| 62 | ALOGD("getITuner"); |
| 63 | if (mTuner != nullptr) { |
| 64 | return true; |
| 65 | } |
Amy Zhang | 0f04c45 | 2020-10-30 13:36:44 -0700 | [diff] [blame] | 66 | mTuner = ITuner::getService(); |
| 67 | if (mTuner == nullptr) { |
shubang | 6d26626 | 2020-10-09 00:15:04 -0700 | [diff] [blame] | 68 | ALOGE("Failed to get ITuner service"); |
| 69 | return false; |
Amy Zhang | 0f04c45 | 2020-10-30 13:36:44 -0700 | [diff] [blame] | 70 | } |
shubang | 6d26626 | 2020-10-09 00:15:04 -0700 | [diff] [blame] | 71 | return true; |
| 72 | } |
| 73 | |
shubang | ae56a2e | 2021-01-21 07:29:55 -0800 | [diff] [blame] | 74 | Status TunerService::openDemux( |
| 75 | int /* demuxHandle */, std::shared_ptr<ITunerDemux>* _aidl_return) { |
shubang | 6d26626 | 2020-10-09 00:15:04 -0700 | [diff] [blame] | 76 | ALOGD("openDemux"); |
| 77 | if (!getITuner()) { |
shubang | ae56a2e | 2021-01-21 07:29:55 -0800 | [diff] [blame] | 78 | return Status::fromServiceSpecificError(static_cast<int32_t>(Result::NOT_INITIALIZED)); |
shubang | 6d26626 | 2020-10-09 00:15:04 -0700 | [diff] [blame] | 79 | } |
| 80 | if (mDemux != nullptr) { |
shubang | ae56a2e | 2021-01-21 07:29:55 -0800 | [diff] [blame] | 81 | *_aidl_return = mDemux->ref<ITunerDemux>(); |
| 82 | return Status::ok(); |
shubang | 6d26626 | 2020-10-09 00:15:04 -0700 | [diff] [blame] | 83 | } |
| 84 | Result res; |
| 85 | uint32_t id; |
shubang | ae56a2e | 2021-01-21 07:29:55 -0800 | [diff] [blame] | 86 | sp<IDemux> demuxSp = nullptr; |
shubang | 6d26626 | 2020-10-09 00:15:04 -0700 | [diff] [blame] | 87 | mTuner->openDemux([&](Result r, uint32_t demuxId, const sp<IDemux>& demux) { |
| 88 | demuxSp = demux; |
| 89 | id = demuxId; |
| 90 | res = r; |
| 91 | ALOGD("open demux, id = %d", demuxId); |
| 92 | }); |
| 93 | if (res == Result::SUCCESS) { |
shubang | ae56a2e | 2021-01-21 07:29:55 -0800 | [diff] [blame] | 94 | mDemux = ::ndk::SharedRefBase::make<TunerDemux>(demuxSp, id); |
| 95 | *_aidl_return = mDemux->ref<ITunerDemux>(); |
| 96 | return Status::ok(); |
shubang | 6d26626 | 2020-10-09 00:15:04 -0700 | [diff] [blame] | 97 | } |
| 98 | |
shubang | ae56a2e | 2021-01-21 07:29:55 -0800 | [diff] [blame] | 99 | ALOGD("open demux failed, res = %d", res); |
| 100 | mDemux = nullptr; |
| 101 | return Status::fromServiceSpecificError(static_cast<int32_t>(res)); |
shubang | 6d26626 | 2020-10-09 00:15:04 -0700 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | Result TunerService::configFilter() { |
| 105 | ALOGD("configFilter"); |
| 106 | if (mFilter == NULL) { |
| 107 | ALOGD("Failed to configure filter: filter not found"); |
| 108 | return Result::NOT_INITIALIZED; |
| 109 | } |
| 110 | DemuxFilterSettings filterSettings; |
| 111 | DemuxTsFilterSettings tsFilterSettings { |
| 112 | .tpid = 256, |
| 113 | }; |
| 114 | DemuxFilterAvSettings filterAvSettings { |
| 115 | .isPassthrough = false, |
| 116 | }; |
| 117 | tsFilterSettings.filterSettings.av(filterAvSettings); |
| 118 | filterSettings.ts(tsFilterSettings); |
| 119 | Result res = mFilter->configure(filterSettings); |
| 120 | |
| 121 | if (res != Result::SUCCESS) { |
| 122 | ALOGD("config filter failed, res = %d", res); |
| 123 | return res; |
| 124 | } |
| 125 | |
| 126 | Result getQueueDescResult = Result::UNKNOWN_ERROR; |
| 127 | mFilter->getQueueDesc( |
| 128 | [&](Result r, const MQDescriptorSync<uint8_t>& desc) { |
| 129 | mFilterMQDesc = desc; |
| 130 | getQueueDescResult = r; |
| 131 | ALOGD("getFilterQueueDesc"); |
| 132 | }); |
| 133 | if (getQueueDescResult == Result::SUCCESS) { |
| 134 | unsafeHidlToAidlMQDescriptor<uint8_t, int8_t, SynchronizedReadWrite>( |
| 135 | mFilterMQDesc, &mAidlMQDesc); |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 136 | mAidlMq = new (nothrow) AidlMessageQueue(mAidlMQDesc); |
shubang | 6d26626 | 2020-10-09 00:15:04 -0700 | [diff] [blame] | 137 | EventFlag::createEventFlag(mAidlMq->getEventFlagWord(), &mEventFlag); |
| 138 | } else { |
| 139 | ALOGD("get MQDesc failed, res = %d", getQueueDescResult); |
| 140 | } |
| 141 | return getQueueDescResult; |
shubang | 23aa3ac | 2020-09-07 18:56:28 -0700 | [diff] [blame] | 142 | } |
| 143 | |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 144 | Status TunerService::getFrontendIds(vector<int32_t>* ids, int32_t* /* _aidl_return */) { |
shubang | 6d26626 | 2020-10-09 00:15:04 -0700 | [diff] [blame] | 145 | if (!getITuner()) { |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 146 | return Status::fromServiceSpecificError( |
shubang | 6d26626 | 2020-10-09 00:15:04 -0700 | [diff] [blame] | 147 | static_cast<int32_t>(Result::NOT_INITIALIZED)); |
shubang | 23aa3ac | 2020-09-07 18:56:28 -0700 | [diff] [blame] | 148 | } |
| 149 | hidl_vec<FrontendId> feIds; |
| 150 | Result res; |
| 151 | mTuner->getFrontendIds([&](Result r, const hidl_vec<FrontendId>& frontendIds) { |
| 152 | feIds = frontendIds; |
| 153 | res = r; |
| 154 | }); |
| 155 | if (res != Result::SUCCESS) { |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 156 | return Status::fromServiceSpecificError(static_cast<int32_t>(res)); |
shubang | 23aa3ac | 2020-09-07 18:56:28 -0700 | [diff] [blame] | 157 | } |
| 158 | ids->resize(feIds.size()); |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 159 | copy(feIds.begin(), feIds.end(), ids->begin()); |
shubang | 23aa3ac | 2020-09-07 18:56:28 -0700 | [diff] [blame] | 160 | |
Amy Zhang | 0f04c45 | 2020-10-30 13:36:44 -0700 | [diff] [blame] | 161 | return Status::ok(); |
shubang | 23aa3ac | 2020-09-07 18:56:28 -0700 | [diff] [blame] | 162 | } |
| 163 | |
Amy Zhang | 70de35a | 2020-10-12 20:13:16 -0700 | [diff] [blame] | 164 | Status TunerService::getFrontendInfo( |
Amy Zhang | 1d28bbb | 2021-01-13 18:11:15 -0800 | [diff] [blame] | 165 | int32_t frontendHandle, TunerFrontendInfo* _aidl_return) { |
Amy Zhang | 70de35a | 2020-10-12 20:13:16 -0700 | [diff] [blame] | 166 | if (mTuner == nullptr) { |
Amy Zhang | 0f04c45 | 2020-10-30 13:36:44 -0700 | [diff] [blame] | 167 | ALOGE("ITuner service is not init."); |
| 168 | return ::ndk::ScopedAStatus::fromServiceSpecificError( |
| 169 | static_cast<int32_t>(Result::UNAVAILABLE)); |
Amy Zhang | 70de35a | 2020-10-12 20:13:16 -0700 | [diff] [blame] | 170 | } |
| 171 | |
| 172 | Result res; |
| 173 | FrontendInfo info; |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 174 | int feId = getResourceIdFromHandle(frontendHandle, FRONTEND); |
Amy Zhang | 70de35a | 2020-10-12 20:13:16 -0700 | [diff] [blame] | 175 | mTuner->getFrontendInfo(feId, [&](Result r, const FrontendInfo& feInfo) { |
| 176 | info = feInfo; |
| 177 | res = r; |
| 178 | }); |
| 179 | if (res != Result::SUCCESS) { |
Amy Zhang | 0f04c45 | 2020-10-30 13:36:44 -0700 | [diff] [blame] | 180 | return Status::fromServiceSpecificError(static_cast<int32_t>(res)); |
Amy Zhang | 70de35a | 2020-10-12 20:13:16 -0700 | [diff] [blame] | 181 | } |
| 182 | |
Amy Zhang | 1d28bbb | 2021-01-13 18:11:15 -0800 | [diff] [blame] | 183 | TunerFrontendInfo tunerInfo = convertToAidlFrontendInfo(info); |
Amy Zhang | 70de35a | 2020-10-12 20:13:16 -0700 | [diff] [blame] | 184 | *_aidl_return = tunerInfo; |
Amy Zhang | 0f04c45 | 2020-10-30 13:36:44 -0700 | [diff] [blame] | 185 | return Status::ok(); |
| 186 | } |
| 187 | |
| 188 | Status TunerService::openFrontend( |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 189 | int32_t frontendHandle, shared_ptr<ITunerFrontend>* _aidl_return) { |
Amy Zhang | 0f04c45 | 2020-10-30 13:36:44 -0700 | [diff] [blame] | 190 | if (mTuner == nullptr) { |
| 191 | ALOGE("ITuner service is not init."); |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 192 | return Status::fromServiceSpecificError(static_cast<int32_t>(Result::UNAVAILABLE)); |
Amy Zhang | 0f04c45 | 2020-10-30 13:36:44 -0700 | [diff] [blame] | 193 | } |
| 194 | |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 195 | Result status; |
| 196 | sp<IFrontend> frontend; |
| 197 | int id = getResourceIdFromHandle(frontendHandle, FRONTEND); |
| 198 | mTuner->openFrontendById(id, [&](Result result, const sp<IFrontend>& fe) { |
| 199 | frontend = fe; |
| 200 | status = result; |
| 201 | }); |
| 202 | if (status != Result::SUCCESS) { |
| 203 | return Status::fromServiceSpecificError(static_cast<int32_t>(status)); |
| 204 | } |
| 205 | *_aidl_return = ::ndk::SharedRefBase::make<TunerFrontend>(frontend, id); |
| 206 | return Status::ok(); |
| 207 | } |
| 208 | |
| 209 | Status TunerService::getFmqSyncReadWrite( |
| 210 | MQDescriptor<int8_t, SynchronizedReadWrite>* mqDesc, bool* _aidl_return) { |
| 211 | ALOGD("getFmqSyncReadWrite"); |
| 212 | // TODO: put the following methods AIDL, and should be called from clients. |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 213 | configFilter(); |
| 214 | mFilter->start(); |
| 215 | if (mqDesc == nullptr) { |
| 216 | ALOGD("getFmqSyncReadWrite null MQDescriptor."); |
| 217 | *_aidl_return = false; |
| 218 | } else { |
| 219 | ALOGD("getFmqSyncReadWrite true"); |
| 220 | *_aidl_return = true; |
| 221 | *mqDesc = move(mAidlMQDesc); |
| 222 | } |
| 223 | return ndk::ScopedAStatus::ok(); |
| 224 | } |
| 225 | |
| 226 | Status TunerService::openLnb(int lnbHandle, shared_ptr<ITunerLnb>* _aidl_return) { |
| 227 | if (mTuner == nullptr) { |
| 228 | ALOGE("ITuner service is not init."); |
| 229 | return Status::fromServiceSpecificError(static_cast<int32_t>(Result::UNAVAILABLE)); |
| 230 | } |
| 231 | |
| 232 | Result status; |
| 233 | sp<ILnb> lnb; |
| 234 | int id = getResourceIdFromHandle(lnbHandle, LNB); |
| 235 | mTuner->openLnbById(id, [&](Result result, const sp<ILnb>& lnbSp){ |
| 236 | lnb = lnbSp; |
| 237 | status = result; |
| 238 | }); |
| 239 | if (status != Result::SUCCESS) { |
| 240 | return Status::fromServiceSpecificError(static_cast<int32_t>(status)); |
| 241 | } |
| 242 | |
| 243 | *_aidl_return = ::ndk::SharedRefBase::make<TunerLnb>(lnb, id); |
| 244 | return Status::ok(); |
| 245 | } |
| 246 | |
| 247 | Status TunerService::openLnbByName(const string& lnbName, shared_ptr<ITunerLnb>* _aidl_return) { |
| 248 | if (mTuner == nullptr) { |
| 249 | ALOGE("ITuner service is not init."); |
| 250 | return Status::fromServiceSpecificError(static_cast<int32_t>(Result::UNAVAILABLE)); |
| 251 | } |
| 252 | |
| 253 | int lnbId; |
| 254 | Result status; |
| 255 | sp<ILnb> lnb; |
| 256 | mTuner->openLnbByName(lnbName, [&](Result r, LnbId id, const sp<ILnb>& lnbSp) { |
| 257 | status = r; |
| 258 | lnb = lnbSp; |
| 259 | lnbId = (int)id; |
| 260 | }); |
| 261 | if (status != Result::SUCCESS) { |
| 262 | return Status::fromServiceSpecificError(static_cast<int32_t>(status)); |
| 263 | } |
| 264 | |
| 265 | *_aidl_return = ::ndk::SharedRefBase::make<TunerLnb>(lnb, lnbId); |
Amy Zhang | 0f04c45 | 2020-10-30 13:36:44 -0700 | [diff] [blame] | 266 | return Status::ok(); |
Amy Zhang | 70de35a | 2020-10-12 20:13:16 -0700 | [diff] [blame] | 267 | } |
| 268 | |
Amy Zhang | 1d28bbb | 2021-01-13 18:11:15 -0800 | [diff] [blame] | 269 | TunerFrontendInfo TunerService::convertToAidlFrontendInfo(FrontendInfo halInfo) { |
| 270 | TunerFrontendInfo info{ |
Amy Zhang | 70de35a | 2020-10-12 20:13:16 -0700 | [diff] [blame] | 271 | .type = (int)halInfo.type, |
| 272 | .minFrequency = (int)halInfo.minFrequency, |
| 273 | .maxFrequency = (int)halInfo.maxFrequency, |
| 274 | .minSymbolRate = (int)halInfo.minSymbolRate, |
| 275 | .maxSymbolRate = (int)halInfo.maxSymbolRate, |
| 276 | .acquireRange = (int)halInfo.acquireRange, |
| 277 | .exclusiveGroupId = (int)halInfo.exclusiveGroupId, |
| 278 | }; |
| 279 | for (int i = 0; i < halInfo.statusCaps.size(); i++) { |
| 280 | info.statusCaps.push_back((int)halInfo.statusCaps[i]); |
| 281 | } |
| 282 | |
| 283 | TunerFrontendCapabilities caps; |
| 284 | switch (halInfo.type) { |
| 285 | case FrontendType::ANALOG: { |
| 286 | TunerFrontendAnalogCapabilities analogCaps{ |
| 287 | .typeCap = (int)halInfo.frontendCaps.analogCaps().typeCap, |
| 288 | .sifStandardCap = (int)halInfo.frontendCaps.analogCaps().sifStandardCap, |
| 289 | }; |
| 290 | caps.set<TunerFrontendCapabilities::analogCaps>(analogCaps); |
| 291 | break; |
| 292 | } |
| 293 | case FrontendType::ATSC: { |
| 294 | TunerFrontendAtscCapabilities atscCaps{ |
| 295 | .modulationCap = (int)halInfo.frontendCaps.atscCaps().modulationCap, |
| 296 | }; |
| 297 | caps.set<TunerFrontendCapabilities::atscCaps>(atscCaps); |
| 298 | break; |
| 299 | } |
| 300 | case FrontendType::ATSC3: { |
| 301 | TunerFrontendAtsc3Capabilities atsc3Caps{ |
| 302 | .bandwidthCap = (int)halInfo.frontendCaps.atsc3Caps().bandwidthCap, |
| 303 | .modulationCap = (int)halInfo.frontendCaps.atsc3Caps().modulationCap, |
| 304 | .timeInterleaveModeCap = |
| 305 | (int)halInfo.frontendCaps.atsc3Caps().timeInterleaveModeCap, |
| 306 | .codeRateCap = (int)halInfo.frontendCaps.atsc3Caps().codeRateCap, |
| 307 | .demodOutputFormatCap = (int)halInfo.frontendCaps.atsc3Caps().demodOutputFormatCap, |
| 308 | .fecCap = (int)halInfo.frontendCaps.atsc3Caps().fecCap, |
| 309 | }; |
| 310 | caps.set<TunerFrontendCapabilities::atsc3Caps>(atsc3Caps); |
| 311 | break; |
| 312 | } |
| 313 | case FrontendType::DVBC: { |
| 314 | TunerFrontendCableCapabilities cableCaps{ |
| 315 | .modulationCap = (int)halInfo.frontendCaps.dvbcCaps().modulationCap, |
| 316 | .codeRateCap = (int)halInfo.frontendCaps.dvbcCaps().fecCap, |
| 317 | .annexCap = (int)halInfo.frontendCaps.dvbcCaps().annexCap, |
| 318 | }; |
| 319 | caps.set<TunerFrontendCapabilities::cableCaps>(cableCaps); |
| 320 | break; |
| 321 | } |
| 322 | case FrontendType::DVBS: { |
| 323 | TunerFrontendDvbsCapabilities dvbsCaps{ |
| 324 | .modulationCap = (int)halInfo.frontendCaps.dvbsCaps().modulationCap, |
| 325 | .codeRateCap = (long)halInfo.frontendCaps.dvbsCaps().innerfecCap, |
| 326 | .standard = (int)halInfo.frontendCaps.dvbsCaps().standard, |
| 327 | }; |
| 328 | caps.set<TunerFrontendCapabilities::dvbsCaps>(dvbsCaps); |
| 329 | break; |
| 330 | } |
| 331 | case FrontendType::DVBT: { |
| 332 | TunerFrontendDvbtCapabilities dvbtCaps{ |
| 333 | .transmissionModeCap = (int)halInfo.frontendCaps.dvbtCaps().transmissionModeCap, |
| 334 | .bandwidthCap = (int)halInfo.frontendCaps.dvbtCaps().bandwidthCap, |
| 335 | .constellationCap = (int)halInfo.frontendCaps.dvbtCaps().constellationCap, |
| 336 | .codeRateCap = (int)halInfo.frontendCaps.dvbtCaps().coderateCap, |
| 337 | .hierarchyCap = (int)halInfo.frontendCaps.dvbtCaps().hierarchyCap, |
| 338 | .guardIntervalCap = (int)halInfo.frontendCaps.dvbtCaps().guardIntervalCap, |
| 339 | .isT2Supported = (bool)halInfo.frontendCaps.dvbtCaps().isT2Supported, |
| 340 | .isMisoSupported = (bool)halInfo.frontendCaps.dvbtCaps().isMisoSupported, |
| 341 | }; |
| 342 | caps.set<TunerFrontendCapabilities::dvbtCaps>(dvbtCaps); |
| 343 | break; |
| 344 | } |
| 345 | case FrontendType::ISDBS: { |
| 346 | TunerFrontendIsdbsCapabilities isdbsCaps{ |
| 347 | .modulationCap = (int)halInfo.frontendCaps.isdbsCaps().modulationCap, |
| 348 | .codeRateCap = (int)halInfo.frontendCaps.isdbsCaps().coderateCap, |
| 349 | }; |
| 350 | caps.set<TunerFrontendCapabilities::isdbsCaps>(isdbsCaps); |
| 351 | break; |
| 352 | } |
| 353 | case FrontendType::ISDBS3: { |
| 354 | TunerFrontendIsdbs3Capabilities isdbs3Caps{ |
| 355 | .modulationCap = (int)halInfo.frontendCaps.isdbs3Caps().modulationCap, |
| 356 | .codeRateCap = (int)halInfo.frontendCaps.isdbs3Caps().coderateCap, |
| 357 | }; |
| 358 | caps.set<TunerFrontendCapabilities::isdbs3Caps>(isdbs3Caps); |
| 359 | break; |
| 360 | } |
| 361 | case FrontendType::ISDBT: { |
| 362 | TunerFrontendIsdbtCapabilities isdbtCaps{ |
| 363 | .modeCap = (int)halInfo.frontendCaps.isdbtCaps().modeCap, |
| 364 | .bandwidthCap = (int)halInfo.frontendCaps.isdbtCaps().bandwidthCap, |
| 365 | .modulationCap = (int)halInfo.frontendCaps.isdbtCaps().modulationCap, |
| 366 | .codeRateCap = (int)halInfo.frontendCaps.isdbtCaps().coderateCap, |
| 367 | .guardIntervalCap = (int)halInfo.frontendCaps.isdbtCaps().guardIntervalCap, |
| 368 | }; |
| 369 | caps.set<TunerFrontendCapabilities::isdbtCaps>(isdbtCaps); |
| 370 | break; |
| 371 | } |
| 372 | default: |
| 373 | break; |
| 374 | } |
| 375 | |
| 376 | info.caps = caps; |
| 377 | return info; |
| 378 | } |
shubang | 23aa3ac | 2020-09-07 18:56:28 -0700 | [diff] [blame] | 379 | } // namespace android |