vc1: add support for video cropping.

If the Advanced profile has display_extension fields, then set the display
width/height dimension as cropping rectangle to the GstVaapiPicture.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
Sreerenj Balachandran 2013-02-18 15:05:37 +02:00 committed by Gwenole Beauchesne
parent 976d27841a
commit f9ae0c0de4

View file

@ -1320,6 +1320,26 @@ gst_vaapi_decoder_vc1_start_frame(GstVaapiDecoder *base_decoder,
gst_vaapi_picture_replace(&priv->current_picture, picture);
gst_vaapi_picture_unref(picture);
/* Update cropping rectangle */
do {
GstVC1AdvancedSeqHdr *adv_hdr;
GstVaapiRectangle crop_rect;
if (priv->profile != GST_VAAPI_PROFILE_VC1_ADVANCED)
break;
adv_hdr = &priv->seq_hdr.advanced;
if (!adv_hdr->display_ext)
break;
crop_rect.x = 0;
crop_rect.y = 0;
crop_rect.width = adv_hdr->disp_horiz_size;
crop_rect.height = adv_hdr->disp_vert_size;
if (crop_rect.width <= priv->width && crop_rect.height <= priv->height)
gst_vaapi_picture_set_crop_rect(picture, &crop_rect);
} while (0);
if (!gst_vc1_bitplanes_ensure_size(priv->bitplanes, &priv->seq_hdr)) {
GST_ERROR("failed to allocate bitplanes");
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;