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 C61B04DA76
	for <ffmpegdev@gitmailbox.com>; Tue, 22 Apr 2025 04:54:20 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 479F3687C17;
	Tue, 22 Apr 2025 07:54:14 +0300 (EEST)
Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E7DB8687D4E
 for <ffmpeg-devel@ffmpeg.org>; Tue, 22 Apr 2025 07:54:06 +0300 (EEST)
Received: from smtp1.mailbox.org (smtp1.mailbox.org
 [IPv6:2001:67c:2050:b231:465::1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4ZhVJD2v7Pz9s7t
 for <ffmpeg-devel@ffmpeg.org>; Tue, 22 Apr 2025 06:54:04 +0200 (CEST)
Message-ID: <5a767a5b-96a3-47e4-ba47-a2572691fcb5@gyani.pro>
Date: Tue, 22 Apr 2025 10:24:01 +0530
MIME-Version: 1.0
To: ffmpeg-devel@ffmpeg.org
References: <20250415104439.13431-1-ffmpeg@gyani.pro>
 <aAaOo/EIFF0O9lJG@mariano>
Content-Language: en-US
From: Gyan Doshi <ffmpeg@gyani.pro>
In-Reply-To: <aAaOo/EIFF0O9lJG@mariano>
X-Rspamd-Queue-Id: 4ZhVJD2v7Pz9s7t
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
Subject: Re: [FFmpeg-devel] [PATCH v2 1/2] avformat: add
 avformat_query_seekable
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>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/5a767a5b-96a3-47e4-ba47-a2572691fcb5@gyani.pro/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>



On 2025-04-21 11:59 pm, Stefano Sabatini wrote:
> On date Tuesday 2025-04-15 16:09:56 +0530, Gyan Doshi wrote:
>> Utility function to report seekability features for a given input.
>>
>> Useful for ffprobe and to extend seek possibilities in fftools.
>> ---
>> v2:
>>     made constants more descriptive
>>     add exception for rtsp false negative seekability
>>
>>   doc/APIchanges         |  3 +++
>>   libavformat/avformat.h | 22 ++++++++++++++++++
>>   libavformat/seek.c     | 53 ++++++++++++++++++++++++++++++++++++++++++
>>   libavformat/version.h  |  2 +-
>>   4 files changed, 79 insertions(+), 1 deletion(-)
>>
>> diff --git a/doc/APIchanges b/doc/APIchanges
>> index 65bf5a9419..879f56b572 100644
>> --- a/doc/APIchanges
>> +++ b/doc/APIchanges
>> @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28
>>   
>>   API changes, most recent first:
>>   
>> +2025-04-xx - xxxxxxxxxx - lavf 62.1.100 - avformat.h
>> +  Add avformat_query_seekable().
>> +
>>   2025-04-07 - 19e9a203b7 - lavu 60.01.100 - dict.h
>>     Add AV_DICT_DEDUP.
>>   
>> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
>> index 498c3020a5..f9da5e9e79 100644
>> --- a/libavformat/avformat.h
>> +++ b/libavformat/avformat.h
>> @@ -2338,6 +2338,28 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp,
>>    */
>>   int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
>>   
>> +#define AVSEEKABLE_IO_NORMAL       0x00000001 ///< I/O is seekable like a local file
>> +#define AVSEEKABLE_IO_PROTOCOL     0x00000002 ///< I/O seek is through protocol request via avio_seek_time
>> +#define AVSEEKABLE_VIA_DEMUXER     0x00000004 ///< demuxer has a seek function
>> +#define AVSEEKABLE_VIA_PKTSCAN     0x00000008 ///< seek is performed by consuming and scanning packet timestamps
>> +#define AVSEEKABLE_BY_TIME         0x00000100 ///< seek target can be a timestamp
>> +#define AVSEEKABLE_BY_BYTE         0x00000200 ///< seek target can be in bytes
>> +#define AVSEEKABLE_BY_FRAME        0x00000400 ///< seek target can be a frame index
>> +#define AVSEEKABLE_PROP_PTS        0x00010000 ///< seek target timestamp is expected to be PTS
>> +#define AVSEEKABLE_PROP_FAST       0x00020000 ///< demuxer allows fast but inaccurate seeking
>> +#define AVSEEKABLE_PROP_FWDONLY    0x00040000 ///< set seek will be equal or forward of specified seek point
> Not sure I get this, can you clarify/expand?

The framework does not seek to an earlier KF, e.g. if either avio is not 
AVIO_SEEKABLE_NORMAL or the index does not correctly mark keyframes. 
then a seek to 12s will return frames from 12s and decoding will start 
from next KF encountered.
I see now that my test for this can produce false postives. I'll try to 
fix it.

>> +/**
>> + * Report if and how a seek can be performed in a given input.
> I don't like the "can be performed in a given input" part, I'd use a
> terminology closer to the function name: "for this format context".
>
> Also, probably we want to specify that the method should be used after
> the open operation or whatever.

Will do.

Regards,
Gyan
_______________________________________________
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".