summaryrefslogtreecommitdiff
path: root/libavformat/img2enc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-11 21:49:26 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-11 21:50:53 +0200
commit647fe2e77733edf6e3a15c490056211bc38ccc20 (patch)
tree3387124478a584b39080e590c7f703b3fc230949 /libavformat/img2enc.c
parent976e3439ed992b8e06e3737642448a3935b148e4 (diff)
parent9e6b5e61a0c91e25e298d0a21b189c4c95443795 (diff)
downloadffmpeg-647fe2e77733edf6e3a15c490056211bc38ccc20.tar.gz
Merge commit '9e6b5e61a0c91e25e298d0a21b189c4c95443795'
* commit '9e6b5e61a0c91e25e298d0a21b189c4c95443795': img2enc: add an option for overwriting one file with subsequent images Conflicts: doc/muxers.texi libavformat/img2enc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/img2enc.c')
-rw-r--r--libavformat/img2enc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index 67b5819dc9..fb297da20b 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -36,7 +36,7 @@ typedef struct {
int is_pipe;
int split_planes; /**< use independent file for each Y, U, V plane */
char path[1024];
- int updatefirst;
+ int update;
} VideoMuxData;
static int write_header(AVFormatContext *s)
@@ -75,8 +75,10 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
int i;
if (!img->is_pipe) {
- if (av_get_frame_filename(filename, sizeof(filename),
- img->path, img->img_number) < 0 && img->img_number > 1 && !img->updatefirst) {
+ if (img->update) {
+ av_strlcpy(filename, img->path, sizeof(filename));
+ } else if (av_get_frame_filename(filename, sizeof(filename), img->path, img->img_number) < 0 &&
+ img->img_number > 1) {
av_log(s, AV_LOG_ERROR,
"Could not get frame filename number %d from pattern '%s' (either set updatefirst or use a pattern like %%03d within the filename pattern)\n",
img->img_number, img->path);
@@ -128,7 +130,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
#define OFFSET(x) offsetof(VideoMuxData, x)
#define ENC AV_OPT_FLAG_ENCODING_PARAM
static const AVOption muxoptions[] = {
- { "updatefirst", "update the first image file", OFFSET(updatefirst), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, ENC },
+ { "updatefirst", "continuously overwrite one file", OFFSET(update), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, ENC },
+ { "update", "continuously overwrite one file", OFFSET(update), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, ENC },
{ "start_number", "set first number in the sequence", OFFSET(img_number), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, INT_MAX, ENC },
{ NULL },
};