Re: [FFmpeg-devel] [EXT] [PATCH v5 7/7] avcodec/v4l2_m2m_dec: setup capture queue before enqueue the first frame

2022-04-04 Thread Ming Qian
> From: Andriy Gelman > Sent: Monday, April 4, 2022 6:29 AM > To: Ming Qian > Cc: FFmpeg development discussions and patches de...@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [EXT] [PATCH v5 7/7] avcodec/v4l2_m2m_dec: > setup capture queue before enqueue the first frame &g

Re: [FFmpeg-devel] [EXT] [PATCH v5 7/7] avcodec/v4l2_m2m_dec: setup capture queue before enqueue the first frame

2022-03-29 Thread Ming Qian
> From: Andriy Gelman [mailto:andriy.gel...@gmail.com] > Sent: Saturday, March 26, 2022 11:43 PM > To: FFmpeg development discussions and patches > Cc: Ming Qian > Subject: Re: [FFmpeg-devel] [EXT] [PATCH v5 7/7] avcodec/v4l2_m2m_dec: > setup capture queue before enque

[FFmpeg-devel] [PATCH 2/2] avcodec/v4l2_m2m_enc: add a dequeue_timeout parameter

2022-03-24 Thread Ming Qian
For the reason similar to decoder, Set a reasonable timeout instead of -1 to avoid dead waiting in some case. Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 4 ++-- libavcodec/v4l2_context.h | 2 +- libavcodec/v4l2_m2m_enc.c | 5 - 3 files changed, 7 insertions(+), 4 deletions

[FFmpeg-devel] [PATCH 1/2] avcodec/v4l2_m2m_dec: add a dequeue_timeout parameter

2022-03-24 Thread Ming Qian
think the client should keep processing OUTPUT buffers if there are available buffers until the end. To resolve it, I think we can set a reasonable timeout instead of -1. So I add a parameter dequeue_timeout, and it works on my side. Signed-off-by: Ming Qian --- libavcodec/v4l2_m2m.h | 5

[FFmpeg-devel] [PATCH v2] avcodec/v4l2_m2m_dec: export v4l2 buffer dma-buf

2022-03-24 Thread Ming Qian
if the v4l2 buffer is supported to export dma-buf, then we can report it to AV_PIX_FMT_DRM_PRIME, so the caller can pass it to other hardware device, such as display it directly without copy frame data. Signed-off-by: Ming Qian --- libavcodec/v4l2_buffers.c | 115

Re: [FFmpeg-devel] [EXT] [PATCH v5 7/7] avcodec/v4l2_m2m_dec: setup capture queue before enqueue the first frame

2022-03-21 Thread Ming Qian
queue via VIDIOC_STREAMON(). 5. Continue with the Capture Setup sequence. And this patch is just following the above flow. Ming > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of > Ming Qian > Sent: Tuesday, January 4, 2022 5:09 PM > To: ffmpeg-devel@ffmpeg.o

Re: [FFmpeg-devel] [PATCH v5 5/7] avcodec/v4l2_context: resume the decoding process after source change event received.

2022-01-11 Thread Ming Qian
On Tue, 04. Jan 17:41, Andriy Gelman wrote: > On Tue, 04. Jan 17:08, Ming Qian wrote: > > client need to resume the decoding process > > after it dequeues the source change event. > > no matter what's the return value of v4l2_resolution_changed(). > > if the client

Re: [FFmpeg-devel] [EXT] Re: [PATCH v4 2/3] avcodec/v4l2_context: resume the decoding process after source change event received.

2022-01-10 Thread Ming Qian
> -Original Message- > From: Andriy Gelman [mailto:andriy.gel...@gmail.com] > Sent: Sunday, January 9, 2022 1:13 AM > To: Ming Qian > Cc: FFmpeg development discussions and patches > Subject: Re: [EXT] Re: [FFmpeg-devel] [PATCH v4 2/3] avcodec/v4l2_context: >

Re: [FFmpeg-devel] [EXT] Re: [PATCH v4 2/3] avcodec/v4l2_context: resume the decoding process after source change event received.

2022-01-04 Thread Ming Qian
> -Original Message- > From: Andriy Gelman [mailto:andriy.gel...@gmail.com] > Sent: Wednesday, January 5, 2022 6:58 AM > To: Ming Qian > Cc: FFmpeg development discussions and patches > Subject: Re: [EXT] Re: [FFmpeg-devel] [PATCH v4 2/3] avcodec/v4l2_context: >

