Skip to content

Commit f7dd228

Browse files
committed
vcap/rtsp: log just setting opts
refers to GH-400
1 parent 4bf2808 commit f7dd228

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/video_capture/rtsp.c

+30
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,40 @@ enum {
9494
DEFAULT_RTSP_PORT = 554,
9595
};
9696

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+
97126
/* error handling macros */
98127
#define my_curl_easy_setopt(A, B, C, action_fail) \
99128
{ \
100129
CURLcode res = CURLE_OK; \
130+
MSG(VERBOSE, "Setting " #B " to %s\n", get_s(C)); \
101131
if ((res = curl_easy_setopt((A), (B), (C))) != CURLE_OK){ \
102132
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); \
103133
printf("[rtsp error] could not configure rtsp capture properly, \n\t\tplease check your parameters. \nExiting...\n\n"); \

0 commit comments

Comments
 (0)