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.rheinha...@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 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".