[FFmpeg-devel] [PATCH 5/5] lavf/avio: remove support for proto, , opt, val, , syntax.

Gyan Doshi ffmpeg at gyani.pro
Wed Jul 28 15:37:11 EEST 2021



On 2021-07-28 17:45, Nicolas George wrote:
> It was only still supported for subfile and only used by dvd2concat.

Examples at http://www.ffmpeg.org/ffmpeg-protocols.html#subfile should 
be updated.

Regards,
Gyan

>
> Signed-off-by: Nicolas George <george at nsup.org>
> ---
>   libavformat/avio.c    | 34 +---------------------------------
>   libavformat/dashdec.c |  2 +-
>   libavformat/hls.c     |  2 +-
>   3 files changed, 3 insertions(+), 35 deletions(-)
>
> diff --git a/libavformat/avio.c b/libavformat/avio.c
> index 4846bbd8c6..1ce290737a 100644
> --- a/libavformat/avio.c
> +++ b/libavformat/avio.c
> @@ -111,39 +111,8 @@ static int url_alloc_for_protocol(URLContext **puc, const URLProtocol *up,
>               goto fail;
>           }
>           if (up->priv_data_class) {
> -            char *start;
>               *(const AVClass **)uc->priv_data = up->priv_data_class;
>               av_opt_set_defaults(uc->priv_data);
> -            if (av_strstart(uc->filename, up->name, (const char**)&start) && *start == ',') {
> -                int ret= 0;
> -                char *p= start;
> -                char sep= *++p;
> -                char *key, *val;
> -                p++;
> -
> -                if (strcmp(up->name, "subfile"))
> -                    ret = AVERROR(EINVAL);
> -
> -                while(ret >= 0 && (key= strchr(p, sep)) && p<key && (val = strchr(key+1, sep))){
> -                    *val= *key= 0;
> -                    if (strcmp(p, "start") && strcmp(p, "end")) {
> -                        ret = AVERROR_OPTION_NOT_FOUND;
> -                    } else
> -                        ret= av_opt_set(uc->priv_data, p, key+1, 0);
> -                    if (ret == AVERROR_OPTION_NOT_FOUND)
> -                        av_log(uc, AV_LOG_ERROR, "Key '%s' not found.\n", p);
> -                    *val= *key= sep;
> -                    p= val+1;
> -                }
> -                if(ret<0 || p!=key){
> -                    av_log(uc, AV_LOG_ERROR, "Error parsing options string %s\n", start);
> -                    av_freep(&uc->priv_data);
> -                    av_freep(&uc);
> -                    err = AVERROR(EINVAL);
> -                    goto fail;
> -                }
> -                memmove(start, key+1, strlen(key));
> -            }
>           }
>       }
>       if (int_cb)
> @@ -255,8 +224,7 @@ static const struct URLProtocol *url_find_protocol(const char *filename)
>       size_t proto_len = strspn(filename, URL_SCHEME_CHARS);
>       int i;
>   
> -    if (filename[proto_len] != ':' &&
> -        (strncmp(filename, "subfile,", 8) || !strchr(filename + proto_len + 1, ':')) ||
> +    if (filename[proto_len] != ':' ||
>           is_dos_path(filename))
>           strcpy(proto_str, "file");
>       else
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 11966f905c..1d186802b3 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -435,7 +435,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
>           ;
>       else if (av_strstart(url, "crypto", NULL) && !strncmp(proto_name, url + 7, strlen(proto_name)) && url[7 + strlen(proto_name)] == ':')
>           ;
> -    else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
> +    else if (strcmp(proto_name, "file"))
>           return AVERROR_INVALIDDATA;
>   
>       av_freep(pb);
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index 3c1b80f60c..e4d24b6fe0 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -667,7 +667,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
>           ;
>       else if (av_strstart(url, "data", NULL) && !strncmp(proto_name, url + 5, strlen(proto_name)) && url[5 + strlen(proto_name)] == ':')
>           ;
> -    else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
> +    else if (strcmp(proto_name, "file"))
>           return AVERROR_INVALIDDATA;
>   
>       av_dict_copy(&tmp, *opts, 0);



More information about the ffmpeg-devel mailing list