avformat/img2enc: Fix integer truncation when frame_pts is enabled

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
Zhao Zhili 2024-09-24 00:16:13 +08:00
parent a2d9663241
commit f56a54387b
1 changed files with 4 additions and 4 deletions

View File

@ -160,13 +160,13 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
} else if (img->frame_pts) { } else if (img->frame_pts) {
if (av_get_frame_filename2(filename, sizeof(filename), s->url, pkt->pts, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) { if (ff_get_frame_filename(filename, sizeof(filename), s->url, pkt->pts, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
av_log(s, AV_LOG_ERROR, "Cannot write filename by pts of the frames."); av_log(s, AV_LOG_ERROR, "Cannot write filename by pts of the frames.");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
} else if (av_get_frame_filename2(filename, sizeof(filename), s->url, } else if (ff_get_frame_filename(filename, sizeof(filename), s->url,
img->img_number, img->img_number,
AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) { AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
if (img->img_number == img->start_img_number) { if (img->img_number == img->start_img_number) {
av_log(s, AV_LOG_WARNING, "The specified filename '%s' does not contain an image sequence pattern or a pattern is invalid.\n", s->url); av_log(s, AV_LOG_WARNING, "The specified filename '%s' does not contain an image sequence pattern or a pattern is invalid.\n", s->url);
av_log(s, AV_LOG_WARNING, av_log(s, AV_LOG_WARNING,