[FFmpeg-devel] [PATCH 06/18] avformat/http: always allow no-op seek
Michael Niedermayer
michaelni at gmx.at
Mon Dec 30 17:43:42 CET 2013
On Mon, Dec 30, 2013 at 01:34:50PM +0200, Anssi Hannula wrote:
> 30.12.2013 13:19, Reimar Döffinger kirjoitti:
> > On Mon, Dec 30, 2013 at 01:14:20PM +0200, Anssi Hannula wrote:
> >> This also allows checking stream position as per ffurl_seek() doxy.
> >>
> >> Signed-off-by: Anssi Hannula <anssi.hannula at iki.fi>
> >> ---
> >> libavformat/http.c | 2 ++
> >> 1 file changed, 2 insertions(+)
> >>
> >> diff --git a/libavformat/http.c b/libavformat/http.c
> >> index fd29966..3b655c6 100644
> >> --- a/libavformat/http.c
> >> +++ b/libavformat/http.c
> >> @@ -947,6 +947,8 @@ static int64_t http_seek(URLContext *h, int64_t off, int whence)
> >>
> >> if (whence == AVSEEK_SIZE)
> >> return s->filesize;
> >> + else if ((whence == SEEK_CUR && off == 0) || (whence == SEEK_SET && off == s->off))
> >> + return s->off;
> >> else if ((s->filesize == -1 && whence == SEEK_END) || h->is_streamed)
> >> return -1;
> >
> > I kind of wonder if that really is the best place to handle it,
> > basically implementing the same check in each stream implementation
> > manually...
>
> Yeah, I didn't really like it...
>
> Maybe we should have .url_tell and mandate every stream who has
> .url_seek to have it so we could use it in ffurl_seek()?
>
> OTOH .url_tell would duplicate .url_seek(0, SEEK_CUR)... but I guess
> missing implementation for a whole function might be easier to notice
> than one case of seek().
maybe a current_offset field could be added to URLContext
and this case be handled without falling back to protocol
implementations
But that shouldnt hold other patches up, the 2 line change looks fine.
Making it more generic is a seperate thing ...
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131230/e37ed32c/attachment.asc>
More information about the ffmpeg-devel
mailing list