Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
416 changes: 172 additions & 244 deletions AVInput/AVInput.cpp

Large diffs are not rendered by default.

48 changes: 43 additions & 5 deletions AVInput/AVInput.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**

Check failure on line 1 in AVInput/AVInput.h

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'AVInput/AVInput.h' (Match: rdkcentral/rdkservices/1, 94 lines, url: https://github.com/rdkcentral/rdkservices/archive/GRT_v1.tar.gz, file: AVInput/AVInput.h)
* If not stated otherwise in this file or this component's LICENSE
* file the following copyright and licenses apply:
*
Expand All @@ -21,7 +21,10 @@

#include "Module.h"
#include "libIBus.h"

#include "dsTypes.h"
#include "host.hpp"
#include "manager.hpp"

#define DEFAULT_PRIM_VOL_LEVEL 25
#define MAX_PRIM_VOL_LEVEL 100
Expand All @@ -30,9 +33,13 @@
namespace WPEFramework {
namespace Plugin {

class AVInput: public PluginHost::IPlugin, public PluginHost::JSONRPC
{
class AVInput: public PluginHost::IPlugin,
public PluginHost::JSONRPC,
public device::Host::IHdmiInEvents,
public device::Host::ICompositeInEvents{

private:

AVInput(const AVInput &) = delete;
AVInput &operator=(const AVInput &) = delete;

Expand All @@ -45,6 +52,15 @@
INTERFACE_ENTRY(PluginHost::IDispatcher)
END_INTERFACE_MAP

private:

template <typename T>
T* baseInterface()
{
static_assert(std::is_base_of<T, AVInput>(), "base type mismatch");
return static_cast<T*>(this);
}

int m_primVolume;
int m_inputVolume; //Player Volume

Expand All @@ -57,9 +73,7 @@
virtual string Information() const override;

protected:
void InitializeIARM();
void DeinitializeIARM();


void RegisterAll();
void UnregisterAll();

Expand Down Expand Up @@ -124,6 +138,30 @@

void hdmiInputAviContentTypeChange(int port, int content_type);
static void dsAviContentTypeEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);

private:

bool _registeredDsEventHandlers;

public:

/* HdmiInEventNotification*/

void OnHdmiInEventHotPlug(dsHdmiInPort_t port, bool isConnected) override;
void OnHdmiInEventSignalStatus(dsHdmiInPort_t port, dsHdmiInSignalStatus_t signalStatus) override;
void OnHdmiInEventStatus(dsHdmiInPort_t activePort, bool isPresented) override;
void OnHdmiInVideoModeUpdate(dsHdmiInPort_t port, const dsVideoPortResolution_t& videoPortResolution) override;
void OnHdmiInAllmStatus(dsHdmiInPort_t port, bool allmStatus) override;
void OnHdmiInAVIContentType(dsHdmiInPort_t port, dsAviContentType_t aviContentType) override;
void OnHdmiInVRRStatus(dsHdmiInPort_t port, dsVRRType_t vrrType) override;

/* CompositeInEventNotification */

void OnCompositeInHotPlug(dsCompositeInPort_t port, bool isConnected) override;
void OnCompositeInSignalStatus(dsCompositeInPort_t port, dsCompInSignalStatus_t signalStatus) override;
void OnCompositeInStatus(dsCompositeInPort_t activePort, bool isPresented) override;
void OnCompositeInVideoModeUpdate(dsCompositeInPort_t activePort, dsVideoPortResolution_t videoResolution) override;

public:
static AVInput* _instance;
};
Expand Down
4 changes: 1 addition & 3 deletions HdcpProfile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ target_link_libraries(${PLUGIN_IMPLEMENTATION} PRIVATE ${NAMESPACE}Protocols::${
endif (USE_THUNDER_R4)

find_package(DS)
find_package(IARMBus)
find_package(CEC)

if (RDK_SERVICE_L2_TEST)
Expand All @@ -82,14 +81,13 @@ if (RDK_SERVICE_L2_TEST)
endif()


target_include_directories(${PLUGIN_IMPLEMENTATION} PRIVATE ${IARMBUS_INCLUDE_DIRS})
target_include_directories(${PLUGIN_IMPLEMENTATION} PRIVATE ${DS_INCLUDE_DIRS})
target_include_directories(${PLUGIN_IMPLEMENTATION} PRIVATE ../helpers)


set_source_files_properties(HdcpProfile.cpp PROPERTIES COMPILE_FLAGS "-fexceptions")

target_link_libraries(${PLUGIN_IMPLEMENTATION} PUBLIC ${NAMESPACE}Plugins::${NAMESPACE}Plugins ${IARMBUS_LIBRARIES} ${DS_LIBRARIES})
target_link_libraries(${PLUGIN_IMPLEMENTATION} PUBLIC ${NAMESPACE}Plugins::${NAMESPACE}Plugins ${DS_LIBRARIES})

install(TARGETS ${PLUGIN_IMPLEMENTATION}
DESTINATION lib/${STORAGE_DIRECTORY}/plugins)
Expand Down
81 changes: 23 additions & 58 deletions HdcpProfile/HdcpProfileImplementation.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**

Check failure on line 1 in HdcpProfile/HdcpProfileImplementation.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'HdcpProfile/HdcpProfileImplementation.cpp' (Match: rdkcentral/rdkservices/1, 343 lines, url: https://github.com/rdkcentral/rdkservices/archive/GRT_v1.tar.gz, file: HdcpProfile/HdcpProfile.cpp)
* If not stated otherwise in this file or this component's LICENSE
* file the following copyright and licenses apply:
*
Expand All @@ -23,14 +23,9 @@

#include "videoOutputPort.hpp"
#include "videoOutputPortConfig.hpp"
#include "dsMgr.h"
#include "manager.hpp"
#include "host.hpp"

#include "UtilsJsonRpc.h"
#include "UtilsIarm.h"

#include "UtilsSynchroIarm.hpp"

#define HDMI_HOT_PLUG_EVENT_CONNECTED 0
#define HDMI_HOT_PLUG_EVENT_DISCONNECTED 1
Expand Down Expand Up @@ -61,14 +56,15 @@
HdcpProfileImplementation::~HdcpProfileImplementation()
{
LOGINFO("Call HdcpProfileImplementation destructor\n");
device::Host::getInstance().UnRegister(baseInterface<device::Host::IVideoOutputPortEvents>());
device::Host::getInstance().UnRegister(baseInterface<device::Host::IDisplayDeviceEvents>());
if (_powerManagerPlugin) {
_powerManagerPlugin.Reset();
}
if(_service != nullptr)
{
_service->Release();
}
DeinitializeIARM();
HdcpProfileImplementation::_instance = nullptr;
mShell = nullptr;
}
Expand All @@ -82,26 +78,7 @@
.createInterface();
}

void HdcpProfileImplementation::InitializeIARM()
{
Utils::IARM::init();

IARM_Result_t res;
IARM_CHECK( Utils::Synchro::RegisterLockedIarmEventHandler<HdcpProfileImplementation>(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG, dsHdmiEventHandler) );
IARM_CHECK( Utils::Synchro::RegisterLockedIarmEventHandler<HdcpProfileImplementation>(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDCP_STATUS, dsHdmiEventHandler) );
}

void HdcpProfileImplementation::DeinitializeIARM()
{
if (Utils::IARM::isConnected())
{
IARM_Result_t res;
IARM_CHECK( Utils::Synchro::RemoveLockedEventHandler<HdcpProfileImplementation>(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG, dsHdmiEventHandler) );
IARM_CHECK( Utils::Synchro::RemoveLockedEventHandler<HdcpProfileImplementation>(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDCP_STATUS, dsHdmiEventHandler) );
}
}

void HdcpProfileImplementation::onHdmiOutputHotPlug(int connectStatus)
void HdcpProfileImplementation::onHdmiOutputHotPlug(dsDisplayEvent_t connectStatus)
{
if (HDMI_HOT_PLUG_EVENT_CONNECTED == connectStatus)
{
Expand Down Expand Up @@ -137,49 +114,36 @@
status.hdcpReason);
}

void HdcpProfileImplementation::onHdmiOutputHDCPStatusEvent(int hdcpStatus)
void HdcpProfileImplementation::onHdmiOutputHDCPStatusEvent(dsHdcpStatus_t hdcpStatus)
{
LOGINFO("hdcpStatus[%d]",hdcpStatus);
onHdcpProfileDisplayConnectionChanged();
}

void HdcpProfileImplementation::dsHdmiEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
void HdcpProfileImplementation::OnDisplayHDMIHotPlug(dsDisplayEvent_t displayEvent)
{
LOGINFO("Received OnDisplayHDMIHotPlug event data:%d \r\n", displayEvent);
HdcpProfileImplementation::_instance->onHdmiOutputHotPlug(displayEvent);
}

void HdcpProfileImplementation::OnHDCPStatusChange(dsHdcpStatus_t hdcpStatus)
{
uint32_t res = Core::ERROR_GENERAL;
PowerState pwrStateCur = WPEFramework::Exchange::IPowerManager::POWER_STATE_UNKNOWN;
PowerState pwrStatePrev = WPEFramework::Exchange::IPowerManager::POWER_STATE_UNKNOWN;

if(!HdcpProfileImplementation::_instance)
return;

if (IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG == eventId)
{
IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
int hdmi_hotplug_event = eventData->data.hdmi_hpd.event;
LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG event data:%d \r\n", hdmi_hotplug_event);

HdcpProfileImplementation::_instance->onHdmiOutputHotPlug(hdmi_hotplug_event);
}
else if (IARM_BUS_DSMGR_EVENT_HDCP_STATUS == eventId)
{
ASSERT (_powerManagerPlugin);
if (_powerManagerPlugin){
res = _powerManagerPlugin->GetPowerState(pwrStateCur, pwrStatePrev);
if (Core::ERROR_NONE != res)
{
LOGWARN("Failed to Invoke RPC method: GetPowerState");
}
else
{
IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
int hdcpStatus = eventData->data.hdmi_hdcp.hdcpStatus;
LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDCP_STATUS event data:%d param.curState: %d \r\n", hdcpStatus,pwrStateCur);
HdcpProfileImplementation::_instance->onHdmiOutputHDCPStatusEvent(hdcpStatus);
}

ASSERT (_powerManagerPlugin);
if (_powerManagerPlugin){
res = _powerManagerPlugin->GetPowerState(pwrStateCur, pwrStatePrev);
if (Core::ERROR_NONE != res)
{
LOGWARN("Failed to Invoke RPC method: GetPowerState");
}
LOGINFO("Received OnHDCPStatusChange event data:%d param.curState: %d \r\n", hdcpStatus,pwrStateCur);
HdcpProfileImplementation::_instance->onHdmiOutputHDCPStatusEvent(hdcpStatus);
}
}

/**
* Register a notification callback
*/
Expand Down Expand Up @@ -243,7 +207,8 @@
_service = service;
_service->AddRef();
ASSERT(service != nullptr);
InitializeIARM();
device::Host::getInstance().Register(baseInterface<device::Host::IVideoOutputPortEvents>(),"WPE::HdcpProfile");
device::Host::getInstance().Register(baseInterface<device::Host::IDisplayDeviceEvents>(),"WPE::HdcpProfile");
InitializePowerManager(service);
return result;
}
Expand Down
29 changes: 18 additions & 11 deletions HdcpProfile/HdcpProfileImplementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,27 @@
#include <core/core.h>
#include <mutex>
#include <vector>
#include "libIBus.h"

#include "host.hpp"

#include "PowerManagerInterface.h"

namespace WPEFramework
{
namespace Plugin
{

class HdcpProfileImplementation : public Exchange::IHdcpProfile, public Exchange::IConfiguration
class HdcpProfileImplementation : public Exchange::IHdcpProfile, public Exchange::IConfiguration, public device::Host::IVideoOutputPortEvents, public device::Host::IDisplayDeviceEvents
// , public Exchange::IConfiguration
{
public:
// We do not allow this plugin to be copied !!
HdcpProfileImplementation();
~HdcpProfileImplementation() override;


virtual void OnDisplayHDMIHotPlug(dsDisplayEvent_t displayEvent) override;
virtual void OnHDCPStatusChange(dsHdcpStatus_t hdcpStatus) override;

static HdcpProfileImplementation *instance(HdcpProfileImplementation *HdcpProfileImpl = nullptr);

// We do not allow this plugin to be copied !!
Expand Down Expand Up @@ -110,18 +113,22 @@


public:
template <typename T>
T* baseInterface()
{
static_assert(std::is_base_of<T, HdcpProfileImplementation>(), "base type mismatch");
return static_cast<T*>(this);
}

Core::hresult Register(Exchange::IHdcpProfile::INotification *notification) override;
Core::hresult Unregister(Exchange::IHdcpProfile::INotification *notification) override;

Core::hresult GetHDCPStatus(HDCPStatus& hdcpstatus,bool& success) override;
Core::hresult GetSettopHDCPSupport(string& supportedHDCPVersion,bool& isHDCPSupported,bool& success) override;
bool GetHDCPStatusInternal(HDCPStatus& hdcpstatus);
void InitializePowerManager(PluginHost::IShell *service);
void InitializeIARM();
void DeinitializeIARM();
static void dsHdmiEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
void onHdmiOutputHotPlug(int connectStatus);
void onHdmiOutputHDCPStatusEvent(int);
void onHdmiOutputHotPlug(dsDisplayEvent_t connectStatus);
void onHdmiOutputHDCPStatusEvent(dsHdcpStatus_t);
void logHdcpStatus (const char *trigger, HDCPStatus& status);
void onHdcpProfileDisplayConnectionChanged();
static PowerManagerInterfaceRef _powerManagerPlugin;
Expand All @@ -143,4 +150,4 @@
};

} // namespace Plugin
} // namespace WPEFramework
} // namespace WPEFramework
Loading
Loading