ximagesrc: Set the pixel aspect ratio correctly in the caps

This commit is contained in:
Olivier Crête 2013-01-23 21:35:25 -05:00
parent 00eed11d6a
commit a31649e357
3 changed files with 12 additions and 18 deletions

View file

@ -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);
}

View file

@ -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

View file

@ -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;