Skip to content

Commit

Permalink
Merge branch 'rdkcentral:sprint/24Q4' into 52028-24Q4
Browse files Browse the repository at this point in the history
  • Loading branch information
tamilselvanak authored Nov 28, 2024
2 parents 5d6b866 + ab38eb4 commit eeffb0c
Show file tree
Hide file tree
Showing 13 changed files with 263 additions and 28 deletions.
74 changes: 57 additions & 17 deletions AVInput/AVInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ void AVInput::InitializeIARM()
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,
Expand Down Expand Up @@ -204,6 +208,9 @@ void AVInput::DeinitializeIARM()
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));
}
Expand Down Expand Up @@ -750,17 +757,18 @@ void AVInput::AVInputStatusChange( int port , bool isPresented, int type)
* @param[in] port HDMI In port id.
* @param[dsVideoPortResolution_t] video resolution data
*/
void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolution)
void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolution, int type)
{
LOGWARN("AVInputVideoModeUpdate [%d]", port);

JsonObject params;
params["id"] = port;
std::stringstream locator;
locator << "hdmiin://localhost/deviceid/" << port;
params["locator"] = locator.str();
if(type == HDMI){

locator << "hdmiin://localhost/deviceid/" << port;
switch(resolution.pixelResolution) {

switch(resolution.pixelResolution) {
case dsVIDEO_PIXELRES_720x480:
params["width"] = 720;
params["height"] = 480;
Expand All @@ -775,8 +783,8 @@ void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolut
params["width"] = 1280;
params["height"] = 720;
break;

case dsVIDEO_PIXELRES_1920x1080:
case dsVIDEO_PIXELRES_1920x1080:
params["width"] = 1920;
params["height"] = 1080;
break;
Expand All @@ -795,10 +803,31 @@ void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolut
params["width"] = 1920;
params["height"] = 1080;
break;
}
params["progressive"] = (!resolution.interlaced);
}
else if(type == COMPOSITE)
{
locator << "cvbsin://localhost/deviceid/" << port;
switch(resolution.pixelResolution) {
case dsVIDEO_PIXELRES_720x480:
params["width"] = 720;
params["height"] = 480;
break;
case dsVIDEO_PIXELRES_720x576:
params["width"] = 720;
params["height"] = 576;
break;
default:
params["width"] = 720;
params["height"] = 576;
break;
}

params["progressive"] = (!resolution.interlaced);
params["progressive"] = false;
}

params["locator"] = locator.str();
switch(resolution.frameRate) {
case dsVIDEO_FRAMERATE_24:
params["frameRateN"] = 24000;
Expand Down Expand Up @@ -851,16 +880,17 @@ void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolut

void AVInput::dsAviContentTypeEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
{
if(!AVInput::_instance)
return;
if(!AVInput::_instance)
return;

if (IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE == eventId)
{
IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
int hdmi_in_port = eventData->data.hdmi_in_content_type.port;
int avi_content_type = eventData->data.hdmi_in_content_type.aviContentType;
LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE event port: %d, Content Type : %d", hdmi_in_port,avi_content_type);
AVInput::_instance->hdmiInputAviContentTypeChange(hdmi_in_port, avi_content_type);
if (IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE == eventId)
{
IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
int hdmi_in_port = eventData->data.hdmi_in_content_type.port;
int avi_content_type = eventData->data.hdmi_in_content_type.aviContentType;
LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE event port: %d, Content Type : %d", hdmi_in_port,avi_content_type);

AVInput::_instance->hdmiInputAviContentTypeChange(hdmi_in_port, avi_content_type);
}
}

Expand Down Expand Up @@ -943,7 +973,17 @@ void AVInput::dsAVVideoModeEventHandler(const char *owner, IARM_EventId_t eventI
resolution.interlaced = eventData->data.hdmi_in_video_mode.resolution.interlaced;
resolution.frameRate = eventData->data.hdmi_in_video_mode.resolution.frameRate;
LOGWARN("Received IARM_BUS_DSMGR_EVENT_HDMI_IN_VIDEO_MODE_UPDATE event port: %d, pixelResolution: %d, interlaced : %d, frameRate: %d \n", hdmi_in_port,resolution.pixelResolution, resolution.interlaced, resolution.frameRate);
AVInput::_instance->AVInputVideoModeUpdate(hdmi_in_port, resolution);
AVInput::_instance->AVInputVideoModeUpdate(hdmi_in_port, resolution,HDMI);
}
else if (IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE == eventId) {
IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
int composite_in_port = eventData->data.composite_in_video_mode.port;
dsVideoPortResolution_t resolution = {};
resolution.pixelResolution = eventData->data.composite_in_video_mode.resolution.pixelResolution;
resolution.interlaced = eventData->data.composite_in_video_mode.resolution.interlaced;
resolution.frameRate = eventData->data.composite_in_video_mode.resolution.frameRate;
LOGWARN("Received IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE event port: %d, pixelResolution: %d, interlaced : %d, frameRate: %d \n", composite_in_port,resolution.pixelResolution, resolution.interlaced, resolution.frameRate);
AVInput::_instance->AVInputVideoModeUpdate(composite_in_port, resolution,COMPOSITE);
}
}

Expand Down
2 changes: 1 addition & 1 deletion AVInput/AVInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class AVInput: public PluginHost::IPlugin, public PluginHost::JSONRPC
void AVInputStatusChange( int port , bool isPresented, int type);
static void dsAVStatusEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);

void AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolution);
void AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolution,int type);
static void dsAVVideoModeEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);

