summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-31 17:10:48 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-31 17:12:54 +0100
commit3ff4da87a0b4ad742b436e6534b3217623824ff4 (patch)
tree1906d8baeac477bec4bb054e5a0b0add7edd9bbc /src
parent5d208afe19d37bd246de2f47436a86669d612fc9 (diff)
downloadadvtime-3ff4da87a0b4ad742b436e6534b3217623824ff4.tar.gz
advtime-3ff4da87a0b4ad742b436e6534b3217623824ff4.tar.bz2
advtime-3ff4da87a0b4ad742b436e6534b3217623824ff4.zip
video-decode: Add seek function
Diffstat (limited to 'src')
-rw-r--r--src/video_decode.c12
-rw-r--r--src/video_decode.h3
2 files changed, 15 insertions, 0 deletions
diff --git a/src/video_decode.c b/src/video_decode.c
index ea23aea..7ce6f42 100644
--- a/src/video_decode.c
+++ b/src/video_decode.c
@@ -100,6 +100,18 @@ video_decode_uninit(struct video_decode **_vd)
}
int
+video_decode_seek(struct video_decode *_vd, int64_t timestamp)
+{
+ struct video_decode_priv *vd = (struct video_decode_priv *) _vd;
+
+ if (vd->fmt_ctx->start_time != AV_NOPTS_VALUE)
+ timestamp += vd->fmt_ctx->start_time;
+
+ return avformat_seek_file(vd->fmt_ctx, vd->stream,
+ INT64_MIN, timestamp, INT64_MAX,0);
+}
+
+int
video_decode_get_frame(struct video_decode *_vd, struct video_frame **frame)
{
struct video_decode_priv *vd = (struct video_decode_priv *) _vd;
diff --git a/src/video_decode.h b/src/video_decode.h
index 3261b76..bd2c558 100644
--- a/src/video_decode.h
+++ b/src/video_decode.h
@@ -18,6 +18,9 @@ video_decode_init(struct video_decode **vd, char *file, int64_t timestamp);
void
video_decode_uninit(struct video_decode **vd);
+int
+video_decode_seek(struct video_decode *_vd, int64_t timestamp);
+
/*
* Returns number of decoded frames:
* 1 - One frame decoded