[FFmpeg-cvslog] avformat: Warn about using network functions without calling avformat_network_init

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Nov 8 08:18:07 CET 2011


On 8 Nov 2011, at 02:22, git at videolan.org (Martin Storsjö) wrote:

> ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Mon Nov  7 13:57:33 2011 +0200| [ce145690b6a53dd9d5134c6d4a5c6d401bc69514] | committer: Martin Storsjö
> 
> 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: Martin Storsjö <martin at martin.st>
> 
>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ce145690b6a53dd9d5134c6d4a5c6d401bc69514
> ---
> 
> libavformat/network.c |    7 +++++++
> libavformat/network.h |    1 +
> libavformat/utils.c   |    1 +
> 3 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/libavformat/network.c b/libavformat/network.c
> index d84dcaf..f8403ae 100644
> --- a/libavformat/network.c
> +++ b/libavformat/network.c
> @@ -119,8 +119,15 @@ void ff_tls_deinit(void)
>     avpriv_unlock_avformat();
> }
> 
> +int ff_network_inited_globally;
> +
> 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");

Isn't that a somewhat bad idea without having an API to check whether some URL needs network or not?
It seems to me applications have the choice between always blindly calling it or hard-coding a list of network protocols...

> @@ -3967,6 +3967,7 @@ int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int std_co
> int avformat_network_init(void)
> {
> #if CONFIG_NETWORK
> +    ff_network_inited_globally = 1;
>     int ret;

That puts code before the declaration.


More information about the ffmpeg-cvslog mailing list