void AVInputALLMChange( int port , bool allmMode);
Expand Down
2 changes: 1 addition & 1 deletion AVInput/AVInput.json
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@
}
},
"videoStreamInfoUpdate": {
"summary": "Triggered whenever there is an update in HDMI Input video stream info",
"summary": "Triggered whenever there is an update in HDMI/Composite Input video stream info",
"params": {
"type": "object",
"properties": {
Expand Down
105 changes: 105 additions & 0 deletions CompositeInput/CompositeInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#define COMPOSITEINPUT_EVENT_ON_DEVICES_CHANGED "onDevicesChanged"
#define COMPOSITEINPUT_EVENT_ON_SIGNAL_CHANGED "onSignalChanged"
#define COMPOSITEINPUT_EVENT_ON_STATUS_CHANGED "onInputStatusChanged"
#define COMPOSITEINPUT_EVENT_ON_VIDEO_MODE_UPDATED "videoStreamInfoUpdate"

namespace WPEFramework
{
Expand Down Expand Up @@ -103,6 +104,7 @@ namespace WPEFramework
IARM_CHECK( IARM_Bus_RegisterEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_HOTPLUG, dsCompositeEventHandler) );
IARM_CHECK( IARM_Bus_RegisterEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_SIGNAL_STATUS, dsCompositeSignalStatusEventHandler) );
IARM_CHECK( IARM_Bus_RegisterEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_STATUS, dsCompositeStatusEventHandler) );
IARM_CHECK( IARM_Bus_RegisterEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE,dsCompositeVideoModeEventHandler) );
}
}

Expand All @@ -114,6 +116,7 @@ namespace WPEFramework
IARM_CHECK( IARM_Bus_RemoveEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_HOTPLUG, dsCompositeEventHandler) );
IARM_CHECK( IARM_Bus_RemoveEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_SIGNAL_STATUS, dsCompositeSignalStatusEventHandler) );
IARM_CHECK( IARM_Bus_RemoveEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_STATUS, dsCompositeStatusEventHandler) );
IARM_CHECK( IARM_Bus_RemoveEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE, dsCompositeVideoModeEventHandler) );
}
}

Expand Down Expand Up @@ -361,6 +364,89 @@ namespace WPEFramework

sendNotify(COMPOSITEINPUT_EVENT_ON_STATUS_CHANGED, params);
}
/**
* @brief This function is used to translate Composite input video mode change to
* videoStreamInfoUpdate event.
*
* @param[in] port Composite In port id.
* @param[dsVideoPortResolution_t] video resolution data
*/
void CompositeInput::compositeInputVideoModeUpdate( int port , dsVideoPortResolution_t resolution)
{
LOGWARN("compositeInputVideoModeUpdate [%d]", port);

JsonObject params;
params["id"] = port;
std::stringstream locator;
locator << "cvbsin://localhost/deviceid/" << port;
params["locator"] = locator.str();

switch(resolution.pixelResolution) {
case dsVIDEO_PIXELRES_720x480:
params["width"] = 720;
params["height"] = 480;
break;
case dsVIDEO_PIXELRES_720x576:
params["width"] = 720;
params["height"] = 576;
break;
default:
params["width"] = 720;
params["height"] = 576;
break;
}

params["progressive"] = false;

switch(resolution.frameRate) {
case dsVIDEO_FRAMERATE_24:
params["frameRateN"] = 24000;
params["frameRateD"] = 1000;
break;

case dsVIDEO_FRAMERATE_25:
params["frameRateN"] = 25000;
params["frameRateD"] = 1000;
break;

case dsVIDEO_FRAMERATE_30:
params["frameRateN"] = 30000;
params["frameRateD"] = 1000;
break;

case dsVIDEO_FRAMERATE_50:
params["frameRateN"] = 50000;
params["frameRateD"] = 1000;
break;

case dsVIDEO_FRAMERATE_60:
params["frameRateN"] = 60000;
params["frameRateD"] = 1000;
break;

case dsVIDEO_FRAMERATE_23dot98:
params["frameRateN"] = 24000;
params["frameRateD"] = 1001;
break;

case dsVIDEO_FRAMERATE_29dot97:
params["frameRateN"] = 30000;
params["frameRateD"] = 1001;
break;

case dsVIDEO_FRAMERATE_59dot94:
params["frameRateN"] = 60000;
params["frameRateD"] = 1001;
break;

default:
params["frameRateN"] = 60000;
params["frameRateD"] = 1000;
break;
}

sendNotify(COMPOSITEINPUT_EVENT_ON_VIDEO_MODE_UPDATED, params);
}

