Use the gstutil scaling function to preserve 64 bits while calculating output width and height from the display-aspec...
Original commit message from CVS: * gst/videoscale/gstvideoscale.c: (gst_video_scale_fixate_caps): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_setcaps): Use the gstutil scaling function to preserve 64 bits while calculating output width and height from the display-aspect-ratio. (A continuation of #341542)
This commit is contained in:
parent
47e7f3f367
commit
f3b81a7de1
@ -1,3 +1,11 @@
|
|||||||
|
2006-05-19 Jan Schmidt <thaytan@mad.scientist.com>
|
||||||
|
|
||||||
|
* gst/videoscale/gstvideoscale.c: (gst_video_scale_fixate_caps):
|
||||||
|
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_setcaps):
|
||||||
|
Use the gstutil scaling function to preserve 64 bits while calculating
|
||||||
|
output width and height from the display-aspect-ratio. (A continuation
|
||||||
|
of #341542)
|
||||||
|
|
||||||
2006-05-19 Jan Schmidt <thaytan@mad.scientist.com>
|
2006-05-19 Jan Schmidt <thaytan@mad.scientist.com>
|
||||||
|
|
||||||
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_clear),
|
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_clear),
|
||||||
|
@ -600,10 +600,10 @@ gst_video_scale_fixate_caps (GstBaseTransform * base, GstPadDirection direction,
|
|||||||
/* if one of the output width or height is fixed, we work from there */
|
/* if one of the output width or height is fixed, we work from there */
|
||||||
if (h) {
|
if (h) {
|
||||||
GST_DEBUG_OBJECT (base, "height is fixed,scaling width");
|
GST_DEBUG_OBJECT (base, "height is fixed,scaling width");
|
||||||
w = h * num / den;
|
w = (guint) gst_util_uint64_scale_int (h, num, den);
|
||||||
} else if (w) {
|
} else if (w) {
|
||||||
GST_DEBUG_OBJECT (base, "width is fixes, scaling height");
|
GST_DEBUG_OBJECT (base, "width is fixed, scaling height");
|
||||||
h = w * den / num;
|
h = (guint) gst_util_uint64_scale_int (w, den, num);
|
||||||
} else {
|
} else {
|
||||||
/* none of width or height is fixed, figure out both of them based only on
|
/* none of width or height is fixed, figure out both of them based only on
|
||||||
* the input width and height */
|
* the input width and height */
|
||||||
@ -611,15 +611,15 @@ gst_video_scale_fixate_caps (GstBaseTransform * base, GstPadDirection direction,
|
|||||||
if (from_h % den == 0) {
|
if (from_h % den == 0) {
|
||||||
GST_DEBUG_OBJECT (base, "keeping video height");
|
GST_DEBUG_OBJECT (base, "keeping video height");
|
||||||
h = from_h;
|
h = from_h;
|
||||||
w = h * num / den;
|
w = (guint) gst_util_uint64_scale_int (h, num, den);
|
||||||
} else if (from_w % num == 0) {
|
} else if (from_w % num == 0) {
|
||||||
GST_DEBUG_OBJECT (base, "keeping video width");
|
GST_DEBUG_OBJECT (base, "keeping video width");
|
||||||
w = from_w;
|
w = from_w;
|
||||||
h = w * den / num;
|
h = (guint) gst_util_uint64_scale_int (w, den, num);
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (base, "approximating but keeping video height");
|
GST_DEBUG_OBJECT (base, "approximating but keeping video height");
|
||||||
h = from_h;
|
h = from_h;
|
||||||
w = h * num / den;
|
w = (guint) gst_util_uint64_scale_int (h, num, den);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GST_DEBUG_OBJECT (base, "scaling to %dx%d", w, h);
|
GST_DEBUG_OBJECT (base, "scaling to %dx%d", w, h);
|
||||||
|
@ -1670,15 +1670,18 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
|||||||
/* check hd / den is an integer scale factor, and scale wd with the PAR */
|
/* check hd / den is an integer scale factor, and scale wd with the PAR */
|
||||||
if (video_height % den == 0) {
|
if (video_height % den == 0) {
|
||||||
GST_DEBUG_OBJECT (xvimagesink, "keeping video height");
|
GST_DEBUG_OBJECT (xvimagesink, "keeping video height");
|
||||||
GST_VIDEO_SINK_WIDTH (xvimagesink) = video_height * num / den;
|
GST_VIDEO_SINK_WIDTH (xvimagesink) = (guint)
|
||||||
|
gst_util_uint64_scale_int (video_height, num, den);
|
||||||
GST_VIDEO_SINK_HEIGHT (xvimagesink) = video_height;
|
GST_VIDEO_SINK_HEIGHT (xvimagesink) = video_height;
|
||||||
} else if (video_width % num == 0) {
|
} else if (video_width % num == 0) {
|
||||||
GST_DEBUG_OBJECT (xvimagesink, "keeping video width");
|
GST_DEBUG_OBJECT (xvimagesink, "keeping video width");
|
||||||
GST_VIDEO_SINK_WIDTH (xvimagesink) = video_width;
|
GST_VIDEO_SINK_WIDTH (xvimagesink) = video_width;
|
||||||
GST_VIDEO_SINK_HEIGHT (xvimagesink) = video_width * den / num;
|
GST_VIDEO_SINK_HEIGHT (xvimagesink) = (guint)
|
||||||
|
gst_util_uint64_scale_int (video_width, den, num);
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (xvimagesink, "approximating while keeping video height");
|
GST_DEBUG_OBJECT (xvimagesink, "approximating while keeping video height");
|
||||||
GST_VIDEO_SINK_WIDTH (xvimagesink) = video_height * num / den;
|
GST_VIDEO_SINK_WIDTH (xvimagesink) = (guint)
|
||||||
|
gst_util_uint64_scale_int (video_height, num, den);
|
||||||
GST_VIDEO_SINK_HEIGHT (xvimagesink) = video_height;
|
GST_VIDEO_SINK_HEIGHT (xvimagesink) = video_height;
|
||||||
}
|
}
|
||||||
GST_DEBUG_OBJECT (xvimagesink, "scaling to %dx%d",
|
GST_DEBUG_OBJECT (xvimagesink, "scaling to %dx%d",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user