Loading tv/tuner/1.1/IFilter.hal +17 −0 Original line number Diff line number Diff line Loading @@ -81,4 +81,21 @@ interface IFilter extends @1.0::IFilter { * UNKNOWN_ERROR if failed for other reasons. */ configureAvStreamType(AvStreamType avStreamType) generates (Result result); /** * Configure the filter to monitor specific Scrambling Status. * * Scrambling Status should be sent through the filer callback at the following two scenarios: * 1. When this method is called, the first detected scrambling status should be sent. * 2. When the filter transits into the monitored statuses configured through this method, * event should be sent. * * @param statuses Scrambling Statuses to monitor. Set corresponding bit to monitor. Reset to * stop monitoring. * @return result Result status of the operation. * SUCCESS if successful, * INVALID_STATE if configure can't be applied, * UNKNOWN_ERROR if failed for other reasons. */ configureScramblingEvent(bitfield<ScramblingStatus> statuses) generates (Result result); }; tv/tuner/1.1/default/Filter.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,28 @@ Return<Result> Filter::configureAvStreamType(const V1_1::AvStreamType& avStreamT return Result::SUCCESS; } Return<Result> Filter::configureScramblingEvent(uint32_t statuses) { ALOGV("%s", __FUNCTION__); mStatuses = statuses; if (mCallback_1_1 != nullptr) { // Assuming current status is always NOT_SCRAMBLED V1_1::DemuxFilterEventExt filterEventExt; V1_1::DemuxFilterEventExt::Event event; event.scramblingStatus(V1_1::ScramblingStatus::NOT_SCRAMBLED); int size = filterEventExt.events.size(); filterEventExt.events.resize(size + 1); filterEventExt.events[size] = event; DemuxFilterEvent emptyFilterEvent; mCallback_1_1->onFilterEvent_1_1(emptyFilterEvent, filterEventExt); mFilterEventExt.events.resize(0); } else { return Result::INVALID_STATE; } return Result::SUCCESS; } bool Filter::createFilterMQ() { ALOGV("%s", __FUNCTION__); Loading tv/tuner/1.1/default/Filter.h +5 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,8 @@ class Filter : public V1_1::IFilter { virtual Return<Result> configureAvStreamType(const V1_1::AvStreamType& avStreamType) override; virtual Return<Result> configureScramblingEvent(uint32_t statuses) override; /** * To create a FilterMQ and its Event Flag. * Loading Loading @@ -230,6 +232,9 @@ class Filter : public V1_1::IFilter { uint32_t mAudioStreamType; uint32_t mVideoStreamType; // Scrambling status to be monitored uint32_t mStatuses = 0; }; } // namespace implementation Loading tv/tuner/1.1/types.hal +21 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,8 @@ struct DemuxFilterEventExt { DemuxFilterRecordEventExt tsRecord; DemuxFilterRecordEventExt mmtpRecord; ScramblingStatus scramblingStatus; }; /** Loading @@ -133,6 +135,25 @@ struct DemuxFilterEventExt { vec<Event> events; }; /** * Scrambling Status Type. */ @export enum ScramblingStatus : uint32_t { /** * Content’s scrambling status is unknown */ UNKNOWN = 1 << 0, /** * Content is not scrambled. */ NOT_SCRAMBLED = 1 << 1, /** * Content is scrambled. */ SCRAMBLED = 1 << 2, }; typedef FrontendDvbcSpectralInversion FrontendSpectralInversion; /** Loading tv/tuner/1.1/vts/functional/FilterTests.cpp +31 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,18 @@ void FilterCallback::testFilterDataOutput() { ALOGW("[vts] pass and stop"); } void FilterCallback::testFilterScramblingEvent() { android::Mutex::Autolock autoLock(mMsgLock); while (mScramblingStatusEvent < 1) { if (-ETIMEDOUT == mMsgCondition.waitRelative(mMsgLock, WAIT_TIMEOUT)) { EXPECT_TRUE(false) << "scrambling event does not output within timeout"; return; } } mScramblingStatusEvent = 0; ALOGW("[vts] pass and stop"); } void FilterCallback::readFilterEventData() { ALOGW("[vts] reading filter event"); // todo separate filter handlers Loading Loading @@ -56,6 +68,9 @@ void FilterCallback::readFilterEventData() { eventExt.mmtpRecord().pts, eventExt.mmtpRecord().firstMbInSlice, eventExt.mmtpRecord().mpuSequenceNumber); break; case DemuxFilterEventExt::Event::hidl_discriminator::scramblingStatus: mScramblingStatusEvent++; break; default: break; } Loading Loading @@ -240,3 +255,19 @@ AssertionResult FilterTests::closeFilter(uint64_t filterId) { } return AssertionResult(status == Result::SUCCESS); } AssertionResult FilterTests::configureScramblingEvent(uint64_t filterId, uint32_t statuses) { EXPECT_TRUE(mFilters[filterId]) << "Test with getNewlyOpenedFilterId first."; Result status; sp<android::hardware::tv::tuner::V1_1::IFilter> filter_v1_1 = android::hardware::tv::tuner::V1_1::IFilter::castFrom(mFilters[filterId]); if (filter_v1_1 != NULL) { status = filter_v1_1->configureScramblingEvent(statuses); mFilterCallbacks[filterId]->testFilterScramblingEvent(); } else { ALOGW("[vts] Can't cast IFilter into v1_1."); return failure(); } return AssertionResult(status == Result::SUCCESS); } Loading
tv/tuner/1.1/IFilter.hal +17 −0 Original line number Diff line number Diff line Loading @@ -81,4 +81,21 @@ interface IFilter extends @1.0::IFilter { * UNKNOWN_ERROR if failed for other reasons. */ configureAvStreamType(AvStreamType avStreamType) generates (Result result); /** * Configure the filter to monitor specific Scrambling Status. * * Scrambling Status should be sent through the filer callback at the following two scenarios: * 1. When this method is called, the first detected scrambling status should be sent. * 2. When the filter transits into the monitored statuses configured through this method, * event should be sent. * * @param statuses Scrambling Statuses to monitor. Set corresponding bit to monitor. Reset to * stop monitoring. * @return result Result status of the operation. * SUCCESS if successful, * INVALID_STATE if configure can't be applied, * UNKNOWN_ERROR if failed for other reasons. */ configureScramblingEvent(bitfield<ScramblingStatus> statuses) generates (Result result); };
tv/tuner/1.1/default/Filter.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,28 @@ Return<Result> Filter::configureAvStreamType(const V1_1::AvStreamType& avStreamT return Result::SUCCESS; } Return<Result> Filter::configureScramblingEvent(uint32_t statuses) { ALOGV("%s", __FUNCTION__); mStatuses = statuses; if (mCallback_1_1 != nullptr) { // Assuming current status is always NOT_SCRAMBLED V1_1::DemuxFilterEventExt filterEventExt; V1_1::DemuxFilterEventExt::Event event; event.scramblingStatus(V1_1::ScramblingStatus::NOT_SCRAMBLED); int size = filterEventExt.events.size(); filterEventExt.events.resize(size + 1); filterEventExt.events[size] = event; DemuxFilterEvent emptyFilterEvent; mCallback_1_1->onFilterEvent_1_1(emptyFilterEvent, filterEventExt); mFilterEventExt.events.resize(0); } else { return Result::INVALID_STATE; } return Result::SUCCESS; } bool Filter::createFilterMQ() { ALOGV("%s", __FUNCTION__); Loading
tv/tuner/1.1/default/Filter.h +5 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,8 @@ class Filter : public V1_1::IFilter { virtual Return<Result> configureAvStreamType(const V1_1::AvStreamType& avStreamType) override; virtual Return<Result> configureScramblingEvent(uint32_t statuses) override; /** * To create a FilterMQ and its Event Flag. * Loading Loading @@ -230,6 +232,9 @@ class Filter : public V1_1::IFilter { uint32_t mAudioStreamType; uint32_t mVideoStreamType; // Scrambling status to be monitored uint32_t mStatuses = 0; }; } // namespace implementation Loading
tv/tuner/1.1/types.hal +21 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,8 @@ struct DemuxFilterEventExt { DemuxFilterRecordEventExt tsRecord; DemuxFilterRecordEventExt mmtpRecord; ScramblingStatus scramblingStatus; }; /** Loading @@ -133,6 +135,25 @@ struct DemuxFilterEventExt { vec<Event> events; }; /** * Scrambling Status Type. */ @export enum ScramblingStatus : uint32_t { /** * Content’s scrambling status is unknown */ UNKNOWN = 1 << 0, /** * Content is not scrambled. */ NOT_SCRAMBLED = 1 << 1, /** * Content is scrambled. */ SCRAMBLED = 1 << 2, }; typedef FrontendDvbcSpectralInversion FrontendSpectralInversion; /** Loading
tv/tuner/1.1/vts/functional/FilterTests.cpp +31 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,18 @@ void FilterCallback::testFilterDataOutput() { ALOGW("[vts] pass and stop"); } void FilterCallback::testFilterScramblingEvent() { android::Mutex::Autolock autoLock(mMsgLock); while (mScramblingStatusEvent < 1) { if (-ETIMEDOUT == mMsgCondition.waitRelative(mMsgLock, WAIT_TIMEOUT)) { EXPECT_TRUE(false) << "scrambling event does not output within timeout"; return; } } mScramblingStatusEvent = 0; ALOGW("[vts] pass and stop"); } void FilterCallback::readFilterEventData() { ALOGW("[vts] reading filter event"); // todo separate filter handlers Loading Loading @@ -56,6 +68,9 @@ void FilterCallback::readFilterEventData() { eventExt.mmtpRecord().pts, eventExt.mmtpRecord().firstMbInSlice, eventExt.mmtpRecord().mpuSequenceNumber); break; case DemuxFilterEventExt::Event::hidl_discriminator::scramblingStatus: mScramblingStatusEvent++; break; default: break; } Loading Loading @@ -240,3 +255,19 @@ AssertionResult FilterTests::closeFilter(uint64_t filterId) { } return AssertionResult(status == Result::SUCCESS); } AssertionResult FilterTests::configureScramblingEvent(uint64_t filterId, uint32_t statuses) { EXPECT_TRUE(mFilters[filterId]) << "Test with getNewlyOpenedFilterId first."; Result status; sp<android::hardware::tv::tuner::V1_1::IFilter> filter_v1_1 = android::hardware::tv::tuner::V1_1::IFilter::castFrom(mFilters[filterId]); if (filter_v1_1 != NULL) { status = filter_v1_1->configureScramblingEvent(statuses); mFilterCallbacks[filterId]->testFilterScramblingEvent(); } else { ALOGW("[vts] Can't cast IFilter into v1_1."); return failure(); } return AssertionResult(status == Result::SUCCESS); }