diff mbox series

[FFmpeg-devel,4/5] avformat/utils: Also set io_repositioned for generic seeking

Message ID AM7PR03MB66601B958C563B1A8D2996758FC39@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 4d200342a7d512dbe91c1820ee82fc3aaf4b644d
Headers show
Series [FFmpeg-devel,1/5] avformat/av1dec: Set position of AVPackets given to BSF | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 22, 2021, 11:29 a.m. UTC
It allows demuxers to perform certain tasks after
a successful generic seek.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
This io_repositioned and the flags which contain which type of seeking
a format supports are IMO implementation details that are only public
because up until recently there were no internal flags.

 libavformat/utils.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

James Almer Aug. 22, 2021, 2:23 p.m. UTC | #1
On 8/22/2021 8:29 AM, Andreas Rheinhardt wrote:
> It allows demuxers to perform certain tasks after
> a successful generic seek.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> This io_repositioned and the flags which contain which type of seeking
> a format supports are IMO implementation details that are only public
> because up until recently there were no internal flags.

io_repositioned could be made internal, yeah. It's apparently meant to 
be used by demuxers, not callers.

> 
>   libavformat/utils.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 5754fc1537..39f082d98d 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -2354,10 +2354,12 @@ static int seek_frame_generic(AVFormatContext *s, int stream_index,
>               ie = &st->internal->index_entries[st->internal->nb_index_entries - 1];
>               if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0)
>                   return ret;
> +            s->io_repositioned = 1;
>               avpriv_update_cur_dts(s, st, ie->timestamp);
>           } else {
>               if ((ret = avio_seek(s->pb, s->internal->data_offset, SEEK_SET)) < 0)
>                   return ret;
> +            s->io_repositioned = 1;
>           }
>           av_packet_unref(pkt);
>           for (;;) {
> @@ -2392,6 +2394,7 @@ static int seek_frame_generic(AVFormatContext *s, int stream_index,
>       ie = &st->internal->index_entries[index];
>       if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0)
>           return ret;
> +    s->io_repositioned = 1;
>       avpriv_update_cur_dts(s, st, ie->timestamp);
>   
>       return 0;
> 

Should be ok.
diff mbox series

Patch

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 5754fc1537..39f082d98d 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2354,10 +2354,12 @@  static int seek_frame_generic(AVFormatContext *s, int stream_index,
             ie = &st->internal->index_entries[st->internal->nb_index_entries - 1];
             if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0)
                 return ret;
+            s->io_repositioned = 1;
             avpriv_update_cur_dts(s, st, ie->timestamp);
         } else {
             if ((ret = avio_seek(s->pb, s->internal->data_offset, SEEK_SET)) < 0)
                 return ret;
+            s->io_repositioned = 1;
         }
         av_packet_unref(pkt);
         for (;;) {
@@ -2392,6 +2394,7 @@  static int seek_frame_generic(AVFormatContext *s, int stream_index,
     ie = &st->internal->index_entries[index];
     if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0)
         return ret;
+    s->io_repositioned = 1;
     avpriv_update_cur_dts(s, st, ie->timestamp);
 
     return 0;