summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2016-06-04 23:21:35 +0200
committerAlfred E. Heggestad <aeh@db.org>2016-06-04 23:21:35 +0200
commite6085d98b562cfc78a7d62ac9e3aa1c3923796dc (patch)
tree3bb0c293a58f1eb9ee966836d6d7781218ef81fa
parent2d396f79d20dbbc1321aa4e705c2f867a97cd307 (diff)
vidloop: copy frame if 1 or more filters are enabled
-rw-r--r--modules/vidloop/vidloop.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/vidloop/vidloop.c b/modules/vidloop/vidloop.c
index 9d05618..59a5ed3 100644
--- a/modules/vidloop/vidloop.c
+++ b/modules/vidloop/vidloop.c
@@ -72,6 +72,7 @@ static struct video_loop *gvl;
static int display(struct video_loop *vl, struct vidframe *frame)
{
+ struct vidframe *frame_filt = NULL;
struct le *le;
int err = 0;
@@ -83,6 +84,21 @@ static int display(struct video_loop *vl, struct vidframe *frame)
struct vidfilt_dec_st *st = le->data;
+ /* Some video decoders keeps the displayed video frame
+ * in memory and we should not write to that frame.
+ */
+ if (!frame_filt) {
+
+ err = vidframe_alloc(&frame_filt, frame->fmt,
+ &frame->size);
+ if (err)
+ return err;
+
+ vidframe_copy(frame_filt, frame);
+
+ frame = frame_filt;
+ }
+
if (st->vf->dech)
err |= st->vf->dech(st, frame);
}
@@ -99,6 +115,8 @@ static int display(struct video_loop *vl, struct vidframe *frame)
vl->err = err;
}
+ mem_deref(frame_filt);
+
return err;
}