blob: 2d7b2754ac4792b1981becf9f7d37733efa39550 [file] [log] [blame]
Henry Fangcf05ed72019-08-15 18:57:08 -07001package android.hardware.tv.tuner@1.0;
2
3import IDemuxCallback;
4
5/**
6 * Demultiplexer(Demux) takes a single multiplexed input and splits it into
7 * one or more output.
8 *
9 */
10interface IDemux {
11
12 /**
13 * Set a frontend resource as data input of the demux
14 *
15 * It is used by the client to specify a hardware frontend as data source of
16 * this demux instance. A demux instance can have only one data source.
17 *
18 * @return result Result status of the operation.
19 * SUCCESS if successful,
20 * INVALID_STATE if failed for wrong state.
21 * UNKNOWN_ERROR if failed for other reasons.
22 */
23 setFrontendDataSource(FrontendId frontendId) generates (Result result);
24
25 /**
Henry Fang7d01fdb2019-08-23 10:31:21 -070026 * Add a filter to the demux
27 *
28 * It is used by the client to add a filter to the demux.
29 *
30 * @param type the type of the filter to be added.
31 * @param bufferSize the buffer size of the filter to be added. It's used to
32 * create a FMQ(Fast Message Queue) to hold data output from the filter.
33 * @param cb the callback for the filter to be used to send notifications
34 * back to the client.
35 * @return result Result status of the operation.
36 * SUCCESS if successful,
37 * INVALID_STATE if failed for wrong state.
38 * UNKNOWN_ERROR if failed for other reasons.
39 * @return filterId the ID of the newly added filter.
40 */
41 addFilter(DemuxFilterType type, uint32_t bufferSize, IDemuxCallback cb)
42 generates (Result result, DemuxFilterId filterId);
43
44 /**
45 * Get the descriptor of the filter's FMQ
46 *
47 * It is used by the client to get the descriptor of the filter's Fast
48 * Message Queue. The data in FMQ is filtered out from MPEG transport
49 * stream. The data is origanized to data blocks which may have
50 * different length. The length's information of one or multiple data blocks
51 * is sent to client throught DemuxFilterEvent.
52 *
53 * @param filterId the ID of the filter.
54 * @return result Result status of the operation.
55 * SUCCESS if successful,
56 * INVALID_ARGUMENT if failed for wrong filter ID.
57 * INVALID_STATE if failed for wrong state.
58 * UNKNOWN_ERROR if failed for other reasons.
59 * @return queue the descriptor of the filter's FMQ
60 */
61 getFilterQueueDesc(DemuxFilterId filterId)
62 generates (Result result, fmq_sync<uint8_t> queue);
63
64 /**
65 * Configure the filter.
66 *
67 * It is used by the client to configure the filter so that it can filter out
68 * intended data.
69 *
70 * @param filterId the ID of the filter.
71 * @param settings the settings of the filter.
72 * @return result Result status of the operation.
73 * SUCCESS if successful,
74 * INVALID_ARGUMENT if failed for wrong filter ID.
75 * INVALID_STATE if failed for wrong state.
76 * UNKNOWN_ERROR if failed for other reasons.
77 */
78 configureFilter(DemuxFilterId filterId, DemuxFilterSettings settings)
79 generates(Result result);
80
81 /**
82 * Start the filter.
83 *
84 * It is used by the client to ask the filter to start filterring data.
85 *
86 * @param filterId the ID of the filter.
87 * @return result Result status of the operation.
88 * SUCCESS if successful,
89 * INVALID_ARGUMENT if failed for wrong filter ID.
90 * INVALID_STATE if failed for wrong state.
91 * UNKNOWN_ERROR if failed for other reasons.
92 */
93 startFilter(DemuxFilterId filterId) generates (Result result);
94
95 /**
96 * Stop the filter.
97 *
98 * It is used by the client to ask the filter to stop filterring data.
99 * It won't discard the data already filtered out by the filter. The filter
100 * will be stopped and removed automatically if the demux is closed.
101 *
102 * @param filterId the ID of the filter.
103 * @return result Result status of the operation.
104 * SUCCESS if successful,
105 * INVALID_ARGUMENT if failed for wrong filter ID.
106 * INVALID_STATE if failed for wrong state.
107 * UNKNOWN_ERROR if failed for other reasons.
108 */
109 stopFilter(DemuxFilterId filterId) generates (Result result);
110
111 /**
112 * Flush the filter.
113 *
114 * It is used by the client to ask the filter to flush the data which is
115 * already produced but not consumed yet.
116 *
117 * @param filterId the ID of the filter.
118 * @return result Result status of the operation.
119 * SUCCESS if successful,
120 * INVALID_ARGUMENT if failed for wrong filter ID.
121 * INVALID_STATE if failed for wrong state.
122 * UNKNOWN_ERROR if failed for other reasons.
123 */
124 flushFilter(DemuxFilterId filterId) generates (Result result);
125
126 /**
127 * Remove a filter from the demux
128 *
129 * It is used by the client to remove a filter from the demux.
130 *
131 * @param filterId the ID of the removed filter.
132 * @return result Result status of the operation.
133 * SUCCESS if successful,
134 * INVALID_ARGUMENT if failed for wrong filter ID.
135 * INVALID_STATE if failed for wrong state.
136 * UNKNOWN_ERROR if failed for other reasons.
137 */
138 removeFilter(DemuxFilterId filterId) generates (Result result);
139
140 /**
141 * Get hardware sync ID for audio and video.
142 *
143 * It is used by the client to get the hardware sync ID for audio and video.
144 *
145 * @param filterId the ID of the filter.
146 * @return result Result status of the operation.
147 * SUCCESS if successful,
148 * INVALID_ARGUMENT if failed for a wrong filter ID.
149 * UNKNOWN_ERROR if failed for other reasons.
150 * @return avSyncHwId the id of hardware A/V sync.
151 */
152 getAvSyncHwId(DemuxFilterId filterId)
153 generates (Result result, AvSyncHwId avSyncHwId);
154
155 /**
156 * Get current time stamp to use for A/V sync
157 *
158 * It is used by the client to get current time stamp for A/V sync. HW is
159 * supported to increment and maintain current time stamp.
160 *
161 * @param avSyncHwId the hardware id of A/V sync.
162 * @return result Result status of the operation.
163 * SUCCESS if successful,
164 * INVALID_ARGUMENT if failed for a wrong hardware ID of A/V sync.
165 * UNKNOWN_ERROR if failed for other reasons.
166 * @return time the current time stamp of hardware A/V sync. The time stamp
167 * based on 90KHz has the same format as PTS (Presentation Time Stamp).
168 */
169 getAvSyncTime(AvSyncHwId avSyncHwId)
170 generates (Result result, uint64_t time);
171
172 /**
Henry Fangcf05ed72019-08-15 18:57:08 -0700173 * Close the Demux instance
174 *
175 * It is used by the client to release the demux instance. HAL clear
176 * underneath resource. client mustn't access the instance any more.
177 *
178 * @return result Result status of the operation.
179 * SUCCESS if successful,
180 * UNKNOWN_ERROR if failed for other reasons.
181 */
182 close() generates (Result result);
183};
184