@@ -94,10 +94,40 @@ enum {
94
94
DEFAULT_RTSP_PORT = 554 ,
95
95
};
96
96
97
+ static const char * int_to_str (int i ) {
98
+ _Thread_local static char buf [100 ];
99
+ snprintf (buf , sizeof buf , "%d" , i );
100
+ return buf ;
101
+ }
102
+
103
+ static const char * long_to_str (long l ) {
104
+ _Thread_local static char buf [100 ];
105
+ snprintf (buf , sizeof buf , "%ld" , l );
106
+ return buf ;
107
+ }
108
+
109
+ static const char * pointer_to_str (void * p ) {
110
+ _Thread_local static char buf [100 ];
111
+ snprintf (buf , sizeof buf , "%p" , p );
112
+ return buf ;
113
+ }
114
+
115
+ static const char * cstr_identity (const char * c ) {
116
+ return c ;
117
+ }
118
+
119
+ #define get_s (X ) \
120
+ _Generic((X), \
121
+ int: int_to_str, \
122
+ long: long_to_str, \
123
+ const char *: cstr_identity, \
124
+ default: pointer_to_str)(X)
125
+
97
126
/* error handling macros */
98
127
#define my_curl_easy_setopt (A , B , C , action_fail ) \
99
128
{ \
100
129
CURLcode res = CURLE_OK; \
130
+ MSG(VERBOSE, "Setting " #B " to %s\n", get_s(C)); \
101
131
if ((res = curl_easy_setopt((A), (B), (C))) != CURLE_OK){ \
102
132
log_msg(LOG_LEVEL_ERROR, MOD_NAME "curl_easy_setopt(%s, %s, %s) failed: %s (%d)\n", #A, #B, #C, curl_easy_strerror(res), res); \
103
133
printf("[rtsp error] could not configure rtsp capture properly, \n\t\tplease check your parameters. \nExiting...\n\n"); \
0 commit comments