31
31
#include < algorithm>
32
32
33
33
#define API_VERSION_NUMBER_MAJOR 1
34
- #define API_VERSION_NUMBER_MINOR 6
35
- #define API_VERSION_NUMBER_PATCH 0
34
+ #define API_VERSION_NUMBER_MINOR 7
35
+ #define API_VERSION_NUMBER_PATCH 1
36
36
37
37
#define HDMI 0
38
38
#define COMPOSITE 1
48
48
#define AVINPUT_METHOD_GET_EDID_VERSION " getEdidVersion"
49
49
#define AVINPUT_METHOD_SET_EDID_ALLM_SUPPORT " setEdid2AllmSupport"
50
50
#define AVINPUT_METHOD_GET_EDID_ALLM_SUPPORT " getEdid2AllmSupport"
51
+ #define AVINPUT_METHOD_GET_HDMI_COMPATIBILITY_VERSION " getHdmiVersion"
51
52
#define AVINPUT_METHOD_SET_MIXER_LEVELS " setMixerLevels"
52
53
#define AVINPUT_METHOD_START_INPUT " startInput"
53
54
#define AVINPUT_METHOD_STOP_INPUT " stopInput"
@@ -167,6 +168,10 @@ void AVInput::InitializeIARM()
167
168
IARM_BUS_DSMGR_NAME,
168
169
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_STATUS,
169
170
dsAVStatusEventHandler));
171
+ IARM_CHECK (IARM_Bus_RegisterEventHandler (
172
+ IARM_BUS_DSMGR_NAME,
173
+ IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE,
174
+ dsAVVideoModeEventHandler));
170
175
IARM_CHECK (IARM_Bus_RegisterEventHandler (
171
176
IARM_BUS_DSMGR_NAME,
172
177
IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE,
@@ -203,6 +208,9 @@ void AVInput::DeinitializeIARM()
203
208
IARM_BUS_DSMGR_NAME,
204
209
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_STATUS, dsAVStatusEventHandler));
205
210
IARM_CHECK (IARM_Bus_RemoveEventHandler (
211
+ IARM_BUS_DSMGR_NAME,
212
+ IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE, dsAVVideoModeEventHandler));
213
+ IARM_CHECK (IARM_Bus_RemoveEventHandler (
206
214
IARM_BUS_DSMGR_NAME,
207
215
IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE, dsAviContentTypeEventHandler));
208
216
}
@@ -223,6 +231,7 @@ void AVInput::RegisterAll()
223
231
Register<JsonObject, JsonObject>(_T (AVINPUT_METHOD_SET_MIXER_LEVELS), &AVInput::setMixerLevels, this );
224
232
Register<JsonObject, JsonObject>(_T (AVINPUT_METHOD_SET_EDID_ALLM_SUPPORT), &AVInput::setEdid2AllmSupportWrapper, this );
225
233
Register<JsonObject, JsonObject>(_T (AVINPUT_METHOD_GET_EDID_ALLM_SUPPORT), &AVInput::getEdid2AllmSupportWrapper, this );
234
+ Register<JsonObject, JsonObject>(_T (AVINPUT_METHOD_GET_HDMI_COMPATIBILITY_VERSION), &AVInput::getHdmiVersionWrapper, this );
226
235
Register<JsonObject, JsonObject>(_T (AVINPUT_METHOD_START_INPUT), &AVInput::startInput, this );
227
236
Register<JsonObject, JsonObject>(_T (AVINPUT_METHOD_STOP_INPUT), &AVInput::stopInput, this );
228
237
Register<JsonObject, JsonObject>(_T (AVINPUT_METHOD_SCALE_INPUT), &AVInput::setVideoRectangleWrapper, this );
@@ -748,17 +757,18 @@ void AVInput::AVInputStatusChange( int port , bool isPresented, int type)
748
757
* @param[in] port HDMI In port id.
749
758
* @param[dsVideoPortResolution_t] video resolution data
750
759
*/
751
- void AVInput::AVInputVideoModeUpdate ( int port , dsVideoPortResolution_t resolution)
760
+ void AVInput::AVInputVideoModeUpdate ( int port , dsVideoPortResolution_t resolution, int type )
752
761
{
753
762
LOGWARN (" AVInputVideoModeUpdate [%d]" , port);
754
763
755
764
JsonObject params;
756
765
params[" id" ] = port;
757
766
std::stringstream locator;
758
- locator << " hdmiin://localhost/deviceid/" << port;
759
- params[" locator" ] = locator.str ();
767
+ if (type == HDMI){
768
+
769
+ locator << " hdmiin://localhost/deviceid/" << port;
770
+ switch (resolution.pixelResolution ) {
760
771
761
- switch (resolution.pixelResolution ) {
762
772
case dsVIDEO_PIXELRES_720x480:
763
773
params[" width" ] = 720 ;
764
774
params[" height" ] = 480 ;
@@ -773,8 +783,8 @@ void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolut
773
783
params[" width" ] = 1280 ;
774
784
params[" height" ] = 720 ;
775
785
break ;
776
-
777
- case dsVIDEO_PIXELRES_1920x1080:
786
+
787
+ case dsVIDEO_PIXELRES_1920x1080:
778
788
params[" width" ] = 1920 ;
779
789
params[" height" ] = 1080 ;
780
790
break ;
@@ -793,10 +803,31 @@ void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolut
793
803
params[" width" ] = 1920 ;
794
804
params[" height" ] = 1080 ;
795
805
break ;
806
+ }
807
+ params[" progressive" ] = (!resolution.interlaced );
796
808
}
809
+ else if (type == COMPOSITE)
810
+ {
811
+ locator << " cvbsin://localhost/deviceid/" << port;
812
+ switch (resolution.pixelResolution ) {
813
+ case dsVIDEO_PIXELRES_720x480:
814
+ params[" width" ] = 720 ;
815
+ params[" height" ] = 480 ;
816
+ break ;
817
+ case dsVIDEO_PIXELRES_720x576:
818
+ params[" width" ] = 720 ;
819
+ params[" height" ] = 576 ;
820
+ break ;
821
+ default :
822
+ params[" width" ] = 720 ;
823
+ params[" height" ] = 576 ;
824
+ break ;
825
+ }
797
826
798
- params[" progressive" ] = (!resolution.interlaced );
827
+ params[" progressive" ] = false ;
828
+ }
799
829
830
+ params[" locator" ] = locator.str ();
800
831
switch (resolution.frameRate ) {
801
832
case dsVIDEO_FRAMERATE_24:
802
833
params[" frameRateN" ] = 24000 ;
@@ -849,16 +880,17 @@ void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolut
849
880
850
881
void AVInput::dsAviContentTypeEventHandler (const char *owner, IARM_EventId_t eventId, void *data, size_t len)
851
882
{
852
- if (!AVInput::_instance)
853
- return ;
883
+ if (!AVInput::_instance)
884
+ return ;
854
885
855
- if (IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE == eventId)
856
- {
857
- IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
858
- int hdmi_in_port = eventData->data .hdmi_in_content_type .port ;
859
- int avi_content_type = eventData->data .hdmi_in_content_type .aviContentType ;
860
- LOGINFO (" Received IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE event port: %d, Content Type : %d" , hdmi_in_port,avi_content_type);
861
- AVInput::_instance->hdmiInputAviContentTypeChange (hdmi_in_port, avi_content_type);
886
+ if (IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE == eventId)
887
+ {
888
+ IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
889
+ int hdmi_in_port = eventData->data .hdmi_in_content_type .port ;
890
+ int avi_content_type = eventData->data .hdmi_in_content_type .aviContentType ;
891
+ LOGINFO (" Received IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE event port: %d, Content Type : %d" , hdmi_in_port,avi_content_type);
892
+
893
+ AVInput::_instance->hdmiInputAviContentTypeChange (hdmi_in_port, avi_content_type);
862
894
}
863
895
}
864
896
@@ -941,7 +973,17 @@ void AVInput::dsAVVideoModeEventHandler(const char *owner, IARM_EventId_t eventI
941
973
resolution.interlaced = eventData->data .hdmi_in_video_mode .resolution .interlaced ;
942
974
resolution.frameRate = eventData->data .hdmi_in_video_mode .resolution .frameRate ;
943
975
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 );
944
- AVInput::_instance->AVInputVideoModeUpdate (hdmi_in_port, resolution);
976
+ AVInput::_instance->AVInputVideoModeUpdate (hdmi_in_port, resolution,HDMI);
977
+ }
978
+ else if (IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE == eventId) {
979
+ IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
980
+ int composite_in_port = eventData->data .composite_in_video_mode .port ;
981
+ dsVideoPortResolution_t resolution = {};
982
+ resolution.pixelResolution = eventData->data .composite_in_video_mode .resolution .pixelResolution ;
983
+ resolution.interlaced = eventData->data .composite_in_video_mode .resolution .interlaced ;
984
+ resolution.frameRate = eventData->data .composite_in_video_mode .resolution .frameRate ;
985
+ 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 );
986
+ AVInput::_instance->AVInputVideoModeUpdate (composite_in_port, resolution,COMPOSITE);
945
987
}
946
988
}
947
989
@@ -1362,6 +1404,53 @@ uint32_t AVInput::setEdidVersionWrapper(const JsonObject& parameters, JsonObject
1362
1404
}
1363
1405
}
1364
1406
1407
+ uint32_t AVInput::getHdmiVersionWrapper (const JsonObject& parameters, JsonObject& response)
1408
+ {
1409
+ LOGINFOMETHOD ();
1410
+ returnIfParamNotFound (parameters, " portId" );
1411
+ string sPortId = parameters[" portId" ].String ();
1412
+ int portId = 0 ;
1413
+
1414
+ try {
1415
+ portId = stoi (sPortId );
1416
+ }catch (const std::exception& err) {
1417
+ LOGWARN (" sPortId invalid paramater: %s " , sPortId .c_str ());
1418
+ returnResponse (false );
1419
+ }
1420
+
1421
+ dsHdmiMaxCapabilityVersion_t hdmiCapVersion = HDMI_COMPATIBILITY_VERSION_14;
1422
+
1423
+ try {
1424
+ device::HdmiInput::getInstance ().getHdmiVersion (portId, &(hdmiCapVersion));
1425
+ LOGWARN (" AVInput::getHdmiVersion Hdmi Version:%d" , hdmiCapVersion);
1426
+ }
1427
+ catch (const device::Exception& err) {
1428
+ LOG_DEVICE_EXCEPTION1 (std::to_string (portId));
1429
+ returnResponse (false );
1430
+ }
1431
+
1432
+
1433
+ switch ((int )hdmiCapVersion){
1434
+ case HDMI_COMPATIBILITY_VERSION_14:
1435
+ response[" HdmiCapabilityVersion" ] = " 1.4" ;
1436
+ break ;
1437
+ case HDMI_COMPATIBILITY_VERSION_20:
1438
+ response[" HdmiCapabilityVersion" ] = " 2.0" ;
1439
+ break ;
1440
+ case HDMI_COMPATIBILITY_VERSION_21:
1441
+ response[" HdmiCapabilityVersion" ] = " 2.1" ;
1442
+ break ;
1443
+ }
1444
+
1445
+
1446
+ if (hdmiCapVersion == HDMI_COMPATIBILITY_VERSION_MAX)
1447
+ {
1448
+ returnResponse (false );
1449
+ }else {
1450
+ returnResponse (true );
1451
+ }
1452
+ }
1453
+
1365
1454
int AVInput::setEdidVersion (int iPort, int iEdidVer)
1366
1455
{
1367
1456
bool ret = true ;
0 commit comments