summaryrefslogtreecommitdiffstats
path: root/demux/demux.c
diff options
context:
space:
mode:
Diffstat (limited to 'demux/demux.c')
-rw-r--r--demux/demux.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/demux/demux.c b/demux/demux.c
index 01c03026f7..d8ebde7384 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -963,9 +963,22 @@ int demux_seek(demuxer_t *demuxer, float rel_seek_secs, int flags)
return 0;
}
+ if ((flags & SEEK_FACTOR) && !(flags & SEEK_ABSOLUTE)) {
+ MP_WARN(demuxer, "Invalid seek flags.\n");
+ return 0;
+ }
+
if (rel_seek_secs == MP_NOPTS_VALUE && (flags & SEEK_ABSOLUTE))
return 0;
+ if (!(flags & (SEEK_BACKWARD | SEEK_FORWARD))) {
+ if (flags & SEEK_ABSOLUTE || rel_seek_secs < 0) {
+ flags |= SEEK_BACKWARD;
+ } else {
+ flags |= SEEK_FORWARD;
+ }
+ }
+
pthread_mutex_lock(&in->lock);
flush_locked(demuxer);