summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2013-01-23 21:35:25 -0500
committerOlivier CrĂȘte <olivier.crete@collabora.com>2013-01-23 21:38:24 -0500
commitfe7dbbcee57195feb280cb133362a04110afa4d9 (patch)
treeea9a5ecba5f17a156b20b11978d407bb061bac6f
parent71664726821a9b28543bc6699b8f151de1eeb534 (diff)
ximagesrc: Set the pixel aspect ratio correctly in the caps
-rw-r--r--sys/ximage/gstximagesrc.c2
-rw-r--r--sys/ximage/ximageutil.c16
-rw-r--r--sys/ximage/ximageutil.h12
3 files changed, 12 insertions, 18 deletions
diff --git a/sys/ximage/gstximagesrc.c b/sys/ximage/gstximagesrc.c
index df43c08bb..ff24de985 100644
--- a/sys/ximage/gstximagesrc.c
+++ b/sys/ximage/gstximagesrc.c
@@ -1080,7 +1080,7 @@ gst_ximage_src_get_caps (GstBaseSrc * bs, GstCaps * filter)
"width", G_TYPE_INT, width,
"height", G_TYPE_INT, height,
"framerate", GST_TYPE_FRACTION_RANGE, 1, G_MAXINT, G_MAXINT, 1,
- "pixel-aspect-ratio", GST_TYPE_FRACTION_RANGE, 1, G_MAXINT, G_MAXINT, 1,
+ "pixel-aspect-ratio", GST_TYPE_FRACTION, xcontext->par_n, xcontext->par_d,
NULL);
}
diff --git a/sys/ximage/ximageutil.c b/sys/ximage/ximageutil.c
index 35069fcfc..20b2dc2b7 100644
--- a/sys/ximage/ximageutil.c
+++ b/sys/ximage/ximageutil.c
@@ -258,11 +258,6 @@ ximageutil_xcontext_clear (GstXContext * xcontext)
if (xcontext->caps != NULL)
gst_caps_unref (xcontext->caps);
- if (xcontext->par) {
- g_value_unset (xcontext->par);
- g_free (xcontext->par);
- }
-
XCloseDisplay (xcontext->disp);
g_free (xcontext);
@@ -314,14 +309,9 @@ ximageutil_calculate_pixel_aspect_ratio (GstXContext * xcontext)
GST_DEBUG ("Decided on index %d (%d/%d)", index,
par[index][0], par[index][1]);
- if (xcontext->par)
- g_free (xcontext->par);
- xcontext->par = g_new0 (GValue, 1);
- g_value_init (xcontext->par, GST_TYPE_FRACTION);
- gst_value_set_fraction (xcontext->par, par[index][0], par[index][1]);
- GST_DEBUG ("set xcontext PAR to %d/%d\n",
- gst_value_get_fraction_numerator (xcontext->par),
- gst_value_get_fraction_denominator (xcontext->par));
+ xcontext->par_n = par[index][0];
+ xcontext->par_d = par[index][1];
+ GST_DEBUG ("set xcontext PAR to %d/%d\n", xcontext->par_n, xcontext->par_d);
}
static void
diff --git a/sys/ximage/ximageutil.h b/sys/ximage/ximageutil.h
index aa03e7a85..12f2c1064 100644
--- a/sys/ximage/ximageutil.h
+++ b/sys/ximage/ximageutil.h
@@ -62,7 +62,10 @@ typedef struct _GstMetaXImage GstMetaXImage;
* @height: the height in pixels of Display @disp
* @widthmm: the width in millimeters of Display @disp
* @heightmm: the height in millimeters of Display @disp
- * @par: the pixel aspect ratio calculated from @width, @widthmm and @height,
+ * @par_n: the pixel aspect ratio numerator calculated from @width, @widthmm
+ * and @height,
+ * @par_d: the pixel aspect ratio denumerator calculated from @width, @widthmm
+ * and @height,
* @heightmm ratio
* @use_xshm: used to known wether of not XShm extension is usable or not even
* if the Extension is present
@@ -90,12 +93,13 @@ struct _GstXContext {
gint width, height;
gint widthmm, heightmm;
- /* these are the output masks
+ /* these are the output masks
* for buffers from ximagesrc
* and are in big endian */
guint32 r_mask_output, g_mask_output, b_mask_output;
-
- GValue *par; /* calculated pixel aspect ratio */
+
+ guint par_n; /* calculated pixel aspect ratio numerator */
+ guint par_d; /* calculated pixel aspect ratio denumerator */
gboolean use_xshm;