Revision 67d4b3f2
libavformat/avio.c | ||
---|---|---|
26 | 26 |
#include "libavcodec/opt.h" |
27 | 27 |
#include "os_support.h" |
28 | 28 |
#include "avformat.h" |
29 |
#if CONFIG_NETWORK |
|
30 |
#include "network.h" |
|
31 |
#endif |
|
29 | 32 |
|
30 | 33 |
#if LIBAVFORMAT_VERSION_MAJOR >= 53 |
31 | 34 |
/** @name Logging context. */ |
... | ... | |
76 | 79 |
URLContext *uc; |
77 | 80 |
int err; |
78 | 81 |
|
82 |
#if CONFIG_NETWORK |
|
83 |
if (!ff_network_init()) |
|
84 |
return AVERROR(EIO); |
|
85 |
#endif |
|
79 | 86 |
uc = av_mallocz(sizeof(URLContext) + strlen(filename) + 1); |
80 | 87 |
if (!uc) { |
81 | 88 |
err = AVERROR(ENOMEM); |
... | ... | |
93 | 100 |
err = up->url_open(uc, filename, flags); |
94 | 101 |
if (err < 0) { |
95 | 102 |
av_free(uc); |
96 |
*puc = NULL; |
|
97 |
return err; |
|
103 |
goto fail; |
|
98 | 104 |
} |
99 | 105 |
|
100 | 106 |
//We must be careful here as url_seek() could be slow, for example for http |
... | ... | |
106 | 112 |
return 0; |
107 | 113 |
fail: |
108 | 114 |
*puc = NULL; |
115 |
#if CONFIG_NETWORK |
|
116 |
ff_network_close(); |
|
117 |
#endif |
|
109 | 118 |
return err; |
110 | 119 |
} |
111 | 120 |
|
... | ... | |
204 | 213 |
|
205 | 214 |
if (h->prot->url_close) |
206 | 215 |
ret = h->prot->url_close(h); |
216 |
#if CONFIG_NETWORK |
|
217 |
ff_network_close(); |
|
218 |
#endif |
|
207 | 219 |
av_free(h); |
208 | 220 |
return ret; |
209 | 221 |
} |
Also available in: Unified diff