mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
v4l2videoenc: Setup crop rectangle if needed
Hantro H1 and Rockchip VEPU2 drivers will pad the width/height to a multiple of 16. In order to obtain the right JPEG size, the image needs to be cropped using the S_SELECTION API. This support is added as best effort since older drivers may emulate this by looking at the capture queue width/height. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2392>
This commit is contained in:
parent
21882223fb
commit
aba9d1de49
2 changed files with 6 additions and 1 deletions
|
@ -4315,7 +4315,6 @@ gst_v4l2_object_set_crop (GstV4l2Object * obj, struct v4l2_rect * crop_rect)
|
|||
struct v4l2_crop crop = { 0 };
|
||||
|
||||
GST_V4L2_CHECK_OPEN (obj);
|
||||
GST_V4L2_CHECK_NOT_ACTIVE (obj);
|
||||
|
||||
sel.type = obj->type;
|
||||
sel.target = V4L2_SEL_TGT_CROP;
|
||||
|
|
|
@ -342,6 +342,9 @@ gst_v4l2_video_enc_set_format (GstVideoEncoder * encoder,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* best effort */
|
||||
gst_v4l2_object_setup_padding (self->v4l2output);
|
||||
|
||||
self->input_state = gst_video_codec_state_ref (state);
|
||||
|
||||
GST_DEBUG_OBJECT (self, "output caps: %" GST_PTR_FORMAT, state->caps);
|
||||
|
@ -876,6 +879,9 @@ gst_v4l2_video_enc_decide_allocation (GstVideoEncoder *
|
|||
}
|
||||
gst_caps_unref (caps);
|
||||
|
||||
/* best effort */
|
||||
gst_v4l2_object_setup_padding (self->v4l2capture);
|
||||
|
||||
if (gst_v4l2_object_decide_allocation (self->v4l2capture, query)) {
|
||||
GstVideoEncoderClass *enc_class = GST_VIDEO_ENCODER_CLASS (parent_class);
|
||||
ret = enc_class->decide_allocation (encoder, query);
|
||||
|
|
Loading…
Reference in a new issue