Skip to content
Snippets Groups Projects
Commit ce145690 authored by Martin Storsjö's avatar Martin Storsjö
Browse files

avformat: Warn about using network functions without calling avformat_network_init


This is to make developers aware of the fact that they will
start using the new init function at some point.

Signed-off-by: default avatarMartin Storsjö <martin@martin.st>
parent 87892ef8
No related branches found
No related tags found
No related merge requests found
...@@ -119,8 +119,15 @@ void ff_tls_deinit(void) ...@@ -119,8 +119,15 @@ void ff_tls_deinit(void)
avpriv_unlock_avformat(); avpriv_unlock_avformat();
} }
int ff_network_inited_globally;
int ff_network_init(void) int ff_network_init(void)
{ {
if (!ff_network_inited_globally)
av_log(NULL, AV_LOG_WARNING, "Using network protocols without global "
"network initialization. Please use "
"avformat_network_init(), this will "
"become mandatory later.\n");
#if HAVE_WINSOCK2_H #if HAVE_WINSOCK2_H
WSADATA wsaData; WSADATA wsaData;
if (WSAStartup(MAKEWORD(1,1), &wsaData)) if (WSAStartup(MAKEWORD(1,1), &wsaData))
......
...@@ -56,6 +56,7 @@ int ff_neterrno(void); ...@@ -56,6 +56,7 @@ int ff_neterrno(void);
int ff_socket_nonblock(int socket, int enable); int ff_socket_nonblock(int socket, int enable);
extern int ff_network_inited_globally;
int ff_network_init(void); int ff_network_init(void);
void ff_network_close(void); void ff_network_close(void);
......
...@@ -3967,6 +3967,7 @@ int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int std_co ...@@ -3967,6 +3967,7 @@ int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int std_co
int avformat_network_init(void) int avformat_network_init(void)
{ {
#if CONFIG_NETWORK #if CONFIG_NETWORK
ff_network_inited_globally = 1;
int ret; int ret;
if ((ret = ff_network_init()) < 0) if ((ret = ff_network_init()) < 0)
return ret; return ret;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment