[FFmpeg-devel] [RFC][PATCH 2/2] ffmpeg_opt: assert_file_overwrite: Work for all file protocol outputs

Stefano Sabatini stefasab at gmail.com
Mon Jan 6 00:11:52 CET 2014


On date Sunday 2014-01-05 03:30:27 +0100, Alexander Strasser encoded:
> Currently the file overwrite check does not work for paths that
> contain a colon.
> 
> Use avio_find_protocol to always execute the existence check if
> the file protocol is going to be used.
> 
> Fix other part of ticket #3249.
> 
> Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>
> ---
>  ffmpeg_opt.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> index d267c6d..1040a1c 100644
> --- a/ffmpeg_opt.c
> +++ b/ffmpeg_opt.c
> @@ -697,9 +697,7 @@ static void assert_file_overwrite(const char *filename)
>          exit_program(1);
>      }
>  
> -    if (!file_overwrite &&
> -        (strchr(filename, ':') == NULL || filename[1] == ':' ||
> -         av_strstart(filename, "file:", NULL))) {
> +    if (!file_overwrite && !strcmp(avio_find_protocol(filename), "file")) {
>          if (avio_check(filename, 0) == 0) {
>              if (stdin_interaction && !no_file_overwrite) {
>                  fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);

Looks nice to me, thanks.
-- 
FFmpeg = Fundamental Fundamentalist Mournful Programmable Enhancing Game


More information about the ffmpeg-devel mailing list