[FFmpeg-devel] [PATCH 2/2] avformat: add protocol_whitelist
Andreas Cadhalpun
andreas.cadhalpun at googlemail.com
Sun Jan 24 20:15:46 CET 2016
On 24.01.2016 16:03, Michael Niedermayer wrote:
> On Sun, Jan 24, 2016 at 03:37:24PM +0100, Andreas Cadhalpun wrote:
>> On 24.01.2016 03:42, Michael Niedermayer wrote:
>>> From: Michael Niedermayer <michael at niedermayer.cc>
>>> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
>>> index 4964263..2fb9130 100644
>>> --- a/libavformat/avformat.h
>>> +++ b/libavformat/avformat.h
>>> @@ -1815,6 +1815,13 @@ typedef struct AVFormatContext {
>>> * Demuxing: Set by user.
>>> */
>>> int (*open_cb)(struct AVFormatContext *s, AVIOContext **p, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options);
>>> +
>>> + /**
>>> + * ',' separated list of allowed protocols.
>>> + * - encoding: unused
>>> + * - decoding: set by user through AVOptions (NO direct access)
>>> + */
>>> + char *protocol_whitelist;
>>> } AVFormatContext;
>>
>> I'm not sure if adding protocol_whitelist to the AVFormatContext is good.
>> Conceptually it would fit better in the AVIOContext. I think that would also
>> make it easier to set a default for it.
>
> the AVFormatContexts AVIOContext can be NULL
I see. Then it could be added to AVIOContext in addition to AVFormatContext and
URLContext. It would require a bit of synchronization, though.
>> Also, this patch doesn't include a mechanism setting a good default for the
>> protocol_whitelist, which would be needed to fix the problem of unintentionally
>> mixing local and remote data.
>
>
>> If the protocol_whitelist would be saved in the AVIOContext, such a mechanism
>> could be implemented in ffurl_open/ffurl_connect.
>
> can you elaborate
> i dont see how that would work
The idea is to classify protocols as local (file, concat) or remote (http, tcp).
If no whitelist is set, then it gets set to a default in ffurl_connect.
If the protocol is local, the default whitelist contains only local protocols.
If the protocol is remote the default whitelist contains only remote protocols.
That whitelist would then have to be propagated into the AVFormatContext.
> also some users use their private IO, i dont think theres a foolproof
> way to identify if its remote or local
This mechanism would only cover IO done via our protocols.
Best regards,
Andreas
More information about the ffmpeg-devel
mailing list