Amy Zhang | 6bfeaa0 | 2020-11-30 15:16:39 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2020 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 | |
| 17 | #ifndef _ANDROID_MEDIA_TV_DEMUX_CLIENT_H_ |
| 18 | #define _ANDROID_MEDIA_TV_DEMUX_CLIENT_H_ |
| 19 | |
| 20 | //#include <aidl/android/media/tv/tuner/ITunerDemux.h> |
| 21 | #include <android/hardware/tv/tuner/1.0/IDemux.h> |
| 22 | #include <android/hardware/tv/tuner/1.1/types.h> |
| 23 | |
| 24 | #include "FilterClient.h" |
| 25 | #include "FrontendClient.h" |
| 26 | |
| 27 | //using ::aidl::android::media::tv::tuner::ITunerDemux; |
| 28 | |
| 29 | using ::android::hardware::tv::tuner::V1_0::IDemux; |
| 30 | |
| 31 | using namespace std; |
| 32 | |
| 33 | namespace android { |
| 34 | |
| 35 | struct DemuxClient : public RefBase { |
| 36 | |
| 37 | public: |
| 38 | DemuxClient(); |
| 39 | ~DemuxClient(); |
| 40 | |
| 41 | // TODO: remove after migration to Tuner Service is done. |
| 42 | void setHidlDemux(sp<IDemux> demux); |
| 43 | |
| 44 | /** |
| 45 | * Set a frontend resource as data input of the demux. |
| 46 | */ |
| 47 | Result setFrontendDataSource(sp<FrontendClient> tunerFrontend); |
| 48 | |
| 49 | /** |
| 50 | * Open a new filter client. |
| 51 | */ |
| 52 | //FilterClient openFilter(int mainType, int subType, int bufferSize, FilterClientCallback cb); |
| 53 | |
| 54 | // TODO: handle TimeFilterClient |
| 55 | |
| 56 | /** |
| 57 | * Get hardware sync ID for audio and video. |
| 58 | */ |
| 59 | int getAvSyncHwId(FilterClient tunerFilter); |
| 60 | |
| 61 | /** |
| 62 | * Get current time stamp to use for A/V sync. |
| 63 | */ |
| 64 | long getAvSyncTime(int avSyncHwId); |
| 65 | |
| 66 | /** |
| 67 | * Open a DVR (Digital Video Record) client. |
| 68 | */ |
| 69 | // TODO: handle DvrClient and callback |
| 70 | //DvrClient openDvr(int dvbType, int bufferSize, DvrClientCallback cb); |
| 71 | |
| 72 | /** |
| 73 | * Connect Conditional Access Modules (CAM) through Common Interface (CI). |
| 74 | */ |
| 75 | Result connectCiCam(int ciCamId); |
| 76 | |
| 77 | /** |
| 78 | * Disconnect Conditional Access Modules (CAM). |
| 79 | */ |
| 80 | Result disconnectCiCam(); |
| 81 | |
| 82 | /** |
| 83 | * Release the Demux Client. |
| 84 | */ |
| 85 | Result close(); |
| 86 | |
| 87 | private: |
| 88 | /** |
| 89 | * An AIDL Tuner Demux Singleton assigned at the first time the Tuner Client |
| 90 | * opens a demux. Default null when demux is not opened. |
| 91 | */ |
| 92 | // TODO: pending on aidl interface |
| 93 | //shared_ptr<ITunerDemux> mTunerDemux; |
| 94 | |
| 95 | /** |
| 96 | * A Demux HAL interface that is ready before migrating to the TunerDemux. |
| 97 | * This is a temprary interface before Tuner Framework migrates to use TunerService. |
| 98 | * Default null when the HAL service does not exist. |
| 99 | */ |
| 100 | sp<IDemux> mDemux; |
| 101 | }; |
| 102 | } // namespace android |
| 103 | |
| 104 | #endif // _ANDROID_MEDIA_TV_DEMUX_CLIENT_H_ |