You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avformat/img2enc: reindent after last commit
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
@@ -131,48 +131,46 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
int ret, i;
|
int ret, i;
|
||||||
int nb_renames = 0;
|
int nb_renames = 0;
|
||||||
|
|
||||||
{
|
if (img->update) {
|
||||||
if (img->update) {
|
av_strlcpy(filename, img->path, sizeof(filename));
|
||||||
av_strlcpy(filename, img->path, sizeof(filename));
|
} else if (img->use_strftime) {
|
||||||
} else if (img->use_strftime) {
|
time_t now0;
|
||||||
time_t now0;
|
struct tm *tm, tmpbuf;
|
||||||
struct tm *tm, tmpbuf;
|
time(&now0);
|
||||||
time(&now0);
|
tm = localtime_r(&now0, &tmpbuf);
|
||||||
tm = localtime_r(&now0, &tmpbuf);
|
if (!strftime(filename, sizeof(filename), img->path, tm)) {
|
||||||
if (!strftime(filename, sizeof(filename), img->path, tm)) {
|
av_log(s, AV_LOG_ERROR, "Could not get frame filename with strftime\n");
|
||||||
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);
|
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
for (i = 0; i < 4; i++) {
|
} else if (img->frame_pts) {
|
||||||
snprintf(img->tmp[i], sizeof(img->tmp[i]), "%s.tmp", filename);
|
if (av_get_frame_filename2(filename, sizeof(filename), img->path, pkt->pts, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
|
||||||
av_strlcpy(img->target[i], filename, sizeof(img->target[i]));
|
av_log(s, AV_LOG_ERROR, "Cannot write filename by pts of the frames.");
|
||||||
if (s->io_open(s, &pb[i], img->use_rename ? img->tmp[i] : filename, AVIO_FLAG_WRITE, NULL) < 0) {
|
return AVERROR(EINVAL);
|
||||||
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];
|
|
||||||
}
|
}
|
||||||
if (img->use_rename)
|
} else if (av_get_frame_filename2(filename, sizeof(filename), img->path,
|
||||||
nb_renames = i + 1;
|
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->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) {
|
if (img->split_planes) {
|
||||||
int ysize = par->width * par->height;
|
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_write(pb[0], pkt->data, pkt->size);
|
||||||
}
|
}
|
||||||
avio_flush(pb[0]);
|
avio_flush(pb[0]);
|
||||||
{
|
ff_format_io_close(s, &pb[0]);
|
||||||
ff_format_io_close(s, &pb[0]);
|
for (i = 0; i < nb_renames; i++) {
|
||||||
for (i = 0; i < nb_renames; i++) {
|
int ret = ff_rename(img->tmp[i], img->target[i], s);
|
||||||
int ret = ff_rename(img->tmp[i], img->target[i], s);
|
if (ret < 0)
|
||||||
if (ret < 0)
|
return ret;
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
img->img_number++;
|
img->img_number++;
|
||||||
|
Reference in New Issue
Block a user