[FFmpeg-devel] [PATCH 2/2] ffmpeg_opt: assert_file_overwrite: Work for all file protocol outputs
Alexander Strasser
eclipse7 at gmx.net
Sun Feb 2 00:04:17 CET 2014
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 remaining part of ticket #3249.
Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>
---
ffmpeg_opt.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 4e0dc47..dc9d5f9 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -697,10 +697,9 @@ 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 (avio_check(filename, 0) == 0) {
+ if (!file_overwrite) {
+ const char *proto_name = avio_find_protocol(filename);
+ if (proto_name && !strcmp(proto_name, "file") && avio_check(filename, 0) == 0) {
if (stdin_interaction && !no_file_overwrite) {
fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
fflush(stderr);
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140202/63a40c95/attachment.asc>
More information about the ffmpeg-devel
mailing list