@@ -793,16 +793,13 @@ void OBS_settings::saveStreamSettings(std::vector<SubCategory> streamSettings)
793793 std::string currentServiceName = obs_data_get_string (obs_service_get_settings (currentService), " service" );
794794
795795 SubCategory sc;
796+ bool serviceChanged = false ;
796797
797798 for (int i = 0 ; i < streamSettings.size (); i++) {
798799 sc = streamSettings.at (i);
799800
800801 std::string nameSubcategory = sc.name ;
801-
802- bool serviceChanged = false ;
803-
804802 Parameter param;
805-
806803 for (int j = 0 ; j < sc.params .size (); j++) {
807804 param = sc.params .at (j);
808805
@@ -816,28 +813,10 @@ void OBS_settings::saveStreamSettings(std::vector<SubCategory> streamSettings)
816813 if (name.compare (" streamType" ) == 0 ) {
817814 newserviceTypeValue = value->c_str ();
818815 settings = obs_service_defaults (newserviceTypeValue);
819- } else if (name.compare (" service" ) == 0 && value->compare (currentServiceName) != 0 ) {
820- serviceChanged = true ;
821- }
822-
823- if (name.compare (" server" ) == 0 && serviceChanged) {
824- obs_service_t * newService = obs_service_create (newserviceTypeValue, " service" , settings, NULL );
825-
826- obs_properties_t * properties = obs_service_properties (newService);
827- obs_property_t * property = obs_properties_first (properties);
828-
829- while (property) {
830- int count = (int )obs_property_list_item_count (property);
831- const char * nameProperty = obs_property_name (property);
832- if (strcmp (nameProperty, " server" ) == 0 ) {
833- *value = obs_property_list_item_string (property, 0 );
834- break ;
835- }
836-
837- obs_property_next (&property);
816+ if (currentStreamType.compare (newserviceTypeValue) != 0 ) {
817+ serviceChanged = true ;
838818 }
839819 }
840-
841820 obs_data_set_string (settings, name.c_str (), value->c_str ());
842821 } else if (type.compare (" OBS_PROPERTY_INT" ) == 0 || type.compare (" OBS_PROPERTY_UINT" ) == 0 ) {
843822 int64_t * value = reinterpret_cast <int64_t *>(param.currentValue .data ());
@@ -851,12 +830,18 @@ void OBS_settings::saveStreamSettings(std::vector<SubCategory> streamSettings)
851830 }
852831 }
853832 }
854- if (currentStreamType. compare (newserviceTypeValue) != 0 ) {
855- // Stream type value has changed
833+
834+ if (serviceChanged) {
856835 settings = obs_service_defaults (newserviceTypeValue);
857- }
858836
859- obs_data_t * data = obs_data_create ();
837+ if (strcmp (newserviceTypeValue, " rtmp_common" ) == 0 ) {
838+ obs_data_set_string (settings, " streamType" , " rtmp_common" );
839+ obs_data_set_string (settings, " service" , " Twitch" );
840+ obs_data_set_bool (settings, " show_all" , 0 );
841+ obs_data_set_string (settings, " server" , " auto" );
842+ obs_data_set_string (settings, " key" , " " );
843+ }
844+ }
860845
861846 obs_data_t * hotkeyData = obs_hotkeys_save_service (currentService);
862847
@@ -866,6 +851,7 @@ void OBS_settings::saveStreamSettings(std::vector<SubCategory> streamSettings)
866851
867852 OBS_service::setService (newService);
868853
854+ obs_data_t * data = obs_data_create ();
869855 obs_data_set_string (data, " type" , obs_service_get_type (newService));
870856 obs_data_set_obj (data, " settings" , settings);
871857
0 commit comments