Merge "Add Demux and Descrambler interface to Tuner HAL Test: Manual bug: 135709729" am: 7048f252cf am: f01ab481f7 am: 900574b220

am: e851be506e

Change-Id: I368401c7ce4b82788ccf7e135cb695ce91282be3
This commit is contained in:
Amy Zhang
2019-09-05 19:17:18 -07:00
committed by android-build-merger
8 changed files with 189 additions and 1 deletions

View File

@@ -8,6 +8,9 @@ hidl_interface {
},
srcs: [
"types.hal",
"IDemux.hal",
"IDemuxCallback.hal",
"IDescrambler.hal",
"IFrontend.hal",
"IFrontendCallback.hal",
"ITuner.hal",

37
tv/tuner/1.0/IDemux.hal Normal file
View File

@@ -0,0 +1,37 @@
package android.hardware.tv.tuner@1.0;
import IDemuxCallback;
/**
* Demultiplexer(Demux) takes a single multiplexed input and splits it into
* one or more output.
*
*/
interface IDemux {
/**
* Set a frontend resource as data input of the demux
*
* It is used by the client to specify a hardware frontend as data source of
* this demux instance. A demux instance can have only one data source.
*
* @return result Result status of the operation.
* SUCCESS if successful,
* INVALID_STATE if failed for wrong state.
* UNKNOWN_ERROR if failed for other reasons.
*/
setFrontendDataSource(FrontendId frontendId) generates (Result result);
/**
* Close the Demux instance
*
* It is used by the client to release the demux instance. HAL clear
* underneath resource. client mustn't access the instance any more.
*
* @return result Result status of the operation.
* SUCCESS if successful,
* UNKNOWN_ERROR if failed for other reasons.
*/
close() generates (Result result);
};

View File

@@ -0,0 +1,11 @@
package android.hardware.tv.tuner@1.0;
interface IDemuxCallback {
/**
* Notify the client that a new filter event happened.
*
* @param filterEvent a demux filter event.
*/
oneway onFilterEvent(DemuxFilterEvent filterEvent);
};

View File

@@ -0,0 +1,35 @@
package android.hardware.tv.tuner@1.0;
/**
* Descrambler is used to descramble input data.
*
*/
interface IDescrambler {
/**
* Set a demux as source of the descrambler
*
* It is used by the client to specify a demux as source of this
* descrambler. A descrambler instance can have only one source, and
* this method can be only called once.
*
* @return result Result status of the operation.
* SUCCESS if successful,
* INVALID_STATE if failed for wrong state.
* UNKNOWN_ERROR if failed for other reasons.
*/
setDemuxSource(DemuxId demuxId) generates (Result result);
/**
* Release the descrambler instance
*
* It is used by the client to release the descrambler instance. HAL clear
* underneath resource. client mustn't access the instance any more.
*
* @return result Result status of the operation.
* SUCCESS if successful,
* UNKNOWN_ERROR if failed for other reasons.
*/
close() generates (Result result);
};

View File

@@ -16,6 +16,8 @@
package android.hardware.tv.tuner@1.0;
import IDemux;
import IDescrambler;
import IFrontend;
/**
@@ -48,5 +50,30 @@ interface ITuner {
openFrontendById(FrontendId frontendId)
generates (Result result, IFrontend frontend);
};
/**
* Create a new instance of Demux.
*
* It is used by the client to create a Demux instance.
*
* @return result Result status of the operation.
* SUCCESS if successful,
* UNKNOWN_ERROR if creation failed for other reasons.
* @return demuxId newly created demux id.
* @return demux the newly created demux interface.
*/
openDemux()
generates (Result result, DemuxId demuxId, IDemux demux);
/**
* Create a new instance of Descrambler.
*
* It is used by the client to create a Descrambler instance.
*
* @return result Result status of the operation.
* SUCCESS if successful,
* UNKNOWN_ERROR if creation failed for other reasons.
* @return descrambler the newly created descrambler interface.
*/
openDescrambler()
generates (Result result, IDescrambler descrambler);
};

View File

@@ -28,6 +28,8 @@ namespace tuner {
namespace V1_0 {
namespace implementation {
using ::android::hardware::tv::tuner::V1_0::DemuxId;
Tuner::Tuner() {
// Static Frontends array to maintain local frontends information
// Array index matches their FrontendId in the default impl
@@ -71,6 +73,25 @@ Return<void> Tuner::openFrontendById(uint32_t frontendId, openFrontendById_cb _h
return Void();
}
Return<void> Tuner::openDemux(openDemux_cb _hidl_cb) {
ALOGV("%s", __FUNCTION__);
sp<IDemux> demux;
DemuxId demuxId = 0;
_hidl_cb(Result::SUCCESS, demuxId, demux);
return Void();
}
Return<void> Tuner::openDescrambler(openDescrambler_cb _hidl_cb) {
ALOGV("%s", __FUNCTION__);
sp<IDescrambler> descrambler;
_hidl_cb(Result::SUCCESS, descrambler);
return Void();
}
} // namespace implementation
} // namespace V1_0
} // namespace tuner

View File

@@ -37,6 +37,10 @@ class Tuner : public ITuner {
virtual Return<void> openFrontendById(uint32_t frontendId,
openFrontendById_cb _hidl_cb) override;
virtual Return<void> openDemux(openDemux_cb _hidl_cb) override;
virtual Return<void> openDescrambler(openDescrambler_cb _hidl_cb) override;
private:
virtual ~Tuner();
// Static mFrontends array to maintain local frontends information

View File

@@ -137,3 +137,53 @@ enum FrontendEventType : uint32_t {
*/
LOST_LOCK,
};
/* Demux ID is used to associate with a hardware demux resource. */
typedef uint32_t DemuxId;
/* Filter ID is used to associate with a hardware filter resource. */
typedef uint32_t DemuxFilterId;
/**
* Filter Type according to ISO/IEC 13818-1
*/
@export
enum DemuxFilterType : uint32_t {
/**
* A filter to filter section data out from input stream.
*/
SECTION,
/**
* A filter to filter PES data out from input stream.
*/
PES,
/**
* A filter to filter TS payload out from input stream.
*/
TS,
/**
* A filter to filter Audio Metadata out from input stream.
*/
AUDIO,
/**
* A filter to filter Vidoe Metadata out from input stream.
*/
VIDEO,
/**
* A filter to set PCR channel from input stream.
*/
PCR,
/**
* A filter to filter data directly to output buffer for record.
*/
RECORD,
};
/**
* Filter Event.
*/
struct DemuxFilterEvent {
DemuxFilterId filterId;
DemuxFilterType filterType;
};