Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98328931 authored by Amy Zhang's avatar Amy Zhang Committed by Android (Google) Code Review
Browse files

Merge changes from topic "tuner_filter"

* changes:
  Tuner HAL Demux Filter VTS
  Tuner HAL Filter APIs default implementation
  Add filter function to Demux interface and Add program info to Descrambler
parents 6b62bfb8 052275a9
Loading
Loading
Loading
Loading
+147 −0
Original line number Diff line number Diff line
@@ -22,6 +22,153 @@ interface IDemux {
     */
    setFrontendDataSource(FrontendId frontendId) generates (Result result);

    /**
     * Add a filter to the demux
     *
     * It is used by the client to add a filter to the demux.
     *
     * @param type the type of the filter to be added.
     * @param bufferSize the buffer size of the filter to be added. It's used to
     * create a FMQ(Fast Message Queue) to hold data output from the filter.
     * @param cb the callback for the filter to be used to send notifications
     * back to the client.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     * @return filterId the ID of the newly added filter.
     */
    addFilter(DemuxFilterType type, uint32_t bufferSize, IDemuxCallback cb)
        generates (Result result, DemuxFilterId filterId);

    /**
     * Get the descriptor of the filter's FMQ
     *
     * It is used by the client to get the descriptor of the filter's Fast
     * Message Queue. The data in FMQ is filtered out from MPEG transport
     * stream. The data is origanized to data blocks which may have
     * different length. The length's information of one or multiple data blocks
     * is sent to client throught DemuxFilterEvent.
     *
     * @param filterId the ID of the filter.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_ARGUMENT if failed for wrong filter ID.
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     * @return queue the descriptor of the filter's FMQ
     */
    getFilterQueueDesc(DemuxFilterId filterId)
        generates (Result result, fmq_sync<uint8_t> queue);

    /**
     * Configure the filter.
     *
     * It is used by the client to configure the filter so that it can filter out
     * intended data.
     *
     * @param filterId the ID of the filter.
     * @param settings the settings of the filter.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_ARGUMENT if failed for wrong filter ID.
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    configureFilter(DemuxFilterId filterId, DemuxFilterSettings settings)
        generates(Result result);

    /**
     * Start the filter.
     *
     * It is used by the client to ask the filter to start filterring data.
     *
     * @param filterId the ID of the filter.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_ARGUMENT if failed for wrong filter ID.
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    startFilter(DemuxFilterId filterId) generates (Result result);

    /**
     * Stop the filter.
     *
     * It is used by the client to ask the filter to stop filterring data.
     * It won't discard the data already filtered out by the filter. The filter
     * will be stopped and removed automatically if the demux is closed.
     *
     * @param filterId the ID of the filter.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_ARGUMENT if failed for wrong filter ID.
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    stopFilter(DemuxFilterId filterId) generates (Result result);

    /**
     * Flush the filter.
     *
     * It is used by the client to ask the filter to flush the data which is
     * already produced but not consumed yet.
     *
     * @param filterId the ID of the filter.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_ARGUMENT if failed for wrong filter ID.
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    flushFilter(DemuxFilterId filterId) generates (Result result);

    /**
     * Remove a filter from the demux
     *
     * It is used by the client to remove a filter from the demux.
     *
     * @param filterId the ID of the removed filter.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_ARGUMENT if failed for wrong filter ID.
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    removeFilter(DemuxFilterId filterId) generates (Result result);

    /**
     * Get hardware sync ID for audio and video.
     *
     * It is used by the client to get the hardware sync ID for audio and video.
     *
     * @param filterId the ID of the filter.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_ARGUMENT if failed for a wrong filter ID.
     *         UNKNOWN_ERROR if failed for other reasons.
     * @return avSyncHwId the id of hardware A/V sync.
     */
    getAvSyncHwId(DemuxFilterId filterId)
        generates (Result result, AvSyncHwId avSyncHwId);

    /**
     * Get current time stamp to use for A/V sync
     *
     * It is used by the client to get current time stamp for A/V sync. HW is
     * supported to increment and maintain current time stamp.
     *
     * @param avSyncHwId the hardware id of A/V sync.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_ARGUMENT if failed for a wrong hardware ID of A/V sync.
     *         UNKNOWN_ERROR if failed for other reasons.
     * @return time the current time stamp of hardware A/V sync. The time stamp
     * based on 90KHz has the same format as PTS (Presentation Time Stamp).
     */
    getAvSyncTime(AvSyncHwId avSyncHwId)
        generates (Result result, uint64_t time);

    /**
     * Close the Demux instance
     *
+9 −1
Original line number Diff line number Diff line
@@ -7,5 +7,13 @@ interface IDemuxCallback {
     * @param filterEvent a demux filter event.
     */
    oneway onFilterEvent(DemuxFilterEvent filterEvent);

    /**
     * Notify the client a new status of a demux filter.
     *
     * @param filterId the demux filter ID.
     * @param status a new status of the demux filter.
     */
    oneway onFilterStatus(DemuxFilterId filterId, DemuxFilterStatus status);
};
+47 −3
Original line number Diff line number Diff line
package android.hardware.tv.tuner@1.0;

/**
 * Descrambler is used to descramble input data.
 *
 */
interface IDescrambler {

    /**
     * Set a demux as source of the descrambler
     *
@@ -13,6 +11,7 @@ interface IDescrambler {
     * descrambler. A descrambler instance can have only one source, and
     * this method can be only called once.
     *
     * @param demuxId the id of the demux to be used as descrambler's source.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
@@ -20,6 +19,51 @@ interface IDescrambler {
     */
    setDemuxSource(DemuxId demuxId) generates (Result result);

    /**
     * Set a key token to link descrambler to a key slot
     *
     * It is used by the client to link a hardware key slot to a descrambler.
     * A descrambler instance can have only one key slot to link, but a key
     * slot can hold a few keys for different purposes.
     *
     * @param keyToken the token to be used to link the key slot.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    setKeyToken(TunerKeyToken keyToken) generates (Result result);

    /**
     * Add packets' PID to the descrambler for descrambling
     *
     * It is used by the client to specify Package ID (PID) of packets which the
     * descrambler start to descramble. Multiple PIDs can be added into one
     * descrambler instance because descambling can happen simultaneously on
     * packets from different PIDs.
     *
     * @param pid the PID of packets to start to be descrambled.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    addPid(DemuxTpid pid) generates (Result result);

    /**
     * Remove packets' PID from the descrambler
     *
     * It is used by the client to specify Package ID (PID) of packets which the
     * descrambler stop to descramble.
     *
     * @param pid the PID of packets to stop to be descrambled.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    removePid(DemuxTpid pid) generates (Result result);

    /**
     * Release the descrambler instance
     *
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ interface ITuner {
     *
     * It is used by the client to create a frontend instance.
     *
     * @param frontendId the id of the frontend to be opened.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         UNKNOWN_ERROR if creation failed for other reasons.
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@ cc_defaults {
    shared_libs: [
        "android.hardware.tv.tuner@1.0",
        "android.hidl.memory@1.0",
        "libcutils",
        "libfmq",
        "libhidlbase",
        "libhidlmemory",
        "libhidltransport",
Loading