Merge "Add Descrambler and Lnb Client interfaces"
This commit is contained in:
@@ -140,9 +140,11 @@ cc_library_shared {
|
||||
srcs: [
|
||||
"android_media_tv_Tuner.cpp",
|
||||
"tuner/DemuxClient.cpp",
|
||||
"tuner/DescramblerClient.cpp",
|
||||
"tuner/DvrClient.cpp",
|
||||
"tuner/FilterClient.cpp",
|
||||
"tuner/FrontendClient.cpp",
|
||||
"tuner/LnbClient.cpp",
|
||||
"tuner/TunerClient.cpp",
|
||||
],
|
||||
|
||||
|
||||
67
media/jni/tuner/DescramblerClient.cpp
Normal file
67
media/jni/tuner/DescramblerClient.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright 2021 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "DescramblerClient"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "DescramblerClient.h"
|
||||
|
||||
using ::android::hardware::tv::tuner::V1_0::Result;
|
||||
|
||||
namespace android {
|
||||
|
||||
/////////////// DescramblerClient ///////////////////////
|
||||
|
||||
// TODO: pending aidl interface
|
||||
DescramblerClient::DescramblerClient() {
|
||||
//mTunerDescrambler = tunerDescrambler;
|
||||
}
|
||||
|
||||
DescramblerClient::~DescramblerClient() {
|
||||
//mTunerDescrambler = NULL;
|
||||
mDescrambler = NULL;
|
||||
}
|
||||
|
||||
// TODO: remove after migration to Tuner Service is done.
|
||||
void DescramblerClient::setHidlDescrambler(sp<IDescrambler> descrambler) {
|
||||
mDescrambler = descrambler;
|
||||
}
|
||||
|
||||
Result DescramblerClient::setDemuxSource(sp<DemuxClient> /*demuxClient*/) {
|
||||
return Result::SUCCESS;
|
||||
}
|
||||
|
||||
Result DescramblerClient::setKeyToken(vector<uint8_t> /*keyToken*/) {
|
||||
return Result::SUCCESS;
|
||||
}
|
||||
|
||||
Result DescramblerClient::addPid(DemuxPid /*pid*/, sp<FilterClient> /*optionalSourceFilter*/) {
|
||||
return Result::SUCCESS;
|
||||
}
|
||||
|
||||
Result DescramblerClient::removePid(DemuxPid /*pid*/, sp<FilterClient> /*optionalSourceFilter*/) {
|
||||
return Result::SUCCESS;
|
||||
}
|
||||
|
||||
Result DescramblerClient::close() {
|
||||
return Result::SUCCESS;
|
||||
}
|
||||
|
||||
/////////////// DescramblerClient Helper Methods ///////////////////////
|
||||
|
||||
} // namespace android
|
||||
89
media/jni/tuner/DescramblerClient.h
Normal file
89
media/jni/tuner/DescramblerClient.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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 <aidl/android/media/tv/tuner/ITunerDescrambler.h>
|
||||
#include <android/hardware/tv/tuner/1.0/IDescrambler.h>
|
||||
#include <android/hardware/tv/tuner/1.1/types.h>
|
||||
|
||||
#include "DemuxClient.h"
|
||||
#include "FilterClient.h"
|
||||
|
||||
//using ::aidl::android::media::tv::tuner::ITunerDescrambler;
|
||||
|
||||
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:
|
||||
// TODO: pending hidl interface
|
||||
DescramblerClient();
|
||||
~DescramblerClient();
|
||||
|
||||
// TODO: remove after migration to Tuner Service is done.
|
||||
void setHidlDescrambler(sp<IDescrambler> descrambler);
|
||||
|
||||
/**
|
||||
* Set a demux as source of the descrambler.
|
||||
*/
|
||||
Result setDemuxSource(sp<DemuxClient> demuxClient);
|
||||
|
||||
/**
|
||||
* Set a key token to link descrambler to a key slot.
|
||||
*/
|
||||
Result setKeyToken(vector<uint8_t> keyToken);
|
||||
|
||||
/**
|
||||
* Add packets' PID to the descrambler for descrambling.
|
||||
*/
|
||||
Result addPid(DemuxPid pid, sp<FilterClient> optionalSourceFilter);
|
||||
|
||||
/**
|
||||
* Remove packets' PID from the descrambler.
|
||||
*/
|
||||
Result removePid(DemuxPid pid, sp<FilterClient> optionalSourceFilter);
|
||||
|
||||
/**
|
||||
* Close a new interface of ITunerDescrambler.
|
||||
*/
|
||||
Result close();
|
||||
|
||||
private:
|
||||
/**
|
||||
* An AIDL Tuner Descrambler Singleton assigned at the first time the Tuner Client
|
||||
* opens a descrambler. Default null when descrambler is not opened.
|
||||
*/
|
||||
// TODO: pending on aidl interface
|
||||
//shared_ptr<ITunerDescrambler> 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<IDescrambler> mDescrambler;
|
||||
};
|
||||
} // namespace android
|
||||
|
||||
#endif // _ANDROID_MEDIA_TV_DESCRAMBLER_CLIENT_H_
|
||||
90
media/jni/tuner/LnbClient.cpp
Normal file
90
media/jni/tuner/LnbClient.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright 2021 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "LnbClient"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "LnbClient.h"
|
||||
|
||||
using ::android::hardware::tv::tuner::V1_0::Result;
|
||||
|
||||
namespace android {
|
||||
|
||||
/////////////// LnbClient ///////////////////////
|
||||
|
||||
// TODO: pending aidl interface
|
||||
LnbClient::LnbClient() {
|
||||
//mTunerLnb = tunerLnb;
|
||||
}
|
||||
|
||||
LnbClient::~LnbClient() {
|
||||
//mTunerLnb = NULL;
|
||||
mLnb = NULL;
|
||||
}
|
||||
|
||||
// TODO: remove after migration to Tuner Service is done.
|
||||
void LnbClient::setHidlLnb(sp<ILnb> lnb) {
|
||||
mLnb = lnb;
|
||||
}
|
||||
|
||||
Result LnbClient::setCallback(sp<LnbClientCallback> /*cb*/) {
|
||||
return Result::SUCCESS;
|
||||
}
|
||||
|
||||
Result LnbClient::setVoltage(int /*voltage*/) {
|
||||
return Result::SUCCESS;
|
||||
}
|
||||
|
||||
Result LnbClient::setTone(int /*tone*/) {
|
||||
return Result::SUCCESS;
|
||||
}
|
||||
|
||||
Result LnbClient::setSatellitePosition(int /*position*/) {
|
||||
return Result::SUCCESS;
|
||||
}
|
||||
|
||||
Result LnbClient::sendDiseqcMessage(vector<uint8_t> /*diseqcMessage*/) {
|
||||
return Result::SUCCESS;
|
||||
}
|
||||
|
||||
Result LnbClient::close() {
|
||||
return Result::SUCCESS;
|
||||
}
|
||||
|
||||
/////////////// ILnbCallback ///////////////////////
|
||||
|
||||
HidlLnbCallback::HidlLnbCallback(sp<LnbClientCallback> lnbClientCallback)
|
||||
: mLnbClientCallback(lnbClientCallback) {}
|
||||
|
||||
Return<void> HidlLnbCallback::onEvent(const LnbEventType lnbEventType) {
|
||||
if (mLnbClientCallback != NULL) {
|
||||
mLnbClientCallback->onEvent(lnbEventType);
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> HidlLnbCallback::onDiseqcMessage(const hidl_vec<uint8_t>& diseqcMessage) {
|
||||
if (mLnbClientCallback != NULL) {
|
||||
mLnbClientCallback->onDiseqcMessage(diseqcMessage);
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
/////////////// LnbClient Helper Methods ///////////////////////
|
||||
|
||||
} // namespace android
|
||||
121
media/jni/tuner/LnbClient.h
Normal file
121
media/jni/tuner/LnbClient.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright 2021 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_LNB_CLIENT_H_
|
||||
#define _ANDROID_MEDIA_TV_LNB_CLIENT_H_
|
||||
|
||||
//#include <aidl/android/media/tv/tuner/ITunerLnb.h>
|
||||
#include <android/hardware/tv/tuner/1.0/ILnb.h>
|
||||
#include <android/hardware/tv/tuner/1.0/ILnbCallback.h>
|
||||
#include <android/hardware/tv/tuner/1.1/types.h>
|
||||
|
||||
#include "LnbClientCallback.h"
|
||||
|
||||
//using ::aidl::android::media::tv::tuner::ITunerLnb;
|
||||
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::tv::tuner::V1_0::ILnb;
|
||||
using ::android::hardware::tv::tuner::V1_0::ILnbCallback;
|
||||
using ::android::hardware::tv::tuner::V1_0::Result;
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace android {
|
||||
|
||||
// TODO: pending aidl interface
|
||||
/*class TunerLnbCallback : public BnTunerLnbCallback {
|
||||
|
||||
public:
|
||||
TunerLnbCallback(sp<LnbClientCallback> lnbClientCallback);
|
||||
|
||||
Status onEvent(int lnbEventType);
|
||||
Status onDiseqcMessage(vector<uint8_t> diseqcMessage);
|
||||
|
||||
private:
|
||||
sp<LnbClientCallback> mLnbClientCallback;
|
||||
};*/
|
||||
|
||||
struct HidlLnbCallback : public ILnbCallback {
|
||||
|
||||
public:
|
||||
HidlLnbCallback(sp<LnbClientCallback> lnbClientCallback);
|
||||
virtual Return<void> onEvent(const LnbEventType lnbEventType);
|
||||
virtual Return<void> onDiseqcMessage(const hidl_vec<uint8_t>& diseqcMessage);
|
||||
|
||||
private:
|
||||
sp<LnbClientCallback> mLnbClientCallback;
|
||||
};
|
||||
|
||||
struct LnbClient : public RefBase {
|
||||
|
||||
public:
|
||||
// TODO: add TunerLnb as parameter.
|
||||
LnbClient();
|
||||
~LnbClient();
|
||||
|
||||
// TODO: remove after migration to Tuner Service is done.
|
||||
void setHidlLnb(sp<ILnb> lnb);
|
||||
|
||||
/**
|
||||
* Set the lnb callback.
|
||||
*/
|
||||
Result setCallback(sp<LnbClientCallback> cb);
|
||||
|
||||
/**
|
||||
* Set the lnb's power voltage.
|
||||
*/
|
||||
Result setVoltage(int voltage);
|
||||
|
||||
/**
|
||||
* Set the lnb's tone mode.
|
||||
*/
|
||||
Result setTone(int tone);
|
||||
|
||||
/**
|
||||
* Select the lnb's position.
|
||||
*/
|
||||
Result setSatellitePosition(int position);
|
||||
|
||||
/**
|
||||
* Sends DiSEqC (Digital Satellite Equipment Control) message.
|
||||
*/
|
||||
Result sendDiseqcMessage(vector<uint8_t> diseqcMessage);
|
||||
|
||||
/**
|
||||
* Releases the LNB instance.
|
||||
*/
|
||||
Result close();
|
||||
|
||||
private:
|
||||
/**
|
||||
* An AIDL Tuner Lnb Singleton assigned at the first time the Tuner Client
|
||||
* opens an Lnb. Default null when lnb is not opened.
|
||||
*/
|
||||
// TODO: pending on aidl interface
|
||||
//shared_ptr<ITunerLnb> mTunerLnb;
|
||||
|
||||
/**
|
||||
* A Lnb HAL interface that is ready before migrating to the TunerLnb.
|
||||
* This is a temprary interface before Tuner Framework migrates to use TunerService.
|
||||
* Default null when the HAL service does not exist.
|
||||
*/
|
||||
sp<ILnb> mLnb;
|
||||
};
|
||||
} // namespace android
|
||||
|
||||
#endif // _ANDROID_MEDIA_TV_LNB_CLIENT_H_
|
||||
33
media/jni/tuner/LnbClientCallback.h
Normal file
33
media/jni/tuner/LnbClientCallback.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2021 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_LNB_CLIENT_CALLBACK_H_
|
||||
#define _ANDROID_MEDIA_TV_LNB_CLIENT_CALLBACK_H_
|
||||
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::tv::tuner::V1_0::LnbEventType;
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace android {
|
||||
|
||||
struct LnbClientCallback : public RefBase {
|
||||
virtual void onEvent(const LnbEventType lnbEventType);
|
||||
virtual void onDiseqcMessage(const hidl_vec<uint8_t>& diseqcMessage);
|
||||
};
|
||||
} // namespace android
|
||||
|
||||
#endif // _ANDROID_MEDIA_TV_LNB_CLIENT_CALLBACK_H_
|
||||
@@ -171,6 +171,23 @@ sp<DemuxClient> TunerClient::openDemux(int /*demuxHandle*/) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DemuxCapabilities TunerClient::getDemuxCaps() {
|
||||
DemuxCapabilities caps;
|
||||
return caps;
|
||||
}
|
||||
|
||||
sp<DescramblerClient> TunerClient::openDescrambler(int /*descramblerHandle*/) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sp<LnbClient> TunerClient::openLnb(int /*lnbHandle*/) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sp<LnbClient> TunerClient::openLnbByName(string /*lnbName*/) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/////////////// TunerClient Helper Methods ///////////////////////
|
||||
|
||||
sp<ITuner> TunerClient::getHidlTuner() {
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "FrontendClient.h"
|
||||
#include "DemuxClient.h"
|
||||
#include "DescramblerClient.h"
|
||||
#include "LnbClient.h"
|
||||
|
||||
using ::aidl::android::media::tv::tuner::ITunerService;
|
||||
using ::aidl::android::media::tv::tuner::TunerServiceFrontendInfo;
|
||||
@@ -94,7 +96,31 @@ public:
|
||||
*
|
||||
* @return the demux’s capabilities.
|
||||
*/
|
||||
//DemuxCapabilities getDemuxCaps() {};
|
||||
DemuxCapabilities getDemuxCaps();
|
||||
|
||||
/**
|
||||
* Open a new interface of DescramblerClient given a descramblerHandle.
|
||||
*
|
||||
* @param descramblerHandle the handle of the descrambler granted by TRM.
|
||||
* @return a newly created DescramblerClient interface.
|
||||
*/
|
||||
sp<DescramblerClient> openDescrambler(int descramblerHandle);
|
||||
|
||||
/**
|
||||
* Open a new interface of LnbClient given an lnbHandle.
|
||||
*
|
||||
* @param lnbHandle the handle of the LNB granted by TRM.
|
||||
* @return a newly created LnbClient interface.
|
||||
*/
|
||||
sp<LnbClient> openLnb(int lnbHandle);
|
||||
|
||||
/**
|
||||
* Open a new interface of LnbClient given a LNB name.
|
||||
*
|
||||
* @param lnbName the name for an external LNB to be opened.
|
||||
* @return a newly created LnbClient interface.
|
||||
*/
|
||||
sp<LnbClient> openLnbByName(string lnbName);
|
||||
|
||||
/**
|
||||
* Get the current Tuner HAL version. The high 16 bits are the major version number
|
||||
|
||||
Reference in New Issue
Block a user