-
Notifications
You must be signed in to change notification settings - Fork 3
[RDKEMW-6168] Update AVInput with libds client library notifications #248
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
base: develop
Are you sure you want to change the base?
Changes from 11 commits
05bd5b7
8349223
c78de9b
8089d93
cae99bf
edcb205
1e58a4a
ff7414f
d61701e
5c073c6
edf04fd
4f0f28f
d9a6466
bfbe61f
1955e35
0b27a74
adce966
519991f
ddd7e67
b62268d
751657a
2079be6
ef95957
4ee9e4b
e8066e0
ad33319
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** | ||
Check failure on line 1 in AVInput/AVInput.cpp
|
||
* If not stated otherwise in this file or this component's LICENSE | ||
* file the following copyright and licenses apply: | ||
* | ||
|
@@ -18,13 +18,12 @@ | |
**/ | ||
|
||
#include "AVInput.h" | ||
#include "dsMgr.h" | ||
|
||
#include "hdmiIn.hpp" | ||
#include "compositeIn.hpp" | ||
Prathyushakothuru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#include "UtilsJsonRpc.h" | ||
#include "UtilsIarm.h" | ||
#include "host.hpp" | ||
|
||
#include "exception.hpp" | ||
#include <vector> | ||
|
@@ -113,6 +112,7 @@ | |
|
||
AVInput::AVInput() | ||
: PluginHost::JSONRPC() | ||
, _registeredDsEventHandlers(false) | ||
{ | ||
RegisterAll(); | ||
} | ||
|
@@ -125,14 +125,38 @@ | |
const string AVInput::Initialize(PluginHost::IShell * /* service */) | ||
{ | ||
AVInput::_instance = this; | ||
InitializeIARM(); | ||
try | ||
{ | ||
device::Manager::Initialize(); | ||
LOGINFO("device::Manager::Initialize success"); | ||
registerDsEventHandlers(); | ||
} | ||
catch(const device::Exception& err) | ||
Prathyushakothuru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
LOGINFO("device::Manager::Initialize failed"); | ||
Prathyushakothuru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
LOG_DEVICE_EXCEPTION0(); | ||
} | ||
|
||
return (string()); | ||
} | ||
|
||
void AVInput::Deinitialize(PluginHost::IShell * /* service */) | ||
{ | ||
DeinitializeIARM(); | ||
|
||
device::Host::getInstance().UnRegister(baseInterface<device::Host::IHdmiInEvents>()); | ||
device::Host::getInstance().UnRegister(baseInterface<device::Host::ICompositeInEvents>()); | ||
_registeredDsEventHandlers = false; | ||
try | ||
{ | ||
device::Manager::DeInitialize(); | ||
LOGINFO("device::Manager::DeInitialize success"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. correct the try-catch block alignment wrt other places where it is already used. |
||
} | ||
catch(const device::Exception& err) | ||
{ | ||
LOGINFO("device::Manager::DeInitialize failed"); | ||
LOG_DEVICE_EXCEPTION0(); | ||
} | ||
|
||
AVInput::_instance = nullptr; | ||
} | ||
|
||
|
@@ -141,97 +165,6 @@ | |
return (string()); | ||
} | ||
|
||
void AVInput::InitializeIARM() | ||
{ | ||
if (Utils::IARM::init()) { | ||
IARM_Result_t res; | ||
IARM_CHECK(IARM_Bus_RegisterEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_HDMI_IN_HOTPLUG, | ||
dsAVEventHandler)); | ||
IARM_CHECK(IARM_Bus_RegisterEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_HDMI_IN_SIGNAL_STATUS, | ||
dsAVSignalStatusEventHandler)); | ||
IARM_CHECK(IARM_Bus_RegisterEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_HDMI_IN_STATUS, | ||
dsAVStatusEventHandler)); | ||
IARM_CHECK(IARM_Bus_RegisterEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_HDMI_IN_VIDEO_MODE_UPDATE, | ||
dsAVVideoModeEventHandler)); | ||
IARM_CHECK(IARM_Bus_RegisterEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_HDMI_IN_ALLM_STATUS, | ||
dsAVGameFeatureStatusEventHandler)); | ||
IARM_CHECK(IARM_Bus_RegisterEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_HDMI_IN_VRR_STATUS, | ||
dsAVGameFeatureStatusEventHandler)); | ||
IARM_CHECK(IARM_Bus_RegisterEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_HOTPLUG, | ||
dsAVEventHandler)); | ||
IARM_CHECK(IARM_Bus_RegisterEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_SIGNAL_STATUS, | ||
dsAVSignalStatusEventHandler)); | ||
IARM_CHECK(IARM_Bus_RegisterEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_STATUS, | ||
dsAVStatusEventHandler)); | ||
IARM_CHECK(IARM_Bus_RegisterEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE, | ||
dsAVVideoModeEventHandler)); | ||
IARM_CHECK(IARM_Bus_RegisterEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE, | ||
dsAviContentTypeEventHandler)); | ||
} | ||
} | ||
|
||
void AVInput::DeinitializeIARM() | ||
{ | ||
if (Utils::IARM::isConnected()) { | ||
IARM_Result_t res; | ||
IARM_CHECK(IARM_Bus_RemoveEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_HDMI_IN_HOTPLUG, dsAVEventHandler)); | ||
IARM_CHECK(IARM_Bus_RemoveEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_HDMI_IN_SIGNAL_STATUS, dsAVSignalStatusEventHandler)); | ||
IARM_CHECK(IARM_Bus_RemoveEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_HDMI_IN_STATUS, dsAVStatusEventHandler)); | ||
IARM_CHECK(IARM_Bus_RemoveEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_HDMI_IN_VIDEO_MODE_UPDATE, dsAVVideoModeEventHandler)); | ||
IARM_CHECK(IARM_Bus_RemoveEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_HDMI_IN_ALLM_STATUS, dsAVGameFeatureStatusEventHandler)); | ||
IARM_CHECK(IARM_Bus_RemoveEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_HDMI_IN_VRR_STATUS, dsAVGameFeatureStatusEventHandler)); | ||
IARM_CHECK(IARM_Bus_RemoveEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_HOTPLUG, dsAVEventHandler)); | ||
IARM_CHECK(IARM_Bus_RemoveEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_SIGNAL_STATUS, dsAVSignalStatusEventHandler)); | ||
IARM_CHECK(IARM_Bus_RemoveEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_STATUS, dsAVStatusEventHandler)); | ||
IARM_CHECK(IARM_Bus_RemoveEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE, dsAVVideoModeEventHandler)); | ||
IARM_CHECK(IARM_Bus_RemoveEventHandler( | ||
IARM_BUS_DSMGR_NAME, | ||
IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE, dsAviContentTypeEventHandler)); | ||
} | ||
} | ||
|
||
void AVInput::RegisterAll() | ||
{ | ||
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_NUMBER_OF_INPUTS), &AVInput::endpoint_numberOfInputs, this); | ||
|
@@ -923,7 +856,7 @@ | |
|
||
sendNotify(AVINPUT_EVENT_ON_VIDEO_MODE_UPDATED, params); | ||
} | ||
|
||
#if 0 | ||
Prathyushakothuru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
void AVInput::dsAviContentTypeEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) | ||
{ | ||
if(!AVInput::_instance) | ||
|
@@ -939,6 +872,7 @@ | |
AVInput::_instance->hdmiInputAviContentTypeChange(hdmi_in_port, avi_content_type); | ||
} | ||
} | ||
#endif | ||
|
||
void AVInput::hdmiInputAviContentTypeChange( int port , int content_type) | ||
{ | ||
|
@@ -948,6 +882,7 @@ | |
sendNotify(AVINPUT_EVENT_ON_AVI_CONTENT_TYPE_CHANGED, params); | ||
} | ||
|
||
#if 0 | ||
void AVInput::dsAVEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) | ||
{ | ||
if(!AVInput::_instance) | ||
|
@@ -1071,6 +1006,8 @@ | |
} | ||
} | ||
|
||
#endif | ||
|
||
void AVInput::AVInputALLMChange( int port , bool allm_mode) | ||
{ | ||
JsonObject params; | ||
|
@@ -1792,5 +1729,146 @@ | |
return edidVersion; | ||
} | ||
|
||
void AVInput::registerDsEventHandlers() | ||
Prathyushakothuru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
LOGINFO("registerDsEventHandlers"); | ||
if(!_registeredDsEventHandlers) | ||
{ | ||
_registeredDsEventHandlers = true; | ||
device::Host::getInstance().Register(baseInterface<device::Host::IHdmiInEvents>()); | ||
Prathyushakothuru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
device::Host::getInstance().Register(baseInterface<device::Host::ICompositeInEvents>()); | ||
} | ||
} | ||
|
||
/* HDMIInEventsNotification*/ | ||
|
||
void AVInput::OnHdmiInAVIContentType(dsHdmiInPort_t port, dsAviContentType_t aviContentType) | ||
{ | ||
LOGINFO("Received OnHdmiInAVIContentType callback, port: %d, Content Type: %d", port, aviContentType); | ||
|
||
if(AVInput::_instance) { | ||
AVInput::_instance->hdmiInputAviContentTypeChange(port, aviContentType); | ||
} | ||
} | ||
|
||
void AVInput::OnHdmiInEventHotPlug(dsHdmiInPort_t port, bool isConnected) | ||
{ | ||
LOGINFO("Received OnHdmiInEventHotPlug callback, port: %d, isConnected: %s", port, isConnected ? "true" : "false"); | ||
|
||
if(AVInput::_instance) { | ||
AVInput::_instance->AVInputHotplug(port,isConnected ? AV_HOT_PLUG_EVENT_CONNECTED : AV_HOT_PLUG_EVENT_DISCONNECTED, HDMI); | ||
} | ||
} | ||
|
||
void AVInput::OnHdmiInEventSignalStatus(dsHdmiInPort_t port, dsHdmiInSignalStatus_t signalStatus) | ||
{ | ||
LOGINFO("Received OnHdmiInEventSignalStatus callback, port: %d, signalStatus: %d",port, signalStatus); | ||
|
||
if(AVInput::_instance) { | ||
AVInput::_instance->AVInputSignalChange(port, signalStatus, HDMI); | ||
} | ||
} | ||
|
||
void AVInput::OnHdmiInEventStatus(dsHdmiInPort_t activePort, bool isPresented) | ||
{ | ||
LOGINFO("Received OnHdmiInEventStatus callback, port: %d, isPresented: %s",activePort, isPresented ? "true" : "false"); | ||
|
||
if (AVInput::_instance) { | ||
AVInput::_instance->AVInputStatusChange(activePort, isPresented, HDMI); | ||
} | ||
} | ||
|
||
void AVInput::OnHdmiInVideoModeUpdate(dsHdmiInPort_t port, const dsVideoPortResolution_t& videoPortResolution) | ||
{ | ||
LOGINFO("Received OnHdmiInVideoModeUpdate callback, port: %d, pixelResolution: %d, interlaced: %d, frameRate: %d", | ||
port, | ||
videoPortResolution.pixelResolution, | ||
videoPortResolution.interlaced, | ||
videoPortResolution.frameRate); | ||
|
||
if (AVInput::_instance) { | ||
AVInput::_instance->AVInputVideoModeUpdate(port, videoPortResolution, HDMI); | ||
} | ||
} | ||
|
||
void AVInput::OnHdmiInAllmStatus(dsHdmiInPort_t port, bool allmStatus) | ||
{ | ||
LOGINFO("Received OnHdmiInAllmStatus callback, port: %d, ALLM Mode: %s", | ||
port, allmStatus ? "true" : "false"); | ||
|
||
if (AVInput::_instance) { | ||
AVInput::_instance->AVInputALLMChange(port, allmStatus); | ||
} | ||
} | ||
|
||
void AVInput::OnHdmiInVRRStatus(dsHdmiInPort_t port, dsVRRType_t vrrType) | ||
{ | ||
LOGINFO("Received OnHdmiInVRRStatus callback, port: %d, VRR Type: %d", | ||
port, vrrType); | ||
|
||
if (!AVInput::_instance) | ||
return; | ||
|
||
// Handle transitions | ||
if (vrrType == dsVRR_NONE) { | ||
if (AVInput::_instance->m_currentVrrType != dsVRR_NONE) { | ||
AVInput::_instance->AVInputVRRChange(port,AVInput::_instance->m_currentVrrType,false); | ||
} | ||
} else { | ||
if (AVInput::_instance->m_currentVrrType != dsVRR_NONE) { | ||
AVInput::_instance->AVInputVRRChange(port,AVInput::_instance->m_currentVrrType,false); | ||
} | ||
AVInput::_instance->AVInputVRRChange(port,vrrType,true); | ||
} | ||
|
||
AVInput::_instance->m_currentVrrType = vrrType; | ||
} | ||
|
||
|
||
/*CompositeInEventsNotification*/ | ||
|
||
void AVInput::OnCompositeInHotPlug(dsCompositeInPort_t port, bool isConnected) | ||
{ | ||
LOGINFO("Received OnCompositeInHotPlug callback, port: %d, isConnected: %s",port, isConnected ? "true" : "false"); | ||
|
||
if(AVInput::_instance) { | ||
AVInput::_instance->AVInputHotplug(port,isConnected ? AV_HOT_PLUG_EVENT_CONNECTED : AV_HOT_PLUG_EVENT_DISCONNECTED,COMPOSITE); | ||
} | ||
} | ||
|
||
void AVInput::OnCompositeInSignalStatus(dsCompositeInPort_t port, dsCompInSignalStatus_t signalStatus) | ||
{ | ||
LOGINFO("Received OnCompositeInSignalStatus callback, port: %d, signalStatus: %d",port, signalStatus); | ||
|
||
if(AVInput::_instance) { | ||
AVInput::_instance->AVInputSignalChange(port, signalStatus, COMPOSITE); | ||
} | ||
} | ||
|
||
void AVInput::OnCompositeInStatus(dsCompositeInPort_t activePort, bool isPresented) | ||
{ | ||
LOGINFO("Received OnCompositeInStatus callback, port: %d, isPresented: %s", | ||
activePort, isPresented ? "true" : "false"); | ||
|
||
if (AVInput::_instance) { | ||
AVInput::_instance->AVInputStatusChange(activePort, isPresented, COMPOSITE); | ||
} | ||
} | ||
|
||
void AVInput::OnCompositeInVideoModeUpdate(dsCompositeInPort_t activePort, dsVideoPortResolution_t videoResolution) | ||
{ | ||
LOGINFO("Received OnCompositeInVideoModeUpdate callback, port: %d, pixelResolution: %d, interlaced: %d, frameRate: %d", | ||
activePort, | ||
videoResolution.pixelResolution, | ||
videoResolution.interlaced, | ||
videoResolution.frameRate); | ||
|
||
if (AVInput::_instance) { | ||
AVInput::_instance->AVInputVideoModeUpdate(activePort, videoResolution, COMPOSITE); | ||
} | ||
} | ||
|
||
|
||
|
||
} // namespace Plugin | ||
} // namespace WPEFramework |
Uh oh!
There was an error while loading. Please reload this page.