From 976d27841a19cf37e2742cae5770c8a7555f72db Mon Sep 17 00:00:00 2001 From: Sreerenj Balachandran Date: Fri, 15 Feb 2013 18:50:26 +0200 Subject: [PATCH] h264: add support for video cropping. If the encoded stream has the frame_cropping_flag set, then associate the cropping rectangle to GstVaapiPicture. Signed-off-by: Gwenole Beauchesne --- gst-libs/gst/vaapi/gstvaapidecoder_h264.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c index 8892d52eaf..aad434cfac 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c @@ -540,8 +540,6 @@ dpb_output( return TRUE; picture = fs->buffers[0]; } - - /* XXX: update cropping rectangle */ return gst_vaapi_picture_output(GST_VAAPI_PICTURE_CAST(picture)); } @@ -2556,6 +2554,16 @@ decode_picture(GstVaapiDecoderH264 *decoder, GstVaapiDecoderUnit *unit) gst_vaapi_picture_replace(&priv->current_picture, picture); gst_vaapi_picture_unref(picture); + /* Update cropping rectangle */ + if (sps->frame_cropping_flag) { + GstVaapiRectangle crop_rect; + crop_rect.x = sps->crop_rect_x; + crop_rect.y = sps->crop_rect_y; + crop_rect.width = sps->crop_rect_width; + crop_rect.height = sps->crop_rect_height; + gst_vaapi_picture_set_crop_rect(&picture->base, &crop_rect); + } + picture->pps = pps; status = ensure_quant_matrix(decoder, picture);