diff --git a/tv/tuner/1.0/vts/functional/LnbTests.cpp b/tv/tuner/1.0/vts/functional/LnbTests.cpp index 9080f59762..9338c7341c 100644 --- a/tv/tuner/1.0/vts/functional/LnbTests.cpp +++ b/tv/tuner/1.0/vts/functional/LnbTests.cpp @@ -48,10 +48,11 @@ AssertionResult LnbTests::openLnbById(uint32_t lnbId) { return AssertionResult(status == Result::SUCCESS); } -AssertionResult LnbTests::openLnbByName(string lnbName) { +AssertionResult LnbTests::openLnbByName(string lnbName, uint32_t& id) { Result status; - mService->openLnbByName(lnbName, [&](Result result, uint32_t /*lnbId*/, const sp& lnb) { + mService->openLnbByName(lnbName, [&](Result result, uint32_t lnbId, const sp& lnb) { mLnb = lnb; + id = lnbId; status = result; }); diff --git a/tv/tuner/1.0/vts/functional/LnbTests.h b/tv/tuner/1.0/vts/functional/LnbTests.h index 2fdbe2ce26..62b42ff937 100644 --- a/tv/tuner/1.0/vts/functional/LnbTests.h +++ b/tv/tuner/1.0/vts/functional/LnbTests.h @@ -64,7 +64,7 @@ class LnbTests { AssertionResult getLnbIds(vector& ids); AssertionResult openLnbById(uint32_t lnbId); - AssertionResult openLnbByName(string lnbName); + AssertionResult openLnbByName(string lnbName, uint32_t& lnbId); AssertionResult setLnbCallback(); AssertionResult setVoltage(LnbVoltage voltage); AssertionResult setTone(LnbTone tone); diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp index 41a494dc6f..4c92665b63 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp @@ -56,7 +56,7 @@ void TunerFilterHidlTest::configSingleFilterInDemuxTest(FilterConfig filterConf, } void TunerFilterHidlTest::testTimeFilter(TimeFilterConfig filterConf) { - if (!filterConf.supportTimeFilter) { + if (!timeFilter.support) { return; } uint32_t demuxId; @@ -64,11 +64,8 @@ void TunerFilterHidlTest::testTimeFilter(TimeFilterConfig filterConf) { DemuxCapabilities caps; ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); - // TODO: add time filter hardware support checker ASSERT_TRUE(mDemuxTests.getDemuxCaps(caps)); - if (!caps.bTimeFilter) { - return; - } + ASSERT_TRUE(caps.bTimeFilter); mFilterTests.setDemux(demux); ASSERT_TRUE(mFilterTests.openTimeFilterInDemux()); ASSERT_TRUE(mFilterTests.setTimeStamp(filterConf.timeStamp)); @@ -86,17 +83,14 @@ void TunerBroadcastHidlTest::broadcastSingleFilterTest(FilterConfig filterConf, uint32_t filterId; mFrontendTests.getFrontendIdByType(frontendConf.type, feId); - if (feId == INVALID_ID) { - // TODO broadcast test on Cuttlefish needs licensed ts input, - // these tests are runnable on vendor device with real frontend module - // or with manual ts installing and use DVBT frontend. - return; - } ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); ASSERT_TRUE(mFrontendTests.setFrontendCallback()); if (mLnbId) { ASSERT_TRUE(mFrontendTests.setLnb(*mLnbId)); } + if (frontendConf.isSoftwareFe) { + mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[live.dvrSoftwareFeId]); + } ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFrontendTests.setDemux(demux); @@ -119,14 +113,16 @@ void TunerBroadcastHidlTest::broadcastSingleFilterTest(FilterConfig filterConf, void TunerBroadcastHidlTest::broadcastSingleFilterTestWithLnb(FilterConfig filterConf, FrontendConfig frontendConf, LnbConfig lnbConf) { - vector ids; - ASSERT_TRUE(mLnbTests.getLnbIds(ids)); - if (ids.size() == 0) { - return; + if (lnbConf.name.compare(emptyHardwareId) == 0) { + vector ids; + ASSERT_TRUE(mLnbTests.getLnbIds(ids)); + ASSERT_TRUE(ids.size() > 0); + ASSERT_TRUE(mLnbTests.openLnbById(ids[0])); + mLnbId = &ids[0]; + } else { + mLnbId = (uint32_t*)malloc(sizeof(uint32_t)); + ASSERT_TRUE(mLnbTests.openLnbByName(lnbConf.name, *mLnbId)); } - ASSERT_TRUE(ids.size() > 0); - ASSERT_TRUE(mLnbTests.openLnbById(ids[0])); - mLnbId = &ids[0]; ASSERT_TRUE(mLnbTests.setLnbCallback()); ASSERT_TRUE(mLnbTests.setVoltage(lnbConf.voltage)); ASSERT_TRUE(mLnbTests.setTone(lnbConf.tone)); @@ -178,6 +174,9 @@ void TunerRecordHidlTest::recordSingleFilterTest(FilterConfig filterConf, if (mLnbId) { ASSERT_TRUE(mFrontendTests.setLnb(*mLnbId)); } + if (frontendConf.isSoftwareFe) { + mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[record.dvrSoftwareFeId]); + } ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFilterTests.setDemux(demux); @@ -212,18 +211,23 @@ void TunerRecordHidlTest::recordSingleFilterTest(FilterConfig filterConf, void TunerRecordHidlTest::recordSingleFilterTestWithLnb(FilterConfig filterConf, FrontendConfig frontendConf, DvrConfig dvrConf, LnbConfig lnbConf) { - vector ids; - ASSERT_TRUE(mLnbTests.getLnbIds(ids)); - if (ids.size() == 0) { - return; + if (lnbConf.name.compare(emptyHardwareId) == 0) { + vector ids; + ASSERT_TRUE(mLnbTests.getLnbIds(ids)); + ASSERT_TRUE(ids.size() > 0); + ASSERT_TRUE(mLnbTests.openLnbById(ids[0])); + mLnbId = &ids[0]; + } else { + mLnbId = (uint32_t*)malloc(sizeof(uint32_t)); + ASSERT_TRUE(mLnbTests.openLnbByName(lnbConf.name, *mLnbId)); } - ASSERT_TRUE(ids.size() > 0); - ASSERT_TRUE(mLnbTests.openLnbById(ids[0])); - mLnbId = &ids[0]; ASSERT_TRUE(mLnbTests.setLnbCallback()); ASSERT_TRUE(mLnbTests.setVoltage(lnbConf.voltage)); ASSERT_TRUE(mLnbTests.setTone(lnbConf.tone)); ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbConf.position)); + for (auto msgName : lnbRecord.diseqcMsgs) { + ASSERT_TRUE(mLnbTests.sendDiseqcMessage(diseqcMsgMap[msgName])); + } recordSingleFilterTest(filterConf, frontendConf, dvrConf); ASSERT_TRUE(mLnbTests.closeLnb()); mLnbId = nullptr; @@ -279,14 +283,11 @@ void TunerDescramblerHidlTest::scrambledBroadcastTest(set m set::iterator id; mFrontendTests.getFrontendIdByType(frontendConf.type, feId); - if (feId == INVALID_ID) { - // TODO broadcast test on Cuttlefish needs licensed ts input, - // these tests are runnable on vendor device with real frontend module - // or with manual ts installing and use DVBT frontend. - return; - } ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); ASSERT_TRUE(mFrontendTests.setFrontendCallback()); + if (frontendConf.isSoftwareFe) { + mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[descrambling.dvrSoftwareFeId]); + } ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFilterTests.setDemux(demux); @@ -301,7 +302,7 @@ void TunerDescramblerHidlTest::scrambledBroadcastTest(set m TunerKeyToken token; ASSERT_TRUE(mDescramblerTests.getKeyToken(descConfig.casSystemId, descConfig.provisionStr, descConfig.hidlPvtData, token)); - ASSERT_TRUE(mDescramblerTests.setKeyToken(token)); + mDescramblerTests.setKeyToken(token); vector pids; DemuxPid pid; for (config = mediaFilterConfs.begin(); config != mediaFilterConfs.end(); config++) { @@ -346,37 +347,24 @@ TEST_P(TunerFrontendHidlTest, BlindScanFrontend) { mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_BLIND); } -TEST_P(TunerLnbHidlTest, OpenLnbByName) { - description("Open and configure an Lnb with name then send a diseqc msg to it."); - // TODO: add lnb hardware support checker - vector ids; - ASSERT_TRUE(mLnbTests.getLnbIds(ids)); - if (ids.size() == 0) { - return; - } - ASSERT_TRUE(mLnbTests.openLnbByName(lnbArray[LNB_EXTERNAL].name)); - ASSERT_TRUE(mLnbTests.setLnbCallback()); - ASSERT_TRUE(mLnbTests.setVoltage(lnbArray[LNB_EXTERNAL].voltage)); - ASSERT_TRUE(mLnbTests.setTone(lnbArray[LNB_EXTERNAL].tone)); - ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbArray[LNB_EXTERNAL].position)); - ASSERT_TRUE(mLnbTests.sendDiseqcMessage(diseqcMsgArray[DISEQC_POWER_ON])); - ASSERT_TRUE(mLnbTests.closeLnb()); -} - TEST_P(TunerLnbHidlTest, SendDiseqcMessageToLnb) { description("Open and configure an Lnb with specific settings then send a diseqc msg to it."); - vector ids; - ASSERT_TRUE(mLnbTests.getLnbIds(ids)); - if (ids.size() == 0) { - return; + if (lnbMap[lnbLive.lnbId].name.compare(emptyHardwareId) == 0) { + vector ids; + ASSERT_TRUE(mLnbTests.getLnbIds(ids)); + ASSERT_TRUE(ids.size() > 0); + ASSERT_TRUE(mLnbTests.openLnbById(ids[0])); + } else { + uint32_t id; + ASSERT_TRUE(mLnbTests.openLnbByName(lnbMap[lnbLive.lnbId].name, id)); } - ASSERT_TRUE(ids.size() > 0); - ASSERT_TRUE(mLnbTests.openLnbById(ids[0])); ASSERT_TRUE(mLnbTests.setLnbCallback()); - ASSERT_TRUE(mLnbTests.setVoltage(lnbArray[LNB0].voltage)); - ASSERT_TRUE(mLnbTests.setTone(lnbArray[LNB0].tone)); - ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbArray[LNB0].position)); - ASSERT_TRUE(mLnbTests.sendDiseqcMessage(diseqcMsgArray[DISEQC_POWER_ON])); + ASSERT_TRUE(mLnbTests.setVoltage(lnbMap[lnbLive.lnbId].voltage)); + ASSERT_TRUE(mLnbTests.setTone(lnbMap[lnbLive.lnbId].tone)); + ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbMap[lnbLive.lnbId].position)); + for (auto msgName : lnbLive.diseqcMsgs) { + ASSERT_TRUE(mLnbTests.sendDiseqcMessage(diseqcMsgMap[msgName])); + } ASSERT_TRUE(mLnbTests.closeLnb()); } @@ -397,6 +385,9 @@ TEST_P(TunerDemuxHidlTest, openDemux) { TEST_P(TunerDemuxHidlTest, getAvSyncTime) { description("Get the A/V sync time from a PCR filter."); + if (live.pcrFilterId.compare(emptyHardwareId) == 0) { + return; + } uint32_t feId; uint32_t demuxId; sp demux; @@ -412,15 +403,15 @@ TEST_P(TunerDemuxHidlTest, getAvSyncTime) { ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFilterTests.setDemux(demux); - ASSERT_TRUE(mFilterTests.openFilterInDemux(filterArray[TS_VIDEO1].type, - filterArray[TS_VIDEO1].bufferSize)); + ASSERT_TRUE(mFilterTests.openFilterInDemux(filterMap[live.videoFilterId].type, + filterMap[live.videoFilterId].bufferSize)); ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(mediaFilterId)); - ASSERT_TRUE(mFilterTests.configFilter(filterArray[TS_VIDEO1].settings, mediaFilterId)); + ASSERT_TRUE(mFilterTests.configFilter(filterMap[live.videoFilterId].settings, mediaFilterId)); mediaFilter = mFilterTests.getFilterById(mediaFilterId); - ASSERT_TRUE(mFilterTests.openFilterInDemux(filterArray[TS_PCR0].type, - filterArray[TS_PCR0].bufferSize)); + ASSERT_TRUE(mFilterTests.openFilterInDemux(filterMap[live.pcrFilterId].type, + filterMap[live.pcrFilterId].bufferSize)); ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(pcrFilterId)); - ASSERT_TRUE(mFilterTests.configFilter(filterArray[TS_PCR0].settings, pcrFilterId)); + ASSERT_TRUE(mFilterTests.configFilter(filterMap[live.pcrFilterId].settings, pcrFilterId)); ASSERT_TRUE(mDemuxTests.getAvSyncId(mediaFilter, avSyncHwId)); ASSERT_TRUE(pcrFilterId == avSyncHwId); ASSERT_TRUE(mDemuxTests.getAvSyncTime(pcrFilterId)); @@ -433,7 +424,7 @@ TEST_P(TunerDemuxHidlTest, getAvSyncTime) { TEST_P(TunerFilterHidlTest, StartFilterInDemux) { description("Open and start a filter in Demux."); // TODO use paramterized tests - configSingleFilterInDemuxTest(filterArray[TS_VIDEO0], frontendMap[live.frontendId]); + configSingleFilterInDemuxTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]); } TEST_P(TunerFilterHidlTest, SetFilterLinkage) { @@ -450,11 +441,9 @@ TEST_P(TunerFilterHidlTest, SetFilterLinkage) { if (caps.linkCaps[i] & (bitMask << j)) { uint32_t sourceFilterId; uint32_t sinkFilterId; - ASSERT_TRUE(mFilterTests.openFilterInDemux(filterLinkageTypes[SOURCE][i], - FMQ_SIZE_16M)); + ASSERT_TRUE(mFilterTests.openFilterInDemux(getLinkageFilterType(i), FMQ_SIZE_16M)); ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(sourceFilterId)); - ASSERT_TRUE( - mFilterTests.openFilterInDemux(filterLinkageTypes[SINK][j], FMQ_SIZE_16M)); + ASSERT_TRUE(mFilterTests.openFilterInDemux(getLinkageFilterType(j), FMQ_SIZE_16M)); ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(sinkFilterId)); ASSERT_TRUE(mFilterTests.setFilterDataSource(sourceFilterId, sinkFilterId)); ASSERT_TRUE(mFilterTests.setFilterDataSourceToDemux(sinkFilterId)); @@ -469,37 +458,47 @@ TEST_P(TunerFilterHidlTest, SetFilterLinkage) { TEST_P(TunerFilterHidlTest, testTimeFilter) { description("Open a timer filter in Demux and set time stamp."); // TODO use paramterized tests - testTimeFilter(timeFilterArray[TIMER0]); + testTimeFilter(timeFilterMap[timeFilter.timeFilterId]); } TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowVideoFilterTest) { description("Test Video Filter functionality in Broadcast use case."); - broadcastSingleFilterTest(filterArray[TS_VIDEO1], frontendMap[live.frontendId]); + broadcastSingleFilterTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]); } TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowAudioFilterTest) { description("Test Audio Filter functionality in Broadcast use case."); - broadcastSingleFilterTest(filterArray[TS_AUDIO0], frontendMap[live.frontendId]); + broadcastSingleFilterTest(filterMap[live.audioFilterId], frontendMap[live.frontendId]); } TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowSectionFilterTest) { description("Test Section Filter functionality in Broadcast use case."); - broadcastSingleFilterTest(filterArray[TS_SECTION0], frontendMap[live.frontendId]); + if (live.sectionFilterId.compare(emptyHardwareId) == 0) { + return; + } + broadcastSingleFilterTest(filterMap[live.sectionFilterId], frontendMap[live.frontendId]); } TEST_P(TunerBroadcastHidlTest, IonBufferTest) { description("Test the av filter data bufferring."); - broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendMap[live.frontendId]); + broadcastSingleFilterTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]); } TEST_P(TunerBroadcastHidlTest, LnbBroadcastDataFlowVideoFilterTest) { description("Test Video Filter functionality in Broadcast with Lnb use case."); - broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendMap[live.frontendId]); + if (!lnbLive.support) { + return; + } + broadcastSingleFilterTestWithLnb(filterMap[lnbLive.videoFilterId], + frontendMap[lnbLive.frontendId], lnbMap[lnbLive.lnbId]); } TEST_P(TunerPlaybackHidlTest, PlaybackDataFlowWithTsSectionFilterTest) { description("Feed ts data from playback and configure Ts section filter to get output"); - playbackSingleFilterTest(filterArray[TS_SECTION0], dvrArray[DVR_PLAYBACK0]); + if (!playback.support || playback.sectionFilterId.compare(emptyHardwareId) == 0) { + return; + } + playbackSingleFilterTest(filterMap[playback.sectionFilterId], dvrMap[playback.dvrId]); } TEST_P(TunerRecordHidlTest, AttachFiltersToRecordTest) { @@ -508,8 +507,8 @@ TEST_P(TunerRecordHidlTest, AttachFiltersToRecordTest) { if (!record.support) { return; } - attachSingleFilterToRecordDvrTest(filterArray[TS_RECORD0], frontendMap[record.frontendId], - dvrArray[DVR_RECORD0]); + attachSingleFilterToRecordDvrTest(filterMap[record.recordFilterId], + frontendMap[record.frontendId], dvrMap[record.dvrRecordId]); } TEST_P(TunerRecordHidlTest, RecordDataFlowWithTsRecordFilterTest) { @@ -517,17 +516,18 @@ TEST_P(TunerRecordHidlTest, RecordDataFlowWithTsRecordFilterTest) { if (!record.support) { return; } - recordSingleFilterTest(filterArray[TS_RECORD0], frontendMap[record.frontendId], - dvrArray[DVR_RECORD0]); + recordSingleFilterTest(filterMap[record.recordFilterId], frontendMap[record.frontendId], + dvrMap[record.dvrRecordId]); } TEST_P(TunerRecordHidlTest, LnbRecordDataFlowWithTsRecordFilterTest) { description("Feed ts data from Fe with Lnb to recording and test with ts record filter"); - if (record.support) { + if (lnbRecord.support) { return; } - recordSingleFilterTestWithLnb(filterArray[TS_RECORD0], frontendMap[lnbRecord.frontendId], - dvrArray[DVR_RECORD0], lnbArray[LNB0]); + recordSingleFilterTestWithLnb(filterMap[lnbRecord.recordFilterId], + frontendMap[lnbRecord.frontendId], dvrMap[lnbRecord.dvrRecordId], + lnbMap[lnbRecord.lnbId]); } TEST_P(TunerDescramblerHidlTest, CreateDescrambler) { @@ -556,10 +556,10 @@ TEST_P(TunerDescramblerHidlTest, ScrambledBroadcastDataFlowMediaFiltersTest) { return; } set filterConfs; - filterConfs.insert(filterArray[TS_AUDIO0]); - filterConfs.insert(filterArray[TS_VIDEO1]); + filterConfs.insert(static_cast(filterMap[descrambling.audioFilterId])); + filterConfs.insert(static_cast(filterMap[descrambling.videoFilterId])); scrambledBroadcastTest(filterConfs, frontendMap[descrambling.frontendId], - descramblerArray[DESC_0]); + descramblerMap[descrambling.descramblerId]); } INSTANTIATE_TEST_SUITE_P( diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h index d1f6a45366..e2406042df 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h @@ -20,6 +20,9 @@ #include "LnbTests.h" using android::hardware::tv::tuner::V1_0::DataFormat; +using android::hardware::tv::tuner::V1_0::DemuxAlpFilterType; +using android::hardware::tv::tuner::V1_0::DemuxMmtpFilterType; +using android::hardware::tv::tuner::V1_0::DemuxTlvFilterType; using android::hardware::tv::tuner::V1_0::IDescrambler; static AssertionResult success() { @@ -33,18 +36,16 @@ bool initConfiguration() { return false; } initFrontendConfig(); + initFilterConfig(); + initDvrConfig(); + initLnbConfig(); + initTimeFilterConfig(); + initDescramblerConfig(); connectHardwaresToTestCases(); if (!validateConnections()) { ALOGW("[vts] failed to validate connections."); return false; } - - initLnbConfig(); - initFilterConfig(); - initTimeFilterConfig(); - initDvrConfig(); - initDescramblerConfig(); - return true; } @@ -148,6 +149,29 @@ class TunerFilterHidlTest : public testing::TestWithParam { void configSingleFilterInDemuxTest(FilterConfig filterConf, FrontendConfig frontendConf); void testTimeFilter(TimeFilterConfig filterConf); + DemuxFilterType getLinkageFilterType(int bit) { + DemuxFilterType type; + type.mainType = static_cast(1 << bit); + switch (type.mainType) { + case DemuxFilterMainType::TS: + type.subType.tsFilterType(DemuxTsFilterType::UNDEFINED); + break; + case DemuxFilterMainType::MMTP: + type.subType.mmtpFilterType(DemuxMmtpFilterType::UNDEFINED); + break; + case DemuxFilterMainType::IP: + type.subType.ipFilterType(DemuxIpFilterType::UNDEFINED); + break; + case DemuxFilterMainType::TLV: + type.subType.tlvFilterType(DemuxTlvFilterType::UNDEFINED); + break; + case DemuxFilterMainType::ALP: + type.subType.alpFilterType(DemuxAlpFilterType::UNDEFINED); + break; + } + return type; + } + sp mService; FrontendTests mFrontendTests; DemuxTests mDemuxTests; diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h index ec5571fb03..65f8615ad8 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h @@ -23,167 +23,47 @@ #include "../../../config/TunerTestingConfigReader.h" -// TODO: remove unnecessary imports after config reader refactoring is done. -using android::hardware::tv::tuner::V1_0::DataFormat; -using android::hardware::tv::tuner::V1_0::DemuxAlpFilterType; -using android::hardware::tv::tuner::V1_0::DemuxFilterEvent; 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::DemuxIpFilterType; -using android::hardware::tv::tuner::V1_0::DemuxMmtpFilterType; -using android::hardware::tv::tuner::V1_0::DemuxRecordScIndexType; -using android::hardware::tv::tuner::V1_0::DemuxTlvFilterType; -using android::hardware::tv::tuner::V1_0::DemuxTpid; using android::hardware::tv::tuner::V1_0::DemuxTsFilterType; -using android::hardware::tv::tuner::V1_0::DvrSettings; -using android::hardware::tv::tuner::V1_0::DvrType; using android::hardware::tv::tuner::V1_0::FrontendDvbtBandwidth; -using android::hardware::tv::tuner::V1_0::FrontendDvbtCoderate; -using android::hardware::tv::tuner::V1_0::FrontendDvbtConstellation; -using android::hardware::tv::tuner::V1_0::FrontendDvbtGuardInterval; -using android::hardware::tv::tuner::V1_0::FrontendDvbtHierarchy; using android::hardware::tv::tuner::V1_0::FrontendDvbtSettings; -using android::hardware::tv::tuner::V1_0::FrontendDvbtStandard; using android::hardware::tv::tuner::V1_0::FrontendDvbtTransmissionMode; using android::hardware::tv::tuner::V1_0::FrontendSettings; using android::hardware::tv::tuner::V1_0::FrontendStatus; using android::hardware::tv::tuner::V1_0::FrontendStatusType; using android::hardware::tv::tuner::V1_0::FrontendType; -using android::hardware::tv::tuner::V1_0::LnbPosition; -using android::hardware::tv::tuner::V1_0::LnbTone; -using android::hardware::tv::tuner::V1_0::LnbVoltage; -using android::hardware::tv::tuner::V1_0::PlaybackSettings; -using android::hardware::tv::tuner::V1_0::RecordSettings; using namespace std; using namespace android::media::tuner::testing::configuration::V1_0; -// TODO: remove all the constants and structs after config reader refactoring is done. -const uint32_t FMQ_SIZE_512K = 0x80000; -const uint32_t FMQ_SIZE_1M = 0x100000; const uint32_t FMQ_SIZE_4M = 0x400000; const uint32_t FMQ_SIZE_16M = 0x1000000; -#define CLEAR_KEY_SYSTEM_ID 0xF6D8 -#define FILTER_MAIN_TYPE_BIT_COUNT 32 -#define PROVISION_STR \ - "{ " \ - " \"id\": 21140844, " \ - " \"name\": \"Test Title\", " \ - " \"lowercase_organization_name\": \"Android\", " \ - " \"asset_key\": { " \ - " \"encryption_key\": \"nezAr3CHFrmBR9R8Tedotw==\" " \ - " }, " \ - " \"cas_type\": 1, " \ - " \"track_types\": [ ] " \ - "} " - -typedef enum { - TS_VIDEO0, - TS_VIDEO1, - TS_AUDIO0, - TS_PES0, - TS_PCR0, - TS_SECTION0, - TS_TS0, - TS_RECORD0, - FILTER_MAX, -} Filter; - -typedef enum { - TIMER0, - TIMER_MAX, -} TimeFilter; - -typedef enum { - SOURCE, - SINK, - LINKAGE_DIR, -} Linkage; - -typedef enum { - LNB0, - LNB_EXTERNAL, - LNB_MAX, -} Lnb; - -typedef enum { - DISEQC_POWER_ON, - DISEQC_MAX, -} Diseqc; - -typedef enum { - DVR_RECORD0, - DVR_PLAYBACK0, - DVR_SOFTWARE_FE, - DVR_MAX, -} Dvr; - -typedef enum { - DESC_0, - DESC_MAX, -} Descrambler; - -struct FilterConfig { - uint32_t bufferSize; - DemuxFilterType type; - DemuxFilterSettings settings; - bool getMqDesc; - - bool operator<(const FilterConfig& /*c*/) const { return false; } -}; - -struct TimeFilterConfig { - bool supportTimeFilter; - uint64_t timeStamp; -}; - -struct LnbConfig { - bool usingLnb; - string name; - LnbVoltage voltage; - LnbTone tone; - LnbPosition position; -}; - -struct DvrConfig { - DvrType type; - uint32_t bufferSize; - DvrSettings settings; - string playbackInputFile; -}; - -struct DescramblerConfig { - uint32_t casSystemId; - string provisionStr; - vector hidlPvtData; -}; - -// TODO: remove all the manual config array after the dynamic config refactoring is done. -static LnbConfig lnbArray[LNB_MAX]; -static vector diseqcMsgArray[DISEQC_MAX]; -static FilterConfig filterArray[FILTER_MAX]; -static TimeFilterConfig timeFilterArray[TIMER_MAX]; -static DemuxFilterType filterLinkageTypes[LINKAGE_DIR][FILTER_MAIN_TYPE_BIT_COUNT]; -static DvrConfig dvrArray[DVR_MAX]; -static DescramblerConfig descramblerArray[DESC_MAX]; +#define FILTER_MAIN_TYPE_BIT_COUNT 5 // Hardware configs static map frontendMap; +static map filterMap; +static map dvrMap; +static map lnbMap; +static map timeFilterMap; +static map> diseqcMsgMap; +static map descramblerMap; // Hardware and test cases connections static LiveBroadcastHardwareConnections live; static ScanHardwareConnections scan; +static DvrPlaybackHardwareConnections playback; static DvrRecordHardwareConnections record; static DescramblingHardwareConnections descrambling; static LnbLiveHardwareConnections lnbLive; static LnbRecordHardwareConnections lnbRecord; +static TimeFilterHardwareConnections timeFilter; -/** Configuration array for the frontend tune test */ +/** Config all the frontends that would be used in the tests */ inline void initFrontendConfig() { - // The test will use the internal default fe is default fe is connected to any data flow without - // overriding in the xml config. + // The test will use the internal default fe when default fe is connected to any data flow + // without overriding in the xml config. string defaultFeId = "FE_DEFAULT"; FrontendDvbtSettings dvbtSettings{ .frequency = 578000, @@ -208,14 +88,63 @@ inline void initFrontendConfig() { TunerTestingConfigReader::readFrontendConfig1_0(frontendMap); }; +inline void initFilterConfig() { + // The test will use the internal default filter when default filter is connected to any + // data flow without overriding in the xml config. + string defaultAudioFilterId = "FILTER_AUDIO_DEFAULT"; + string defaultVideoFilterId = "FILTER_VIDEO_DEFAULT"; + + filterMap[defaultVideoFilterId].type.mainType = DemuxFilterMainType::TS; + filterMap[defaultVideoFilterId].type.subType.tsFilterType(DemuxTsFilterType::VIDEO); + filterMap[defaultVideoFilterId].bufferSize = FMQ_SIZE_16M; + filterMap[defaultVideoFilterId].settings.ts().tpid = 256; + filterMap[defaultVideoFilterId].settings.ts().filterSettings.av({.isPassthrough = false}); + + filterMap[defaultAudioFilterId].type.mainType = DemuxFilterMainType::TS; + filterMap[defaultAudioFilterId].type.subType.tsFilterType(DemuxTsFilterType::AUDIO); + filterMap[defaultAudioFilterId].bufferSize = FMQ_SIZE_16M; + filterMap[defaultAudioFilterId].settings.ts().tpid = 256; + filterMap[defaultAudioFilterId].settings.ts().filterSettings.av({.isPassthrough = false}); + + // Read customized config + TunerTestingConfigReader::readFilterConfig1_0(filterMap); +}; + +/** Config all the dvrs that would be used in the tests */ +inline void initDvrConfig() { + // Read customized config + TunerTestingConfigReader::readDvrConfig1_0(dvrMap); +}; + +/** Config all the lnbs that would be used in the tests */ +inline void initLnbConfig() { + // Read customized config + TunerTestingConfigReader::readLnbConfig1_0(lnbMap); + TunerTestingConfigReader::readDiseqcMessages(diseqcMsgMap); +}; + +/** Config all the time filters that would be used in the tests */ +inline void initTimeFilterConfig() { + // Read customized config + TunerTestingConfigReader::readTimeFilterConfig1_0(timeFilterMap); +}; + +/** Config all the descramblers that would be used in the tests */ +inline void initDescramblerConfig() { + // Read customized config + TunerTestingConfigReader::readDescramblerConfig1_0(descramblerMap); +}; + /** Read the vendor configurations of which hardware to use for each test cases/data flows */ inline void connectHardwaresToTestCases() { TunerTestingConfigReader::connectLiveBroadcast(live); TunerTestingConfigReader::connectScan(scan); + TunerTestingConfigReader::connectDvrPlayback(playback); TunerTestingConfigReader::connectDvrRecord(record); TunerTestingConfigReader::connectDescrambling(descrambling); TunerTestingConfigReader::connectLnbLive(lnbLive); TunerTestingConfigReader::connectLnbRecord(lnbRecord); + TunerTestingConfigReader::connectTimeFilter(timeFilter); }; inline bool validateConnections() { @@ -228,153 +157,88 @@ inline bool validateConnections() { feIsValid &= lnbLive.support ? frontendMap.find(lnbLive.frontendId) != frontendMap.end() : true; feIsValid &= lnbRecord.support ? frontendMap.find(lnbRecord.frontendId) != frontendMap.end() : true; - return feIsValid; + + if (!feIsValid) { + ALOGW("[vts config] dynamic config fe connection is invalid."); + return false; + } + + bool dvrIsValid = frontendMap[live.frontendId].isSoftwareFe + ? dvrMap.find(live.dvrSoftwareFeId) != dvrMap.end() + : true; + dvrIsValid &= playback.support ? dvrMap.find(playback.dvrId) != dvrMap.end() : true; + if (record.support) { + if (frontendMap[record.frontendId].isSoftwareFe) { + dvrIsValid &= dvrMap.find(record.dvrSoftwareFeId) != dvrMap.end(); + } + dvrIsValid &= dvrMap.find(record.dvrRecordId) != dvrMap.end(); + } + if (descrambling.support && frontendMap[descrambling.frontendId].isSoftwareFe) { + dvrIsValid &= dvrMap.find(descrambling.dvrSoftwareFeId) != dvrMap.end(); + } + + if (!dvrIsValid) { + ALOGW("[vts config] dynamic config dvr connection is invalid."); + return false; + } + + bool filterIsValid = filterMap.find(live.audioFilterId) != filterMap.end() && + filterMap.find(live.videoFilterId) != filterMap.end(); + filterIsValid &= playback.support + ? (filterMap.find(playback.audioFilterId) != filterMap.end() && + filterMap.find(playback.videoFilterId) != filterMap.end()) + : true; + filterIsValid &= + record.support ? filterMap.find(record.recordFilterId) != filterMap.end() : true; + filterIsValid &= descrambling.support + ? (filterMap.find(descrambling.audioFilterId) != filterMap.end() && + filterMap.find(descrambling.videoFilterId) != filterMap.end()) + : true; + filterIsValid &= lnbLive.support ? (filterMap.find(lnbLive.audioFilterId) != filterMap.end() && + filterMap.find(lnbLive.videoFilterId) != filterMap.end()) + : true; + filterIsValid &= + lnbRecord.support ? filterMap.find(lnbRecord.recordFilterId) != filterMap.end() : true; + + if (!filterIsValid) { + ALOGW("[vts config] dynamic config filter connection is invalid."); + return false; + } + + bool lnbIsValid = lnbLive.support ? lnbMap.find(lnbLive.lnbId) != lnbMap.end() : true; + lnbIsValid &= lnbRecord.support ? lnbMap.find(lnbRecord.lnbId) != lnbMap.end() : true; + + if (!lnbIsValid) { + ALOGW("[vts config] dynamic config lnb connection is invalid."); + return false; + } + + bool descramblerIsValid = + descrambling.support + ? descramblerMap.find(descrambling.descramblerId) != descramblerMap.end() + : true; + + if (!descramblerIsValid) { + ALOGW("[vts config] dynamic config descrambler connection is invalid."); + return false; + } + + bool diseqcMsgIsValid = true; + if (lnbLive.support) { + for (auto msgName : lnbLive.diseqcMsgs) { + diseqcMsgIsValid &= diseqcMsgMap.find(msgName) != diseqcMsgMap.end(); + } + } + if (lnbRecord.support) { + for (auto msgName : lnbRecord.diseqcMsgs) { + diseqcMsgIsValid &= diseqcMsgMap.find(msgName) != diseqcMsgMap.end(); + } + } + + if (!diseqcMsgIsValid) { + ALOGW("[vts config] dynamic config diseqcMsg sender is invalid."); + return false; + } + + return true; } - -// TODO: remove all the manual configs after the dynamic config refactoring is done. -/** Configuration array for the Lnb test */ -inline void initLnbConfig() { - lnbArray[LNB0].usingLnb = true; - lnbArray[LNB0].voltage = LnbVoltage::VOLTAGE_12V; - lnbArray[LNB0].tone = LnbTone::NONE; - lnbArray[LNB0].position = LnbPosition::UNDEFINED; - lnbArray[LNB_EXTERNAL].usingLnb = true; - lnbArray[LNB_EXTERNAL].name = "default_lnb_external"; - lnbArray[LNB_EXTERNAL].voltage = LnbVoltage::VOLTAGE_5V; - lnbArray[LNB_EXTERNAL].tone = LnbTone::NONE; - lnbArray[LNB_EXTERNAL].position = LnbPosition::UNDEFINED; -}; - -/** Diseqc messages array for the Lnb test */ -inline void initDiseqcMsg() { - diseqcMsgArray[DISEQC_POWER_ON] = {0xE, 0x0, 0x0, 0x0, 0x0, 0x3}; -}; - -/** Configuration array for the filter test */ -inline void initFilterConfig() { - // TS VIDEO filter setting for default implementation testing - filterArray[TS_VIDEO0].type.mainType = DemuxFilterMainType::TS; - filterArray[TS_VIDEO0].type.subType.tsFilterType(DemuxTsFilterType::VIDEO); - filterArray[TS_VIDEO0].bufferSize = FMQ_SIZE_16M; - filterArray[TS_VIDEO0].settings.ts().tpid = 256; - filterArray[TS_VIDEO0].settings.ts().filterSettings.av({.isPassthrough = false}); - filterArray[TS_VIDEO1].type.mainType = DemuxFilterMainType::TS; - filterArray[TS_VIDEO1].type.subType.tsFilterType(DemuxTsFilterType::VIDEO); - filterArray[TS_VIDEO1].bufferSize = FMQ_SIZE_16M; - filterArray[TS_VIDEO1].settings.ts().tpid = 256; - filterArray[TS_VIDEO1].settings.ts().filterSettings.av({.isPassthrough = false}); - // TS AUDIO filter setting - filterArray[TS_AUDIO0].type.mainType = DemuxFilterMainType::TS; - filterArray[TS_AUDIO0].type.subType.tsFilterType(DemuxTsFilterType::AUDIO); - filterArray[TS_AUDIO0].bufferSize = FMQ_SIZE_16M; - filterArray[TS_AUDIO0].settings.ts().tpid = 256; - filterArray[TS_AUDIO0].settings.ts().filterSettings.av({.isPassthrough = false}); - // TS PES filter setting - filterArray[TS_PES0].type.mainType = DemuxFilterMainType::TS; - filterArray[TS_PES0].type.subType.tsFilterType(DemuxTsFilterType::PES); - filterArray[TS_PES0].bufferSize = FMQ_SIZE_16M; - filterArray[TS_PES0].settings.ts().tpid = 256; - filterArray[TS_PES0].settings.ts().filterSettings.pesData({ - .isRaw = false, - .streamId = 0xbd, - }); - filterArray[TS_PES0].getMqDesc = true; - // TS PCR filter setting - filterArray[TS_PCR0].type.mainType = DemuxFilterMainType::TS; - filterArray[TS_PCR0].type.subType.tsFilterType(DemuxTsFilterType::PCR); - filterArray[TS_PCR0].bufferSize = FMQ_SIZE_16M; - filterArray[TS_PCR0].settings.ts().tpid = 256; - filterArray[TS_PCR0].settings.ts().filterSettings.noinit(); - // TS filter setting - filterArray[TS_TS0].type.mainType = DemuxFilterMainType::TS; - filterArray[TS_TS0].type.subType.tsFilterType(DemuxTsFilterType::TS); - filterArray[TS_TS0].bufferSize = FMQ_SIZE_16M; - filterArray[TS_TS0].settings.ts().tpid = 256; - filterArray[TS_TS0].settings.ts().filterSettings.noinit(); - // TS SECTION filter setting - filterArray[TS_SECTION0].type.mainType = DemuxFilterMainType::TS; - filterArray[TS_SECTION0].type.subType.tsFilterType(DemuxTsFilterType::SECTION); - filterArray[TS_SECTION0].bufferSize = FMQ_SIZE_16M; - filterArray[TS_SECTION0].settings.ts().tpid = 256; - filterArray[TS_SECTION0].settings.ts().filterSettings.section({ - .isRaw = false, - }); - filterArray[TS_SECTION0].getMqDesc = true; - // TS RECORD filter setting - filterArray[TS_RECORD0].type.mainType = DemuxFilterMainType::TS; - filterArray[TS_RECORD0].type.subType.tsFilterType(DemuxTsFilterType::RECORD); - filterArray[TS_RECORD0].settings.ts().tpid = 81; - filterArray[TS_RECORD0].settings.ts().filterSettings.record({ - .scIndexType = DemuxRecordScIndexType::NONE, - }); - - // TS Linkage filter setting - filterLinkageTypes[SOURCE][0].mainType = DemuxFilterMainType::TS; - filterLinkageTypes[SOURCE][0].subType.tsFilterType(DemuxTsFilterType::TS); - filterLinkageTypes[SINK][0] = filterLinkageTypes[SOURCE][0]; - // MMTP Linkage filter setting - filterLinkageTypes[SOURCE][1].mainType = DemuxFilterMainType::MMTP; - filterLinkageTypes[SOURCE][1].subType.mmtpFilterType(DemuxMmtpFilterType::AUDIO); - filterLinkageTypes[SINK][1] = filterLinkageTypes[SOURCE][1]; - // IP Linkage filter setting - filterLinkageTypes[SOURCE][2].mainType = DemuxFilterMainType::IP; - filterLinkageTypes[SOURCE][2].subType.ipFilterType(DemuxIpFilterType::IP); - filterLinkageTypes[SINK][2] = filterLinkageTypes[SOURCE][2]; - // TLV Linkage filter setting - filterLinkageTypes[SOURCE][3].mainType = DemuxFilterMainType::TLV; - filterLinkageTypes[SOURCE][3].subType.tlvFilterType(DemuxTlvFilterType::TLV); - filterLinkageTypes[SINK][3] = filterLinkageTypes[SOURCE][3]; - // ALP Linkage PTP filter setting - filterLinkageTypes[SOURCE][4].mainType = DemuxFilterMainType::ALP; - filterLinkageTypes[SOURCE][4].subType.alpFilterType(DemuxAlpFilterType::PTP); - filterLinkageTypes[SINK][4] = filterLinkageTypes[SOURCE][4]; -}; - -/** Configuration array for the timer filter test */ -inline void initTimeFilterConfig() { - timeFilterArray[TIMER0].supportTimeFilter = true; - timeFilterArray[TIMER0].timeStamp = 1; -} - -/** Configuration array for the dvr test */ -inline void initDvrConfig() { - RecordSettings recordSettings{ - .statusMask = 0xf, - .lowThreshold = 0x1000, - .highThreshold = 0x07fff, - .dataFormat = DataFormat::TS, - .packetSize = 188, - }; - dvrArray[DVR_RECORD0].type = DvrType::RECORD; - dvrArray[DVR_RECORD0].bufferSize = FMQ_SIZE_4M; - dvrArray[DVR_RECORD0].settings.record(recordSettings); - PlaybackSettings playbackSettings{ - .statusMask = 0xf, - .lowThreshold = 0x1000, - .highThreshold = 0x07fff, - .dataFormat = DataFormat::TS, - .packetSize = 188, - }; - dvrArray[DVR_PLAYBACK0].type = DvrType::PLAYBACK; - dvrArray[DVR_PLAYBACK0].playbackInputFile = "/data/local/tmp/segment000000.ts"; - dvrArray[DVR_PLAYBACK0].bufferSize = FMQ_SIZE_4M; - dvrArray[DVR_PLAYBACK0].settings.playback(playbackSettings); - PlaybackSettings softwareFePlaybackSettings{ - .statusMask = 0xf, - .lowThreshold = 0x1000, - .highThreshold = 0x07fff, - .dataFormat = DataFormat::TS, - .packetSize = 188, - }; - dvrArray[DVR_SOFTWARE_FE].type = DvrType::PLAYBACK; - dvrArray[DVR_SOFTWARE_FE].playbackInputFile = "/data/local/tmp/segment000000.ts"; - dvrArray[DVR_SOFTWARE_FE].bufferSize = FMQ_SIZE_4M; - dvrArray[DVR_SOFTWARE_FE].settings.playback(softwareFePlaybackSettings); -}; - -/** Configuration array for the descrambler test */ -inline void initDescramblerConfig() { - descramblerArray[DESC_0].casSystemId = CLEAR_KEY_SYSTEM_ID; - descramblerArray[DESC_0].provisionStr = PROVISION_STR; - descramblerArray[DESC_0].hidlPvtData.resize(256); -}; diff --git a/tv/tuner/config/TunerTestingConfigReader.h b/tv/tuner/config/TunerTestingConfigReader.h index 5c7f5648d3..90499c414c 100644 --- a/tv/tuner/config/TunerTestingConfigReader.h +++ b/tv/tuner/config/TunerTestingConfigReader.h @@ -29,8 +29,11 @@ using namespace android::media::tuner::testing::configuration::V1_0; using android::hardware::tv::tuner::V1_0::DataFormat; using android::hardware::tv::tuner::V1_0::DemuxAlpFilterType; +using android::hardware::tv::tuner::V1_0::DemuxFilterAvSettings; using android::hardware::tv::tuner::V1_0::DemuxFilterEvent; using android::hardware::tv::tuner::V1_0::DemuxFilterMainType; +using android::hardware::tv::tuner::V1_0::DemuxFilterRecordSettings; +using android::hardware::tv::tuner::V1_0::DemuxFilterSectionSettings; using android::hardware::tv::tuner::V1_0::DemuxFilterSettings; using android::hardware::tv::tuner::V1_0::DemuxFilterType; using android::hardware::tv::tuner::V1_0::DemuxIpFilterType; @@ -61,6 +64,19 @@ using android::hardware::tv::tuner::V1_0::PlaybackSettings; using android::hardware::tv::tuner::V1_0::RecordSettings; const string configFilePath = "/vendor/etc/tuner_vts_config.xml"; +const string emptyHardwareId = ""; + +#define PROVISION_STR \ + "{ " \ + " \"id\": 21140844, " \ + " \"name\": \"Test Title\", " \ + " \"lowercase_organization_name\": \"Android\", " \ + " \"asset_key\": { " \ + " \"encryption_key\": \"nezAr3CHFrmBR9R8Tedotw==\" " \ + " }, " \ + " \"cas_type\": 1, " \ + " \"track_types\": [ ] " \ + "} " struct FrontendConfig { bool isSoftwareFe; @@ -70,48 +86,104 @@ struct FrontendConfig { vector expectTuneStatuses; }; +struct FilterConfig { + uint32_t bufferSize; + DemuxFilterType type; + DemuxFilterSettings settings; + bool getMqDesc; + + bool operator<(const FilterConfig& /*c*/) const { return false; } +}; + +struct DvrConfig { + DvrType type; + uint32_t bufferSize; + DvrSettings settings; + string playbackInputFile; +}; + +struct LnbConfig { + string name; + LnbVoltage voltage; + LnbTone tone; + LnbPosition position; +}; + +struct TimeFilterConfig { + uint64_t timeStamp; +}; + +struct DescramblerConfig { + uint32_t casSystemId; + string provisionStr; + vector hidlPvtData; +}; + struct LiveBroadcastHardwareConnections { string frontendId; - /* string audioFilterId; + string dvrSoftwareFeId; + string audioFilterId; string videoFilterId; - list string of extra filters; */ + string sectionFilterId; + string pcrFilterId; + /* list string of extra filters; */ }; struct ScanHardwareConnections { string frontendId; }; +struct DvrPlaybackHardwareConnections { + bool support; + string frontendId; + string dvrId; + string audioFilterId; + string videoFilterId; + string sectionFilterId; + /* list string of extra filters; */ +}; + struct DvrRecordHardwareConnections { bool support; string frontendId; - /* string recordFilterId; - string dvrId; */ + string dvrRecordId; + string dvrSoftwareFeId; + string recordFilterId; }; struct DescramblingHardwareConnections { bool support; string frontendId; - /* string descramblerId; + string dvrSoftwareFeId; string audioFilterId; string videoFilterId; - list string of extra filters; */ + string descramblerId; + /* list string of extra filters; */ }; struct LnbLiveHardwareConnections { bool support; string frontendId; - /* string audioFilterId; + string audioFilterId; string videoFilterId; - list string of extra filters; - string lnbId; */ + string lnbId; + vector diseqcMsgs; + /* list string of extra filters; */ }; struct LnbRecordHardwareConnections { bool support; string frontendId; - /* string recordFilterId; - list string of extra filters; - string lnbId; */ + string dvrRecordId; + string recordFilterId; + string lnbId; + vector diseqcMsgs; + /* list string of extra filters; */ +}; + +struct TimeFilterHardwareConnections { + bool support; + string timeFilterId; }; struct TunerTestingConfigReader { @@ -129,7 +201,7 @@ struct TunerTestingConfigReader { static void readFrontendConfig1_0(map& frontendMap) { auto hardwareConfig = getHardwareConfig(); if (hardwareConfig.hasFrontends()) { - // TODO: complete the tune status config + // TODO: b/182519645 complete the tune status config vector types; types.push_back(FrontendStatusType::DEMOD_LOCK); FrontendStatus status; @@ -149,7 +221,7 @@ struct TunerTestingConfigReader { case FrontendTypeEnum::UNDEFINED: type = FrontendType::UNDEFINED; break; - // TODO: finish all other frontend settings + // TODO: b/182519645 finish all other frontend settings case FrontendTypeEnum::ANALOG: type = FrontendType::ANALOG; break; @@ -189,16 +261,158 @@ struct TunerTestingConfigReader { } frontendMap[id].type = type; frontendMap[id].isSoftwareFe = feConfig.getIsSoftwareFrontend(); - // TODO: complete the tune status config + // TODO: b/182519645 complete the tune status config frontendMap[id].tuneStatusTypes = types; frontendMap[id].expectTuneStatuses = statuses; } } } + static void readFilterConfig1_0(map& filterMap) { + auto hardwareConfig = getHardwareConfig(); + if (hardwareConfig.hasFilters()) { + auto filters = *hardwareConfig.getFirstFilters(); + for (auto filterConfig : filters.getFilter()) { + string id = filterConfig.getId(); + if (id.compare(string("FILTER_AUDIO_DEFAULT")) == 0) { + // overrid default + filterMap.erase(string("FILTER_AUDIO_DEFAULT")); + } + if (id.compare(string("FILTER_VIDEO_DEFAULT")) == 0) { + // overrid default + filterMap.erase(string("FILTER_VIDEO_DEFAULT")); + } + + DemuxFilterType type; + DemuxFilterSettings settings; + if (!readFilterTypeAndSettings(filterConfig, type, settings)) { + ALOGW("[ConfigReader] invalid filter type"); + return; + } + filterMap[id].type = type; + filterMap[id].bufferSize = filterConfig.getBufferSize(); + filterMap[id].getMqDesc = filterConfig.getUseFMQ(); + filterMap[id].settings = settings; + } + } + } + + static void readDvrConfig1_0(map& dvrMap) { + auto hardwareConfig = getHardwareConfig(); + if (hardwareConfig.hasDvrs()) { + auto dvrs = *hardwareConfig.getFirstDvrs(); + for (auto dvrConfig : dvrs.getDvr()) { + string id = dvrConfig.getId(); + DvrType type; + switch (dvrConfig.getType()) { + case DvrTypeEnum::PLAYBACK: + type = DvrType::PLAYBACK; + dvrMap[id].settings.playback(readPlaybackSettings(dvrConfig)); + break; + case DvrTypeEnum::RECORD: + type = DvrType::RECORD; + dvrMap[id].settings.record(readRecordSettings(dvrConfig)); + break; + case DvrTypeEnum::UNKNOWN: + ALOGW("[ConfigReader] invalid DVR type"); + return; + } + dvrMap[id].type = type; + dvrMap[id].bufferSize = static_cast(dvrConfig.getBufferSize()); + if (dvrConfig.hasInputFilePath()) { + dvrMap[id].playbackInputFile = dvrConfig.getInputFilePath(); + } + } + } + } + + static void readLnbConfig1_0(map& lnbMap) { + auto hardwareConfig = getHardwareConfig(); + if (hardwareConfig.hasLnbs()) { + auto lnbs = *hardwareConfig.getFirstLnbs(); + for (auto lnbConfig : lnbs.getLnb()) { + string id = lnbConfig.getId(); + if (lnbConfig.hasName()) { + lnbMap[id].name = lnbConfig.getName(); + } else { + lnbMap[id].name = emptyHardwareId; + } + lnbMap[id].voltage = static_cast(lnbConfig.getVoltage()); + lnbMap[id].tone = static_cast(lnbConfig.getTone()); + lnbMap[id].position = static_cast(lnbConfig.getPosition()); + } + } + } + + static void readDescramblerConfig1_0(map& descramblerMap) { + auto hardwareConfig = getHardwareConfig(); + if (hardwareConfig.hasDescramblers()) { + auto descramblers = *hardwareConfig.getFirstDescramblers(); + for (auto descramblerConfig : descramblers.getDescrambler()) { + string id = descramblerConfig.getId(); + descramblerMap[id].casSystemId = + static_cast(descramblerConfig.getCasSystemId()); + if (descramblerConfig.hasProvisionStr()) { + descramblerMap[id].provisionStr = descramblerConfig.getProvisionStr(); + } else { + descramblerMap[id].provisionStr = PROVISION_STR; + } + if (descramblerConfig.hasSesstionPrivatData()) { + auto privateData = descramblerConfig.getSesstionPrivatData(); + int size = privateData.size(); + descramblerMap[id].hidlPvtData.resize(size); + memcpy(descramblerMap[id].hidlPvtData.data(), privateData.data(), size); + } else { + descramblerMap[id].hidlPvtData.resize(256); + } + } + } + } + + static void readDiseqcMessages(map>& diseqcMsgMap) { + auto hardwareConfig = getHardwareConfig(); + if (hardwareConfig.hasDiseqcMessages()) { + auto msgs = *hardwareConfig.getFirstDiseqcMessages(); + for (auto msgConfig : msgs.getDiseqcMessage()) { + string name = msgConfig.getMsgName(); + for (uint8_t atom : msgConfig.getMsgBody()) { + diseqcMsgMap[name].push_back(atom); + } + } + } + } + + static void readTimeFilterConfig1_0(map& timeFilterMap) { + auto hardwareConfig = getHardwareConfig(); + if (hardwareConfig.hasTimeFilters()) { + auto timeFilters = *hardwareConfig.getFirstTimeFilters(); + for (auto timeFilterConfig : timeFilters.getTimeFilter()) { + string id = timeFilterConfig.getId(); + timeFilterMap[id].timeStamp = + static_cast(timeFilterConfig.getTimeStamp()); + } + } + } + static void connectLiveBroadcast(LiveBroadcastHardwareConnections& live) { - auto liveConfig = getDataFlowConfiguration().getFirstClearLiveBroadcast(); - live.frontendId = liveConfig->getFrontendConnection(); + auto liveConfig = *getDataFlowConfiguration().getFirstClearLiveBroadcast(); + live.frontendId = liveConfig.getFrontendConnection(); + + live.audioFilterId = liveConfig.getAudioFilterConnection(); + live.videoFilterId = liveConfig.getVideoFilterConnection(); + if (liveConfig.hasPcrFilterConnection()) { + live.pcrFilterId = liveConfig.getPcrFilterConnection(); + } else { + live.pcrFilterId = emptyHardwareId; + } + if (liveConfig.hasSectionFilterConnection()) { + live.sectionFilterId = liveConfig.getSectionFilterConnection(); + } else { + live.sectionFilterId = emptyHardwareId; + } + if (liveConfig.hasDvrSoftwareFeConnection()) { + live.dvrSoftwareFeId = liveConfig.getDvrSoftwareFeConnection(); + } } static void connectScan(ScanHardwareConnections& scan) { @@ -206,49 +420,109 @@ struct TunerTestingConfigReader { scan.frontendId = scanConfig->getFrontendConnection(); } - static void connectDvrRecord(DvrRecordHardwareConnections& record) { + static void connectDvrPlayback(DvrPlaybackHardwareConnections& playback) { auto dataFlow = getDataFlowConfiguration(); - if (!dataFlow.hasDvrRecord()) { - record.support = false; + if (dataFlow.hasDvrPlayback()) { + playback.support = true; + } else { return; } - auto recordConfig = dataFlow.getFirstDvrRecord(); - record.frontendId = recordConfig->getFrontendConnection(); + auto playbackConfig = *dataFlow.getFirstDvrPlayback(); + playback.dvrId = playbackConfig.getDvrConnection(); + playback.audioFilterId = playbackConfig.getAudioFilterConnection(); + playback.videoFilterId = playbackConfig.getVideoFilterConnection(); + if (playbackConfig.hasSectionFilterConnection()) { + playback.sectionFilterId = playbackConfig.getSectionFilterConnection(); + } else { + playback.sectionFilterId = emptyHardwareId; + } + } + + static void connectDvrRecord(DvrRecordHardwareConnections& record) { + auto dataFlow = getDataFlowConfiguration(); + if (dataFlow.hasDvrRecord()) { + record.support = true; + } else { + return; + } + auto recordConfig = *dataFlow.getFirstDvrRecord(); + record.frontendId = recordConfig.getFrontendConnection(); + record.recordFilterId = recordConfig.getRecordFilterConnection(); + record.dvrRecordId = recordConfig.getDvrRecordConnection(); + if (recordConfig.hasDvrSoftwareFeConnection()) { + record.dvrSoftwareFeId = recordConfig.getDvrSoftwareFeConnection(); + } } static void connectDescrambling(DescramblingHardwareConnections& descrambling) { auto dataFlow = getDataFlowConfiguration(); - if (!dataFlow.hasDescrambling()) { - descrambling.support = false; + if (dataFlow.hasDescrambling()) { + descrambling.support = true; + } else { return; } - auto descConfig = dataFlow.getFirstDescrambling(); - descrambling.frontendId = descConfig->getFrontendConnection(); + auto descConfig = *dataFlow.getFirstDescrambling(); + descrambling.frontendId = descConfig.getFrontendConnection(); + descrambling.descramblerId = descConfig.getDescramblerConnection(); + descrambling.audioFilterId = descConfig.getAudioFilterConnection(); + descrambling.videoFilterId = descConfig.getVideoFilterConnection(); + if (descConfig.hasDvrSoftwareFeConnection()) { + descrambling.dvrSoftwareFeId = descConfig.getDvrSoftwareFeConnection(); + } } static void connectLnbLive(LnbLiveHardwareConnections& lnbLive) { auto dataFlow = getDataFlowConfiguration(); - if (!dataFlow.hasLnbLive()) { - lnbLive.support = false; + if (dataFlow.hasLnbLive()) { + lnbLive.support = true; + } else { return; } - auto lnbLiveConfig = dataFlow.getFirstLnbLive(); - lnbLive.frontendId = lnbLiveConfig->getFrontendConnection(); + auto lnbLiveConfig = *dataFlow.getFirstLnbLive(); + lnbLive.frontendId = lnbLiveConfig.getFrontendConnection(); + lnbLive.audioFilterId = lnbLiveConfig.getAudioFilterConnection(); + lnbLive.videoFilterId = lnbLiveConfig.getVideoFilterConnection(); + lnbLive.lnbId = lnbLiveConfig.getLnbConnection(); + if (lnbLiveConfig.hasDiseqcMsgSender()) { + for (auto msgName : lnbLiveConfig.getDiseqcMsgSender()) { + lnbLive.diseqcMsgs.push_back(msgName); + } + } } static void connectLnbRecord(LnbRecordHardwareConnections& lnbRecord) { auto dataFlow = getDataFlowConfiguration(); - if (!dataFlow.hasLnbRecord()) { - lnbRecord.support = false; + if (dataFlow.hasLnbRecord()) { + lnbRecord.support = true; + } else { return; } - auto lnbRecordConfig = dataFlow.getFirstLnbRecord(); - lnbRecord.frontendId = lnbRecordConfig->getFrontendConnection(); + auto lnbRecordConfig = *dataFlow.getFirstLnbRecord(); + lnbRecord.frontendId = lnbRecordConfig.getFrontendConnection(); + lnbRecord.recordFilterId = lnbRecordConfig.getRecordFilterConnection(); + lnbRecord.dvrRecordId = lnbRecordConfig.getDvrRecordConnection(); + lnbRecord.lnbId = lnbRecordConfig.getLnbConnection(); + if (lnbRecordConfig.hasDiseqcMsgSender()) { + for (auto msgName : lnbRecordConfig.getDiseqcMsgSender()) { + lnbRecord.diseqcMsgs.push_back(msgName); + } + } + } + + static void connectTimeFilter(TimeFilterHardwareConnections& timeFilter) { + auto dataFlow = getDataFlowConfiguration(); + if (dataFlow.hasTimeFilter()) { + timeFilter.support = true; + } else { + return; + } + auto timeFilterConfig = *dataFlow.getFirstTimeFilter(); + timeFilter.timeFilterId = timeFilterConfig.getTimeFilterConnection(); } private: static FrontendDvbtSettings readDvbtFrontendSettings(Frontend feConfig) { - ALOGW("[ConfigReader] type is dvbt"); + ALOGW("[ConfigReader] fe type is dvbt"); FrontendDvbtSettings dvbtSettings{ .frequency = (uint32_t)feConfig.getFrequency(), }; @@ -266,7 +540,7 @@ struct TunerTestingConfigReader { } static FrontendDvbsSettings readDvbsFrontendSettings(Frontend feConfig) { - ALOGW("[ConfigReader] type is dvbs"); + ALOGW("[ConfigReader] fe type is dvbs"); FrontendDvbsSettings dvbsSettings{ .frequency = (uint32_t)feConfig.getFrequency(), }; @@ -281,6 +555,171 @@ struct TunerTestingConfigReader { return dvbsSettings; } + static bool readFilterTypeAndSettings(Filter filterConfig, DemuxFilterType& type, + DemuxFilterSettings& settings) { + auto mainType = filterConfig.getMainType(); + auto subType = filterConfig.getSubType(); + uint32_t pid = static_cast(filterConfig.getPid()); + switch (mainType) { + case FilterMainTypeEnum::TS: { + ALOGW("[ConfigReader] filter main type is ts"); + type.mainType = DemuxFilterMainType::TS; + switch (subType) { + case FilterSubTypeEnum::UNDEFINED: + break; + case FilterSubTypeEnum::SECTION: + type.subType.tsFilterType(DemuxTsFilterType::SECTION); + settings.ts().filterSettings.section( + readSectionFilterSettings(filterConfig)); + break; + case FilterSubTypeEnum::PES: + // TODO: b/182519645 support all the filter settings + /*settings.ts().filterSettings.pesData( + getPesFilterSettings(filterConfig));*/ + type.subType.tsFilterType(DemuxTsFilterType::PES); + break; + case FilterSubTypeEnum::TS: + type.subType.tsFilterType(DemuxTsFilterType::TS); + settings.ts().filterSettings.noinit(); + break; + case FilterSubTypeEnum::PCR: + type.subType.tsFilterType(DemuxTsFilterType::PCR); + settings.ts().filterSettings.noinit(); + break; + case FilterSubTypeEnum::TEMI: + type.subType.tsFilterType(DemuxTsFilterType::TEMI); + settings.ts().filterSettings.noinit(); + break; + case FilterSubTypeEnum::AUDIO: + type.subType.tsFilterType(DemuxTsFilterType::AUDIO); + settings.ts().filterSettings.av(readAvFilterSettings(filterConfig)); + break; + case FilterSubTypeEnum::VIDEO: + type.subType.tsFilterType(DemuxTsFilterType::VIDEO); + settings.ts().filterSettings.av(readAvFilterSettings(filterConfig)); + break; + case FilterSubTypeEnum::RECORD: + type.subType.tsFilterType(DemuxTsFilterType::RECORD); + settings.ts().filterSettings.record(readRecordFilterSettings(filterConfig)); + break; + default: + ALOGW("[ConfigReader] ts subtype is not supported"); + return false; + } + settings.ts().tpid = pid; + break; + } + case FilterMainTypeEnum::MMTP: { + ALOGW("[ConfigReader] filter main type is mmtp"); + type.mainType = DemuxFilterMainType::MMTP; + switch (subType) { + case FilterSubTypeEnum::UNDEFINED: + break; + case FilterSubTypeEnum::SECTION: + type.subType.mmtpFilterType(DemuxMmtpFilterType::SECTION); + settings.mmtp().filterSettings.section( + readSectionFilterSettings(filterConfig)); + break; + case FilterSubTypeEnum::PES: + type.subType.mmtpFilterType(DemuxMmtpFilterType::PES); + // TODO: b/182519645 support all the filter settings + /*settings.mmtp().filterSettings.pesData( + getPesFilterSettings(filterConfig));*/ + break; + case FilterSubTypeEnum::MMTP: + type.subType.mmtpFilterType(DemuxMmtpFilterType::MMTP); + settings.mmtp().filterSettings.noinit(); + break; + case FilterSubTypeEnum::AUDIO: + type.subType.mmtpFilterType(DemuxMmtpFilterType::AUDIO); + settings.mmtp().filterSettings.av(readAvFilterSettings(filterConfig)); + break; + case FilterSubTypeEnum::VIDEO: + settings.mmtp().filterSettings.av(readAvFilterSettings(filterConfig)); + break; + case FilterSubTypeEnum::RECORD: + type.subType.mmtpFilterType(DemuxMmtpFilterType::RECORD); + settings.mmtp().filterSettings.record( + readRecordFilterSettings(filterConfig)); + break; + case FilterSubTypeEnum::DOWNLOAD: + type.subType.mmtpFilterType(DemuxMmtpFilterType::DOWNLOAD); + // TODO: b/182519645 support all the filter settings + /*settings.mmtp().filterSettings.download( + getDownloadFilterSettings(filterConfig));*/ + break; + default: + ALOGW("[ConfigReader] mmtp subtype is not supported"); + return false; + } + settings.mmtp().mmtpPid = pid; + break; + } + default: + // TODO: b/182519645 support all the filter configs + ALOGW("[ConfigReader] filter main type is not supported in dynamic config"); + return false; + } + return true; + } + + static DemuxFilterSectionSettings readSectionFilterSettings(Filter filterConfig) { + DemuxFilterSectionSettings settings; + if (!filterConfig.hasSectionFilterSettings_optional()) { + return settings; + } + auto section = filterConfig.getFirstSectionFilterSettings_optional(); + settings.isCheckCrc = section->getIsCheckCrc(); + settings.isRepeat = section->getIsRepeat(); + settings.isRaw = section->getIsRaw(); + return settings; + } + + static DemuxFilterAvSettings readAvFilterSettings(Filter filterConfig) { + DemuxFilterAvSettings settings; + if (!filterConfig.hasAvFilterSettings_optional()) { + return settings; + } + auto av = filterConfig.getFirstAvFilterSettings_optional(); + settings.isPassthrough = av->getIsPassthrough(); + return settings; + } + + static DemuxFilterRecordSettings readRecordFilterSettings(Filter filterConfig) { + DemuxFilterRecordSettings settings; + if (!filterConfig.hasRecordFilterSettings_optional()) { + return settings; + } + auto record = filterConfig.getFirstRecordFilterSettings_optional(); + settings.tsIndexMask = static_cast(record->getTsIndexMask()); + settings.scIndexType = static_cast(record->getScIndexType()); + return settings; + } + + static PlaybackSettings readPlaybackSettings(Dvr dvrConfig) { + ALOGW("[ConfigReader] dvr type is playback"); + PlaybackSettings playbackSettings{ + .statusMask = static_cast(dvrConfig.getStatusMask()), + .lowThreshold = static_cast(dvrConfig.getLowThreshold()), + .highThreshold = static_cast(dvrConfig.getHighThreshold()), + .dataFormat = static_cast(dvrConfig.getDataFormat()), + .packetSize = static_cast(dvrConfig.getPacketSize()), + }; + return playbackSettings; + } + + static RecordSettings readRecordSettings(Dvr dvrConfig) { + ALOGW("[ConfigReader] dvr type is record"); + RecordSettings recordSettings{ + .statusMask = static_cast(dvrConfig.getStatusMask()), + .lowThreshold = static_cast(dvrConfig.getLowThreshold()), + .highThreshold = static_cast(dvrConfig.getHighThreshold()), + .dataFormat = static_cast(dvrConfig.getDataFormat()), + .packetSize = static_cast(dvrConfig.getPacketSize()), + }; + return recordSettings; + } + static TunerConfiguration getTunerConfig() { return *read(configFilePath.c_str()); } static HardwareConfiguration getHardwareConfig() { diff --git a/tv/tuner/config/api/current.txt b/tv/tuner/config/api/current.txt index b0f410d25e..4255a60d16 100644 --- a/tv/tuner/config/api/current.txt +++ b/tv/tuner/config/api/current.txt @@ -1,50 +1,112 @@ // Signature format: 2.0 package android.media.tuner.testing.configuration.V1_0 { + public class AvFilterSettings { + ctor public AvFilterSettings(); + method @Nullable public boolean getIsPassthrough(); + method public void setIsPassthrough(@Nullable boolean); + } + public class DataFlowConfiguration { ctor public DataFlowConfiguration(); method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.ClearLiveBroadcast getClearLiveBroadcast(); method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Descrambling getDescrambling(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrPlayback getDvrPlayback(); method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrRecord getDvrRecord(); method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbLive getLnbLive(); method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbRecord getLnbRecord(); method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Scan getScan(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.TimeFilter getTimeFilter(); method public void setClearLiveBroadcast(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.ClearLiveBroadcast); method public void setDescrambling(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Descrambling); + method public void setDvrPlayback(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrPlayback); method public void setDvrRecord(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrRecord); method public void setLnbLive(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbLive); method public void setLnbRecord(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbRecord); method public void setScan(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Scan); + method public void setTimeFilter(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.TimeFilter); } public static class DataFlowConfiguration.ClearLiveBroadcast { ctor public DataFlowConfiguration.ClearLiveBroadcast(); + method @Nullable public String getAudioFilterConnection(); + method @Nullable public String getDvrSoftwareFeConnection(); method @Nullable public String getFrontendConnection(); + method @Nullable public String getPcrFilterConnection(); + method @Nullable public String getSectionFilterConnection(); + method @Nullable public String getVideoFilterConnection(); + method public void setAudioFilterConnection(@Nullable String); + method public void setDvrSoftwareFeConnection(@Nullable String); method public void setFrontendConnection(@Nullable String); + method public void setPcrFilterConnection(@Nullable String); + method public void setSectionFilterConnection(@Nullable String); + method public void setVideoFilterConnection(@Nullable String); } public static class DataFlowConfiguration.Descrambling { ctor public DataFlowConfiguration.Descrambling(); + method @Nullable public String getAudioFilterConnection(); + method @Nullable public String getDescramblerConnection(); + method @Nullable public String getDvrSoftwareFeConnection(); method @Nullable public String getFrontendConnection(); + method @Nullable public String getVideoFilterConnection(); + method public void setAudioFilterConnection(@Nullable String); + method public void setDescramblerConnection(@Nullable String); + method public void setDvrSoftwareFeConnection(@Nullable String); method public void setFrontendConnection(@Nullable String); + method public void setVideoFilterConnection(@Nullable String); + } + + public static class DataFlowConfiguration.DvrPlayback { + ctor public DataFlowConfiguration.DvrPlayback(); + method @Nullable public String getAudioFilterConnection(); + method @Nullable public String getDvrConnection(); + method @Nullable public String getSectionFilterConnection(); + method @Nullable public String getVideoFilterConnection(); + method public void setAudioFilterConnection(@Nullable String); + method public void setDvrConnection(@Nullable String); + method public void setSectionFilterConnection(@Nullable String); + method public void setVideoFilterConnection(@Nullable String); } public static class DataFlowConfiguration.DvrRecord { ctor public DataFlowConfiguration.DvrRecord(); + method @Nullable public String getDvrRecordConnection(); + method @Nullable public String getDvrSoftwareFeConnection(); method @Nullable public String getFrontendConnection(); + method @Nullable public String getRecordFilterConnection(); + method public void setDvrRecordConnection(@Nullable String); + method public void setDvrSoftwareFeConnection(@Nullable String); method public void setFrontendConnection(@Nullable String); + method public void setRecordFilterConnection(@Nullable String); } public static class DataFlowConfiguration.LnbLive { ctor public DataFlowConfiguration.LnbLive(); + method @Nullable public String getAudioFilterConnection(); + method @Nullable public java.util.List getDiseqcMsgSender(); method @Nullable public String getFrontendConnection(); + method @Nullable public String getLnbConnection(); + method @Nullable public String getVideoFilterConnection(); + method public void setAudioFilterConnection(@Nullable String); + method public void setDiseqcMsgSender(@Nullable java.util.List); method public void setFrontendConnection(@Nullable String); + method public void setLnbConnection(@Nullable String); + method public void setVideoFilterConnection(@Nullable String); } public static class DataFlowConfiguration.LnbRecord { ctor public DataFlowConfiguration.LnbRecord(); + method @Nullable public java.util.List getDiseqcMsgSender(); + method @Nullable public String getDvrRecordConnection(); method @Nullable public String getFrontendConnection(); + method @Nullable public String getLnbConnection(); + method @Nullable public String getRecordFilterConnection(); + method public void setDiseqcMsgSender(@Nullable java.util.List); + method public void setDvrRecordConnection(@Nullable String); method public void setFrontendConnection(@Nullable String); + method public void setLnbConnection(@Nullable String); + method public void setRecordFilterConnection(@Nullable String); } public static class DataFlowConfiguration.Scan { @@ -53,6 +115,32 @@ package android.media.tuner.testing.configuration.V1_0 { method public void setFrontendConnection(@Nullable String); } + public static class DataFlowConfiguration.TimeFilter { + ctor public DataFlowConfiguration.TimeFilter(); + method @Nullable public String getTimeFilterConnection(); + method public void setTimeFilterConnection(@Nullable String); + } + + public class Descrambler { + ctor public Descrambler(); + method @Nullable public java.math.BigInteger getCasSystemId(); + method @Nullable public String getId(); + method @Nullable public String getProvisionStr(); + method @Nullable public java.util.List getSesstionPrivatData(); + method public void setCasSystemId(@Nullable java.math.BigInteger); + method public void setId(@Nullable String); + method public void setProvisionStr(@Nullable String); + method public void setSesstionPrivatData(@Nullable java.util.List); + } + + public class DiseqcMessage { + ctor public DiseqcMessage(); + method @Nullable public java.util.List getMsgBody(); + method @Nullable public String getMsgName(); + method public void setMsgBody(@Nullable java.util.List); + method public void setMsgName(@Nullable String); + } + public class DvbsFrontendSettings { ctor public DvbsFrontendSettings(); method @Nullable public java.math.BigInteger getInputStreamId(); @@ -71,6 +159,93 @@ package android.media.tuner.testing.configuration.V1_0 { method public void setTransmissionMode(@Nullable java.math.BigInteger); } + public class Dvr { + ctor public Dvr(); + method @Nullable public java.math.BigInteger getBufferSize(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.DvrDataFormatEnum getDataFormat(); + method @Nullable public java.math.BigInteger getHighThreshold(); + method @Nullable public String getId(); + method @Nullable public String getInputFilePath(); + method @Nullable public java.math.BigInteger getLowThreshold(); + method @Nullable public java.math.BigInteger getPacketSize(); + method @Nullable public java.math.BigInteger getStatusMask(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.DvrTypeEnum getType(); + method public void setBufferSize(@Nullable java.math.BigInteger); + method public void setDataFormat(@Nullable android.media.tuner.testing.configuration.V1_0.DvrDataFormatEnum); + method public void setHighThreshold(@Nullable java.math.BigInteger); + method public void setId(@Nullable String); + method public void setInputFilePath(@Nullable String); + method public void setLowThreshold(@Nullable java.math.BigInteger); + method public void setPacketSize(@Nullable java.math.BigInteger); + method public void setStatusMask(@Nullable java.math.BigInteger); + method public void setType(@Nullable android.media.tuner.testing.configuration.V1_0.DvrTypeEnum); + } + + public enum DvrDataFormatEnum { + method @NonNull public String getRawName(); + enum_constant public static final android.media.tuner.testing.configuration.V1_0.DvrDataFormatEnum ES; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.DvrDataFormatEnum PES; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.DvrDataFormatEnum SHV_TLV; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.DvrDataFormatEnum TS; + } + + public enum DvrStatusEnum { + method @NonNull public String getRawName(); + enum_constant public static final android.media.tuner.testing.configuration.V1_0.DvrStatusEnum DATA_READY; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.DvrStatusEnum HIGH_WATER; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.DvrStatusEnum LOW_WATER; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.DvrStatusEnum OVERFLOW; + } + + public enum DvrTypeEnum { + method @NonNull public String getRawName(); + enum_constant public static final android.media.tuner.testing.configuration.V1_0.DvrTypeEnum PLAYBACK; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.DvrTypeEnum RECORD; + } + + public class Filter { + ctor public Filter(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.AvFilterSettings getAvFilterSettings_optional(); + method @Nullable public java.math.BigInteger getBufferSize(); + method @Nullable public String getId(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.FilterMainTypeEnum getMainType(); + method @Nullable public java.math.BigInteger getPid(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.RecordFilterSettings getRecordFilterSettings_optional(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.SectionFilterSettings getSectionFilterSettings_optional(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.FilterSubTypeEnum getSubType(); + method @Nullable public boolean getUseFMQ(); + method public void setAvFilterSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.AvFilterSettings); + method public void setBufferSize(@Nullable java.math.BigInteger); + method public void setId(@Nullable String); + method public void setMainType(@Nullable android.media.tuner.testing.configuration.V1_0.FilterMainTypeEnum); + method public void setPid(@Nullable java.math.BigInteger); + method public void setRecordFilterSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.RecordFilterSettings); + method public void setSectionFilterSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.SectionFilterSettings); + method public void setSubType(@Nullable android.media.tuner.testing.configuration.V1_0.FilterSubTypeEnum); + method public void setUseFMQ(@Nullable boolean); + } + + public enum FilterMainTypeEnum { + method @NonNull public String getRawName(); + enum_constant public static final android.media.tuner.testing.configuration.V1_0.FilterMainTypeEnum MMTP; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.FilterMainTypeEnum TS; + } + + public enum FilterSubTypeEnum { + method @NonNull public String getRawName(); + enum_constant public static final android.media.tuner.testing.configuration.V1_0.FilterSubTypeEnum AUDIO; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.FilterSubTypeEnum DOWNLOAD; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.FilterSubTypeEnum MMTP; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.FilterSubTypeEnum PCR; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.FilterSubTypeEnum PES; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.FilterSubTypeEnum RECORD; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.FilterSubTypeEnum SECTION; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.FilterSubTypeEnum TEMI; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.FilterSubTypeEnum TS; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.FilterSubTypeEnum UNDEFINED; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.FilterSubTypeEnum VIDEO; + } + public class Frontend { ctor public Frontend(); method @Nullable public java.math.BigInteger getConnectToCicamId(); @@ -108,8 +283,40 @@ package android.media.tuner.testing.configuration.V1_0 { public class HardwareConfiguration { ctor public HardwareConfiguration(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Descramblers getDescramblers(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.DiseqcMessages getDiseqcMessages(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Dvrs getDvrs(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Filters getFilters(); method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Frontends getFrontends(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Lnbs getLnbs(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.TimeFilters getTimeFilters(); + method public void setDescramblers(@Nullable android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Descramblers); + method public void setDiseqcMessages(@Nullable android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.DiseqcMessages); + method public void setDvrs(@Nullable android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Dvrs); + method public void setFilters(@Nullable android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Filters); method public void setFrontends(@Nullable android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Frontends); + method public void setLnbs(@Nullable android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.Lnbs); + method public void setTimeFilters(@Nullable android.media.tuner.testing.configuration.V1_0.HardwareConfiguration.TimeFilters); + } + + public static class HardwareConfiguration.Descramblers { + ctor public HardwareConfiguration.Descramblers(); + method @Nullable public java.util.List getDescrambler(); + } + + public static class HardwareConfiguration.DiseqcMessages { + ctor public HardwareConfiguration.DiseqcMessages(); + method @Nullable public java.util.List getDiseqcMessage(); + } + + public static class HardwareConfiguration.Dvrs { + ctor public HardwareConfiguration.Dvrs(); + method @Nullable public java.util.List getDvr(); + } + + public static class HardwareConfiguration.Filters { + ctor public HardwareConfiguration.Filters(); + method @Nullable public java.util.List getFilter(); } public static class HardwareConfiguration.Frontends { @@ -117,6 +324,89 @@ package android.media.tuner.testing.configuration.V1_0 { method @Nullable public java.util.List getFrontend(); } + public static class HardwareConfiguration.Lnbs { + ctor public HardwareConfiguration.Lnbs(); + method @Nullable public java.util.List getLnb(); + } + + public static class HardwareConfiguration.TimeFilters { + ctor public HardwareConfiguration.TimeFilters(); + method @Nullable public java.util.List getTimeFilter(); + } + + public class Lnb { + ctor public Lnb(); + method @Nullable public String getId(); + method @Nullable public String getName(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.LnbPositionEnum getPosition(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.LnbToneEnum getTone(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.LnbVoltageEnum getVoltage(); + method public void setId(@Nullable String); + method public void setName(@Nullable String); + method public void setPosition(@Nullable android.media.tuner.testing.configuration.V1_0.LnbPositionEnum); + method public void setTone(@Nullable android.media.tuner.testing.configuration.V1_0.LnbToneEnum); + method public void setVoltage(@Nullable android.media.tuner.testing.configuration.V1_0.LnbVoltageEnum); + } + + public enum LnbPositionEnum { + method @NonNull public String getRawName(); + enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbPositionEnum POSITION_A; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbPositionEnum POSITION_B; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbPositionEnum UNDEFINED; + } + + public enum LnbToneEnum { + method @NonNull public String getRawName(); + enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbToneEnum CONTINUOUS; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbToneEnum NONE; + } + + public enum LnbVoltageEnum { + method @NonNull public String getRawName(); + enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbVoltageEnum NONE; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbVoltageEnum VOLTAGE_11V; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbVoltageEnum VOLTAGE_12V; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbVoltageEnum VOLTAGE_13V; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbVoltageEnum VOLTAGE_14V; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbVoltageEnum VOLTAGE_15V; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbVoltageEnum VOLTAGE_18V; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbVoltageEnum VOLTAGE_19V; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbVoltageEnum VOLTAGE_5V; + } + + public class RecordFilterSettings { + ctor public RecordFilterSettings(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.ScIndexTypeEnum getScIndexType(); + method @Nullable public java.math.BigInteger getTsIndexMask(); + method public void setScIndexType(@Nullable android.media.tuner.testing.configuration.V1_0.ScIndexTypeEnum); + method public void setTsIndexMask(@Nullable java.math.BigInteger); + } + + public enum ScIndexTypeEnum { + method @NonNull public String getRawName(); + enum_constant public static final android.media.tuner.testing.configuration.V1_0.ScIndexTypeEnum NONE; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.ScIndexTypeEnum SC; + enum_constant public static final android.media.tuner.testing.configuration.V1_0.ScIndexTypeEnum SC_HEVC; + } + + public class SectionFilterSettings { + ctor public SectionFilterSettings(); + method @Nullable public boolean getIsCheckCrc(); + method @Nullable public boolean getIsRaw(); + method @Nullable public boolean getIsRepeat(); + method public void setIsCheckCrc(@Nullable boolean); + method public void setIsRaw(@Nullable boolean); + method public void setIsRepeat(@Nullable boolean); + } + + public class TimeFilter { + ctor public TimeFilter(); + method @Nullable public String getId(); + method @Nullable public java.math.BigInteger getTimeStamp(); + method public void setId(@Nullable String); + method public void setTimeStamp(@Nullable java.math.BigInteger); + } + public class TunerConfiguration { ctor public TunerConfiguration(); method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration getDataFlowConfiguration(); diff --git a/tv/tuner/config/sample_tuner_vts_config.xml b/tv/tuner/config/sample_tuner_vts_config.xml index c4080d9ac7..570171edb7 100644 --- a/tv/tuner/config/sample_tuner_vts_config.xml +++ b/tv/tuner/config/sample_tuner_vts_config.xml @@ -60,16 +60,165 @@ connectToCicamId="0" frequency="578000" endFrequency="800000"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + + + diff --git a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd index cd8b061309..3fe93ff120 100644 --- a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd +++ b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd @@ -85,7 +85,7 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Each filter element contain the following attributes: + "id": unique id of the filter that could be used to connect to the test the + "dataFlowConfiguration" + "mainType": the main filter type. The enums are defined in the xsd. + "subType": the sub filter type. The enums are defined in the xsd. + "bufferSize": the buffer size of the filter in hex. + "pid": the pid that would be used to configure the filter. + "useFMQ": if the filter uses FMQ. + + Each filter element also contains at most one type-related "filterSettings". + - The settings type should match the filter "subType" attribute. + - For example, when filter subType is audio or video, the avFilterSettings + can be configured. + - This is optional and skipping the settings would pass a setting with tpid + config only to the hal. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Each dvr element contain the following attributes: + "id": unique id of the dvr that could be used to connect to the test the + "dataFlowConfiguration" + "type": the dvr type. + "bufferSize": the dvr buffer size. + "statusMask": register callbacks of specific status. + "lowThreshold": the dvr status low threshold. + "highThreshold": the dvr status high threshold. + "dataFormat": the dvr data format. + "packetSize": the dvr packet size. + "inputFilePath": the dvr playback input file path. Only required in playback + dvr. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Each lnb element contain the following attributes: + "id": unique id of the lnb that could be used to connect to the test the + "dataFlowConfiguration" + "name": the external lnb device name. + "voltage": the voltage used to config the lnb. + "tone": the voltage used to config the lnb. + "position": the voltage used to config the lnb. + + + + + + + + + + + + + + + + + + + + + + Each timeFilter element contain the following attributes: + "id": unique id of the time filter that could be used to connect to the test the + "dataFlowConfiguration" + "timeStamp": the time stamp used to config the time filter. + + + + + + + + + + + + + + + + + + + + + Each descrambler element contain the following attributes: + "id": unique id of the descrambler that could be used to connect to the test the + "dataFlowConfiguration" + "casSystemId": the cas system id to connect to the descrambler. + "provisionStr": the provision string to use with the cas plugin. + "sesstionPrivatData": the session private data used to open the cas session. + + + + + + + + @@ -131,6 +424,110 @@ + + + + + This section contains configurations of all the filters that would be + used in the tests. + - This section is optional and can be skipped to use the default + filter settings. + - The default settings can be found in the + sample_tuner_vts_configurations.xml. + - The users can also override the default filter settings using + - id="FILTER_AUDIO_DEFAULT" or "FILTER_VIDEO_DEFAULT". + - The users can configure 1 or more filter elements in the filters + sections. + + + + + + + + + + + + This section contains configurations of all the dvrs that would be used + in the tests. + - This section is optional and can be skipped if the device does + not support dvr. + - The users can configure 1 or more dvr elements in the dvrs + sections. + + + + + + + + + + + + This section contains configurations of all the diseqc messages that + would be used in the lnb tests. + - This section is optional and can be skipped if lnb is not suppoted + - The users can configure 1 or more message elements in the + diseqcMessages sections. + + + + + + + + + + + + This section contains configurations of all the lnbs that would be used + in the tests. + - This section is optional and can be skipped if lnb is not suppoted + - The users can configure 1 or more lnb elements in the lnbs + sections. + + + + + + + + + + + + This section contains configurations of all the time filters that would + be used in the tests. + - This section is optional and can be skipped if time filter is + not supported. + - The users can configure 1 or more time filter elements in the + time filters sections. + + + + + + + + + + + + This section contains configurations of all the descramblers that would + be used in the tests. + - This section is optional and can be skipped if descrambling is not + supported. + - The users can configure 1 or more descrambler elements in the + descramblers sections. + + + + + + + @@ -139,8 +536,14 @@ - + + + + + + + @@ -151,21 +554,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -184,5 +620,25 @@ + + + + + + + + + + + + + + + + + + + +