/* * Copyright 2020 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. */ #ifndef _ANDROID_MEDIA_TV_DESCRAMBLER_CLIENT_H_ #define _ANDROID_MEDIA_TV_DESCRAMBLER_CLIENT_H_ #include #include #include #include "DemuxClient.h" #include "FilterClient.h" using ::aidl::android::media::tv::tuner::ITunerDescrambler; using ::aidl::android::media::tv::tuner::TunerDemuxPid; using ::android::hardware::tv::tuner::V1_0::IDescrambler; using ::android::hardware::tv::tuner::V1_0::Result; using ::android::hardware::tv::tuner::V1_0::DemuxPid; using namespace std; namespace android { struct DescramblerClient : public RefBase { public: DescramblerClient(shared_ptr tunerDescrambler); ~DescramblerClient(); // TODO: remove after migration to Tuner Service is done. void setHidlDescrambler(sp descrambler); /** * Set a demux as source of the descrambler. */ Result setDemuxSource(sp demuxClient); /** * Set a key token to link descrambler to a key slot. */ Result setKeyToken(vector keyToken); /** * Add packets' PID to the descrambler for descrambling. */ Result addPid(DemuxPid pid, sp optionalSourceFilter); /** * Remove packets' PID from the descrambler. */ Result removePid(DemuxPid pid, sp optionalSourceFilter); /** * Close a new interface of ITunerDescrambler. */ Result close(); private: TunerDemuxPid getAidlDemuxPid(DemuxPid& pid); /** * An AIDL Tuner Descrambler Singleton assigned at the first time the Tuner Client * opens a descrambler. Default null when descrambler is not opened. */ shared_ptr mTunerDescrambler; /** * A Descrambler HAL interface that is ready before migrating to the TunerDescrambler. * This is a temprary interface before Tuner Framework migrates to use TunerService. * Default null when the HAL service does not exist. */ sp mDescrambler; }; } // namespace android #endif // _ANDROID_MEDIA_TV_DESCRAMBLER_CLIENT_H_