mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:23:37 +00:00
Add API to configure media filter stream type for Demux Framing
Test: atest VtsHalTvTunerV1_1TargetTest Bug: 170339836 Change-Id: Ib42e041ddcd6de36df8af6732715c54097995e92
This commit is contained in:
@@ -70,4 +70,15 @@ interface IFilter extends @1.0::IFilter {
|
||||
* memory is not initialized.
|
||||
*/
|
||||
getAvSharedHandle() generates (Result result, handle avMemory, uint64_t avMemSize);
|
||||
|
||||
/**
|
||||
* Configure A/V filter’s stream type. This API only applies to A/V filters.
|
||||
*
|
||||
* @param avStreamType the stream type for A/V.
|
||||
* @return 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.
|
||||
*/
|
||||
configureAvStreamType(AvStreamType avStreamType) generates (Result result);
|
||||
};
|
||||
|
||||
@@ -228,6 +228,27 @@ Return<void> Filter::getAvSharedHandle(getAvSharedHandle_cb _hidl_cb) {
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<Result> Filter::configureAvStreamType(const V1_1::AvStreamType& avStreamType) {
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
|
||||
if (!mIsMediaFilter) {
|
||||
return Result::UNAVAILABLE;
|
||||
}
|
||||
|
||||
switch (avStreamType.getDiscriminator()) {
|
||||
case V1_1::AvStreamType::hidl_discriminator::audio:
|
||||
mAudioStreamType = static_cast<uint32_t>(avStreamType.audio());
|
||||
break;
|
||||
case V1_1::AvStreamType::hidl_discriminator::video:
|
||||
mVideoStreamType = static_cast<uint32_t>(avStreamType.video());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return Result::SUCCESS;
|
||||
}
|
||||
|
||||
bool Filter::createFilterMQ() {
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
|
||||
|
||||
@@ -82,6 +82,8 @@ class Filter : public V1_1::IFilter {
|
||||
|
||||
virtual Return<void> getAvSharedHandle(getAvSharedHandle_cb _hidl_cb) override;
|
||||
|
||||
virtual Return<Result> configureAvStreamType(const V1_1::AvStreamType& avStreamType) override;
|
||||
|
||||
/**
|
||||
* To create a FilterMQ and its Event Flag.
|
||||
*
|
||||
@@ -225,6 +227,9 @@ class Filter : public V1_1::IFilter {
|
||||
hidl_handle mSharedAvMemHandle;
|
||||
bool mUsingSharedAvMem = true;
|
||||
uint32_t mSharedAvMemOffset = 0;
|
||||
|
||||
uint32_t mAudioStreamType;
|
||||
uint32_t mVideoStreamType;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
@@ -568,3 +568,130 @@ safe_union FrontendScanMessageExt1_1 {
|
||||
|
||||
bool isHighPriority;
|
||||
};
|
||||
|
||||
@export
|
||||
enum VideoStreamType : uint32_t {
|
||||
UNDEFINED,
|
||||
/*
|
||||
* ITU-T | ISO/IEC Reserved
|
||||
*/
|
||||
RESERVED,
|
||||
/*
|
||||
* ISO/IEC 11172
|
||||
*/
|
||||
MPEG1,
|
||||
/*
|
||||
* ITU-T Rec.H.262 and ISO/IEC 13818-2
|
||||
*/
|
||||
MPEG2,
|
||||
/*
|
||||
* ISO/IEC 14496-2 (MPEG-4 H.263 based video)
|
||||
*/
|
||||
MPEG4P2,
|
||||
/*
|
||||
* ITU-T Rec.H.264 and ISO/IEC 14496-10
|
||||
*/
|
||||
AVC,
|
||||
/*
|
||||
* ITU-T Rec. H.265 and ISO/IEC 23008-2
|
||||
*/
|
||||
HEVC,
|
||||
/*
|
||||
* Microsoft VC.1
|
||||
*/
|
||||
VC1,
|
||||
/*
|
||||
* Google VP8
|
||||
*/
|
||||
VP8,
|
||||
/*
|
||||
* Google VP9
|
||||
*/
|
||||
VP9,
|
||||
/*
|
||||
* AOMedia Video 1
|
||||
*/
|
||||
AV1,
|
||||
/*
|
||||
* Chinese Standard
|
||||
*/
|
||||
AVS,
|
||||
/*
|
||||
* New Chinese Standard
|
||||
*/
|
||||
AVS2,
|
||||
};
|
||||
|
||||
@export
|
||||
enum AudioStreamType : uint32_t {
|
||||
UNDEFINED,
|
||||
/*
|
||||
* Uncompressed Audio
|
||||
*/
|
||||
PCM,
|
||||
/*
|
||||
* MPEG Audio Layer III versions
|
||||
*/
|
||||
MP3,
|
||||
/*
|
||||
* ISO/IEC 11172 Audio
|
||||
*/
|
||||
MPEG1,
|
||||
/*
|
||||
* ISO/IEC 13818-3
|
||||
*/
|
||||
MPEG2,
|
||||
/*
|
||||
* ISO/IEC 23008-3 (MPEG-H Part 3)
|
||||
*/
|
||||
MPEGH,
|
||||
/*
|
||||
* ISO/IEC 14496-3
|
||||
*/
|
||||
AAC,
|
||||
/*
|
||||
* Dolby Digital
|
||||
*/
|
||||
AC3,
|
||||
/*
|
||||
* Dolby Digital Plus
|
||||
*/
|
||||
EAC3,
|
||||
/*
|
||||
* Dolby AC-4
|
||||
*/
|
||||
AC4,
|
||||
/*
|
||||
* Basic DTS
|
||||
*/
|
||||
DTS,
|
||||
/*
|
||||
* High Resolution DTS
|
||||
*/
|
||||
DTS_HD,
|
||||
/*
|
||||
* Windows Media Audio
|
||||
*/
|
||||
WMA,
|
||||
/*
|
||||
* Opus Interactive Audio Codec
|
||||
*/
|
||||
OPUS,
|
||||
/*
|
||||
* VORBIS Interactive Audio Codec
|
||||
*/
|
||||
VORBIS,
|
||||
/*
|
||||
* SJ/T 11368-2006
|
||||
*/
|
||||
DRA,
|
||||
};
|
||||
|
||||
/**
|
||||
* Stream type for A/V filter.
|
||||
*/
|
||||
safe_union AvStreamType {
|
||||
VideoStreamType video;
|
||||
|
||||
AudioStreamType audio;
|
||||
};
|
||||
|
||||
@@ -164,6 +164,20 @@ AssertionResult FilterTests::configFilter(DemuxFilterSettings setting, uint64_t
|
||||
return AssertionResult(status == Result::SUCCESS);
|
||||
}
|
||||
|
||||
AssertionResult FilterTests::configAvFilterStreamType(AvStreamType type, uint64_t filterId) {
|
||||
Result status;
|
||||
EXPECT_TRUE(mFilters[filterId]) << "Test with getNewlyOpenedFilterId first.";
|
||||
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->configureAvStreamType(type);
|
||||
} else {
|
||||
ALOGW("[vts] Can't cast IFilter into v1_1.");
|
||||
return failure();
|
||||
}
|
||||
return AssertionResult(status == Result::SUCCESS);
|
||||
}
|
||||
|
||||
AssertionResult FilterTests::configIpFilterCid(uint32_t ipCid, uint64_t filterId) {
|
||||
Result status;
|
||||
EXPECT_TRUE(mFilters[filterId]) << "Open Ip filter first.";
|
||||
|
||||
@@ -54,6 +54,7 @@ using android::hardware::tv::tuner::V1_0::DemuxTsFilterType;
|
||||
using android::hardware::tv::tuner::V1_0::IDemux;
|
||||
using android::hardware::tv::tuner::V1_0::IFilter;
|
||||
using android::hardware::tv::tuner::V1_0::Result;
|
||||
using android::hardware::tv::tuner::V1_1::AvStreamType;
|
||||
using android::hardware::tv::tuner::V1_1::DemuxFilterEventExt;
|
||||
using android::hardware::tv::tuner::V1_1::IFilterCallback;
|
||||
using android::hardware::tv::tuner::V1_1::ITuner;
|
||||
@@ -150,6 +151,7 @@ class FilterTests {
|
||||
AssertionResult getSharedAvMemoryHandle(uint64_t filterId);
|
||||
AssertionResult releaseShareAvHandle(uint64_t filterId);
|
||||
AssertionResult configFilter(DemuxFilterSettings setting, uint64_t filterId);
|
||||
AssertionResult configAvFilterStreamType(AvStreamType type, uint64_t filterId);
|
||||
AssertionResult configIpFilterCid(uint32_t ipCid, uint64_t filterId);
|
||||
AssertionResult getFilterMQDescriptor(uint64_t filterId);
|
||||
AssertionResult startFilter(uint64_t filterId);
|
||||
|
||||
@@ -69,6 +69,7 @@ void TunerBroadcastHidlTest::mediaFilterUsingSharedMemoryTest(FilterConfig filte
|
||||
ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId_64bit(filterId));
|
||||
ASSERT_TRUE(mFilterTests.getSharedAvMemoryHandle(filterId));
|
||||
ASSERT_TRUE(mFilterTests.configFilter(filterConf.settings, filterId));
|
||||
ASSERT_TRUE(mFilterTests.configAvFilterStreamType(filterConf.streamType, filterId));
|
||||
ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId));
|
||||
ASSERT_TRUE(mFilterTests.startFilter(filterId));
|
||||
// tune test
|
||||
|
||||
@@ -46,9 +46,12 @@ using android::hardware::tv::tuner::V1_0::FrontendSettings;
|
||||
using android::hardware::tv::tuner::V1_0::FrontendType;
|
||||
using android::hardware::tv::tuner::V1_0::PlaybackSettings;
|
||||
using android::hardware::tv::tuner::V1_0::RecordSettings;
|
||||
using android::hardware::tv::tuner::V1_1::AudioStreamType;
|
||||
using android::hardware::tv::tuner::V1_1::AvStreamType;
|
||||
using android::hardware::tv::tuner::V1_1::FrontendSettingsExt1_1;
|
||||
using android::hardware::tv::tuner::V1_1::FrontendStatusExt1_1;
|
||||
using android::hardware::tv::tuner::V1_1::FrontendStatusTypeExt1_1;
|
||||
using android::hardware::tv::tuner::V1_1::VideoStreamType;
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -91,6 +94,7 @@ struct FilterConfig {
|
||||
uint32_t bufferSize;
|
||||
DemuxFilterType type;
|
||||
DemuxFilterSettings settings;
|
||||
AvStreamType streamType;
|
||||
uint32_t ipCid;
|
||||
|
||||
bool operator<(const FilterConfig& /*c*/) const { return false; }
|
||||
@@ -184,6 +188,7 @@ inline void initFilterConfig() {
|
||||
filterArray[TS_VIDEO1].bufferSize = FMQ_SIZE_16M;
|
||||
filterArray[TS_VIDEO1].settings.ts().tpid = 256;
|
||||
filterArray[TS_VIDEO1].settings.ts().filterSettings.av({.isPassthrough = false});
|
||||
filterArray[TS_VIDEO1].streamType.video(VideoStreamType::MPEG1);
|
||||
// TS AUDIO filter setting
|
||||
filterArray[TS_AUDIO0].type.mainType = DemuxFilterMainType::TS;
|
||||
filterArray[TS_AUDIO0].type.subType.tsFilterType(DemuxTsFilterType::AUDIO);
|
||||
@@ -195,6 +200,7 @@ inline void initFilterConfig() {
|
||||
filterArray[TS_AUDIO1].bufferSize = FMQ_SIZE_16M;
|
||||
filterArray[TS_AUDIO1].settings.ts().tpid = 257;
|
||||
filterArray[TS_AUDIO1].settings.ts().filterSettings.av({.isPassthrough = false});
|
||||
filterArray[TS_VIDEO1].streamType.audio(AudioStreamType::MP3);
|
||||
// TS PES filter setting
|
||||
filterArray[TS_PES0].type.mainType = DemuxFilterMainType::TS;
|
||||
filterArray[TS_PES0].type.subType.tsFilterType(DemuxTsFilterType::PES);
|
||||
|
||||
Reference in New Issue
Block a user