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 [email protected]; 18 19import IDvr; 20import IDvrCallback; 21import IFilter; 22import IFilterCallback; 23import ITimeFilter; 24 25/** 26 * Demultiplexer(Demux) takes a single multiplexed input and splits it into 27 * one or more output. 28 */ 29interface IDemux { 30 /** 31 * Set a frontend resource as data input of the demux 32 * 33 * It is used by the client to specify a hardware frontend as data source of 34 * this demux instance. A demux instance can have only one data source. 35 * 36 * @return result Result status of the operation. 37 * SUCCESS if successful, 38 * INVALID_STATE if failed for wrong state. 39 * UNKNOWN_ERROR if failed for other reasons. 40 */ 41 setFrontendDataSource(FrontendId frontendId) generates (Result result); 42 43 /** 44 * Open a new filter in the demux 45 * 46 * It is used by the client to open a filter in the demux. 47 * 48 * @param type the type of the filter to be added. 49 * @param bufferSize the buffer size of the filter to be opened. It's used 50 * to create a FMQ(Fast Message Queue) to hold data output from the filter. 51 * @param cb the callback for the filter to be used to send notifications 52 * back to the client. 53 * @return result Result status of the operation. 54 * SUCCESS if successful, 55 * INVALID_STATE if failed for wrong state. 56 * UNKNOWN_ERROR if failed for other reasons. 57 * @return filter the filter instance of the newly added. 58 */ 59 openFilter(DemuxFilterType type, uint32_t bufferSize, IFilterCallback cb) 60 generates (Result result, IFilter filter); 61 62 /** 63 * Open time filter of the demux 64 * 65 * It is used by the client to open time filter of the demux. 66 * 67 * @return result Result status of the operation. 68 * SUCCESS if successful, 69 * UNAVAILABLE if time filter is not supported. 70 * INVALID_STATE if failed for wrong state. 71 * UNKNOWN_ERROR if failed for other reasons. 72 * @return timeFilter the time filter instance of the newly added. 73 */ 74 openTimeFilter() generates (Result result, ITimeFilter timeFilter); 75 76 /** 77 * Get hardware sync ID for audio and video. 78 * 79 * It is used by the client to get the hardware sync ID for audio and video. 80 * 81 * @param filter the filter instance. 82 * @return result Result status of the operation. 83 * SUCCESS if successful, 84 * INVALID_ARGUMENT if failed for a wrong filter ID. 85 * UNKNOWN_ERROR if failed for other reasons. 86 * @return avSyncHwId the id of hardware A/V sync. 87 */ 88 getAvSyncHwId(IFilter filter) generates (Result result, AvSyncHwId avSyncHwId); 89 90 /** 91 * Get current time stamp to use for A/V sync 92 * 93 * It is used by the client to get current time stamp for A/V sync. HW is 94 * supported to increment and maintain current time stamp. 95 * 96 * @param avSyncHwId the hardware id of A/V sync. 97 * @return result Result status of the operation. 98 * SUCCESS if successful, 99 * INVALID_ARGUMENT if failed for a wrong hardware ID of A/V sync. 100 * UNKNOWN_ERROR if failed for other reasons. 101 * @return time the current time stamp of hardware A/V sync. The time stamp 102 * based on 90KHz has the same format as PTS (Presentation Time Stamp). 103 */ 104 getAvSyncTime(AvSyncHwId avSyncHwId) generates (Result result, uint64_t time); 105 106 /** 107 * Close the Demux instance 108 * 109 * It is used by the client to release the demux instance. HAL clear 110 * underneath resource. client mustn't access the instance any more. 111 * 112 * @return result Result status of the operation. 113 * SUCCESS if successful, 114 * UNKNOWN_ERROR if failed for other reasons. 115 */ 116 close() generates (Result result); 117 118 /** 119 * Open a DVR (Digital Video Record) instance in the demux 120 * 121 * It is used by the client to record and playback. 122 * 123 * @param type specify which kind of DVR to open. 124 * @param bufferSize the buffer size of the output to be added. It's used to 125 * create a FMQ(Fast Message Queue) to hold data from selected filters. 126 * @param cb the callback for the DVR to be used to send notifications 127 * back to the client. 128 * @return result Result status of the operation. 129 * SUCCESS if successful, 130 * OUT_OF_MEMORY if failed for not enough memory. 131 * UNKNOWN_ERROR if failed for other reasons. 132 * @return dvr a DVR instance. 133 */ 134 openDvr(DvrType type, uint32_t bufferSize, IDvrCallback cb) 135 generates (Result result, IDvr dvr); 136 137 /** 138 * Connect Conditional Access Modules (CAM) through Common Interface (CI) 139 * 140 * It is used by the client to connect CI-CAM. The demux uses the output 141 * from the frontend as the input by default, and must change to use the 142 * output from CI-CAM as the input after this call take place. 143 * 144 * @param ciCamId specify CI-CAM Id to connect. 145 * @return result Result status of the operation. 146 * SUCCESS if successful, 147 * UNKNOWN_ERROR if failed for other reasons. 148 */ 149 connectCiCam(uint32_t ciCamId) generates (Result result); 150 151 /** 152 * Disconnect Conditional Access Modules (CAM) 153 * 154 * It is used by the client to disconnect CI-CAM. The demux will use the 155 * output from the frontend as the input after this call take place. 156 * 157 * @return result Result status of the operation. 158 * SUCCESS if successful, 159 * UNKNOWN_ERROR if failed for other reasons. 160 */ 161 disconnectCiCam() generates (Result result); 162}; 163