[FFmpeg-devel] [PATCH] avformat/thp: implement seeking
Michael Niedermayer
michael at niedermayer.cc
Tue Jan 26 11:45:26 CET 2016
On Tue, Jan 26, 2016 at 09:03:05AM +0100, Paul B Mahol wrote:
> On 1/26/16, Michael Niedermayer <michael at niedermayer.cc> wrote:
> > On Mon, Jan 25, 2016 at 11:02:35PM +0100, Paul B Mahol wrote:
> >> On 1/25/16, Michael Niedermayer <michael at niedermayer.cc> wrote:
> >> > On Mon, Jan 25, 2016 at 10:29:08PM +0100, Paul B Mahol wrote:
> >> >> On 1/25/16, Michael Niedermayer <michael at niedermayer.cc> wrote:
> >> >> > On Sun, Nov 22, 2015 at 12:58:51AM +0100, Paul B Mahol wrote:
> >> >> >> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> >> >> >> ---
> >> >> >> libavformat/thp.c | 44
> >> >> >> +++++++++++++++++++++++++++++++++++++++++---
> >> >> >> 1 file changed, 41 insertions(+), 3 deletions(-)
> >> >> >
> >> >> > confirmed to be working
> >> >>
> >> >> No, it doesnt always. AFAIK its not possible to fix.
> >> >
> >> > it worked with the thp files i had locally :(
> >> > where can i find a file with which it doesnt work ?
> >>
> >> https://www.dropbox.com/s/zr8034va0y6tfyy/KilllaKillOP.thp
> >
> > seeking (clicking right/left arrows in ffplay) seems to work with
> > this file too
> >
>
> but with mouse, doesnt?
needs something like this:
diff --git a/libavformat/thp.c b/libavformat/thp.c
index 9d54219..38d67b8 100644
--- a/libavformat/thp.c
+++ b/libavformat/thp.c
@@ -223,7 +223,7 @@ static int thp_read_seek(AVFormatContext *s, int stream_index,
if (stream_index != thp->video_stream_index)
return -1;
- if (index >= 0 && index < st->nb_index_entries) {
+ if (index >= 0 && index < st->nb_index_entries && st->index_entries[index].timestamp >= timestamp) {
AVIndexEntry *e = &st->index_entries[index];
thp->next_frame = e->pos;
OR
diff --git a/libavformat/thp.c b/libavformat/thp.c
index 9d54219..9892d61 100644
--- a/libavformat/thp.c
+++ b/libavformat/thp.c
@@ -218,7 +218,7 @@ static int thp_read_seek(AVFormatContext *s, int stream_index,
{
ThpDemuxContext *thp = s->priv_data;
AVStream *st = s->streams[stream_index];
- int index = av_index_search_timestamp(st, timestamp, flags);
+ int index = av_index_search_timestamp(st, timestamp, flags & ~AVSEEK_FLAG_BACKWARD);
if (stream_index != thp->video_stream_index)
return -1;
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160126/77402489/attachment.sig>
More information about the ffmpeg-devel
mailing list