diff --git a/sys/vdpau/gstvdputils.c b/sys/vdpau/gstvdputils.c index ecb6352405..7602225f5e 100644 --- a/sys/vdpau/gstvdputils.c +++ b/sys/vdpau/gstvdputils.c @@ -131,12 +131,21 @@ gst_vdp_video_to_output_caps (GstCaps * caps) result = gst_caps_copy (caps); for (i = 0; i < gst_caps_get_size (result); i++) { GstStructure *structure = gst_caps_get_structure (result, i); + gint par_n, par_d; gst_structure_set_name (structure, "video/x-vdpau-output"); gst_structure_remove_field (structure, "chroma-type"); - /* FIXME: don't know what to do with pixel-aspect-ratio */ - gst_structure_remove_field (structure, "pixel-aspect-ratio"); + if (gst_structure_get_fraction (structure, "pixel-aspect-ratio", &par_n, + &par_d)) { + gint width; + + gst_structure_get_int (structure, "width", &width); + width = gst_util_uint64_scale_int (width, par_n, par_d); + gst_structure_set (structure, "width", G_TYPE_INT, width, NULL); + + gst_structure_remove_field (structure, "pixel-aspect-ratio"); + } } return result; diff --git a/sys/vdpau/gstvdpvideopostprocess.c b/sys/vdpau/gstvdpvideopostprocess.c index 7b965e9d38..9673bd3bb6 100644 --- a/sys/vdpau/gstvdpvideopostprocess.c +++ b/sys/vdpau/gstvdpvideopostprocess.c @@ -509,8 +509,9 @@ gst_vdp_vpp_sink_setcaps (GstPad * pad, GstCaps * caps) structure = gst_caps_get_structure (caps, 0); gst_structure_get_boolean (structure, "interlaced", &vpp->interlaced); - output_caps = gst_vdp_video_to_output_caps (caps); allowed_caps = gst_pad_get_allowed_caps (vpp->srcpad); + structure = gst_caps_get_structure (allowed_caps, 0); + output_caps = gst_vdp_video_to_output_caps (caps); src_caps = gst_caps_intersect (output_caps, allowed_caps); gst_caps_truncate (src_caps); @@ -629,7 +630,10 @@ gst_vdp_vpp_chain (GstPad * pad, GstBuffer * buffer) GstVdpOutputBuffer *outbuf; GstStructure *structure; - GstVideoRectangle src_r, dest_r; + GstVideoRectangle src_r = { 0, } + , dest_r = { + 0,}; + gint par_n, par_d; VdpRect rect; GstVdpDevice *device; @@ -646,6 +650,15 @@ gst_vdp_vpp_chain (GstPad * pad, GstBuffer * buffer) !gst_structure_get_int (structure, "height", &src_r.h)) goto invalid_caps; + if (gst_structure_get_fraction (structure, "pixel-aspect-ratio", &par_n, + &par_d)) { + gint new_width; + + new_width = gst_util_uint64_scale_int (src_r.w, par_n, par_d); + src_r.x += (src_r.w - new_width) / 2; + src_r.w = new_width; + } + structure = gst_caps_get_structure (GST_BUFFER_CAPS (outbuf), 0); if (!gst_structure_get_int (structure, "width", &dest_r.w) || !gst_structure_get_int (structure, "height", &dest_r.h))