From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTPS id 35D424BAC5
	for <ffmpegdev@gitmailbox.com>; Fri,  2 May 2025 08:02:18 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D61B768B8BF;
	Fri,  2 May 2025 11:02:07 +0300 (EEST)
Received: from smtp.dnamail.fi (sender103.dnamail.fi [83.102.40.157])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4724268B722
 for <ffmpeg-devel@ffmpeg.org>; Fri,  2 May 2025 11:02:01 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by smtp.dnamail.fi (Postfix) with ESMTP id C75114098E8A;
 Fri,  2 May 2025 11:02:00 +0300 (EEST)
X-Virus-Scanned: X-Virus-Scanned: amavis at smtp.dnamail.fi
Received: from smtp.dnamail.fi ([83.102.40.157])
 by localhost (dmail-psmtp02.s.dnaip.fi [127.0.0.1]) (amavis, port 10024)
 with ESMTP id widWuWu50qn8; Fri,  2 May 2025 11:02:00 +0300 (EEST)
Received: from kanala.kunkku.net (82-181-37-223.bb.dnainternet.fi
 [82.181.37.223])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by smtp.dnamail.fi (Postfix) with ESMTPS id 39CF24098E81;
 Fri,  2 May 2025 11:02:00 +0300 (EEST)
Received: from kanala.kunkku.net (kanala.kunkku.net [127.0.0.1])
 by kanala.kunkku.net (8.18.1/8.18.1) with ESMTP id 54281vgQ672931;
 Fri, 2 May 2025 11:01:57 +0300
Received: (from kaarle@localhost)
 by kanala.kunkku.net (8.18.1/8.18.1/Submit) id 54281vRf672930;
 Fri, 2 May 2025 11:01:57 +0300
X-Authentication-Warning: kanala.kunkku.net: kaarle set sender to
 kaarle.ritvanen@datakunkku.fi using -f
To: ffmpeg-devel@ffmpeg.org
Date: Fri,  2 May 2025 11:01:45 +0300
Message-ID: <20250502080145.672904-2-kaarle.ritvanen@datakunkku.fi>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <20250502080145.672904-1-kaarle.ritvanen@datakunkku.fi>
References: <20250502080145.672904-1-kaarle.ritvanen@datakunkku.fi>
MIME-Version: 1.0
Subject: [FFmpeg-devel] [PATCH 2/2] avformat/seek: fail seeking immediately
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
From: Kaarle Ritvanen via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250502080145.672904-2-kaarle.ritvanen@datakunkku.fi/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

when AVFMTCTX_UNSEEKABLE is set. Depending on the codec, the execution
of this function may take several seconds. This is an optimization for
the case where the stream is already known unseekable.

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
---
 libavformat/seek.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/seek.c b/libavformat/seek.c
index c0d94371e6..1a7d3d6741 100644
--- a/libavformat/seek.c
+++ b/libavformat/seek.c
@@ -643,6 +643,9 @@ int av_seek_frame(AVFormatContext *s, int stream_index,
 {
     int ret;
 
+    if (s->ctx_flags & AVFMTCTX_UNSEEKABLE)
+        return AVERROR(ENOSYS);
+
     if (ffifmt(s->iformat)->read_seek2 && !ffifmt(s->iformat)->read_seek) {
         int64_t min_ts = INT64_MIN, max_ts = INT64_MAX;
         if ((flags & AVSEEK_FLAG_BACKWARD))
-- 
2.49.0

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