[FFmpeg-devel] [PATCH 1/2] lavf/url: add ffurl_disconnect().

Michael Niedermayer michaelni at gmx.at
Tue Jul 23 21:30:07 CEST 2013


On Sun, Jul 21, 2013 at 04:14:23PM +0200, Nicolas George wrote:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavformat/avio.c |   14 ++++++++++++--
>  libavformat/url.h  |    7 +++++++
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/avio.c b/libavformat/avio.c
> index 2c7a35e..067964b 100644
> --- a/libavformat/avio.c
> +++ b/libavformat/avio.c
> @@ -337,14 +337,24 @@ int64_t ffurl_seek(URLContext *h, int64_t pos, int whence)
>      return ret;
>  }
>  
> -int ffurl_closep(URLContext **hh)
> +int ffurl_disconnect(URLContext *h)
>  {
> -    URLContext *h= *hh;
>      int ret = 0;
>      if (!h) return 0; /* can happen when ffurl_open fails */
>  
>      if (h->is_connected && h->prot->url_close)
>          ret = h->prot->url_close(h);
> +    h->is_connected = 0;
> +    return ret;
> +}
> +
> +int ffurl_closep(URLContext **hh)
> +{
> +    URLContext *h= *hh;
> +    int ret = 0;
> +    if (!h) return 0; /* can happen when ffurl_open fails */
> +
> +    ret = ffurl_disconnect(h);
>  #if CONFIG_NETWORK
>      if (h->prot->flags & URL_PROTOCOL_FLAG_NETWORK)
>          ff_network_close();

> diff --git a/libavformat/url.h b/libavformat/url.h
> index 06dfda1..84d6527 100644
> --- a/libavformat/url.h
> +++ b/libavformat/url.h
> @@ -181,6 +181,13 @@ int ffurl_write(URLContext *h, const unsigned char *buf, int size);
>  int64_t ffurl_seek(URLContext *h, int64_t pos, int whence);
>  
>  /**
> + * Disconnect from the resource accessed by the URLContext h.
> + *
> + * @return  0 for success or a negative error code
> + */

maybe add a note about how to reconnect

otherwise LGTM if this is used by something

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130723/573630af/attachment.asc>


More information about the ffmpeg-devel mailing list