[FFmpeg-devel] [PATCH v5 5/7] avcodec/v4l2_context: resume the decoding process after source change event received.

2022-01-04 Thread Ming Qian
() with the V4L2_DEC_CMD_START command. 2. Continue with the Capture Setup sequence. Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 31 +++ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/libavcodec/v4l2_context.c b/libavcodec

[FFmpeg-devel] [PATCH v5 4/7] avcodec/v4l2_context: set resolution change if decoded format changed

2022-01-04 Thread Ming Qian
. the minimum number of buffers needed for decoding 4. bit-depth of the bitstream has been changed when the bit-depth is changed, the pixel format will be changed, so the format is changed after a source change event, we should handle it and reinit the capture queue. Signed-off-by: Ming Qian

[FFmpeg-devel] [PATCH v5 7/7] avcodec/v4l2_m2m_dec: setup capture queue before enqueue the first frame

2022-01-04 Thread Ming Qian
first, then enqueue the first frame. Signed-off-by: Ming Qian --- libavcodec/v4l2_m2m_dec.c | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c index b0c3d30ac8ae..e67758531ace 100644 --- a/libavcodec

[FFmpeg-devel] [PATCH v5 3/7] avcodec/v4l2_context: add v4l2_start_decode

2022-01-04 Thread Ming Qian
on dynamic resolution change, The decoding process must be resumed with either a pair of calls to VIDIOC_STREAMOFF() and VIDIOC_STREAMON() on the CAPTURE queue, or a call to VIDIOC_DECODER_CMD() with the V4L2_DEC_CMD_START command. Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 18

[FFmpeg-devel] [PATCH v5 6/7] avcodec/v4l2_context: sync v4l2 context status with driver.

2022-01-04 Thread Ming Qian
Check v4l2 context before call VIDIOC_STREAMON() or VIDIOC_STREAMOFF(). Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c index b7b584dfbef6..8910ae08d3a5 100644 --- a/libavcodec

[FFmpeg-devel] [PATCH v5 2/7] avcodec/v4l2_m2m: remove ff_v4l2_m2m_codec_full_reinit

2022-01-04 Thread Ming Qian
ff_v4l2_m2m_codec_full_reinit is not used any more, so remove it. Signed-off-by: Ming Qian --- libavcodec/v4l2_m2m.c | 76 --- libavcodec/v4l2_m2m.h | 10 -- 2 files changed, 86 deletions(-) diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c

[FFmpeg-devel] [PATCH v5 1/7] avcodec/v4l2_context: don't reinit output queue when dynamic resolution change

2022-01-04 Thread Ming Qian
operates separately from the CAPTURE queue and this remains true for the duration of the entire resolution change sequence as well. so don't reinit the output queue when handling the resolution change event Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 27

Re: [FFmpeg-devel] [EXT] Re: [PATCH v4 2/3] avcodec/v4l2_context: resume the decoding process after source change event received.

2022-01-03 Thread Ming Qian
> -Original Message- > From: Andriy Gelman [mailto:andriy.gel...@gmail.com] > Sent: Monday, January 3, 2022 12:41 AM > To: FFmpeg development discussions and patches > Cc: Ming Qian > Subject: [EXT] Re: [FFmpeg-devel] [PATCH v4 2/3] avcodec/v4l2_context: > resume

Re: [FFmpeg-devel] [EXT] Re: [PATCH v4 1/3] avcodec/v4l2_context: don't reinit output queue when dynamic resolution change

2022-01-03 Thread Ming Qian
> -Original Message- > From: Andriy Gelman [mailto:andriy.gel...@gmail.com] > Sent: Monday, January 3, 2022 12:24 AM > To: FFmpeg development discussions and patches > Cc: Ming Qian > Subject: [EXT] Re: [FFmpeg-devel] [PATCH v4 1/3] avcodec/v4l2_context: don't > rei

[FFmpeg-devel] [PATCH v2] avcodec/v4l2_m2m_dec: export v4l2 buffer dma-buf

2021-11-19 Thread Ming Qian
if the v4l2 buffer is supported to export dma-buf, then we can report it to AV_PIX_FMT_DRM_PRIME, so the caller can pass it to other hardware device, such as display it directly without copy frame data. Signed-off-by: Ming Qian --- libavcodec/v4l2_buffers.c | 115

