Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rdk 52316 #390

Merged
merged 6 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions interfaces/IContentProtection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2022 Metrological
*
* 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.
*/

#pragma once

#include "Module.h"

namespace Thunder {
namespace Exchange {

// @json 1.0.0
struct EXTERNAL IContentProtection : virtual public Core::IUnknown {
enum { ID = ID_CONTENTPROTECTION };

~IContentProtection() override = default;

enum KeySystem : uint8_t {
WIDEVINE /* @text:widevine */,
PLAYREADY /* @text:playready */,
CLEARKEY /* @text:clearkey */
};

enum State : uint8_t {
ACTIVE /* @text:active */,
INACTIVE /* @text:inactive */
};

// @event
struct EXTERNAL INotification : virtual public Core::IUnknown {
enum { ID = ID_CONTENTPROTECTION_NOTIFICATION };

~INotification() override = default;

struct Status {
enum State : uint8_t {
GRANTED = 1 /* @text:GRANTED */,
NOT_REQUIRED = 2 /* @text:NOT_REQUIRED */,
DENIED = 3 /* @text:DENIED */,
FAILED = 4 /* @text:FAILED */,
};

State state;
int32_t failureReason;
};

// @alt onWatermarkStatusChanged
virtual void WatermarkStatusChanged(uint32_t sessionId,
const Status& status)
= 0;
};

virtual uint32_t Register(INotification* notification) = 0;
virtual uint32_t Unregister(INotification* notification) = 0;

// @alt openDrmSession
virtual uint32_t OpenDrmSession(const string& clientId,
KeySystem keySystem, const string& licenseRequest,
const string& initData /* @opaque */,
uint32_t& sessionId /* @out */,
string& response /* @text:openSessionResponse @opaque @out */)
= 0;

// @alt setDrmSessionState
virtual uint32_t SetDrmSessionState(uint32_t sessionId,
State sessionState)
= 0;

// @alt updateDrmSession
virtual uint32_t UpdateDrmSession(uint32_t sessionId,
const string& licenseRequest,
const string& initData /* @opaque */,
string& response /* @text:updateSessionResponse @opaque @out */)
= 0;

// @alt closeDrmSession
virtual uint32_t CloseDrmSession(uint32_t sessionId) = 0;

// @alt showWatermark
virtual uint32_t ShowWatermark(uint32_t sessionId,
bool show, bool localOverlay)
= 0;

// @alt setPlaybackPosition
virtual uint32_t SetPlaybackPosition(uint32_t sessionId,
int32_t speed, long position)
= 0;
};

} // namespace Exchange
} // namespace Thunder
46 changes: 46 additions & 0 deletions interfaces/IWatermark.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#pragma once

#include "Module.h"

namespace Thunder {
namespace Exchange {

struct PalettedImageData
{
uint32_t imageKey;
uint32_t imageWidth;
uint32_t imageHeight;
uint32_t clutKey;
uint32_t clutSize;
string clutType;
};

struct EXTERNAL IWatermark : virtual public Core::IUnknown {
enum { ID = ID_WATERMARK };

struct INotification : virtual public Core::IUnknown {

enum { ID = ID_WATERMARK_NOTIFICATION };

~INotification() override = default;

virtual void WatermarkEvent(const string& eventName, const string& parametersJson) = 0;
};


virtual ~IWatermark() {}
virtual uint32_t Initialize(string waylandDisplay, bool synchronized) = 0;
virtual uint32_t Deinitialize() = 0;
virtual uint32_t Register(INotification* notification) = 0;
virtual uint32_t Unregister(INotification* notification) = 0;
virtual bool ShowWatermark(const bool show) = 0;
virtual bool CreateWatermark(uint32_t id, uint32_t zorder) = 0;
virtual bool UpdateWatermark(uint32_t id, uint32_t key, uint32_t size) = 0;
virtual bool AdjustWatermark(uint32_t id, uint32_t zorder) = 0;
virtual bool DeleteWatermark(uint32_t id) = 0;
virtual PalettedImageData GetPalettedWatermark(uint32_t id) = 0;
virtual bool ModifyPalettedWatermark(uint32_t id, PalettedImageData data) = 0;
};

} // Exchange
} // Thunder
9 changes: 8 additions & 1 deletion interfaces/Ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,14 @@ namespace Exchange {

ID_TESTAUTOMATIONMEMORY = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x9F0,
ID_TESTAUTOMATIONCOMRPC = ID_TESTAUTOMATIONMEMORY + 1,
ID_TESTAUTOMATIONCOMRPCINTERNAL = ID_TESTAUTOMATIONMEMORY + 2
ID_TESTAUTOMATIONCOMRPCINTERNAL = ID_TESTAUTOMATIONMEMORY + 2,

ID_CONTENTPROTECTION = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x500,
ID_CONTENTPROTECTION_NOTIFICATION = ID_CONTENTPROTECTION + 1,

ID_WATERMARK = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x510,
ID_WATERMARK_NOTIFICATION = ID_WATERMARK + 2,

};
}
}