[FFmpeg-devel,1/4] lavf/network: add a ff_log_net_error function.

Submitted by Jun Zhao on Aug. 5, 2018, 1:14 p.m.

Details

Message ID 1533474873-10436-2-git-send-email-mypopydev@gmail.com
State New
Headers show

Commit Message

Jun Zhao Aug. 5, 2018, 1:14 p.m.
add a ff_log_net_error function for error log.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
---
 libavformat/network.c |    7 +++++++
 libavformat/network.h |    2 ++
 2 files changed, 9 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavformat/network.c b/libavformat/network.c
index d5c82e9..21c836a 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -346,3 +346,10 @@  int ff_http_match_no_proxy(const char *no_proxy, const char *hostname)
     av_free(buf);
     return ret;
 }
+
+void ff_log_net_error(void *ctx, int level, const char* prefix)
+{
+    char errbuf[100];
+    av_strerror(ff_neterrno(), errbuf, sizeof(errbuf));
+    av_log(ctx, level, "%s: %s\n", prefix, errbuf);
+}
diff --git a/libavformat/network.h b/libavformat/network.h
index efaa789..7843b90 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -304,4 +304,6 @@  int ff_http_match_no_proxy(const char *no_proxy, const char *hostname);
 
 int ff_socket(int domain, int type, int protocol);
 
+void ff_log_net_error(void *ctx, int level, const char* prefix);
+
 #endif /* AVFORMAT_NETWORK_H */