]> git.sesse.net Git - ffmpeg/commitdiff
lavf/img2enc: add atomic_writing option
authorClément Bœsch <clement@stupeflix.com>
Tue, 8 Dec 2015 09:44:31 +0000 (10:44 +0100)
committerClément Bœsch <clement@stupeflix.com>
Mon, 21 Dec 2015 10:19:51 +0000 (11:19 +0100)
This behaviour change caused a regression on our side recently, we might
want to disable the option by default.

libavformat/img2enc.c

index c2e6e4d2185fde6704abc58424f49ae8431636f5..9291802a2a71fd529baee5dd4693046409b5a759 100644 (file)
@@ -73,7 +73,8 @@ static int write_header(AVFormatContext *s)
                              && desc->nb_components >= 3;
     }
 
-    img->use_rename = proto && !strcmp(proto, "file");
+    img->use_rename = img->use_rename < 0 ? proto && !strcmp(proto, "file")
+                                          : img->use_rename;
 
     return 0;
 }
@@ -206,6 +207,7 @@ static const AVOption muxoptions[] = {
     { "update",       "continuously overwrite one file", OFFSET(update),  AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0,       1, ENC },
     { "start_number", "set first number in the sequence", OFFSET(img_number), AV_OPT_TYPE_INT,  { .i64 = 1 }, 0, INT_MAX, ENC },
     { "strftime",     "use strftime for filename", OFFSET(use_strftime),  AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC },
+    { "atomic_writing", "write files atomically (using temporary files and renames)", OFFSET(use_rename), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, ENC },
     { NULL },
 };