You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-11 14:30:22 +02:00
avio: Only do implicit network initialization for network protocols
The implicit network initialization is set to be removed in the future, but is kept for compatibility. By not doing the implicit initialization for non-network protocols, we avoid the warning about avformat_network_init() not being called for these, where it really doesn't make much sense. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
@ -129,7 +129,7 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
|
|||||||
int err;
|
int err;
|
||||||
|
|
||||||
#if CONFIG_NETWORK
|
#if CONFIG_NETWORK
|
||||||
if (!ff_network_init())
|
if (up->flags & URL_PROTOCOL_FLAG_NETWORK && !ff_network_init())
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
#endif
|
#endif
|
||||||
uc = av_mallocz(sizeof(URLContext) + strlen(filename) + 1);
|
uc = av_mallocz(sizeof(URLContext) + strlen(filename) + 1);
|
||||||
@ -159,7 +159,8 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
|
|||||||
fail:
|
fail:
|
||||||
*puc = NULL;
|
*puc = NULL;
|
||||||
#if CONFIG_NETWORK
|
#if CONFIG_NETWORK
|
||||||
ff_network_close();
|
if (up->flags & URL_PROTOCOL_FLAG_NETWORK)
|
||||||
|
ff_network_close();
|
||||||
#endif
|
#endif
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -380,7 +381,8 @@ int ffurl_close(URLContext *h)
|
|||||||
if (h->is_connected && h->prot->url_close)
|
if (h->is_connected && h->prot->url_close)
|
||||||
ret = h->prot->url_close(h);
|
ret = h->prot->url_close(h);
|
||||||
#if CONFIG_NETWORK
|
#if CONFIG_NETWORK
|
||||||
ff_network_close();
|
if (h->prot->flags & URL_PROTOCOL_FLAG_NETWORK)
|
||||||
|
ff_network_close();
|
||||||
#endif
|
#endif
|
||||||
if (h->prot->priv_data_size) {
|
if (h->prot->priv_data_size) {
|
||||||
if (h->prot->priv_data_class)
|
if (h->prot->priv_data_class)
|
||||||
|
Reference in New Issue
Block a user