blob: 586db73d1dccb2c00c00d458bab1e2acfab1cf9e [file] [log] [blame]
Hongguang4092f2f2021-07-08 18:49:12 -07001/*
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>
Hongguange423acd2021-07-27 16:56:47 -070021#include <aidl/android/hardware/tv/tuner/Result.h>
Hongguang4092f2f2021-07-08 18:49:12 -070022#include <utils/Log.h>
23
24#include "Descrambler.h"
25
26namespace aidl {
27namespace android {
28namespace hardware {
29namespace tv {
30namespace tuner {
31
32Descrambler::Descrambler() {}
33
34Descrambler::~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);
Hongguange423acd2021-07-27 16:56:47 -070041 return ::ndk::ScopedAStatus::fromServiceSpecificError(
42 static_cast<int32_t>(Result::INVALID_STATE));
Hongguang4092f2f2021-07-08 18:49:12 -070043 }
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