diff options
-rw-r--r-- | modules/vidloop/vidloop.c | 18 |
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; } |