summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2009-11-22 22:54:27 +0100
committerCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2009-11-22 22:54:27 +0100
commitd57488461a6657c0b480f6296a8fbf708b2a74f8 (patch)
treef22e0b1d1d1c92cd91ab098a35cc8953a794dc30
parent7401cd90ad20edc6c11b26146b40adbb73215a47 (diff)
vdpauvideopostprocess: convert to 1/1 pixel-aspect-ratio for rgb too
-rw-r--r--sys/vdpau/gstvdputils.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/sys/vdpau/gstvdputils.c b/sys/vdpau/gstvdputils.c
index 21c5cc2a4..c1ea9076a 100644
--- a/sys/vdpau/gstvdputils.c
+++ b/sys/vdpau/gstvdputils.c
@@ -22,6 +22,23 @@
#include "gstvdputils.h"
+static void
+gst_vdp_video_remove_pixel_aspect_ratio (GstStructure * structure)
+{
+ gint par_n, par_d;
+
+ 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");
+ }
+}
+
GstCaps *
gst_vdp_yuv_to_output_caps (GstCaps * caps)
{
@@ -37,9 +54,11 @@ gst_vdp_yuv_to_output_caps (GstCaps * caps)
gst_structure_set_name (structure, "video/x-vdpau-output");
gst_structure_remove_field (structure, "format");
+ gst_vdp_video_remove_pixel_aspect_ratio (structure);
gst_structure_set_name (rgb_structure, "video/x-raw-rgb");
gst_structure_remove_field (rgb_structure, "format");
+ gst_vdp_video_remove_pixel_aspect_ratio (rgb_structure);
gst_caps_append_structure (result, rgb_structure);
}
@@ -56,27 +75,17 @@ gst_vdp_video_to_output_caps (GstCaps * caps)
for (i = 0; i < gst_caps_get_size (caps); i++) {
GstStructure *structure, *rgb_structure;
- gint par_n, par_d;
structure = gst_caps_get_structure (result, i);
rgb_structure = gst_structure_copy (structure);
gst_structure_set_name (structure, "video/x-vdpau-output");
gst_structure_remove_field (structure, "chroma-type");
-
- 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");
- }
+ gst_vdp_video_remove_pixel_aspect_ratio (structure);
gst_structure_set_name (rgb_structure, "video/x-raw-rgb");
- gst_structure_remove_field (rgb_structure, "chroma-type");
+ gst_structure_remove_field (structure, "chroma-type");
+ gst_vdp_video_remove_pixel_aspect_ratio (rgb_structure);
gst_caps_append_structure (result, rgb_structure);
}