[FFmpeg-devel] [PATCH] libavformat/mov.c Fixed 'Error while filtering: Operation not permitted' when using -stream_loop, a short file with negativ timestamps and only one keyframe Fixes Ticket #6139

2017-06-03 Thread Jonas Licht
---

 libavformat/mov.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 3845e63b53..afc2efe063 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6547,9 +6547,9 @@ static int mov_seek_stream(AVFormatContext *s, AVStream 
*st, int64_t timestamp,
 {
 MOVStreamContext *sc = st->priv_data;
 int sample, time_sample;
-int i;
-
-int ret = mov_seek_fragment(s, st, timestamp);
+int i,ret;
+timestamp -= sc->time_offset;
+ret = mov_seek_fragment(s, st, timestamp);
 if (ret < 0)
 return ret;
 
-- 
2.13.0


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libavformat/mov.c: use calculated dts offset when seeking in streams

2017-06-19 Thread Jonas Licht
Subtract the calculated dts offset from the requested timestamp before
seeking. This fixes an error "Error while filtering: Operation not
permitted" observed with a short file which contains only one key frame
and starts with negative timestamps.

Then, av_index_search_timestamp() returns a valid negative timestamp,
but mov_seek_stream bails out with AVERROR_INVALIDDATA.

Fixes ticket #6139.

Signed-off-by: Jonas Licht 
---
 libavformat/mov.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 63f84be782..45d5f72aaf 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6615,9 +6615,11 @@ static int mov_seek_stream(AVFormatContext *s, AVStream 
*st, int64_t timestamp,
 {
 MOVStreamContext *sc = st->priv_data;
 int sample, time_sample;
-int i;
+int i, ret;
+
+timestamp -= sc->time_offset;
 
-int ret = mov_seek_fragment(s, st, timestamp);
+ret = mov_seek_fragment(s, st, timestamp);
 if (ret < 0)
 return ret;
 
-- 
2.13.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel