From: "softworkz ." <softworkz-at-hotmail.com@ffmpeg.org> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH 1/2] avformat: add avformat_query_seekable Date: Sun, 13 Apr 2025 16:09:31 +0000 Message-ID: <DM8P223MB03651EDCA0D837A06C6B7C62BAB02@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM> (raw) In-Reply-To: <20250413111545.4619-1-ffmpeg@gyani.pro> > -----Original Message----- > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Gyan > Doshi > Sent: Sonntag, 13. April 2025 13:16 > To: ffmpeg-devel@ffmpeg.org > Subject: [FFmpeg-devel] [PATCH 1/2] avformat: add > avformat_query_seekable > > Utility function to report seekability features for a given input. > > Useful for ffprobe and to extend seek possibilities in fftools. > --- > 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..e00f1ed0d9 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); Hi Gyan, I like the idea of showing seekability in FFprobe output! As far as I understand, these flags are expressing three different things: 1. Seek method > +#define AVSEEKABLE_NORMAL 0x01 ///< I/O is seekable like a local > file > +#define AVSEEKABLE_PROTOCOL 0x02 ///< I/O seek is through protocol > request via avio_seek_time > +#define AVSEEKABLE_DEMUXER 0x04 ///< demuxer has a seek function > +#define AVSEEKABLE_PKTSCAN 0x08 ///< seek is performed by consuming 2. Seek parameter type > and scanning packet timestamps > +#define AVSEEKABLE_TIME 0x10 ///< seek target can be a timestamp > +#define AVSEEKABLE_BYTE 0x20 ///< seek target can be in bytes > +#define AVSEEKABLE_FRAME 0x40 ///< seek target can be a frame > index 3. Additional seek behavior > +#define AVSEEKABLE_PTS 0x100 ///< seek target timestamp is > expected to be PTS > +#define AVSEEKABLE_FAST 0x200 ///< demuxer allows fast but > inaccurate seeking > +#define AVSEEKABLE_FWDONLY 0x400 ///< set seek will be equal or > forward of specified seek point Wouldn't it be better for clarity when this differentiation would be reflected in the naming? Maybe something like this: AVSEEKABLE_VIA_DEMUXER AVSEEKABLE_BY_TIME AVSEEKABLE_BEHAVIOR_FAST Another note: > +#define AVSEEKABLE_NORMAL 0x01 ///< I/O is seekable like a local > +#define AVSEEKABLE_PROTOCOL 0x02 ///< I/O seek is through protocol > +#define AVSEEKABLE_DEMUXER 0x04 ///< demuxer has a seek function > +#define AVSEEKABLE_PKTSCAN 0x08 ///< seek is performed by consuming There's no (numeric) room for extending the first block > +#define AVSEEKABLE_TIME 0x10 ///< seek target can be a timestamp > +#define AVSEEKABLE_BYTE 0x20 ///< seek target can be in bytes > +#define AVSEEKABLE_FRAME 0x40 ///< seek target can be a frame > + // TODO: no flag for frame seeking. Add flag and update this check > + if (s->iformat->flags & 0) > + ret |= AVSEEKABLE_FRAME; > + > + if (s->iformat->flags & AVFMT_SEEK_TO_PTS) > + ret |= AVSEEKABLE_PTS; Maybe add a check for AVSEEKABLE_TIME - for sanity? > + // TODO: flag exists but not added to the demuxers which support it > + if (s->iformat->flags & AVFMT_FLAG_FAST_SEEK) > + ret |= AVSEEKABLE_FAST; Another idea would be to return a struct (like AVSeekability) with a clear separation of those three types of information, maybe that would provide better clarity? Best, sw _______________________________________________ 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".
next prev parent reply other threads:[~2025-04-13 16:09 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-04-13 11:15 Gyan Doshi 2025-04-13 11:15 ` [FFmpeg-devel] [PATCH 2/2] ffprobe: show seekability details in format section Gyan Doshi 2025-04-13 16:18 ` softworkz . 2025-04-14 4:39 ` Gyan Doshi 2025-04-14 4:52 ` softworkz . 2025-04-14 4:57 ` softworkz . 2025-04-14 6:53 ` Gyan Doshi 2025-04-14 7:27 ` softworkz . 2025-04-14 10:36 ` Gyan Doshi 2025-04-14 8:34 ` Nicolas George 2025-04-13 16:09 ` softworkz . [this message] 2025-04-14 4:23 ` [FFmpeg-devel] [PATCH 1/2] avformat: add avformat_query_seekable Gyan Doshi 2025-04-14 4:40 ` softworkz . 2025-04-13 16:42 ` Zhao Zhili 2025-04-14 4:10 ` Gyan Doshi
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=DM8P223MB03651EDCA0D837A06C6B7C62BAB02@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM \ --to=softworkz-at-hotmail.com@ffmpeg.org \ --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