summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorRudolf Polzer <divverent@xonotic.org>2013-05-20 06:55:29 +0200
committerRudolf Polzer <divverent@xonotic.org>2013-05-20 06:55:29 +0200
commit34e542591bf1f9573548b90c87d8c07f8a353570 (patch)
treed8e781c921eb5c2355e7d0f99c143c30e1bc65a2 /TOOLS
parentd8c06cd99e2b46b00da53850570aed6b6d52da27 (diff)
downloadmpv-34e542591bf1f9573548b90c87d8c07f8a353570.tar.bz2
mpv-34e542591bf1f9573548b90c87d8c07f8a353570.tar.xz
vf_dlopen framestep filter: add a parameter for the phase
also, default to 0-indexed frame counts (so by default, the 1st frame is output). Old behaviour can be done by -vf dlopen=./framestep.so:42:41.
Diffstat (limited to 'TOOLS')
-rw-r--r--TOOLS/vf_dlopen/framestep.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/TOOLS/vf_dlopen/framestep.c b/TOOLS/vf_dlopen/framestep.c
index 322ca56c1f..6440fe3139 100644
--- a/TOOLS/vf_dlopen/framestep.c
+++ b/TOOLS/vf_dlopen/framestep.c
@@ -35,6 +35,10 @@
* usage: -vf dlopen=./framestep.so:5
*
* outputs every 5th frame
+ *
+ * usage: -vf dlopen=./framestep.so:5:3
+ *
+ * outputs every 5th frame, starting with frame index 3 (default: 0)
*/
typedef struct {
@@ -46,10 +50,10 @@ static int framestep_put_image(struct vf_dlopen_context *ctx)
framestep_data_t *framestep = ctx->priv;
// stepping
- ++framestep->pos;
- if (framestep->pos < framestep->step)
+ --framestep->pos;
+ if (framestep->pos >= 0)
return 0;
- framestep->pos = 0;
+ framestep->pos += framestep->step;
// copying
assert(ctx->inpic.planes == ctx->outpic[0].planes);
@@ -81,13 +85,14 @@ int vf_dlopen_getcontext(struct vf_dlopen_context *ctx, int argc, const char **a
{
VF_DLOPEN_CHECK_VERSION(ctx);
- if (argc != 1)
+ if (argc != 1 && argc != 2)
return -1;
framestep_data_t *framestep = malloc(sizeof(framestep_data_t));
memset(framestep, 0, sizeof(*framestep));
framestep->step = atoi(argv[0]);
+ framestep->pos = (argc >= 2) ? atoi(argv[1]) : 0;
ctx->priv = framestep;
ctx->put_image = framestep_put_image;