Re: [FFmpeg-devel] [EXT] Re: [PATCH v1 2/2] avcodec/v4l2_buffer: export v4l2 buffer dma-buf

2021-11-14 Thread Ming Qian
> -Original Message- > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of > Ming Qian > Sent: Monday, November 15, 2021 10:49 AM > To: FFmpeg development discussions and patches > Subject: Re: [FFmpeg-devel] [EXT] Re: [PATCH v1 2/2] avcodec/v4l2_buf

Re: [FFmpeg-devel] [EXT] Re: [PATCH v1 2/2] avcodec/v4l2_buffer: export v4l2 buffer dma-buf

2021-11-14 Thread Ming Qian
port > v4l2 buffer dma-buf > > Caution: EXT Email > > 12 Nov 2021, 09:36 by ming.q...@nxp.com: > > > Signed-off-by: Ming Qian > > --- > > libavcodec/v4l2_buffers.c | 14 ++ > > libavcodec/v4l2_buffers.h | 1 + libavcodec/v4l2_context.c | 4 ++

[FFmpeg-devel] [PATCH v1 2/2] avcodec/v4l2_buffer: export v4l2 buffer dma-buf

2021-11-12 Thread Ming Qian
Signed-off-by: Ming Qian --- libavcodec/v4l2_buffers.c | 14 ++ libavcodec/v4l2_buffers.h | 1 + libavcodec/v4l2_context.c | 4 3 files changed, 19 insertions(+) diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c index 4b2679eb3814..efa42f4c58ea 100644

[FFmpeg-devel] [PATCH v1 1/2] avutil/buffer: support represents dma-buf

2021-11-12 Thread Ming Qian
add a member dmafd in buffer struct. we can use it represents dma-buf. Signed-off-by: Ming Qian --- libavutil/buffer.c | 12 libavutil/buffer.h | 14 ++ libavutil/buffer_internal.h | 1 + 3 files changed, 27 insertions(+) diff --git a/libavutil

[FFmpeg-devel] [PATCH v4 3/3] avcodec/v4l2_m2m_dec: setup capture queue before enqueue the first frame

2021-08-19 Thread Ming Qian
first, then enqueue the first frame. Signed-off-by: Ming Qian --- libavcodec/v4l2_m2m_dec.c | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c index 224eb3d5e7be..6b936b6df2a9 100644 --- a/libavcodec

[FFmpeg-devel] [PATCH v4 2/3] avcodec/v4l2_context: resume the decoding process after source change event received.

2021-08-19 Thread Ming Qian
() with the V4L2_DEC_CMD_START command. 2. Continue with the Capture Setup sequence. Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 52 --- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/libavcodec/v4l2_context.c b

[FFmpeg-devel] [PATCH v4 1/3] avcodec/v4l2_context: don't reinit output queue when dynamic resolution change

2021-08-19 Thread Ming Qian
operates separately from the CAPTURE queue and this remains true for the duration of the entire resolution change sequence as well. so don't reinit the output queue when handling the resolution change event Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 27

Re: [FFmpeg-devel] [EXT] Re: [PATCH v3 1/3] avcodec/v4l2_context: don't reinit output queue when dynamic resolution change

2021-08-16 Thread Ming Qian
> -Original Message- > From: Andriy Gelman [mailto:andriy.gel...@gmail.com] > Sent: Tuesday, August 17, 2021 1:34 AM > To: Ming Qian > Cc: FFmpeg development discussions and patches > Subject: Re: [EXT] Re: [FFmpeg-devel] [PATCH v3 1/3] avcodec/v4l2_context: > don'

[FFmpeg-devel] [PATCH v3 3/3] avcodec/v4l2_m2m_dec: start capture after source change event is received

2021-07-29 Thread Ming Qian
> capture streamon -> capture streamoff -> capture streamon. Then it may led to some unforeseen and serious problems. So to avoid such timing issues, the client should setup the capture queue after the first source change event is received. Signed-off-by: Ming Qian --- libavcodec/v

[FFmpeg-devel] [PATCH v3 2/3] avcodec/v4l2_context: resume the decoding process after source change event received.

2021-07-29 Thread Ming Qian
() with the V4L2_DEC_CMD_START command. 2. Continue with the Capture Setup sequence. Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 31 +++ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/libavcodec/v4l2_context.c b/libavcodec

[FFmpeg-devel] [PATCH v3 1/3] avcodec/v4l2_context: don't reinit output queue when dynamic resolution change

