[FFmpeg-devel] [PATCH] avformat/concatf: ignore trailing whitespaces

James Almer jamrial at gmail.com
Tue Dec 7 14:09:47 EET 2021



On 12/7/2021 9:00 AM, Gyan Doshi wrote:
> The concatf protocol returns an opaque error on open if
> concatf list file contains trailing newlines.
> ---
>   libavformat/concat.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/concat.c b/libavformat/concat.c
> index 2560811ff9..faeba2293a 100644
> --- a/libavformat/concat.c
> +++ b/libavformat/concat.c
> @@ -245,6 +245,10 @@ static av_cold int concatf_open(URLContext *h, const char *uri, int flags)
>           char *node_uri;
>           int64_t size;
>           size_t len = i;
> +        int leading_spaces = strspn(cursor, " \n\t\r");
> +
> +        if (!cursor[leading_spaces])
> +            break;
>   
>           node_uri = av_get_token(&cursor, "\r\n");
>           if (!node_uri) {

Seems to work, so LGTM.


More information about the ffmpeg-devel mailing list