[FFmpeg-devel] [PATCH] avformat/img2dec: Join branches
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Wed May 8 13:13:00 EEST 2024
Piped inputs don't support the ts_from_file option,
which allows to avoid a branch. Should also help
Coverity with issue #1500302.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavformat/img2dec.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index a40675d434..5c2ff58f2e 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -502,7 +502,9 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
}
pkt->stream_index = 0;
pkt->flags |= AV_PKT_FLAG_KEY;
- if (s->ts_from_file) {
+ if (s->is_pipe) {
+ pkt->pos = avio_tell(f[0]);
+ } else if (s->ts_from_file) {
struct stat img_stat;
if (stat(filename, &img_stat)) {
res = AVERROR(EIO);
@@ -514,13 +516,10 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
pkt->pts = 1000000000*pkt->pts + img_stat.st_mtim.tv_nsec;
#endif
av_add_index_entry(s1->streams[0], s->img_number, pkt->pts, 0, 0, AVINDEX_KEYFRAME);
- } else if (!s->is_pipe) {
+ } else {
pkt->pts = s->pts;
}
- if (s->is_pipe)
- pkt->pos = avio_tell(f[0]);
-
/*
* export_path_metadata must be explicitly enabled via
* command line options for path metadata to be exported
--
2.40.1
More information about the ffmpeg-devel
mailing list