mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Add new APIs for watermarking
Bug: 263762255 Test: m Change-Id: I7eeaa58f0a3a1056f33e22aba42540636794ade1
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# Bug component: 105688
|
||||
hgchen@google.com
|
||||
shubang@google.com
|
||||
quxiangfang@google.com
|
||||
|
||||
@@ -14,6 +14,7 @@ aidl_interface {
|
||||
imports: [
|
||||
"android.hardware.common-V2",
|
||||
"android.media.audio.common.types-V1",
|
||||
"android.hardware.common.fmq-V1",
|
||||
],
|
||||
stability: "vintf",
|
||||
backend: {
|
||||
|
||||
@@ -38,6 +38,8 @@ interface ITvInput {
|
||||
android.hardware.tv.input.TvStreamConfig[] getStreamConfigurations(in int deviceId);
|
||||
android.hardware.common.NativeHandle openStream(in int deviceId, in int streamId);
|
||||
void setCallback(in android.hardware.tv.input.ITvInputCallback callback);
|
||||
void setTvMessageEnabled(int deviceId, int streamId, in android.hardware.tv.input.TvMessageEventType type, boolean enabled);
|
||||
void getTvMessageQueueDesc(out android.hardware.common.fmq.MQDescriptor<byte,android.hardware.common.fmq.SynchronizedReadWrite> queue, int deviceId, int streamId);
|
||||
const int STATUS_UNKNOWN = 1;
|
||||
const int STATUS_NO_RESOURCE = 2;
|
||||
const int STATUS_INVALID_ARGUMENTS = 3;
|
||||
|
||||
@@ -35,4 +35,5 @@ package android.hardware.tv.input;
|
||||
@VintfStability
|
||||
interface ITvInputCallback {
|
||||
void notify(in android.hardware.tv.input.TvInputEvent event);
|
||||
void notifyTvMessageEvent(in android.hardware.tv.input.TvMessageEvent event);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.input;
|
||||
@VintfStability
|
||||
parcelable TvMessage {
|
||||
String subType;
|
||||
long groupId;
|
||||
int dataLengthBytes;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.input;
|
||||
@VintfStability
|
||||
parcelable TvMessageEvent {
|
||||
android.hardware.tv.input.TvMessageEventType type;
|
||||
int streamId;
|
||||
android.hardware.tv.input.TvMessage[] messages;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.input;
|
||||
@Backing(type="int") @VintfStability
|
||||
enum TvMessageEventType {
|
||||
WATERMARK = 1,
|
||||
CLOSED_CAPTION = 2,
|
||||
OTHER = 3,
|
||||
}
|
||||
@@ -17,7 +17,10 @@
|
||||
package android.hardware.tv.input;
|
||||
|
||||
import android.hardware.common.NativeHandle;
|
||||
import android.hardware.common.fmq.MQDescriptor;
|
||||
import android.hardware.common.fmq.SynchronizedReadWrite;
|
||||
import android.hardware.tv.input.ITvInputCallback;
|
||||
import android.hardware.tv.input.TvMessageEventType;
|
||||
import android.hardware.tv.input.TvStreamConfig;
|
||||
|
||||
@VintfStability
|
||||
@@ -73,4 +76,32 @@ interface ITvInput {
|
||||
* @throws ServiceSpecificException with values from the ITvInput::STATUS_* constants
|
||||
*/
|
||||
void setCallback(in ITvInputCallback callback);
|
||||
|
||||
/**
|
||||
* Enables or disables TV message detection for the specified stream on the device.
|
||||
*
|
||||
* @param deviceId The ID of the device that contains the stream to set the flag for.
|
||||
* @param streamId The ID of the stream to set the flag for.
|
||||
* @param type The type of {@link android.hardware.tv.input.TvMessageEventType}.
|
||||
* @param enabled {@code true} if you want to enable TV message detection
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
void setTvMessageEnabled(
|
||||
int deviceId, int streamId, in TvMessageEventType type, boolean enabled);
|
||||
|
||||
/**
|
||||
* Gets the TV message queue for the specified stream on the device.
|
||||
*
|
||||
* The FMQ is used to relay events that are parsed from the specified stream to the
|
||||
* app or service responsible for processing the message. The HAL implementation
|
||||
* is expected to parse these messages and add them to the queue as new events are
|
||||
* detected from the stream based on whether or not they are enabled by
|
||||
* {@link #setTvMessageEnabled(int, int, TvMessageEventType, boolean)}.
|
||||
*
|
||||
* @param deviceId The ID of the device that contains the stream to get the queue for.
|
||||
* @param streamId THe ID of the stream to get the queue for.
|
||||
* @return The descriptor of the TV message queue.
|
||||
*/
|
||||
void getTvMessageQueueDesc(
|
||||
out MQDescriptor<byte, SynchronizedReadWrite> queue, int deviceId, int streamId);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package android.hardware.tv.input;
|
||||
|
||||
import android.hardware.tv.input.TvInputEvent;
|
||||
import android.hardware.tv.input.TvMessageEvent;
|
||||
|
||||
@VintfStability
|
||||
interface ITvInputCallback {
|
||||
@@ -27,4 +28,11 @@ interface ITvInputCallback {
|
||||
* @param event Event passed to the client.
|
||||
*/
|
||||
void notify(in TvInputEvent event);
|
||||
/**
|
||||
* Notifies the client that an TV message event has occurred. For possible event types,
|
||||
* check TvMessageEventType.
|
||||
*
|
||||
* @param event Event passed to the client.
|
||||
*/
|
||||
void notifyTvMessageEvent(in TvMessageEvent event);
|
||||
}
|
||||
|
||||
35
tv/input/aidl/android/hardware/tv/input/TvMessage.aidl
Normal file
35
tv/input/aidl/android/hardware/tv/input/TvMessage.aidl
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.input;
|
||||
|
||||
@VintfStability
|
||||
parcelable TvMessage {
|
||||
/**
|
||||
* Extended data type, like “ATSC A/336 Watermark”, “ATSC_CC”, etc. This is opaque
|
||||
* to the framework.
|
||||
*/
|
||||
String subType;
|
||||
/**
|
||||
* This group id is used to optionally identify messages that belong together, such as
|
||||
* headers and bodies of the same event. For messages that do not have a group, this value
|
||||
* should be -1.
|
||||
*
|
||||
* As -1 is a reserved value, -1 should not be used as a valid groupId.
|
||||
*/
|
||||
long groupId;
|
||||
int dataLengthBytes;
|
||||
}
|
||||
28
tv/input/aidl/android/hardware/tv/input/TvMessageEvent.aidl
Normal file
28
tv/input/aidl/android/hardware/tv/input/TvMessageEvent.aidl
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.input;
|
||||
|
||||
import android.hardware.tv.input.TvMessage;
|
||||
import android.hardware.tv.input.TvMessageEventType;
|
||||
|
||||
@VintfStability
|
||||
parcelable TvMessageEvent {
|
||||
TvMessageEventType type;
|
||||
|
||||
int streamId;
|
||||
TvMessage[] messages;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.input;
|
||||
|
||||
@VintfStability
|
||||
@Backing(type="int")
|
||||
enum TvMessageEventType {
|
||||
WATERMARK = 1,
|
||||
CLOSED_CAPTION = 2,
|
||||
OTHER = 3,
|
||||
}
|
||||
@@ -13,6 +13,10 @@ cc_binary {
|
||||
init_rc: ["input-default.rc"],
|
||||
vintf_fragments: ["input-default.xml"],
|
||||
vendor: true,
|
||||
cflags: [
|
||||
"-Werror",
|
||||
"-Wno-unused-parameter",
|
||||
],
|
||||
srcs: [
|
||||
"TvInput.cpp",
|
||||
"service.cpp",
|
||||
@@ -23,9 +27,11 @@ cc_binary {
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"liblog",
|
||||
"libfmq",
|
||||
"libutils",
|
||||
"libcutils",
|
||||
"libbinder_ndk",
|
||||
"android.hardware.tv.input-V1-ndk",
|
||||
"android.hardware.common.fmq-V1-ndk",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -65,6 +65,21 @@ void TvInput::init() {
|
||||
return ::ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
::ndk::ScopedAStatus TvInput::setTvMessageEnabled(int32_t deviceId, int32_t streamId,
|
||||
TvMessageEventType in_type, bool enabled) {
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
// TODO: Implement this
|
||||
return ::ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
::ndk::ScopedAStatus TvInput::getTvMessageQueueDesc(
|
||||
MQDescriptor<int8_t, SynchronizedReadWrite>* out_queue, int32_t in_deviceId,
|
||||
int32_t in_streamId) {
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
// TODO: Implement this
|
||||
return ::ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
::ndk::ScopedAStatus TvInput::getStreamConfigurations(int32_t in_deviceId,
|
||||
vector<TvStreamConfig>* _aidl_return) {
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include <aidl/android/hardware/tv/input/BnTvInput.h>
|
||||
#include <utils/KeyedVector.h>
|
||||
|
||||
#include <aidl/android/hardware/tv/input/TvMessageEventType.h>
|
||||
#include <fmq/AidlMessageQueue.h>
|
||||
#include <map>
|
||||
#include "TvInputDeviceInfoWrapper.h"
|
||||
#include "TvStreamConfigWrapper.h"
|
||||
@@ -26,6 +28,9 @@
|
||||
using namespace android;
|
||||
using namespace std;
|
||||
using ::aidl::android::hardware::common::NativeHandle;
|
||||
using ::aidl::android::hardware::common::fmq::MQDescriptor;
|
||||
using ::aidl::android::hardware::common::fmq::SynchronizedReadWrite;
|
||||
using ::android::AidlMessageQueue;
|
||||
|
||||
namespace aidl {
|
||||
namespace android {
|
||||
@@ -38,6 +43,11 @@ class TvInput : public BnTvInput {
|
||||
TvInput();
|
||||
|
||||
::ndk::ScopedAStatus setCallback(const shared_ptr<ITvInputCallback>& in_callback) override;
|
||||
::ndk::ScopedAStatus setTvMessageEnabled(int32_t deviceId, int32_t streamId,
|
||||
TvMessageEventType in_type, bool enabled) override;
|
||||
::ndk::ScopedAStatus getTvMessageQueueDesc(
|
||||
MQDescriptor<int8_t, SynchronizedReadWrite>* out_queue, int32_t in_deviceId,
|
||||
int32_t in_streamId) override;
|
||||
::ndk::ScopedAStatus getStreamConfigurations(int32_t in_deviceId,
|
||||
vector<TvStreamConfig>* _aidl_return) override;
|
||||
::ndk::ScopedAStatus openStream(int32_t in_deviceId, int32_t in_streamId,
|
||||
|
||||
@@ -9,10 +9,16 @@ package {
|
||||
|
||||
cc_test {
|
||||
name: "VtsHalTvInputTargetTest",
|
||||
defaults: ["VtsHalTargetTestDefaults","use_libaidlvintf_gtest_helper_static",],
|
||||
defaults: [
|
||||
"VtsHalTargetTestDefaults",
|
||||
"use_libaidlvintf_gtest_helper_static",
|
||||
],
|
||||
cflags: [
|
||||
"-Werror",
|
||||
"-Wno-unused-parameter",
|
||||
],
|
||||
srcs: ["VtsHalTvInputTargetTest.cpp"],
|
||||
static_libs: [
|
||||
"android.hardware.tv.input-V1-ndk",
|
||||
"android.media.audio.common.types-V1-ndk",
|
||||
"android.hardware.common-V2-ndk",
|
||||
"libaidlcommonsupport",
|
||||
@@ -24,6 +30,9 @@ cc_test {
|
||||
shared_libs: [
|
||||
"libbinder_ndk",
|
||||
"libvndksupport",
|
||||
"libfmq",
|
||||
"android.hardware.common.fmq-V1-ndk",
|
||||
"android.hardware.tv.input-V1-ndk",
|
||||
],
|
||||
require_root: true,
|
||||
}
|
||||
|
||||
@@ -43,6 +43,11 @@ TvInputAidlTest::TvInputCallback::TvInputCallback(shared_ptr<TvInputAidlTest> pa
|
||||
return ::ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
::ndk::ScopedAStatus TvInputAidlTest::TvInputCallback::notifyTvMessageEvent(
|
||||
const TvMessageEvent& in_event) {
|
||||
return ::ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
void TvInputAidlTest::SetUp() {
|
||||
if (AServiceManager_isDeclared(GetParam().c_str())) {
|
||||
::ndk::SpAIBinder binder(AServiceManager_waitForService(GetParam().c_str()));
|
||||
|
||||
@@ -25,15 +25,19 @@
|
||||
#include <aidl/android/hardware/tv/input/ITvInput.h>
|
||||
#include <aidl/android/hardware/tv/input/TvInputDeviceInfo.h>
|
||||
#include <aidl/android/hardware/tv/input/TvInputEvent.h>
|
||||
#include <aidl/android/hardware/tv/input/TvMessageEvent.h>
|
||||
#include <aidl/android/hardware/tv/input/TvMessageEventType.h>
|
||||
#include <aidl/android/hardware/tv/input/TvStreamConfig.h>
|
||||
#include <fmq/AidlMessageQueue.h>
|
||||
|
||||
#include <log/log.h>
|
||||
#include <utils/KeyedVector.h>
|
||||
|
||||
using namespace aidl::android::hardware::tv::input;
|
||||
using namespace std;
|
||||
|
||||
using ::aidl::android::hardware::common::NativeHandle;
|
||||
using ::aidl::android::hardware::common::fmq::MQDescriptor;
|
||||
using ::android::AidlMessageQueue;
|
||||
|
||||
#define WAIT_FOR_EVENT_TIMEOUT 5
|
||||
#define DEFAULT_ID INT32_MIN
|
||||
@@ -46,6 +50,7 @@ class TvInputAidlTest : public testing::TestWithParam<string> {
|
||||
public:
|
||||
TvInputCallback(shared_ptr<TvInputAidlTest> parent);
|
||||
::ndk::ScopedAStatus notify(const TvInputEvent& in_event) override;
|
||||
::ndk::ScopedAStatus notifyTvMessageEvent(const TvMessageEvent& in_event) override;
|
||||
|
||||
private:
|
||||
shared_ptr<TvInputAidlTest> parent_;
|
||||
|
||||
Reference in New Issue
Block a user