Browse Source

lavf/network: add a ff_log_net_error function.

add a ff_log_net_error function for error log.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
tags/n4.1
Jun Zhao Jun Zhao 7 years ago
parent
commit
d428ef0ea5
2 changed files with 9 additions and 0 deletions
  1. +7
    -0
      libavformat/network.c
  2. +2
    -0
      libavformat/network.h

+ 7
- 0
libavformat/network.c View File

@@ -346,3 +346,10 @@ int ff_http_match_no_proxy(const char *no_proxy, const char *hostname)
av_free(buf); av_free(buf);
return ret; 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);
}

+ 2
- 0
libavformat/network.h View File

@@ -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); 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 */ #endif /* AVFORMAT_NETWORK_H */

Loading…
Cancel
Save