From d1bb80df16a8bee9635a916f02c848298f7d9988 Mon Sep 17 00:00:00 2001 From: Divya Jaiswal Date: Tue, 7 Jul 2015 14:53:03 +0200 Subject: v4l2-mfc-example: Add EOS This patch adds a function that tells MFC when there is end of stream. Signed-off-by: Divya Jaiswal Signed-off-by: Mateusz Krawczuk --- v4l2-mfc-example/main.c | 2 ++ v4l2-mfc-example/mfc.c | 14 ++++++++++++++ v4l2-mfc-example/mfc.h | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) (limited to 'v4l2-mfc-example') diff --git a/v4l2-mfc-example/main.c b/v4l2-mfc-example/main.c index 73b9ad7..a27aa16 100644 --- a/v4l2-mfc-example/main.c +++ b/v4l2-mfc-example/main.c @@ -171,6 +171,8 @@ void *parser_thread_func(void *args) dbg("Parser has extracted all frames"); i->parser.finished = 1; fs = 0; + mfc_dec_stop(i); + return 0; } dbg("Extracted frame of size %d", fs); diff --git a/v4l2-mfc-example/mfc.c b/v4l2-mfc-example/mfc.c index 1b535e6..0a89657 100644 --- a/v4l2-mfc-example/mfc.c +++ b/v4l2-mfc-example/mfc.c @@ -367,3 +367,17 @@ int mfc_dec_setup_capture(struct instance *i, int extra_buf) return 0; } +int mfc_dec_stop(struct instance *i) +{ + int ret; + struct v4l2_decoder_cmd cmd; + + memzero(cmd); + cmd.cmd = V4L2_ENC_CMD_STOP; + ret = ioctl(i->mfc.fd, VIDIOC_DECODER_CMD, &cmd); + if (ret != 0) { + err("Failed ioctl vidioc_decoder_cmd"); + return -1; + } + return 0; +} diff --git a/v4l2-mfc-example/mfc.h b/v4l2-mfc-example/mfc.h index 74095b4..b30ff7a 100644 --- a/v4l2-mfc-example/mfc.h +++ b/v4l2-mfc-example/mfc.h @@ -48,6 +48,7 @@ int mfc_dec_setup_capture(struct instance *i, int extra_buf); /* Dequeue a buffer, the structure *buf is used to return the parameters of the * dequeued buffer. */ int mfc_dec_dequeue_buf(struct instance *i, struct v4l2_buffer *buf); - +/* This function is for EOS*/ +int mfc_dec_stop(struct instance *i); #endif /* INCLUDE_MFC_H */ -- cgit v1.2.3