void CompositeInput::dsCompositeEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
{
Expand Down Expand Up @@ -409,6 +495,25 @@ namespace WPEFramework
CompositeInput::_instance->compositeInputStatusChange(composite_in_port, composite_in_status);
}
}
void CompositeInput::dsCompositeVideoModeEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
{
if(!CompositeInput::_instance)
return;

if (IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE == eventId)
{
IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
int composite_in_port = eventData->data.composite_in_video_mode.port;
dsVideoPortResolution_t resolution = {};
resolution.pixelResolution = eventData->data.composite_in_video_mode.resolution.pixelResolution;
resolution.interlaced = eventData->data.composite_in_video_mode.resolution.interlaced;
resolution.frameRate = eventData->data.composite_in_video_mode.resolution.frameRate;
LOGWARN("Received IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE event port: %d, pixelResolution: %d, interlaced : %d, frameRate: %d \n", composite_in_port,resolution.pixelResolution, resolution.interlaced, resolution.frameRate);

CompositeInput::_instance->compositeInputVideoModeUpdate(composite_in_port, resolution);

}
}

} // namespace Plugin
} // namespace WPEFramework
4 changes: 3 additions & 1 deletion CompositeInput/CompositeInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#pragma once

#include "libIBus.h"

#include "dsTypes.h"
#include "Module.h"

namespace WPEFramework {
Expand Down Expand Up @@ -70,6 +70,8 @@ namespace WPEFramework {
void compositeInputStatusChange( int port , bool isPresented);
static void dsCompositeStatusEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);

void compositeInputVideoModeUpdate( int port , dsVideoPortResolution_t resolution);
static void dsCompositeVideoModeEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
public:
CompositeInput();
virtual ~CompositeInput();
Expand Down
48 changes: 48 additions & 0 deletions CompositeInput/CompositeInput.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,54 @@
"signalStatus"
]
}
},
"videoStreamInfoUpdate": {
"summary": "Triggered whenever there is an update in HDMI/Composite Input video stream info",
"params": {
"type": "object",
"properties": {
"id": {
"$ref": "#/definitions/id"
},
"locator": {
"$ref": "#/definitions/locator"
},
"width": {
"summary": "Width of the Video Stream",
"type": "integer",
"example": 3840
},
"height": {
"summary": "Height of the Video Stream",
"type": "integer",
"example": 2160
},
"progressive": {
"summary": "Whether the streaming video is progressive or not?",
"type": "boolean",
"example": true
},
"frameRateN": {
"summary": "FrameRate Numerator",
"type": "integer",
"example": 60000
},
"frameRateD": {
"summary": "FrameRate Denomirator",
"type": "integer",
"example": 1001
}
},
"required": [
"id",
"locator",
"width",
"height",
"progressive",
"frameRateN",
"frameRateD"
]
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions PlayerInfo/DeviceSettings/PlatformImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ class PlayerInfoImplementation : public Exchange::IPlayerProperties, public Exch
else if(soundmode == device::AudioStereoMode::kStereo) mode = STEREO;
else if(soundmode == device::AudioStereoMode::kMono) mode = MONO;
else if(soundmode == device::AudioStereoMode::kPassThru) mode = PASSTHRU;
else if(soundmode == device::AudioStereoMode::kDD) mode = DOLBYDIGITAL;
else if(soundmode == device::AudioStereoMode::kDDPlus) mode = DOLBYDIGITALPLUS;
else mode = UNKNOWN;

/* Auto mode applicable for HDMI Arc and SPDIF */
Expand Down
Loading

0 comments on commit eeffb0c

Please sign in to comment.