mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-08 23:42:28 +00:00
ximagesrc: Set the pixel aspect ratio correctly in the caps
This commit is contained in:
parent
00eed11d6a
commit
a31649e357
3 changed files with 12 additions and 18 deletions
|
@ -1080,7 +1080,7 @@ gst_ximage_src_get_caps (GstBaseSrc * bs, GstCaps * filter)
|
||||||
"width", G_TYPE_INT, width,
|
"width", G_TYPE_INT, width,
|
||||||
"height", G_TYPE_INT, height,
|
"height", G_TYPE_INT, height,
|
||||||
"framerate", GST_TYPE_FRACTION_RANGE, 1, G_MAXINT, G_MAXINT, 1,
|
"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);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -258,11 +258,6 @@ ximageutil_xcontext_clear (GstXContext * xcontext)
|
||||||
if (xcontext->caps != NULL)
|
if (xcontext->caps != NULL)
|
||||||
gst_caps_unref (xcontext->caps);
|
gst_caps_unref (xcontext->caps);
|
||||||
|
|
||||||
if (xcontext->par) {
|
|
||||||
g_value_unset (xcontext->par);
|
|
||||||
g_free (xcontext->par);
|
|
||||||
}
|
|
||||||
|
|
||||||
XCloseDisplay (xcontext->disp);
|
XCloseDisplay (xcontext->disp);
|
||||||
|
|
||||||
g_free (xcontext);
|
g_free (xcontext);
|
||||||
|
@ -314,14 +309,9 @@ ximageutil_calculate_pixel_aspect_ratio (GstXContext * xcontext)
|
||||||
GST_DEBUG ("Decided on index %d (%d/%d)", index,
|
GST_DEBUG ("Decided on index %d (%d/%d)", index,
|
||||||
par[index][0], par[index][1]);
|
par[index][0], par[index][1]);
|
||||||
|
|
||||||
if (xcontext->par)
|
xcontext->par_n = par[index][0];
|
||||||
g_free (xcontext->par);
|
xcontext->par_d = par[index][1];
|
||||||
xcontext->par = g_new0 (GValue, 1);
|
GST_DEBUG ("set xcontext PAR to %d/%d\n", xcontext->par_n, xcontext->par_d);
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -62,7 +62,10 @@ typedef struct _GstMetaXImage GstMetaXImage;
|
||||||
* @height: the height in pixels of Display @disp
|
* @height: the height in pixels of Display @disp
|
||||||
* @widthmm: the width in millimeters of Display @disp
|
* @widthmm: the width in millimeters of Display @disp
|
||||||
* @heightmm: the height 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
|
* @heightmm ratio
|
||||||
* @use_xshm: used to known wether of not XShm extension is usable or not even
|
* @use_xshm: used to known wether of not XShm extension is usable or not even
|
||||||
* if the Extension is present
|
* if the Extension is present
|
||||||
|
@ -90,12 +93,13 @@ struct _GstXContext {
|
||||||
gint width, height;
|
gint width, height;
|
||||||
gint widthmm, heightmm;
|
gint widthmm, heightmm;
|
||||||
|
|
||||||
/* these are the output masks
|
/* these are the output masks
|
||||||
* for buffers from ximagesrc
|
* for buffers from ximagesrc
|
||||||
* and are in big endian */
|
* and are in big endian */
|
||||||
guint32 r_mask_output, g_mask_output, b_mask_output;
|
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;
|
gboolean use_xshm;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue