From 45b8c0d1c2190142859e0795848b9eedf5c017ce Mon Sep 17 00:00:00 2001 From: "F. Duncanh" Date: Fri, 13 Dec 2024 10:32:50 -0500 Subject: [PATCH] cleanup printf statements --- lib/crypto.c | 1 - lib/httpd.c | 14 +++++++------- lib/raop.c | 18 ++++++------------ lib/raop_rtp_mirror.c | 10 +--------- uxplay.cpp | 17 +++++++---------- 5 files changed, 21 insertions(+), 39 deletions(-) diff --git a/lib/crypto.c b/lib/crypto.c index 906a2fe..d530d97 100644 --- a/lib/crypto.c +++ b/lib/crypto.c @@ -343,7 +343,6 @@ int gcm_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *pl return plaintext_len; } else { /* Verify failed */ - printf("failed\n"); return -1; } } diff --git a/lib/httpd.c b/lib/httpd.c index 1799e34..6147928 100644 --- a/lib/httpd.c +++ b/lib/httpd.c @@ -413,22 +413,22 @@ httpd_thread(void *arg) logger_log(httpd->logger, LOGGER_DEBUG, "httpd receiving on socket %d, connection %d", connection->socket_fd, i); if (logger_debug) { - printf("\nhttpd: current connections:\n"); + logger_log(httpd->logger, LOGGER_DEBUG,"\nhttpd: current connections:"); for (int i = 0; i < httpd->max_connections; i++) { http_connection_t *connection = &httpd->connections[i]; if(!connection->connected) { continue; } if (!FD_ISSET(connection->socket_fd, &rfds)) { - printf("connection %d type %d socket %d conn %p %s\n", i, - connection->type, connection->socket_fd, - connection->user_data, typename [connection->type]); + logger_log(httpd->logger, LOGGER_DEBUG, "connection %d type %d socket %d conn %p %s", i, + connection->type, connection->socket_fd, + connection->user_data, typename [connection->type]); } else { - printf("connection %d type %d socket %d conn %p %s ACTIVE CONNECTION\n", i, connection->type, - connection->socket_fd, connection->user_data, typename [connection->type]); + logger_log(httpd->logger, LOGGER_DEBUG, "connection %d type %d socket %d conn %p %s ACTIVE CONNECTION", + i, connection->type, connection->socket_fd, connection->user_data, typename [connection->type]); } } - printf("\n"); + logger_log(httpd->logger, LOGGER_DEBUG, " "); } /* reverse-http responses from the client must not be sent to the llhttp parser: * such messages start with "HTTP/1.1" */ diff --git a/lib/raop.c b/lib/raop.c index 6bd3e0e..c275dc1 100644 --- a/lib/raop.c +++ b/lib/raop.c @@ -311,19 +311,16 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response) { char * plist_xml; uint32_t plist_len; plist_to_xml(req_root_node, &plist_xml, &plist_len); - printf("%s\n",plist_xml); - //logger_log(conn->raop->logger, LOGGER_DEBUG, "%s", plist_xml); + logger_log(conn->raop->logger, LOGGER_DEBUG, "%s", plist_xml); free(plist_xml); plist_free(req_root_node); } else if (data_is_text) { char *data_str = utils_data_to_text((char *) request_data, request_datalen); - printf("%s\n", data_str); - //logger_log(conn->raop->logger, LOGGER_DEBUG, "%s", data_str); + logger_log(conn->raop->logger, LOGGER_DEBUG, "%s", data_str); free(data_str); } else { char *data_str = utils_data_to_string((unsigned char *) request_data, request_datalen, 16); - printf("%s\n", data_str); - //logger_log(conn->raop->logger, LOGGER_DEBUG, "%s", data_str); + logger_log(conn->raop->logger, LOGGER_DEBUG, "%s", data_str); free(data_str); } } @@ -449,18 +446,15 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response) { uint32_t plist_len; plist_to_xml(res_root_node, &plist_xml, &plist_len); plist_free(res_root_node); - printf("%s\n", plist_xml); - //logger_log(conn->raop->logger, LOGGER_DEBUG, "%s", plist_xml); + logger_log(conn->raop->logger, LOGGER_DEBUG, "%s", plist_xml); free(plist_xml); } else if (data_is_text) { char *data_str = utils_data_to_text((char*) response_data, response_datalen); - printf("%s\n", data_str); - //logger_log(conn->raop->logger, LOGGER_DEBUG, "%s", data_str); + logger_log(conn->raop->logger, LOGGER_DEBUG, "%s", data_str); free(data_str); } else { char *data_str = utils_data_to_string((unsigned char *) response_data, response_datalen, 16); - printf("%s\n", data_str); - //logger_log(conn->raop->logger, LOGGER_DEBUG, "%s", data_str); + logger_log(conn->raop->logger, LOGGER_DEBUG, "%s", data_str); free(data_str); } } diff --git a/lib/raop_rtp_mirror.c b/lib/raop_rtp_mirror.c index e97f66f..bc88472 100644 --- a/lib/raop_rtp_mirror.c +++ b/lib/raop_rtp_mirror.c @@ -541,9 +541,6 @@ raop_rtp_mirror_thread(void *arg) raop_rtp_mirror->callbacks.video_process(raop_rtp_mirror->callbacks.cls, raop_rtp_mirror->ntp, &video_data); free(payload_out); break; - //char *str3 = utils_data_to_string(payload_out, video_data.data_len, 16); - //printf("%s\n", str3); - //free (str3); case 0x01: /* 128-byte observed packet header structure bytes 0-15: length + timestamp @@ -609,13 +606,12 @@ raop_rtp_mirror_thread(void *arg) free(sps_pps); sps_pps = NULL; } - /* test for a H265 VPS/SPs/PPS */ + /* test for a H265 VPS/SPS/PPS */ unsigned char hvc1[] = { 0x68, 0x76, 0x63, 0x31 }; if (!memcmp(payload + 4, hvc1, 4)) { /* hvc1 HECV detected */ codec = VIDEO_CODEC_H265; - printf("h265 detected\n"); h265_video = true; raop_rtp_mirror->callbacks.video_set_codec(raop_rtp_mirror->callbacks.cls, codec); unsigned char vps_start_code[] = { 0xa0, 0x00, 0x01, 0x00 }; @@ -687,10 +683,6 @@ raop_rtp_mirror_thread(void *arg) memcpy(ptr, nal_start_code, 4); ptr += 4; memcpy(ptr, pps, pps_size); - // printf (" HEVC (hvc1) vps + sps + pps NALU\n"); - //char *str = utils_data_to_string(sps_pps, sps_pps_len, 16); - //printf("%s\n", str); - //free (str); } else { codec = VIDEO_CODEC_H264; h265_video = false; diff --git a/uxplay.cpp b/uxplay.cpp index d6a2d1e..3246ffd 100644 --- a/uxplay.cpp +++ b/uxplay.cpp @@ -1575,7 +1575,6 @@ extern "C" void conn_reset (void *cls, int timeouts, bool reset_video) { LOGI(" Sometimes the network connection may recover after a longer delay:\n" " the default timeout limit n = %d can be changed with the \"-reset n\" option", NTP_TIMEOUT_LIMIT); } - printf("reset_video %d\n",(int) reset_video); if (!nofreeze) { close_window = reset_video; /* leave "frozen" window open if reset_video is false */ } @@ -1880,9 +1879,7 @@ extern "C" void on_video_acquire_playback_info (void *cls, playback_info_t *play LOGI(" video has finished, %f", playback_info->position); playback_info->position = -1.0; playback_info->duration = -1.0; - printf("about to stop\n"); video_renderer_stop(); - printf("stopped\n"); } } @@ -2083,8 +2080,8 @@ static void read_config_file(const char * filename, const char * uxplay_name) { void real_main (int argc, char *argv[]); int main (int argc, char *argv[]) { - printf("*=== Using gst_macos_main wrapper for GStreamer >= 1.22 on macOS ===*\n"); - return gst_macos_main ((GstMainFunc) real_main, argc, argv , NULL); + LOGI("*=== Using gst_macos_main wrapper for GStreamer >= 1.22 on macOS ===*"); + return gst_macos_main ((GstMainFunc) real_main, argc, argv , NULL); } void real_main (int argc, char *argv[]) { @@ -2124,22 +2121,22 @@ int main (int argc, char *argv[]) { } if (dump_video) { if (video_dump_limit > 0) { - printf("dump video using \"-vdmp %d %s\"\n", video_dump_limit, video_dumpfile_name.c_str()); + LOGI("dump video using \"-vdmp %d %s\"", video_dump_limit, video_dumpfile_name.c_str()); } else { - printf("dump video using \"-vdmp %s\"\n", video_dumpfile_name.c_str()); + LOGI("dump video using \"-vdmp %s\"", video_dumpfile_name.c_str()); } } if (dump_audio) { if (audio_dump_limit > 0) { - printf("dump audio using \"-admp %d %s\"\n", audio_dump_limit, audio_dumpfile_name.c_str()); + LOGI("dump audio using \"-admp %d %s\"", audio_dump_limit, audio_dumpfile_name.c_str()); } else { - printf("dump audio using \"-admp %s\"\n", audio_dumpfile_name.c_str()); + LOGI("dump audio using \"-admp %s\"", audio_dumpfile_name.c_str()); } } #if __APPLE__ /* force use of -nc option on macOS */ - LOGI("macOS detected: use -nc option as workaround for GStreamer problem"); + LOGI("macOS detected: using -nc option as workaround for GStreamer problem"); new_window_closing_behavior = false; #endif