[FFmpeg-devel] [PATCH] avformat: Add a protocol blacklisting API

Michael Niedermayer michael at niedermayer.cc
Thu Mar 3 20:50:19 CET 2016


On Thu, Mar 03, 2016 at 05:18:03PM +0000, Derek Buitenhuis wrote:
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
> This matches API with Libav, in a forthcoming merge, using our
> exisiting infastructure code.
> 
> CC'd Michael, since he wrote the whitelisting code.
> 
> This has been tested with FATE.
> ---
>  Changelog                         |  1 +
>  doc/APIchanges                    |  3 +++
>  libavformat/async.c               |  2 +-
>  libavformat/avformat.h            |  7 +++++++
>  libavformat/avidec.c              |  2 +-
>  libavformat/avio.c                | 22 ++++++++++++++++++++--
>  libavformat/avio.h                |  5 +++++
>  libavformat/avio_internal.h       |  2 +-
>  libavformat/aviobuf.c             | 13 +++++++++----
>  libavformat/cache.c               |  2 +-
>  libavformat/concat.c              |  2 +-
>  libavformat/concatdec.c           |  2 +-
>  libavformat/crypto.c              |  2 +-
>  libavformat/ftp.c                 |  4 ++--
>  libavformat/gopher.c              |  2 +-
>  libavformat/hls.c                 |  2 +-
>  libavformat/hlsproto.c            |  4 ++--
>  libavformat/http.c                |  6 +++---
>  libavformat/icecast.c             |  2 +-
>  libavformat/internal.h            |  2 +-
>  libavformat/md5proto.c            |  2 +-
>  libavformat/mmst.c                |  2 +-
>  libavformat/mpeg.c                |  2 +-
>  libavformat/options.c             |  2 +-
>  libavformat/options_table.h       |  1 +
>  libavformat/rdt.c                 |  2 +-
>  libavformat/rtmpcrypt.c           |  2 +-
>  libavformat/rtmpproto.c           |  4 ++--
>  libavformat/rtpdec_asf.c          |  2 +-
>  libavformat/rtpproto.c            |  6 +++---
>  libavformat/rtsp.c                | 10 +++++-----
>  libavformat/rtspdec.c             |  4 ++--
>  libavformat/sapdec.c              |  4 ++--
>  libavformat/sapenc.c              |  4 ++--
>  libavformat/smoothstreamingenc.c  |  8 ++++----
>  libavformat/srtpproto.c           |  2 +-
>  libavformat/subfile.c             |  2 +-
>  libavformat/tls.c                 |  2 +-
>  libavformat/tls_securetransport.c |  2 +-
>  libavformat/url.h                 |  3 ++-
>  libavformat/utils.c               | 19 +++++++++++++++----
>  libavformat/version.h             |  4 ++--
>  42 files changed, 114 insertions(+), 62 deletions(-)
> 
> diff --git a/Changelog b/Changelog
> index d6459a8..0e70724 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -10,6 +10,7 @@ version <next>:
>  - datascope filter
>  - bench and abench filters
>  - ciescope filter
> +- protocol blacklisting API
>  
>  
>  version 3.0:
> diff --git a/doc/APIchanges b/doc/APIchanges
> index a75f346..2fc6a71 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -15,6 +15,9 @@ libavutil:     2015-08-28
>  
>  API changes, most recent first:
>  
> +2016-XX-XX - xxxxxxx - lavf 57.28.100
> +  Add protocol blacklisting API
> +
>  2016-02-28 - xxxxxxx - lavc 57.27.101
>    Validate AVFrame returned by get_buffer2 to have required
>    planes not NULL and unused planes set to NULL as crashes
> diff --git a/libavformat/async.c b/libavformat/async.c
> index a835292..0cc6fb0 100644
> --- a/libavformat/async.c
> +++ b/libavformat/async.c
> @@ -251,7 +251,7 @@ static int async_open(URLContext *h, const char *arg, int flags, AVDictionary **
>  
>      /* wrap interrupt callback */
>      c->interrupt_callback = h->interrupt_callback;
> -    ret = ffurl_open_whitelist(&c->inner, arg, flags, &interrupt_callback, options, h->protocol_whitelist);
> +    ret = ffurl_open_whitelist(&c->inner, arg, flags, &interrupt_callback, options, h->protocol_whitelist, h->protocol_blacklist);
>      if (ret != 0) {
>          av_log(h, AV_LOG_ERROR, "ffurl_open failed : %s, %s\n", av_err2str(ret), arg);
>          goto url_fail;

> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index b843a4b..b133575 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1838,6 +1838,13 @@ typedef struct AVFormatContext {
>       */
>      char *protocol_whitelist;
>  
> +    /**
> +     * ',' separated list of disallowed protocols.
> +     * - encoding: unused
> +     * - decoding: set by user through AVOptions (NO direct access)
> +     */
> +    char *protocol_blacklist;
> +
>      /*
>       * A callback for opening new IO streams.
>       *

The io_open/close callbacks afterwards seem direct access IIUC
so its not possible to remove or add any fields prior

though maybe they have been added so recently that its ok to move
them above all "no direct access" fields
or maybe iam missing something

otherwise no objections from me



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

There will always be a question for which you do not know the correct answer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160303/cd6b0f21/attachment.sig>


More information about the ffmpeg-devel mailing list