Merge "Add API to filter out unnecessary PIDs from frontend output."
This commit is contained in:
committed by
Android (Google) Code Review
commit
ff34ced59a
@@ -6618,6 +6618,7 @@ package android.media.tv.tuner {
|
||||
method @Nullable public android.media.tv.tuner.Lnb openLnbByName(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.media.tv.tuner.LnbCallback);
|
||||
method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_SHARED_FILTER) public static android.media.tv.tuner.filter.SharedFilter openSharedFilter(@NonNull android.content.Context, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.media.tv.tuner.filter.SharedFilterCallback);
|
||||
method @Nullable public android.media.tv.tuner.filter.TimeFilter openTimeFilter();
|
||||
method public int removeOutputPid(@IntRange(from=0) int);
|
||||
method public int scan(@NonNull android.media.tv.tuner.frontend.FrontendSettings, int, @NonNull java.util.concurrent.Executor, @NonNull android.media.tv.tuner.frontend.ScanCallback);
|
||||
method public int setLnaEnabled(boolean);
|
||||
method public int setMaxNumberOfFrontends(int, @IntRange(from=0) int);
|
||||
|
||||
@@ -1002,7 +1002,7 @@ public class Tuner implements AutoCloseable {
|
||||
private native String nativeGetFrontendHardwareInfo();
|
||||
private native int nativeSetMaxNumberOfFrontends(int frontendType, int maxNumber);
|
||||
private native int nativeGetMaxNumberOfFrontends(int frontendType);
|
||||
|
||||
private native int nativeRemoveOutputPid(int pid);
|
||||
private native Lnb nativeOpenLnbByHandle(int handle);
|
||||
private native Lnb nativeOpenLnbByName(String name);
|
||||
|
||||
@@ -1564,6 +1564,36 @@ public class Tuner implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter out unnecessary PID (packet identifier) from frontend output.
|
||||
*
|
||||
* <p>It is used by the client to remove some video or audio PIDs of other program to reduce the
|
||||
* total amount of recorded TS.
|
||||
*
|
||||
* <p>This API is only supported by Tuner HAL 2.0 or higher. Unsupported version would cause
|
||||
* no-op. Use {@link TunerVersionChecker#getTunerVersion()} to check the version.
|
||||
*
|
||||
* @return result status of the operation. Unsupported version or if current active frontend
|
||||
* doesn’t support PID filtering out would return {@link #RESULT_UNAVAILABLE}.
|
||||
* @throws IllegalStateException if there is no active frontend currently.
|
||||
*/
|
||||
@Result
|
||||
public int removeOutputPid(@IntRange(from = 0) int pid) {
|
||||
mFrontendLock.lock();
|
||||
try {
|
||||
if (!TunerVersionChecker.checkHigherOrEqualVersionTo(
|
||||
TunerVersionChecker.TUNER_VERSION_2_0, "Remove output PID")) {
|
||||
return RESULT_UNAVAILABLE;
|
||||
}
|
||||
if (mFrontend == null) {
|
||||
throw new IllegalStateException("frontend is not initialized");
|
||||
}
|
||||
return nativeRemoveOutputPid(pid);
|
||||
} finally {
|
||||
mFrontendLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the currently initialized and activated frontend information. To get all the available
|
||||
* frontend info on the device, use {@link getAvailableFrontendInfos()}.
|
||||
|
||||
@@ -1622,6 +1622,15 @@ int32_t JTuner::getMaxNumberOfFrontends(int32_t type) {
|
||||
return mTunerClient->getMaxNumberOfFrontends(static_cast<FrontendType>(type));
|
||||
}
|
||||
|
||||
jint JTuner::removeOutputPid(int32_t pid) {
|
||||
if (mFeClient == nullptr) {
|
||||
ALOGE("frontend is not initialized");
|
||||
return (jint)Result::INVALID_STATE;
|
||||
}
|
||||
|
||||
return (jint)mFeClient->removeOutputPid(pid);
|
||||
}
|
||||
|
||||
jobject JTuner::openLnbByHandle(int handle) {
|
||||
if (mTunerClient == nullptr) {
|
||||
return nullptr;
|
||||
@@ -4375,6 +4384,11 @@ static jint android_media_tv_Tuner_get_maximum_frontends(JNIEnv *env, jobject th
|
||||
return tuner->getMaxNumberOfFrontends(type);
|
||||
}
|
||||
|
||||
static jint android_media_tv_Tuner_remove_output_pid(JNIEnv *env, jobject thiz, jint pid) {
|
||||
sp<JTuner> tuner = getTuner(env, thiz);
|
||||
return tuner->removeOutputPid(pid);
|
||||
}
|
||||
|
||||
static jint android_media_tv_Tuner_close_frontend(JNIEnv* env, jobject thiz, jint /* handle */) {
|
||||
sp<JTuner> tuner = getTuner(env, thiz);
|
||||
return tuner->closeFrontend();
|
||||
@@ -4694,6 +4708,8 @@ static const JNINativeMethod gTunerMethods[] = {
|
||||
(void *)android_media_tv_Tuner_set_maximum_frontends },
|
||||
{ "nativeGetMaxNumberOfFrontends", "(I)I",
|
||||
(void *)android_media_tv_Tuner_get_maximum_frontends },
|
||||
{ "nativeRemoveOutputPid", "(I)I",
|
||||
(void *)android_media_tv_Tuner_remove_output_pid },
|
||||
};
|
||||
|
||||
static const JNINativeMethod gFilterMethods[] = {
|
||||
|
||||
@@ -205,6 +205,7 @@ struct JTuner : public RefBase {
|
||||
Result getFrontendHardwareInfo(string& info);
|
||||
jint setMaxNumberOfFrontends(int32_t frontendType, int32_t maxNumber);
|
||||
int32_t getMaxNumberOfFrontends(int32_t frontendType);
|
||||
jint removeOutputPid(int32_t pid);
|
||||
|
||||
jweak getObject();
|
||||
|
||||
|
||||
@@ -143,6 +143,15 @@ Result FrontendClient::getHardwareInfo(string& info) {
|
||||
return Result::INVALID_STATE;
|
||||
}
|
||||
|
||||
Result FrontendClient::removeOutputPid(int32_t pid) {
|
||||
if (mTunerFrontend != nullptr) {
|
||||
Status s = mTunerFrontend->removeOutputPid(pid);
|
||||
return ClientHelper::getServiceSpecificErrorCode(s);
|
||||
}
|
||||
|
||||
return Result::INVALID_STATE;
|
||||
}
|
||||
|
||||
shared_ptr<ITunerFrontend> FrontendClient::getAidlFrontend() {
|
||||
return mTunerFrontend;
|
||||
}
|
||||
|
||||
@@ -120,6 +120,11 @@ public:
|
||||
*/
|
||||
Result getHardwareInfo(string& info);
|
||||
|
||||
/**
|
||||
* Filter out unnecessary PID from frontend output.
|
||||
*/
|
||||
Result removeOutputPid(int32_t pid);
|
||||
|
||||
int32_t getId();
|
||||
|
||||
shared_ptr<ITunerFrontend> getAidlFrontend();
|
||||
|
||||
Reference in New Issue
Block a user