From: Hans Verkuil <hverkuil-ci...@xs4all.nl>

Report the full list of supported decoder formats until the
format encoded in the bitstream is known. After that only
report the formats compatible with that initial format.

Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl>
---
 drivers/media/platform/vicodec/vicodec-core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/vicodec/vicodec-core.c 
b/drivers/media/platform/vicodec/vicodec-core.c
index 980c30cc9d48..7e4ac412cc38 100644
--- a/drivers/media/platform/vicodec/vicodec-core.c
+++ b/drivers/media/platform/vicodec/vicodec-core.c
@@ -671,7 +671,6 @@ static int job_ready(void *priv)
                        v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
 
                update_capture_data_from_header(ctx);
-               ctx->first_source_change_sent = true;
                v4l2_event_queue_fh(&ctx->fh, &rs_event);
                set_last_buffer(dst_buf, src_buf, ctx);
                ctx->source_changed = true;
@@ -718,7 +717,7 @@ static int enum_fmt(struct v4l2_fmtdesc *f, struct 
vicodec_ctx *ctx,
                const struct v4l2_fwht_pixfmt_info *info =
                                        get_q_data(ctx, f->type)->info;
 
-               if (!info || ctx->is_enc)
+               if (!ctx->first_source_change_sent || ctx->is_enc)
                        info = v4l2_fwht_get_pixfmt(f->index);
                else
                        info = v4l2_fwht_find_nth_fmt(info->width_div,
@@ -1522,6 +1521,7 @@ static void vicodec_buf_queue(struct vb2_buffer *vb)
         * handled in job_ready
         */
        if (vb2_is_streaming(vq_cap) && vb2_is_streaming(vq_out)) {
+               ctx->first_source_change_sent = true;
                v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
                return;
        }
@@ -1726,6 +1726,8 @@ static void vicodec_stop_streaming(struct vb2_queue *q)
                        ctx->next_is_last = false;
                }
        }
+       if (!ctx->is_enc && V4L2_TYPE_IS_OUTPUT(q->type))
+               ctx->first_source_change_sent = false;
 
        if ((!V4L2_TYPE_IS_OUTPUT(q->type) && !ctx->is_enc) ||
            (V4L2_TYPE_IS_OUTPUT(q->type) && ctx->is_enc)) {
-- 
2.17.1

Reply via email to