Merge "Add TEMI filter, releasing AV handle and CI-CAM" am: e7044daa5b

am: 7216c1bb33

Change-Id: I416ebd571abe54fe39eca1aade4f7da3af89ff4c
This commit is contained in:
Henry Fang 2019-12-04 16:01:58 -08:00 committed by android-build-merger
commit a9dbfec768
8 changed files with 114 additions and 4 deletions

View file

@ -25,7 +25,6 @@ import ITimeFilter;
/**
* Demultiplexer(Demux) takes a single multiplexed input and splits it into
* one or more output.
*
*/
interface IDemux {
/**
@ -134,4 +133,30 @@ interface IDemux {
*/
openDvr(DvrType type, uint32_t bufferSize, IDvrCallback cb)
generates (Result result, IDvr dvr);
/**
* Connect Conditional Access Modules (CAM) through Common Interface (CI)
*
* It is used by the client to connect CI-CAM. The demux uses the output
* from the frontend as the input by default, and must change to use the
* output from CI-CAM as the input after this call take place.
*
* @param ciCamId specify CI-CAM Id to connect.
* @return result Result status of the operation.
* SUCCESS if successful,
* UNKNOWN_ERROR if failed for other reasons.
*/
connectCiCam(uint32_t ciCamId) generates (Result result);
/**
* Disconnect Conditional Access Modules (CAM)
*
* It is used by the client to disconnect CI-CAM. The demux will use the
* output from the frontend as the input after this call take place.
*
* @return result Result status of the operation.
* SUCCESS if successful,
* UNKNOWN_ERROR if failed for other reasons.
*/
disconnectCiCam() generates (Result result);
};

View file

@ -112,6 +112,21 @@ interface IFilter {
*/
getId() generates (Result result, uint32_t filterId);
/**
* Release the handle reported by the HAL for AV memory.
*
* It is used by the client to notify the HAL that the AV handle won't be
* used any more in client side, so that the HAL can mark the memory
* presented by file descripor in the handle as released.
*
* @param avMemory A handle associated to the memory for audio or video.
* @return result Result status of the operation.
* SUCCESS if successful,
* INVALID_ARGUMENT if failed for wrong parameter.
* UNKNOWN_ERROR if failed for other reasons.
*/
releaseAvHandle(handle avMemory) generates (Result result);
/**
* Set the filter's data source.
*

View file

@ -147,6 +147,20 @@ Return<void> Demux::openDvr(DvrType type, uint32_t bufferSize, const sp<IDvrCall
return Void();
}
Return<Result> Demux::connectCiCam(uint32_t ciCamId) {
ALOGV("%s", __FUNCTION__);
mCiCamId = ciCamId;
return Result::SUCCESS;
}
Return<Result> Demux::disconnectCiCam() {
ALOGV("%s", __FUNCTION__);
return Result::SUCCESS;
}
Result Demux::removeFilter(uint32_t filterId) {
ALOGV("%s", __FUNCTION__);

View file

@ -76,6 +76,10 @@ class Demux : public IDemux {
virtual Return<void> openDvr(DvrType type, uint32_t bufferSize, const sp<IDvrCallback>& cb,
openDvr_cb _hidl_cb) override;
virtual Return<Result> connectCiCam(uint32_t ciCamId) override;
virtual Return<Result> disconnectCiCam() override;
// Functions interacts with Tuner Service
void stopBroadcastInput();
Result removeFilter(uint32_t filterId);
@ -118,6 +122,7 @@ class Demux : public IDemux {
void startTsFilter(vector<uint8_t> data);
uint32_t mDemuxId;
uint32_t mCiCamId;
/**
* Record the last used filter id. Initial value is -1.
* Filter Id starts with 0.

View file

@ -120,6 +120,12 @@ Return<Result> Filter::flush() {
return Result::SUCCESS;
}
Return<Result> Filter::releaseAvHandle(const hidl_handle& /*avMemory*/) {
ALOGV("%s", __FUNCTION__);
return Result::SUCCESS;
}
Return<Result> Filter::close() {
ALOGV("%s", __FUNCTION__);
@ -289,6 +295,9 @@ Result Filter::startFilterHandler() {
case DemuxTsFilterType::RECORD:
startRecordFilterHandler();
break;
case DemuxTsFilterType::TEMI:
startTemiFilterHandler();
break;
}
break;
case DemuxFilterMainType::MMTP:
@ -419,6 +428,11 @@ Result Filter::startPcrFilterHandler() {
return Result::SUCCESS;
}
Result Filter::startTemiFilterHandler() {
// TODO handle starting TEMI filter
return Result::SUCCESS;
}
bool Filter::writeSectionsAndCreateEvent(vector<uint8_t> data) {
// TODO check how many sections has been read
ALOGD("[Filter] section hander");
@ -453,4 +467,4 @@ bool Filter::writeDataToFilterMQ(const std::vector<uint8_t>& data) {
} // namespace tuner
} // namespace tv
} // namespace hardware
} // namespace android
} // namespace android