2021-07-29 Thread Ming Qian
operates separately from the CAPTURE queue and this remains true for the duration of the entire resolution change sequence as well. so don't reinit the output queue when handling the resolution change event Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 27

[FFmpeg-devel] [PATCH v2 2/2] avcodec/v4l2_context: resume the decoding process after source change event received.

2021-07-21 Thread Ming Qian
() with the V4L2_DEC_CMD_START command. 2. Continue with the Capture Setup sequence. Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 31 +++ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/libavcodec/v4l2_context.c b/libavcodec

[FFmpeg-devel] [PATCH v2 1/2] avcodec/v4l2_context: don't reinit output queue when dynamic resolution change

2021-07-21 Thread Ming Qian
operates separately from the CAPTURE queue and this remains true for the duration of the entire resolution change sequence as well. so don't reinit the output queue when handling the resolution change event Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 27

[FFmpeg-devel] [PATCH v1] avcodec/v4l2_context: resume the decoding process after source change event received.

2021-07-19 Thread Ming Qian
() with the V4L2_DEC_CMD_START command. 2. Continue with the Capture Setup sequence. Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 31 +++ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/libavcodec/v4l2_context.c b/libavcodec

[FFmpeg-devel] [PATCH v1] avcodec/v4l2_context: don't reinit output queue when dynamic resolution change

2021-07-16 Thread Ming Qian
operates separately from the CAPTURE queue and this remains true for the duration of the entire resolution change sequence as well. so don't reinit the output queue when handling the resolution change event Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 27

Re: [FFmpeg-devel] [EXT] Re: [PATCH v1] avcodec/v4l2_m2m_enc: Set bitrate mode to cbr by default

2020-04-29 Thread Ming Qian
> On Wed, 29. Apr 16:14, Ming Qian wrote: > > Without this setting, bitrate may have no effect > > if the default value of bitrate mode is VBR. > > > > Signed-off-by: Ming Qian > > --- > > libavcodec/v4l2_m2m_enc.c | 1 + > > 1 fi

Re: [FFmpeg-devel] [EXT] [PATCH 2/2] avcodec/v4l2_context: Finish draining if V4L2_BUF_FLAG_LAST is set

2020-04-29 Thread Ming Qian
> From: Andriy Gelman > > V4L2 api can indicate that flushing of the capture buffers is completed by > setting the V4L2_BUF_FLAG_LAST flag. > Use guards because the flag was only defined in Linux v4.2. > > Reference: > linux/Documentation/media/uapi/v4l/dev-decoder.rst > > "The client must

Re: [FFmpeg-devel] [EXT] [PATCH 1/2] avcodec/v4l2_context: Drop empty packet while draining

2020-04-29 Thread Ming Qian
> From: Andriy Gelman > > v4l2_m2m devices may send an empty packet/frame while draining to indicate > that all capture buffers have been flushed. > > Currently, the empty packet/frame is not handled correctly: > When encoding, the empty packet is forwarded to the muxer, usually creating >

[FFmpeg-devel] [PATCH v1] avcodec/v4l2_m2m_enc: Set bitrate mode to cbr by default

2020-04-29 Thread Ming Qian
Without this setting, bitrate may have no effect if the default value of bitrate mode is VBR. Signed-off-by: Ming Qian --- libavcodec/v4l2_m2m_enc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c index 8454e2326c..6296ad88c6

Re: [FFmpeg-devel] [EXT] [PATCH v5] avcodec/v4l2_m2m_enc: Support changing qmin/qmax

2020-04-28 Thread Ming Qian
hanges in v5: > - Check that qmin does not exceed qmax (thanks for feedback from Ming > Qian) > > libavcodec/v4l2_m2m_enc.c | 23 +++ > 1 file changed, 19 insertions(+), 4 deletions(-) > > diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2

Re: [FFmpeg-devel] [EXT] Re: [PATCH v4 1/3] avcodec/v4l2_m2m_enc: Reduce log verbosity for some params

2020-04-09 Thread Ming Qian
lgtm Best regards, Ming Qian Tel#:86-512-6805-6630 -Original Message- From: ffmpeg-devel On Behalf Of Andriy Gelman Sent: Saturday, March 14, 2020 10:32 PM To: ffmpeg-devel@ffmpeg.org Subject: [EXT] Re: [FFmpeg-devel] [PATCH v4 1/3] avcodec/v4l2_m2m_enc: Reduce log verbosity

