unsigned int crop_width;
unsigned int crop_height;
bool selection_set;
+ struct v4l2_fract aspect_ratio;
unsigned int sizeimage;
unsigned int sequence;
if (format->es.video.color_space)
color_mmal2v4l(ctx, format->es.video.color_space);
+ q_data->aspect_ratio.numerator = format->es.video.par.num;
+ q_data->aspect_ratio.denominator = format->es.video.par.den;
+
queue_res_chg_event(ctx);
}
return 0;
}
+static int vidioc_g_pixelaspect(struct file *file, void *fh, int type,
+ struct v4l2_fract *f)
+{
+ struct bcm2835_codec_ctx *ctx = file2ctx(file);
+
+ /*
+ * The selection API takes V4L2_BUF_TYPE_VIDEO_CAPTURE and
+ * V4L2_BUF_TYPE_VIDEO_OUTPUT, even if the device implements the MPLANE
+ * API. The V4L2 core will have converted the MPLANE variants to
+ * non-MPLANE.
+ * Open code this instead of using get_q_data in this case.
+ */
+ if (ctx->dev->role != DECODE)
+ return -ENOIOCTLCMD;
+
+ if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+ return -EINVAL;
+
+ *f = ctx->q_data[V4L2_M2M_DST].aspect_ratio;
+
+ return 0;
+}
+
static int vidioc_subscribe_evt(struct v4l2_fh *fh,
const struct v4l2_event_subscription *sub)
{
.vidioc_g_parm = vidioc_g_parm,
.vidioc_s_parm = vidioc_s_parm,
+ .vidioc_g_pixelaspect = vidioc_g_pixelaspect,
+
.vidioc_subscribe_event = vidioc_subscribe_evt,
.vidioc_unsubscribe_event = v4l2_event_unsubscribe,
ctx->q_data[V4L2_M2M_DST].crop_width,
ctx->q_data[V4L2_M2M_DST].height,
ctx->q_data[V4L2_M2M_DST].fmt);
+ ctx->q_data[V4L2_M2M_DST].aspect_ratio.numerator = 1;
+ ctx->q_data[V4L2_M2M_DST].aspect_ratio.denominator = 1;
ctx->colorspace = V4L2_COLORSPACE_REC709;
ctx->bitrate = 10 * 1000 * 1000;