View file

@ -68,6 +68,8 @@ class Filter : public IFilter {
virtual Return<Result> flush() override;
virtual Return<Result> releaseAvHandle(const hidl_handle& avMemory) override;
virtual Return<Result> close() override;
/**
@ -129,6 +131,7 @@ class Filter : public IFilter {
Result startMediaFilterHandler();
Result startRecordFilterHandler();
Result startPcrFilterHandler();
Result startTemiFilterHandler();
Result startFilterLoop();
void deleteEventFlag();
@ -176,4 +179,4 @@ class Filter : public IFilter {
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_TV_TUNER_V1_0_FILTER_H_
#endif // ANDROID_HARDWARE_TV_TUNER_V1_0_FILTER_H_

View file

@ -1759,6 +1759,12 @@ enum DemuxTsFilterType : uint32_t {
* buffer of the record.
*/
RECORD,
/**
* A filter to filter out Timed External Media Information (TEMI) according
* to ISO/IEC 13818-1:2013/ DAM 6 from input stream, and send TEMI event to
* client through onFilterEvent.
*/
TEMI,
};
/**
@ -2170,7 +2176,8 @@ struct DemuxTsFilterSettings {
safe_union FilterSettings {
/**
* Not additional parameters. it's used by PCR, TS subtype filters.
* Not additional parameters. it's used by PCR, TS, TEMI subtype
* filters.
*/
Monostate noinit;
@ -2460,6 +2467,27 @@ struct DemuxFilterTsRecordEvent {
uint64_t byteNumber;
};
/**
* Filter Event for Timed External Media Information (TEMI) data.
*/
struct DemuxFilterTemiEvent {
/**
* Presentation Time Stamp for audio or video frame. It based on 90KHz has
* the same format as PTS (Presentation Time Stamp) in ISO/IEC 13818-1.
*/
uint64_t pts;
/**
* TEMI Descriptor Tag
*/
uint8_t descrTag;
/**
* TEMI Descriptor
*/
vec<uint8_t> descrData;
};
/**
* Filter Event for MMTP Record data.
*/
@ -2521,6 +2549,8 @@ struct DemuxFilterEvent {
DemuxFilterDownloadEvent download;
DemuxFilterIpPayloadEvent ipPayload;
DemuxFilterTemiEvent temi;
};
/**

View file

@ -159,6 +159,7 @@ enum FilterEventType : uint8_t {
RECORD,
MMTPRECORD,
DOWNLOAD,
TEMI,
};
struct PlaybackConf {
@ -821,6 +822,9 @@ class TunerHidlTest : public ::testing::VtsHalHidlTargetTestBase {
case DemuxTsFilterType::RECORD:
eventType = FilterEventType::RECORD;
break;
case DemuxTsFilterType::TEMI:
eventType = FilterEventType::TEMI;
break;
}
break;
case DemuxFilterMainType::MMTP: