Skip to content
Open
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
7 changes: 3 additions & 4 deletions externals/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,11 @@ endif()
#secmanager/client macros
if(CMAKE_USE_SECCLIENT)
message("CMAKE_USE_SECCLIENT set")
set(LIB_EXT_DEPENDS "${LIB_EXT_DEPENDS} -lFireboltSDK")
set(LIB_EXT_DEFINES "${LIB_EXT_DEFINES} -DUSE_SECCLIENT")
list(APPEND LIB_EXT_DEPENDS -lSecClient )
endif()
if(CMAKE_USE_SECMANAGER)
message("CMAKE_USE_SECMANAGER set")
set(LIB_EXT_DEPENDS "${LIB_EXT_DEPENDS} -lFireboltSDK")
set(LIB_EXT_DEFINES "${LIB_EXT_DEFINES} -DUSE_SECMANAGER")
endif()

Expand Down Expand Up @@ -182,8 +180,9 @@ target_link_libraries(playerfbinterface playerlogmanager)
target_link_libraries(playerfbinterface baseconversion)
target_link_libraries(playerfbinterface playerjsonobject)
if(CMAKE_USE_SECCLIENT OR CMAKE_USE_SECMANAGER)
find_package(FireboltAamp CONFIG REQUIRED)
target_link_libraries(playerfbinterface FireboltAamp::FireboltAamp)
find_package(FireboltTransport CONFIG REQUIRED)
find_package(FireboltEntOs CONFIG REQUIRED)
target_link_libraries(playerfbinterface FireboltTransport::FireboltTransport FireboltEntOs::FireboltEntOs)
endif()

# Configure pkg-config file
Expand Down
51 changes: 19 additions & 32 deletions externals/IFirebolt/FireboltInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,36 +68,23 @@ FireboltInterface::FireboltInterface()

bool FireboltInterface::CreateFireboltInstance(const std::string &url)
{
const std::string config = "{\
\"waitTime\": 5000,\
\"logLevel\": \"Info\",\
\"workerPool\":{\
\"queueSize\": 8,\
\"threadCount\": 3\
},\
\"wsUrl\": " + url +
"}";
Firebolt::Config cfg{};
cfg.wsUrl = url;
cfg.waitTime_ms = 5000;

auto callback = [this](bool connected, Firebolt::Error error) {
this->ConnectionChanged(connected, static_cast<int>(error));
};
mIsConnected = false;
MW_LOG_ERR("CreateFireboltInstance url: %s -- config : %s", url.c_str(), config.c_str());
Firebolt::Error errorInitialize = Firebolt::IFireboltAampAccessor::Instance().Initialize(config);
if (errorInitialize != Firebolt::Error::None)
{
MW_LOG_ERR("Failed to create FireboltInstance InitializeError:\"%d\"", static_cast<int>(errorInitialize));
return false;
}
auto errorConnect = Firebolt::IFireboltAampAccessor::Instance().Connect(callback);
if (!errorConnect)
{
MW_LOG_ERR("Failed to create FireboltInstance ConnectError:\"%d\"", static_cast<int>(errorConnect.error()));
return false;
}
mListenerId = *errorConnect;
MW_LOG_INFO("Firebolt Instance created successfully, Connected to Firebolt!");
return true;
auto callback = [this](const bool connected, const Firebolt::Error error) {
this->ConnectionChanged(connected, static_cast<int>(error));
};
mIsConnected = false;
MW_LOG_ERR("CreateFireboltInstance url: %s", url.c_str());
Firebolt::Error errorConnect = Firebolt::EntOs::IFireboltAccessor::Instance().Connect(cfg, callback);
if (errorConnect != Firebolt::Error::None)
{
MW_LOG_ERR("Failed to create FireboltInstance ConnectError:\"%d\"", static_cast<int>(errorConnect));
return false;
}
MW_LOG_INFO("Firebolt Instance created successfully, Connected to Firebolt!");
return true;
}

void FireboltInterface::ConnectionChanged(const bool connected, int error)
Expand All @@ -113,12 +100,12 @@ void FireboltInterface::ConnectionChanged(const bool connected, int error)
void FireboltInterface::DestroyFireboltInstance()
{
MW_LOG_WARN("Destroying Firebolt instance");
Firebolt::IFireboltAampAccessor::Instance().Disconnect(mListenerId);
Firebolt::EntOs::IFireboltAccessor::Instance().Disconnect();
}

FireboltInterface::~FireboltInterface()
{
Firebolt::IFireboltAampAccessor::Instance().ContentProtectionInterface().unsubscribeAll();
Firebolt::IFireboltAampAccessor::Instance().DeviceInterface().unsubscribeAll();
Firebolt::EntOs::IFireboltAccessor::Instance().ContentProtectionInterface().unsubscribeAll();
Firebolt::EntOs::IFireboltAccessor::Instance().DeviceInterface().unsubscribeAll();
DestroyFireboltInstance();
}
4 changes: 1 addition & 3 deletions externals/IFirebolt/FireboltInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#pragma once

#include "fireboltaamp.h"
#include "firebolt/entos/firebolt.h"

#include <memory>

Expand All @@ -44,8 +44,6 @@ class FireboltInterface{

bool mIsConnected = false;

unsigned int mListenerId;

FireboltInterface();

bool CreateFireboltInstance(const std::string &url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
#include "_base64.h"
#include "PlayerJsonObject.h"
#include "PlayerLogManager.h"
#include "contentprotection.h"
#include "fireboltaamp.h"
#include "firebolt/entos/firebolt.h"
#include "FireboltInterface.h"

#include <unistd.h>
Expand All @@ -36,7 +35,7 @@

std::condition_variable mConnectionCV;
std::mutex mConnectionMutex;
using namespace Firebolt;
using namespace Firebolt::EntOs;
uint64_t ContentProtectionFirebolt::mSubscriptionId = 0;

//Lookup table to convert CPS error to secmanager error
Expand Down Expand Up @@ -96,7 +95,7 @@ ContentProtectionFirebolt::~ContentProtectionFirebolt()
// TODO- Yet to test Watermark Events as ContentProtection Thunder Plugin have issues.
void ContentProtectionFirebolt::SubscribeEvents()
{
auto result = Firebolt::IFireboltAampAccessor::Instance().ContentProtectionInterface().subscribeOnWatermarkStatusChanged(
auto result = Firebolt::EntOs::IFireboltAccessor::Instance().ContentProtectionInterface().subscribeOnWatermarkStatusChanged(
[this](const auto& status)
{
HandleWatermarkEvent(status.sessionId, status.status, status.appId);
Expand All @@ -117,7 +116,7 @@ void ContentProtectionFirebolt::UnSubscribeEvents()
{
MW_LOG_INFO("Unsubscribing from Firebolt Content Protection events %lld", mSubscriptionId);
auto result =
Firebolt::IFireboltAampAccessor::Instance().ContentProtectionInterface().unsubscribe(mSubscriptionId);
Firebolt::EntOs::IFireboltAccessor::Instance().ContentProtectionInterface().unsubscribe(mSubscriptionId);
if (result.error() != Firebolt::Error::None)
{
MW_LOG_ERR("Failed to Unsubscribe to watermark events: %d", static_cast<int>(result.error()));
Expand Down Expand Up @@ -436,7 +435,7 @@ void ContentProtectionFirebolt::CloseDrmSession(int64_t sessionId)
}
std::lock_guard<std::mutex> lock(mContentProtectionMutex);
// Call the closeDrmSession method from the interface
auto result = Firebolt::IFireboltAampAccessor::Instance().ContentProtectionInterface().closeDrmSession(std::to_string(sessionId));
auto result = Firebolt::EntOs::IFireboltAccessor::Instance().ContentProtectionInterface().closeDrmSession(std::to_string(sessionId));
// Check for errors
if (result.error() == Firebolt::Error::None)
{
Expand All @@ -459,18 +458,18 @@ bool ContentProtectionFirebolt::SetDrmSessionState(int64_t sessionId, bool activ
MW_LOG_ERR("Firebolt is not active (or) channel couldn't be opened");
return ret;
}
Firebolt::ContentProtection::SessionState sessionState;
Firebolt::EntOs::ContentProtection::SessionState sessionState;
if (active)
{
sessionState = Firebolt::ContentProtection::SessionState::ACTIVE;
sessionState = Firebolt::EntOs::ContentProtection::SessionState::ACTIVE;
}
else
{
sessionState = Firebolt::ContentProtection::SessionState::INACTIVE;
sessionState = Firebolt::EntOs::ContentProtection::SessionState::INACTIVE;
}
std::lock_guard<std::mutex> lock(mContentProtectionMutex);
// Call the setDrmSessionState method from the interface
auto result = Firebolt::IFireboltAampAccessor::Instance().ContentProtectionInterface().setDrmSessionState(std::to_string(sessionId), sessionState);
auto result = Firebolt::EntOs::IFireboltAccessor::Instance().ContentProtectionInterface().setDrmSessionState(std::to_string(sessionId), sessionState);
// Check for errors
if (result.error() == Firebolt::Error::None)
{
Expand Down Expand Up @@ -499,7 +498,7 @@ bool ContentProtectionFirebolt::SetPlaybackPosition(int64_t sessionId, float spe
}
std::lock_guard<std::mutex> lock(mContentProtectionMutex);
// Call the setPlaybackPosition method from the interface
auto result = Firebolt::IFireboltAampAccessor::Instance().ContentProtectionInterface().setPlaybackPosition(std::to_string(sessionId), speed, position);
auto result = Firebolt::EntOs::IFireboltAccessor::Instance().ContentProtectionInterface().setPlaybackPosition(std::to_string(sessionId), speed, position);
// Check for errors
if (result.error() == Firebolt::Error::None)
{
Expand Down Expand Up @@ -527,7 +526,7 @@ void ContentProtectionFirebolt::ShowWatermark(bool show, int64_t sessionId)

std::lock_guard<std::mutex> lock(mContentProtectionMutex);
// Call the showWatermark method from the interface
auto result = Firebolt::IFireboltAampAccessor::Instance().ContentProtectionInterface().showWatermark(std::to_string(sessionId), show, 0);
auto result = Firebolt::EntOs::IFireboltAccessor::Instance().ContentProtectionInterface().showWatermark(std::to_string(sessionId), show, 0);
// Check for errors
if (result.error() == Firebolt::Error::None) {
// No error, watermark visibility was successfully set
Expand All @@ -537,24 +536,24 @@ void ContentProtectionFirebolt::ShowWatermark(bool show, int64_t sessionId)
MW_LOG_ERR("showWatermark failed. Firebolt Error: \"%d\"", static_cast<int>(result.error()));
}
}
static Firebolt::ContentProtection::KeySystem convertStringToKeySystem(const std::string& keySystemStr)
static Firebolt::EntOs::ContentProtection::KeySystem convertStringToKeySystem(const std::string& keySystemStr)
{
if (keySystemStr.find("widevine") != std::string::npos)
{
return Firebolt::ContentProtection::KeySystem::WIDEVINE;
return Firebolt::EntOs::ContentProtection::KeySystem::WIDEVINE;
}
else if (keySystemStr.find("playready") != std::string::npos)
{
return Firebolt::ContentProtection::KeySystem::PLAYREADY;
return Firebolt::EntOs::ContentProtection::KeySystem::PLAYREADY;
}
else if (keySystemStr.find("clearkey") != std::string::npos)
{
return Firebolt::ContentProtection::KeySystem::CLEARKEY;
return Firebolt::EntOs::ContentProtection::KeySystem::CLEARKEY;
}
else
{
MW_LOG_ERR("Unknown KeySystem string: %s returning to default", keySystemStr.c_str());
return Firebolt::ContentProtection::KeySystem::WIDEVINE; // safest fallback default
return Firebolt::EntOs::ContentProtection::KeySystem::WIDEVINE; // safest fallback default
}
}
bool ContentProtectionFirebolt::OpenDrmSession(std::string& clientId, std::string appId, std::string keySystem, std::string licenseRequest, std::string initData, int64_t &sessionId, int32_t &errorCode, std::string &response)
Expand All @@ -565,8 +564,8 @@ bool ContentProtectionFirebolt::OpenDrmSession(std::string& clientId, std::strin
MW_LOG_ERR("Firebolt is not active (or) channel couldn't be opened");
return false; // Return false if system is not active
}
// Firebolt::ContentProtection::DRMSession drmSession;
auto drmSession = Firebolt::IFireboltAampAccessor::Instance()
// Firebolt::EntOs::ContentProtection::DRMSession drmSession;
auto drmSession = Firebolt::EntOs::IFireboltAccessor::Instance()
.ContentProtectionInterface()
.openDrmSession(clientId, appId, convertStringToKeySystem(keySystem),
licenseRequest, initData);
Expand All @@ -593,7 +592,7 @@ bool ContentProtectionFirebolt::UpdateDrmSession(int64_t sessionId, int32_t &err
return false; // Return false if system is not active
}

auto drmSession = Firebolt::IFireboltAampAccessor::Instance()
auto drmSession = Firebolt::EntOs::IFireboltAccessor::Instance()
.ContentProtectionInterface()
.updateDrmSession(std::to_string(sessionId),
licenseRequest, initData);
Expand Down
40 changes: 20 additions & 20 deletions externals/rdk/IFirebolt/DeviceFireboltInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ IFirebolt folder to be deleted, as IARM is no longer available as an alternative
*/

#include "DeviceFireboltInterface.h"
#include "fireboltaamp.h"
#include "firebolt/entos/firebolt.h"
#include "PlayerLogManager.h"
#include "PlayerExternalsRdkInterface.h"
#include "PlayerExternalUtils.h"
Expand All @@ -49,9 +49,9 @@ std::shared_ptr<DeviceFireboltInterface> s_pDeviceFireboltInterface = nullptr;
std::mutex mFireboltConnectionMutex;
std::condition_variable mFireboltConnectionCV;

static void HDCPEventHandlerFirebolt(const Firebolt::Device::HDCPVersionMap& t_HDCPVersionMap);
static void ResolutionHandlerFirebolt(const std::string& t_res);
static void getActiveInterfaceEventHandlerFirebolt (const Firebolt::Device::NetworkInfoResult& t_NetworkInfoResult);
static void HDCPEventHandlerFirebolt(const Firebolt::EntOs::Device::HDCPVersionMap& t_HDCPVersionMap);
static void ResolutionHandlerFirebolt(const Firebolt::EntOs::Device::Resolution& t_res);
static void getActiveInterfaceEventHandlerFirebolt (const Firebolt::EntOs::Device::NetworkInfoResult& t_NetworkInfoResult);

std::shared_ptr<DeviceFireboltInterface> DeviceFireboltInterface::GetInstance()
{
Expand Down Expand Up @@ -99,7 +99,7 @@ void DeviceFireboltInterface::RegisterDsMgrEventHandler()

MW_PRE_LOGGER_LOG("Subscribing to Firebolt hdcp change event \n");

auto result = Firebolt::IFireboltAampAccessor::Instance().DeviceInterface().subscribeOnHdcpChanged(
auto result = Firebolt::EntOs::IFireboltAccessor::Instance().DeviceInterface().subscribeOnHdcpChanged(
[](const auto& hdcpProtocol) {
MW_LOG_ERR("[Event] HDCP changed");
HDCPEventHandlerFirebolt(hdcpProtocol);
Expand All @@ -118,10 +118,10 @@ void DeviceFireboltInterface::RegisterDsMgrEventHandler()

MW_PRE_LOGGER_LOG("Subscribing to Firebolt resolution change event \n");

result = Firebolt::IFireboltAampAccessor::Instance().DeviceInterface().subscribeOnVideoResolutionChanged(
[](const std::string& videoResolution)
result = Firebolt::EntOs::IFireboltAccessor::Instance().DeviceInterface().subscribeOnVideoResolutionChanged(
[](const Firebolt::EntOs::Device::Resolution& videoResolution)
{
MW_LOG_WARN("[Event] Video resolution changed: %s" , videoResolution.c_str());
MW_LOG_WARN("[Event] Video resolution changed");
ResolutionHandlerFirebolt(videoResolution);
});
if(result)
Expand All @@ -139,14 +139,14 @@ void DeviceFireboltInterface::RegisterDsMgrEventHandler()
void DeviceFireboltInterface::RemoveEventHandlers()
{
//removes everything ...
Firebolt::IFireboltAampAccessor::Instance().DeviceInterface().unsubscribeAll();
Firebolt::EntOs::IFireboltAccessor::Instance().DeviceInterface().unsubscribeAll();
}

void DeviceFireboltInterface::RegisterNtwMgrEventHandler()
{
MW_PRE_LOGGER_LOG("Subscribing to Firebolt Network change event\n");

auto result = Firebolt::IFireboltAampAccessor::Instance().DeviceInterface().subscribeOnNetworkChanged(
auto result = Firebolt::EntOs::IFireboltAccessor::Instance().DeviceInterface().subscribeOnNetworkChanged(
[](const auto& network) {
MW_LOG_ERR("[Event] network changed");
getActiveInterfaceEventHandlerFirebolt(network);
Expand All @@ -165,11 +165,11 @@ void DeviceFireboltInterface::RegisterNtwMgrEventHandler()

std::shared_ptr<PlayerExternalsRdkInterface> pInstance = PlayerExternalsRdkInterface::GetPlayerExternalsRdkInterfaceInstance();

auto network = Firebolt::IFireboltAampAccessor::Instance().DeviceInterface().network();
auto network = Firebolt::EntOs::IFireboltAccessor::Instance().DeviceInterface().network();

if(network)
{
if(network.value().type == Firebolt::Device::NetworkType::WIFI)
if(network.value().type == Firebolt::EntOs::Device::NetworkType::WIFI)
{
MW_PRE_LOGGER_LOG("Active interface wifi\n");
pInstance->SetActiveInterface(true);
Expand All @@ -189,20 +189,20 @@ char * DeviceFireboltInterface::GetTR181Config(const char * paramName, size_t &
return nullptr;
}

static void getActiveInterfaceEventHandlerFirebolt (const Firebolt::Device::NetworkInfoResult& t_NetworkInfoResult)
static void getActiveInterfaceEventHandlerFirebolt (const Firebolt::EntOs::Device::NetworkInfoResult& t_NetworkInfoResult)
{
std::shared_ptr<PlayerExternalsRdkInterface> pInstance = PlayerExternalsRdkInterface::GetPlayerExternalsRdkInterfaceInstance();

if(t_NetworkInfoResult.state == Firebolt::Device::NetworkState::CONNECTED)
if(t_NetworkInfoResult.state == Firebolt::EntOs::Device::NetworkState::CONNECTED)
{
std::string interface = "unknown";
if(t_NetworkInfoResult.type == Firebolt::Device::NetworkType::WIFI)
if(t_NetworkInfoResult.type == Firebolt::EntOs::Device::NetworkType::WIFI)
{
interface = "wlan";
pInstance->SetActiveInterface(true);
MW_LOG_INFO("Network interface changed to wifi");
}
else if(t_NetworkInfoResult.type == Firebolt::Device::NetworkType::ETHERNET)
else if(t_NetworkInfoResult.type == Firebolt::EntOs::Device::NetworkType::ETHERNET)
{
interface = "eth";
pInstance->SetActiveInterface(false);
Expand All @@ -225,7 +225,7 @@ static void getActiveInterfaceEventHandlerFirebolt (const Firebolt::Device::Netw
/**
* @brief IARM event handler for HDCP and HDMI hot plug events
*/
static void HDCPEventHandlerFirebolt(const Firebolt::Device::HDCPVersionMap& t_HDCPVersionMap)
static void HDCPEventHandlerFirebolt(const Firebolt::EntOs::Device::HDCPVersionMap& t_HDCPVersionMap)
{
std::shared_ptr<PlayerExternalsRdkInterface> pInstance = PlayerExternalsRdkInterface::GetPlayerExternalsRdkInterfaceInstance();

Expand All @@ -251,14 +251,14 @@ static void HDCPEventHandlerFirebolt(const Firebolt::Device::HDCPVersionMap& t_H
/**
* @brief IARM event handler for resolution changes
*/
static void ResolutionHandlerFirebolt(const std::string& t_res)
static void ResolutionHandlerFirebolt(const Firebolt::EntOs::Device::Resolution& t_res)
{
int width = 1280;
int height = 720;

MW_LOG_INFO("Resolution: %s", t_res.c_str());
MW_LOG_INFO("Resolution changed");

auto curr_network = Firebolt::IFireboltAampAccessor::Instance().DeviceInterface().videoResolution();
auto curr_network = Firebolt::EntOs::IFireboltAccessor::Instance().DeviceInterface().videoResolution();

if(curr_network)
{
Expand Down
Loading