Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avformat/img2dec: Join branches
@ 2024-05-08 10:13 Andreas Rheinhardt
  0 siblings, 0 replies; only message in thread
From: Andreas Rheinhardt @ 2024-05-08 10:13 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

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@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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-08 10:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-08 10:13 [FFmpeg-devel] [PATCH] avformat/img2dec: Join branches Andreas Rheinhardt

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git