1/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.tv.tuner@1.0;
18
19/**
20 * Timer Filter is used by Demux to filter data based on time stamp.
21 */
22interface ITimeFilter {
23    /**
24     * Set time stamp for time based filter.
25     *
26     * It is used by the client to set initial time stamp and enable time
27     * filtering. The time will be incremented locally. The demux discards
28     * the content which time stamp is older than the time in the time filter.
29     *
30     * @param timeStamp initial time stamp for the time filter. It based on
31     * 90KHz has the same format as PTS (Presentation Time Stamp).
32     * @return result Result status of the operation.
33     *         SUCCESS if successful,
34     *         UNKNOWN_ERROR if failed for other reasons.
35     */
36    setTimeStamp(uint64_t timeStamp) generates (Result result);
37
38    /**
39     * Clear the time stamp in the time filter.
40     *
41     * It is used by the client to clear the time value of the time filter,
42     * then disable time filter.
43     *
44     * @return result Result status of the operation.
45     *         SUCCESS if successful,
46     *         UNKNOWN_ERROR if failed for other reasons.
47     */
48    clearTimeStamp() generates (Result result);
49
50    /**
51     * Get the current time in the time filter.
52     *
53     * It is used by the client to inquiry current time in the time filter.
54     *
55     * @return result Result status of the operation.
56     *         SUCCESS if successful,
57     *         INVALID_STATE if failed for wrong state.
58     *         UNKNOWN_ERROR if failed for other reasons.
59     * @return timeStamp current time stamp in the time filter.
60     */
61    getTimeStamp() generates (Result result, uint64_t timeStamp);
62
63    /**
64     * Get the time from the beginning of current data source.
65     *
66     * It is used by the client to inquiry the time stamp from the beginning
67     * of current data source.
68     *
69     * @return result Result status of the operation.
70     *         SUCCESS if successful,
71     *         INVALID_STATE if failed for wrong state.
72     *         UNKNOWN_ERROR if failed for other reasons.
73     * @return timeStamp time stamp from the beginning of current data source.
74     */
75    getSourceTime() generates (Result result, uint64_t timeStamp);
76
77    /**
78     * Close the Time Filter instance
79     *
80     * It is used by the client to release the demux instance. HAL clear
81     * underneath resource. client mustn't access the instance any more.
82     *
83     * @return result Result status of the operation.
84     *         SUCCESS if successful,
85     *         UNKNOWN_ERROR if failed for other reasons.
86     */
87    close() generates (Result result);
88};
89