Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH] avformat/img2dec: Join branches
Date: Wed,  8 May 2024 12:13:00 +0200
Message-ID: <GV1P250MB073712158301160EA808A35D8FE52@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw)

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".

                 reply	other threads:[~2024-05-08 10:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=GV1P250MB073712158301160EA808A35D8FE52@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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