Re: [FFmpeg-devel] [EXT] [PATCH 2/2] avcodec/v4l2_context: Log warning when all capture buffers are in userspace

2020-04-09 Thread Ming Qian
Lgtm, But if don't prevent enqueue frame buffer of capture port, unlikely to happen this case. And I think we can get a proper num_frame_buffers by g_ctrl V4L2_CID_MIN_BUFFERS_FOR_CAPTURE and V4L2_CID_MIN_BUFFERS_FOR_OUTPUT. Best regards, Ming Qian Tel#:86-512-6805-6630 -Original

Re: [FFmpeg-devel] 回复: [EXT] Re: [PATCH] avcodec/v4l2_buffers: don't prevent enqueue capture buffer to driver

2020-04-08 Thread Ming Qian
ure buffers are dequeued (v4l2_context.c:300), and this patch would prevent it (although it's not needed if an eos event is received). Yes, but I think it's not appropriate to judge whether the capture port is done by checking all the capture buffers are dequeued. Best regards, Ming Qian Tel#:86-

[FFmpeg-devel] [PATCH v4] avcodec/v4l2_m2m: handle the v4l2 eos event

2020-03-31 Thread Ming Qian
the capture buffers Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 6 ++ libavcodec/v4l2_m2m_dec.c | 8 libavcodec/v4l2_m2m_enc.c | 19 +++ 3 files changed, 33 insertions(+) diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c index 8110bbb555

[FFmpeg-devel] [PATCH v3] avcodec/v4l2_m2m: handle the v4l2 eos event

2020-03-17 Thread Ming Qian
at the end of encoding/decoding when flushing the capture buffers Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 5 + libavcodec/v4l2_m2m_dec.c | 9 + libavcodec/v4l2_m2m_enc.c | 20 3 files changed, 34 insertions(+) diff --git a/libavcodec

[FFmpeg-devel] [PATCH v2] avcodec/v4l2_m2m: fix setting the frame rate

2020-03-17 Thread Ming Qian
v4l2 set the frame rate through frame intervals, not set frame rate directly. the frame rate and frame intervals are reciprocal. so in libavdevice/v4l2.c we can see the following code: tpf->numerator = framerate_q.den; tpf->denominator = framerate_q.num; Signed-off-by: Min

[FFmpeg-devel] [PATCH v2] avcodec/v4l2_m2m: handle the v4l2 eos event

2020-03-17 Thread Ming Qian
at the end of encoding/decoding when flushing the capture buffers Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 5 + libavcodec/v4l2_m2m_dec.c | 9 + libavcodec/v4l2_m2m_enc.c | 22 +- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git

[FFmpeg-devel] 回复: [EXT] Re: [PATCH] avcodec/v4l2_buffers: don't prevent enqueue capture buffer to driver

2020-03-17 Thread Ming Qian
10:02, Ming Qian wrote: > the draining is set when the output port is finished, > but it doesn't mean the capture port is finished. > especially for decoder, there may be a stream buffer to store several > frames. > so the decoder still need capture buffer even if the draining is

[FFmpeg-devel] [PATCH] avcodec/v4l2_m2m: handle the v4l2 eos event

2020-03-15 Thread Ming Qian
when the last frame of capture is dequeueed, driver may send this V4L2_EVENT_EOS event, if this event is received, then we can set the capture port done Signed-off-by: Ming Qian --- libavcodec/v4l2_context.c | 5 + libavcodec/v4l2_m2m_dec.c | 10 ++ libavcodec/v4l2_m2m_enc.c | 22

[FFmpeg-devel] [PATCH] avcodec/v4l2_buffers: don't prevent enqueue capture buffer to driver

2020-03-15 Thread Ming Qian
the draining is set when the output port is finished, but it doesn't mean the capture port is finished. especially for decoder, there may be a stream buffer to store several frames. so the decoder still need capture buffer even if the draining is set. Signed-off-by: Ming Qian --- libavcodec

[FFmpeg-devel] [PATCH] avcodec/v4l2_m2m: fix setting the frame rate

2020-03-15 Thread Ming Qian
v4l2 set the frame rate through frame intervals, not set frame rate directly. the frame rate and frame intervals are reciprocal. so in libavdevice/v4l2.c we can see the following code: tpf->numerator = framerate_q.den; tpf->denominator = framerate_q.num; Signed-off-by: Min