@@ -168,6 +168,10 @@ void AVInput::InitializeIARM()
168
168
IARM_BUS_DSMGR_NAME,
169
169
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_STATUS,
170
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));
171
175
IARM_CHECK (IARM_Bus_RegisterEventHandler (
172
176
IARM_BUS_DSMGR_NAME,
173
177
IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE,
@@ -204,6 +208,9 @@ void AVInput::DeinitializeIARM()
204
208
IARM_BUS_DSMGR_NAME,
205
209
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_STATUS, dsAVStatusEventHandler));
206
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 (
207
214
IARM_BUS_DSMGR_NAME,
208
215
IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE, dsAviContentTypeEventHandler));
209
216
}
@@ -750,17 +757,18 @@ void AVInput::AVInputStatusChange( int port , bool isPresented, int type)
750
757
* @param[in] port HDMI In port id.
751
758
* @param[dsVideoPortResolution_t] video resolution data
752
759
*/
753
- void AVInput::AVInputVideoModeUpdate ( int port , dsVideoPortResolution_t resolution)
760
+ void AVInput::AVInputVideoModeUpdate ( int port , dsVideoPortResolution_t resolution, int type )
754
761
{
755
762
LOGWARN (" AVInputVideoModeUpdate [%d]" , port);
756
763
757
764
JsonObject params;
758
765
params[" id" ] = port;
759
766
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 ) {
762
771
763
- switch (resolution.pixelResolution ) {
764
772
case dsVIDEO_PIXELRES_720x480:
765
773
params[" width" ] = 720 ;
766
774
params[" height" ] = 480 ;
@@ -776,7 +784,7 @@ void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolut
776
784
params[" height" ] = 720 ;
777
785
break ;
778
786
779
- case dsVIDEO_PIXELRES_1920x1080:
787
+ case dsVIDEO_PIXELRES_1920x1080:
780
788
params[" width" ] = 1920 ;
781
789
params[" height" ] = 1080 ;
782
790
break ;
@@ -795,10 +803,31 @@ void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolut
795
803
params[" width" ] = 1920 ;
796
804
params[" height" ] = 1080 ;
797
805
break ;
806
+ }
807
+ params[" progressive" ] = (!resolution.interlaced );
798
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
+ }
799
826
800
- params[" progressive" ] = (!resolution.interlaced );
827
+ params[" progressive" ] = false ;
828
+ }
801
829
830
+ params[" locator" ] = locator.str ();
802
831
switch (resolution.frameRate ) {
803
832
case dsVIDEO_FRAMERATE_24:
804
833
params[" frameRateN" ] = 24000 ;
@@ -851,16 +880,17 @@ void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolut
851
880
852
881
void AVInput::dsAviContentTypeEventHandler (const char *owner, IARM_EventId_t eventId, void *data, size_t len)
853
882
{
854
- if (!AVInput::_instance)
855
- return ;
883
+ if (!AVInput::_instance)
884
+ return ;
856
885
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);
864
894
}
865
895
}
866
896
@@ -943,7 +973,17 @@ void AVInput::dsAVVideoModeEventHandler(const char *owner, IARM_EventId_t eventI
943
973
resolution.interlaced = eventData->data .hdmi_in_video_mode .resolution .interlaced ;
944
974
resolution.frameRate = eventData->data .hdmi_in_video_mode .resolution .frameRate ;
945
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 );
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);
947
987
}
948
988
}
949
989
0 commit comments