@@ -168,6 +168,10 @@ void AVInput::InitializeIARM()
168168 IARM_BUS_DSMGR_NAME,
169169 IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_STATUS,
170170 dsAVStatusEventHandler));
171+ IARM_CHECK (IARM_Bus_RegisterEventHandler (
172+ IARM_BUS_DSMGR_NAME,
173+ IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE,
174+ dsAVVideoModeEventHandler));
171175 IARM_CHECK (IARM_Bus_RegisterEventHandler (
172176 IARM_BUS_DSMGR_NAME,
173177 IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE,
@@ -204,6 +208,9 @@ void AVInput::DeinitializeIARM()
204208 IARM_BUS_DSMGR_NAME,
205209 IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_STATUS, dsAVStatusEventHandler));
206210 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 (
207214 IARM_BUS_DSMGR_NAME,
208215 IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE, dsAviContentTypeEventHandler));
209216 }
@@ -750,17 +757,18 @@ void AVInput::AVInputStatusChange( int port , bool isPresented, int type)
750757 * @param[in] port HDMI In port id.
751758 * @param[dsVideoPortResolution_t] video resolution data
752759 */
753- void AVInput::AVInputVideoModeUpdate ( int port , dsVideoPortResolution_t resolution)
760+ void AVInput::AVInputVideoModeUpdate ( int port , dsVideoPortResolution_t resolution, int type )
754761{
755762 LOGWARN (" AVInputVideoModeUpdate [%d]" , port);
756763
757764 JsonObject params;
758765 params[" id" ] = port;
759766 std::stringstream locator;
760- locator << " hdmiin://localhost/deviceid/" << port;
761- params[" locator" ] = locator.str ();
767+ if (type == HDMI){
768+
769+ locator << " hdmiin://localhost/deviceid/" << port;
770+ switch (resolution.pixelResolution ) {
762771
763- switch (resolution.pixelResolution ) {
764772 case dsVIDEO_PIXELRES_720x480:
765773 params[" width" ] = 720 ;
766774 params[" height" ] = 480 ;
@@ -776,7 +784,7 @@ void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolut
776784 params[" height" ] = 720 ;
777785 break ;
778786
779- case dsVIDEO_PIXELRES_1920x1080:
787+ case dsVIDEO_PIXELRES_1920x1080:
780788 params[" width" ] = 1920 ;
781789 params[" height" ] = 1080 ;
782790 break ;
@@ -795,10 +803,31 @@ void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolut
795803 params[" width" ] = 1920 ;
796804 params[" height" ] = 1080 ;
797805 break ;
806+ }
807+ params[" progressive" ] = (!resolution.interlaced );
798808 }
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+ }
799826
800- params[" progressive" ] = (!resolution.interlaced );
827+ params[" progressive" ] = false ;
828+ }
801829
830+ params[" locator" ] = locator.str ();
802831 switch (resolution.frameRate ) {
803832 case dsVIDEO_FRAMERATE_24:
804833 params[" frameRateN" ] = 24000 ;
@@ -851,16 +880,17 @@ void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolut
851880
852881void AVInput::dsAviContentTypeEventHandler (const char *owner, IARM_EventId_t eventId, void *data, size_t len)
853882{
854- if (!AVInput::_instance)
855- return ;
883+ if (!AVInput::_instance)
884+ return ;
856885
857- if (IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE == eventId)
858- {
859- IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
860- int hdmi_in_port = eventData->data .hdmi_in_content_type .port ;
861- int avi_content_type = eventData->data .hdmi_in_content_type .aviContentType ;
862- LOGINFO (" Received IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE event port: %d, Content Type : %d" , hdmi_in_port,avi_content_type);
863- 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);
864894 }
865895}
866896
@@ -943,7 +973,17 @@ void AVInput::dsAVVideoModeEventHandler(const char *owner, IARM_EventId_t eventI
943973 resolution.interlaced = eventData->data .hdmi_in_video_mode .resolution .interlaced ;
944974 resolution.frameRate = eventData->data .hdmi_in_video_mode .resolution .frameRate ;
945975 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 );
946- 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);
947987 }
948988}
949989
0 commit comments