This source file includes following definitions.
- cedrus_device_run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 #include <media/v4l2-device.h>
17 #include <media/v4l2-ioctl.h>
18 #include <media/v4l2-event.h>
19 #include <media/v4l2-mem2mem.h>
20
21 #include "cedrus.h"
22 #include "cedrus_dec.h"
23 #include "cedrus_hw.h"
24
25 void cedrus_device_run(void *priv)
26 {
27 struct cedrus_ctx *ctx = priv;
28 struct cedrus_dev *dev = ctx->dev;
29 struct cedrus_run run = {};
30 struct media_request *src_req;
31
32 run.src = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
33 run.dst = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
34
35
36 src_req = run.src->vb2_buf.req_obj.req;
37
38 if (src_req)
39 v4l2_ctrl_request_setup(src_req, &ctx->hdl);
40
41 switch (ctx->src_fmt.pixelformat) {
42 case V4L2_PIX_FMT_MPEG2_SLICE:
43 run.mpeg2.slice_params = cedrus_find_control_data(ctx,
44 V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS);
45 run.mpeg2.quantization = cedrus_find_control_data(ctx,
46 V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION);
47 break;
48
49 case V4L2_PIX_FMT_H264_SLICE:
50 run.h264.decode_params = cedrus_find_control_data(ctx,
51 V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS);
52 run.h264.pps = cedrus_find_control_data(ctx,
53 V4L2_CID_MPEG_VIDEO_H264_PPS);
54 run.h264.scaling_matrix = cedrus_find_control_data(ctx,
55 V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX);
56 run.h264.slice_params = cedrus_find_control_data(ctx,
57 V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS);
58 run.h264.sps = cedrus_find_control_data(ctx,
59 V4L2_CID_MPEG_VIDEO_H264_SPS);
60 break;
61
62 default:
63 break;
64 }
65
66 v4l2_m2m_buf_copy_metadata(run.src, run.dst, true);
67
68 dev->dec_ops[ctx->current_codec]->setup(ctx, &run);
69
70
71
72 if (src_req)
73 v4l2_ctrl_request_complete(src_req, &ctx->hdl);
74
75 dev->dec_ops[ctx->current_codec]->trigger(ctx);
76 }