summaryrefslogtreecommitdiff
path: root/libavformat/img2enc.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2019-12-26 20:54:14 +0100
committerMarton Balint <cus@passwd.hu>2020-01-03 11:23:55 +0100
commit43d5ddb4b551845ca2191eb68347355323658c38 (patch)
tree5fea01f289a12309e6b53509b9f54bbb71a3ced6 /libavformat/img2enc.c
parent04e36fc4e170fc5a30e2f9e6796b39d25530f609 (diff)
downloadffmpeg-43d5ddb4b551845ca2191eb68347355323658c38.tar.gz
avformat/img2enc: reindent after last commit
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/img2enc.c')
-rw-r--r--libavformat/img2enc.c86
1 files changed, 41 insertions, 45 deletions
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index dfc7566dad..a976d07acc 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -131,48 +131,46 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
int ret, i;
int nb_renames = 0;
- {
- if (img->update) {
- av_strlcpy(filename, img->path, sizeof(filename));
- } else if (img->use_strftime) {
- time_t now0;
- struct tm *tm, tmpbuf;
- time(&now0);
- tm = localtime_r(&now0, &tmpbuf);
- if (!strftime(filename, sizeof(filename), img->path, tm)) {
- av_log(s, AV_LOG_ERROR, "Could not get frame filename with strftime\n");
- return AVERROR(EINVAL);
- }
- } else if (img->frame_pts) {
- if (av_get_frame_filename2(filename, sizeof(filename), img->path, pkt->pts, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
- av_log(s, AV_LOG_ERROR, "Cannot write filename by pts of the frames.");
- return AVERROR(EINVAL);
- }
- } else if (av_get_frame_filename2(filename, sizeof(filename), img->path,
- img->img_number,
- AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0 &&
- img->img_number > 1) {
- av_log(s, AV_LOG_ERROR,
- "Could not get frame filename number %d from pattern '%s'. "
- "Use '-frames:v 1' for a single image, or '-update' option, or use a pattern such as %%03d within the filename.\n",
- img->img_number, img->path);
+ if (img->update) {
+ av_strlcpy(filename, img->path, sizeof(filename));
+ } else if (img->use_strftime) {
+ time_t now0;
+ struct tm *tm, tmpbuf;
+ time(&now0);
+ tm = localtime_r(&now0, &tmpbuf);
+ if (!strftime(filename, sizeof(filename), img->path, tm)) {
+ av_log(s, AV_LOG_ERROR, "Could not get frame filename with strftime\n");
return AVERROR(EINVAL);
}
- for (i = 0; i < 4; i++) {
- snprintf(img->tmp[i], sizeof(img->tmp[i]), "%s.tmp", filename);
- av_strlcpy(img->target[i], filename, sizeof(img->target[i]));
- if (s->io_open(s, &pb[i], img->use_rename ? img->tmp[i] : filename, AVIO_FLAG_WRITE, NULL) < 0) {
- av_log(s, AV_LOG_ERROR, "Could not open file : %s\n", img->use_rename ? img->tmp[i] : filename);
- return AVERROR(EIO);
- }
-
- if (!img->split_planes || i+1 >= desc->nb_components)
- break;
- filename[strlen(filename) - 1] = "UVAx"[i];
+ } else if (img->frame_pts) {
+ if (av_get_frame_filename2(filename, sizeof(filename), img->path, pkt->pts, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
+ av_log(s, AV_LOG_ERROR, "Cannot write filename by pts of the frames.");
+ return AVERROR(EINVAL);
+ }
+ } else if (av_get_frame_filename2(filename, sizeof(filename), img->path,
+ img->img_number,
+ AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0 &&
+ img->img_number > 1) {
+ av_log(s, AV_LOG_ERROR,
+ "Could not get frame filename number %d from pattern '%s'. "
+ "Use '-frames:v 1' for a single image, or '-update' option, or use a pattern such as %%03d within the filename.\n",
+ img->img_number, img->path);
+ return AVERROR(EINVAL);
+ }
+ for (i = 0; i < 4; i++) {
+ snprintf(img->tmp[i], sizeof(img->tmp[i]), "%s.tmp", filename);
+ av_strlcpy(img->target[i], filename, sizeof(img->target[i]));
+ if (s->io_open(s, &pb[i], img->use_rename ? img->tmp[i] : filename, AVIO_FLAG_WRITE, NULL) < 0) {
+ av_log(s, AV_LOG_ERROR, "Could not open file : %s\n", img->use_rename ? img->tmp[i] : filename);
+ return AVERROR(EIO);
}
- if (img->use_rename)
- nb_renames = i + 1;
+
+ if (!img->split_planes || i+1 >= desc->nb_components)
+ break;
+ filename[strlen(filename) - 1] = "UVAx"[i];
}
+ if (img->use_rename)
+ nb_renames = i + 1;
if (img->split_planes) {
int ysize = par->width * par->height;
@@ -198,13 +196,11 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
avio_write(pb[0], pkt->data, pkt->size);
}
avio_flush(pb[0]);
- {
- ff_format_io_close(s, &pb[0]);
- for (i = 0; i < nb_renames; i++) {
- int ret = ff_rename(img->tmp[i], img->target[i], s);
- if (ret < 0)
- return ret;
- }
+ ff_format_io_close(s, &pb[0]);
+ for (i = 0; i < nb_renames; i++) {
+ int ret = ff_rename(img->tmp[i], img->target[i], s);
+ if (ret < 0)
+ return ret;
}
img->img_number++;