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

Commit 2b505cd0 authored by Amy Zhang's avatar Amy Zhang Committed by Gerrit Code Review
Browse files

Merge changes from topic "filters"

* changes:
  VTS refactoring for filter separation
  Refactor Tuner HAL Default Impl for Filter and Dvr separation
  Add Filter linkage and seperate interface
parents 69879436 5d794f4f
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -9,15 +9,21 @@ hidl_interface {
    srcs: [
        "types.hal",
        "IDemux.hal",
        "IDemuxCallback.hal",
        "IDescrambler.hal",
        "IDvr.hal",
        "IDvrCallback.hal",
        "IFilter.hal",
        "IFilterCallback.hal",
        "IFrontend.hal",
        "IFrontendCallback.hal",
        "ILnb.hal",
        "ILnbCallback.hal",
        "ITimeFilter.hal",
        "ITuner.hal",
    ],
    interfaces: [
        "android.hidl.base@1.0",
        "android.hidl.safe_union@1.0",
    ],
    gen_java: false,
    gen_java_constants: true,
+27 −305
Original line number Diff line number Diff line
@@ -16,7 +16,11 @@

package android.hardware.tv.tuner@1.0;

import IDemuxCallback;
import IDvr;
import IDvrCallback;
import IFilter;
import IFilterCallback;
import ITimeFilter;

/**
 * Demultiplexer(Demux) takes a single multiplexed input and splits it into
@@ -24,7 +28,6 @@ import IDemuxCallback;
 *
 */
interface IDemux {

    /**
     * Set a frontend resource as data input of the demux
     *
@@ -39,134 +42,51 @@ interface IDemux {
    setFrontendDataSource(FrontendId frontendId) generates (Result result);

    /**
     * Add a filter to the demux
     * Open a new filter in the demux
     *
     * It is used by the client to add a filter to the demux.
     * It is used by the client to open a filter in 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 bufferSize the buffer size of the filter to be opened. 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.
     * @return filter the filter instance of the newly added.
     */
    flushFilter(DemuxFilterId filterId) generates (Result result);
    openFilter(DemuxFilterType type, uint32_t bufferSize, IFilterCallback cb)
        generates (Result result, IFilter filter);

    /**
     * Remove a filter from the demux
     * Open time filter of the demux
     *
     * It is used by the client to remove a filter from the demux.
     * It is used by the client to open time filter of 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.
     *         UNAVAILABLE if time filter is not supported.
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     * @return timeFilter the time filter instance of the newly added.
     */
    removeFilter(DemuxFilterId filterId) generates (Result result);
    openTimeFilter() generates (Result result, ITimeFilter timeFilter);

    /**
     * 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.
     * @param filter the filter instance.
     * @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);
    getAvSyncHwId(IFilter filter) generates (Result result, AvSyncHwId avSyncHwId);

    /**
     * Get current time stamp to use for A/V sync
@@ -182,8 +102,7 @@ interface IDemux {
     * @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);
    getAvSyncTime(AvSyncHwId avSyncHwId) generates (Result result, uint64_t time);

    /**
     * Close the Demux instance
@@ -198,218 +117,21 @@ interface IDemux {
    close() generates (Result result);

    /**
     * Add output to the demux
     * Open a DVR (Digital Video Record) instance in the demux
     *
     * It is used by the client to record output data from selected filters.
     * It is used by the client to record and playback.
     *
     * @param type specify which kind of DVR to open.
     * @param bufferSize the buffer size of the output to be added. It's used to
     * create a FMQ(Fast Message Queue) to hold data from selected filters.
     * @param cb the callback for the demux to be used to send notifications
     * back to the client.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         OUT_OF_MEMORY if failed for not enough memory.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    addOutput(uint32_t bufferSize, IDemuxCallback cb) generates (Result result);

    /**
     * Get the descriptor of the output's FMQ
     *
     * It is used by the client to get the descriptor of the output's Fast
     * Message Queue. The data in FMQ is muxed packets output from selected
     * filters. The packet's format is specifed by DemuxDataFormat in
     * DemuxOutputSettings.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         UNKNOWN_ERROR if failed for other reasons.
     * @return queue the descriptor of the output's FMQ
     */
    getOutputQueueDesc() generates (Result result, fmq_sync<uint8_t> queue);

    /**
     * Configure the demux's output.
     *
     * It is used by the client to configure the demux's output for recording.
     *
     * @param settings the settings of the demux's output.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    configureOutput(DemuxOutputSettings settings) generates (Result result);

    /**
     * Attach one filter to the demux's output.
     *
     * It is used by the client to mux one filter's output to demux's output.
     *
     * @param filterId the ID of the attached filter.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    attachOutputFilter(DemuxFilterId filterId) generates (Result result);

    /**
     * Detach one filter from the demux's output.
     *
     * It is used by the client to remove one filter's output from demux's
     * output.
     *
     * @param filterId the ID of the detached filter.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    detachOutputFilter(DemuxFilterId filterId) generates (Result result);

    /**
     * Start to take data to the demux's output.
     *
     * It is used by the client to ask the output to start to take data from
     * attached filters.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    startOutput() generates (Result result);

    /**
     * Stop to take data to the demux's output.
     *
     * It is used by the client to ask the output to stop to take data from
     * attached filters.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    stopOutput() generates (Result result);

    /**
     * Flush unconsumed data in the demux's output.
     *
     * It is used by the client to ask the demux to flush the data which is
     * already produced but not consumed yet in the demux's output.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    flushOutput() generates (Result result);

    /**
     * Remove the demux's output.
     *
     * It is used by the client to remove the demux's output.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    removeOutput() generates (Result result);

    /**
     * Add input to the demux
     *
     * It is used by the client to add the demux's input for playback content.
     *
     * @param bufferSize the buffer size of the demux's input to be added.
     * It's used to create a FMQ(Fast Message Queue) to hold input data.
     * @param cb the callback for the demux to be used to send notifications
     * @param cb the callback for the DVR to be used to send notifications
     * back to the client.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         OUT_OF_MEMORY if failed for not enough memory.
     *         UNKNOWN_ERROR if failed for other reasons.
     * @return dvr a DVR instance.
     */
    addInput(uint32_t bufferSize, IDemuxCallback cb) generates (Result result);

    /**
     * Get the descriptor of the input's FMQ
     *
     * It is used by the client to get the descriptor of the input's Fast
     * Message Queue. The data in FMQ is fed by client. Data format is specifed
     * by DemuxDataFormat in DemuxInputSettings.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         UNKNOWN_ERROR if failed for other reasons.
     * @return queue the descriptor of the output's FMQ
     */
    getInputQueueDesc() generates (Result result, fmq_sync<uint8_t> queue);

    /**
     * Configure the demux's input.
     *
     * It is used by the client to configure the demux's input for playback.
     *
     * @param settings the settings of the demux's input.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    configureInput(DemuxInputSettings settings) generates (Result result);

    /**
     * Start to consume the data from the demux's input.
     *
     * It is used by the client to ask the demux to start to consume data from
     * the demux's input.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    startInput() generates (Result result);

    /**
     * Stop to consume the data from the demux's input.
     *
     * It is used by the client to ask the demux to stop to consume data from
     * the demux's input.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    stopInput() generates (Result result);

    /**
     * Flush unconsumed data in the demux's input.
     *
     * It is used by the client to ask the demux to flush the data which is
     * already produced but not consumed yet in the demux's input.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    flushInput() generates (Result result);

    /**
     * Remove the demux's input.
     *
     * It is used by the client to remove the demux's input.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    removeInput() generates (Result result);
    openDvr(DvrType type, uint32_t bufferSize, IDvrCallback cb)
        generates (Result result, IDvr dvr);
};
+7 −3
Original line number Diff line number Diff line
@@ -15,6 +15,9 @@
 */

package android.hardware.tv.tuner@1.0;

import IFilter;

/**
 * Descrambler is used to descramble input data.
 *
@@ -59,12 +62,13 @@ interface IDescrambler {
     * packets from different PIDs.
     *
     * @param pid the PID of packets to start to be descrambled.
     * @param filter an optional filter instance to identify upper stream.
     * @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);
    addPid(DemuxPid pid, IFilter optionalSourceFilter) generates (Result result);

    /**
     * Remove packets' PID from the descrambler
@@ -73,12 +77,13 @@ interface IDescrambler {
     * descrambler stop to descramble.
     *
     * @param pid the PID of packets to stop to be descrambled.
     * @param filter an optional filter instance to identify upper stream.
     * @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);
    removePid(DemuxPid pid, IFilter optionalSourceFilter) generates (Result result);

    /**
     * Release the descrambler instance
@@ -92,4 +97,3 @@ interface IDescrambler {
     */
    close() generates (Result result);
};

tv/tuner/1.0/IDvr.hal

0 → 100644
+133 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.tv.tuner@1.0;

import IFilter;

/**
 * Digtal Video Record (DVR) interface provides record control on Demux's
 * output buffer and playback control on Demux's input buffer.
 */
interface IDvr {
    /**
     * Get the descriptor of the DVR's FMQ
     *
     * It is used by the client to get the descriptor of the DVR's Fast
     * Message Queue. The FMQ is used to transfer record or playback data
     * between the client and the HAL.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         UNKNOWN_ERROR if failed for other reasons.
     * @return queue the descriptor of the DVR's FMQ
     */
    getQueueDesc() generates (Result result, fmq_sync<uint8_t> queue);

    /**
     * Configure the DVR.
     *
     * It is used by the client to configure the DVR interface.
     *
     * @param settings the settings of the DVR interface.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    configure(DvrSettings settings) generates (Result result);

    /**
     * Attach one filter to DVR interface for recording.
     *
     * It is used by the client to add the data filtered out from the filter
     * to record.
     *
     * @param filter the instance of the attached filter.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    attachFilter(IFilter filter) generates (Result result);

    /**
     * Detach one filter from the DVR's recording.
     *
     * It is used by the client to remove the data of the filter from DVR's
     * recording.
     *
     * @param filter the instance of the detached filter.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    detachFilter(IFilter filter) generates (Result result);

    /**
     * Start DVR.
     *
     * It is used by the client to ask the DVR to start consuming playback data
     * or producing data for record.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    start() generates (Result result);

    /**
     * Stop DVR.
     *
     * It is used by the client to ask the DVR to stop consuming playback data
     * or producing data for record.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    stop() generates (Result result);

    /**
     * Flush DVR data.
     *
     * It is used by the client to ask the DVR to flush the data which is
     * not consumed by HAL for playback or the client for record yet.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    flush() generates (Result result);

    /**
     * close the DVR instance to release resource for DVR.
     *
     * It is used by the client to close the DVR instance, and HAL clears
     * underneath resource for this DVR instance. Client mustn't access the
     * instance any more and all methods should return a failure.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if failed for wrong state.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    close() generates (Result result);
};
+33 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.tv.tuner@1.0;

interface IDvrCallback {
    /**
     * Notify the client a new status of the demux's record.
     *
     * @param status a new status of the demux's record.
     */
    oneway onRecordStatus(RecordStatus status);

    /**
     * Notify the client a new status of the demux's playback.
     *
     * @param status a new status of the demux's playback.
     */
    oneway onPlaybackStatus(PlaybackStatus status);
};
Loading