26 #include <UnitTest++/UnitTest++.h> 32 #include <sys/types.h> 36 #include <libcjson/cJSON.h> 37 #include <libmediaprocsutils/log.h> 38 #include <libmediaprocsutils/stat_codes.h> 39 #include <libmediaprocs/proc_if.h> 40 #include "../src/video_settings.h" 43 SUITE(UTESTS_VIDEO_SETTINGS_CTX)
45 TEST(UTESTS_VIDEO_SETTINGS_CTX_T)
50 std::string settings_cppstr;
51 cJSON *cjson_rest= NULL;
52 char *rest_response_str= NULL;
56 CHECK(video_settings_enc_ctx!= NULL);
57 if(video_settings_enc_ctx== NULL)
60 CHECK(video_settings_enc_ctx2!= NULL);
61 if(video_settings_enc_ctx2== NULL)
66 CHECK(ret_code== STAT_SUCCESS);
70 video_settings_enc_ctx2);
71 CHECK(ret_code== STAT_SUCCESS);
80 CHECK(video_settings_enc_ctx->
gop_size==
90 settings_cppstr= (std::string)
"bit_rate_output=1234&" 91 "frame_rate_output=60&width_output=720&height_output=576&" 92 "gop_size=123&conf_preset=ultrafast";
94 settings_cppstr.c_str(), NULL);
95 CHECK(ret_code== STAT_SUCCESS);
100 CHECK(video_settings_enc_ctx->
gop_size== 123);
101 CHECK(strncmp(video_settings_enc_ctx->
conf_preset,
"ultrafast",
105 settings_cppstr= (std::string)
"{" 106 "\"bit_rate_output\":4321," 107 "\"frame_rate_output\":61," 108 "\"width_output\":1920," 109 "\"height_output\":1080," 111 "\"conf_preset\":\"veryfast\"" 114 settings_cppstr.c_str(), NULL);
115 CHECK(ret_code== STAT_SUCCESS);
120 CHECK(video_settings_enc_ctx->
gop_size== 321);
121 CHECK(strncmp(video_settings_enc_ctx->
conf_preset,
"veryfast",
127 CHECK(ret_code== STAT_SUCCESS && cjson_rest!= NULL);
128 if(cjson_rest== NULL)
132 rest_response_str= cJSON_PrintUnformatted(cjson_rest);
133 CHECK(rest_response_str!= NULL && strlen(rest_response_str)> 0);
134 if(rest_response_str== NULL)
136 CHECK(strcmp(settings_cppstr.c_str(), rest_response_str)== 0);
139 if(video_settings_enc_ctx!= NULL)
141 if(cjson_rest!= NULL)
142 cJSON_Delete(cjson_rest);
143 if(rest_response_str!= NULL)
144 free(rest_response_str);
int video_settings_enc_ctx_init(volatile video_settings_enc_ctx_t *video_settings_enc_ctx)
SUITE(UTESTS_LIVE555_RTSP)
int video_settings_enc_ctx_restful_put(volatile video_settings_enc_ctx_t *video_settings_enc_ctx, const char *str, log_ctx_t *log_ctx)
void video_settings_enc_ctx_deinit(volatile video_settings_enc_ctx_t *video_settings_enc_ctx)
void video_settings_enc_ctx_release(video_settings_enc_ctx_t **ref_video_settings_enc_ctx)
int video_settings_enc_ctx_cpy(const video_settings_enc_ctx_t *video_settings_enc_ctx_src, video_settings_enc_ctx_t *video_settings_enc_ctx_dst)
int video_settings_enc_ctx_restful_get(volatile video_settings_enc_ctx_t *video_settings_enc_ctx, cJSON **ref_cjson_rest, log_ctx_t *log_ctx)
video_settings_enc_ctx_t * video_settings_enc_ctx_allocate()