videoflip: Also flip the pixel-aspect-ratio if width/height are exchanged

This commit is contained in:
Sebastian Dröge 2010-04-19 14:37:54 +02:00
parent f9edd9b169
commit 45571f4bd4

View file

@ -133,6 +133,7 @@ gst_video_flip_transform_caps (GstBaseTransform * trans,
for (i = 0; i < gst_caps_get_size (ret); i++) {
GstStructure *structure = gst_caps_get_structure (ret, i);
gint par_n, par_d;
if (gst_structure_get_int (structure, "width", &width) &&
gst_structure_get_int (structure, "height", &height)) {
@ -144,6 +145,17 @@ gst_video_flip_transform_caps (GstBaseTransform * trans,
case GST_VIDEO_FLIP_METHOD_OTHER:
gst_structure_set (structure, "width", G_TYPE_INT, height,
"height", G_TYPE_INT, width, NULL);
if (gst_structure_get_fraction (structure, "pixel-aspect-ratio",
&par_n, &par_d)) {
if (par_n != 1 || par_d != 1) {
GValue val = { 0, };
g_value_init (&val, GST_TYPE_FRACTION);
gst_value_set_fraction (&val, par_d, par_n);
gst_structure_set_value (structure, "pixel-aspect-ratio", &val);
g_value_unset (&val);
}
}
break;
case GST_VIDEO_FLIP_METHOD_IDENTITY:
case GST_VIDEO_FLIP_METHOD_180: