Hongguang | 4092f2f | 2021-07-08 18:49:12 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2021 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 | //#define LOG_NDEBUG 0 |
| 18 | #define LOG_TAG "android.hardware.tv.tuner-service.example-Descrambler" |
| 19 | |
| 20 | #include <aidl/android/hardware/tv/tuner/IFrontendCallback.h> |
Hongguang | e423acd | 2021-07-27 16:56:47 -0700 | [diff] [blame^] | 21 | #include <aidl/android/hardware/tv/tuner/Result.h> |
Hongguang | 4092f2f | 2021-07-08 18:49:12 -0700 | [diff] [blame] | 22 | #include <utils/Log.h> |
| 23 | |
| 24 | #include "Descrambler.h" |
| 25 | |
| 26 | namespace aidl { |
| 27 | namespace android { |
| 28 | namespace hardware { |
| 29 | namespace tv { |
| 30 | namespace tuner { |
| 31 | |
| 32 | Descrambler::Descrambler() {} |
| 33 | |
| 34 | Descrambler::~Descrambler() {} |
| 35 | |
| 36 | ::ndk::ScopedAStatus Descrambler::setDemuxSource(int32_t in_demuxId) { |
| 37 | ALOGV("%s", __FUNCTION__); |
| 38 | if (mDemuxSet) { |
| 39 | ALOGW("[ WARN ] Descrambler has already been set with a demux id %" PRIu32, |
| 40 | mSourceDemuxId); |
Hongguang | e423acd | 2021-07-27 16:56:47 -0700 | [diff] [blame^] | 41 | return ::ndk::ScopedAStatus::fromServiceSpecificError( |
| 42 | static_cast<int32_t>(Result::INVALID_STATE)); |
Hongguang | 4092f2f | 2021-07-08 18:49:12 -0700 | [diff] [blame] | 43 | } |
| 44 | mDemuxSet = true; |
| 45 | mSourceDemuxId = in_demuxId; |
| 46 | |
| 47 | return ::ndk::ScopedAStatus::ok(); |
| 48 | } |
| 49 | |
| 50 | ::ndk::ScopedAStatus Descrambler::setKeyToken(const std::vector<uint8_t>& /* in_keyToken */) { |
| 51 | ALOGV("%s", __FUNCTION__); |
| 52 | |
| 53 | return ::ndk::ScopedAStatus::ok(); |
| 54 | } |
| 55 | |
| 56 | ::ndk::ScopedAStatus Descrambler::addPid( |
| 57 | const DemuxPid& /* in_pid */, |
| 58 | const std::shared_ptr<IFilter>& /* in_optionalSourceFilter */) { |
| 59 | ALOGV("%s", __FUNCTION__); |
| 60 | |
| 61 | return ::ndk::ScopedAStatus::ok(); |
| 62 | } |
| 63 | |
| 64 | ::ndk::ScopedAStatus Descrambler::removePid( |
| 65 | const DemuxPid& /* in_pid */, |
| 66 | const std::shared_ptr<IFilter>& /* in_optionalSourceFilter */) { |
| 67 | ALOGV("%s", __FUNCTION__); |
| 68 | |
| 69 | return ::ndk::ScopedAStatus::ok(); |
| 70 | } |
| 71 | |
| 72 | ::ndk::ScopedAStatus Descrambler::close() { |
| 73 | ALOGV("%s", __FUNCTION__); |
| 74 | mDemuxSet = false; |
| 75 | |
| 76 | return ::ndk::ScopedAStatus::ok(); |
| 77 | } |
| 78 | |
| 79 | } // namespace tuner |
| 80 | } // namespace tv |
| 81 | } // namespace hardware |
| 82 | } // namespace android |
| 83 | } // namespace aidl |