mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-19 20:46:22 +00:00
ext/cairo/gsttimeoverlay.c: Fix timeoverlay for non-multiple-of-4 widths. This fourcc crap
Original commit message from CVS: * ext/cairo/gsttimeoverlay.c: (gst_cairo_time_overlay_transform): Fix timeoverlay for non-multiple-of-4 widths. This fourcc crap SUCKS.
This commit is contained in:
parent
7ce14b6bd8
commit
757797ef3a
2 changed files with 17 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2006-05-03 Michael Smith <msmith@fluendo.com>
|
||||||
|
|
||||||
|
* ext/cairo/gsttimeoverlay.c: (gst_cairo_time_overlay_transform):
|
||||||
|
Fix timeoverlay for non-multiple-of-4 widths. This fourcc crap
|
||||||
|
SUCKS.
|
||||||
|
|
||||||
2006-05-02 Stefan Kost <ensonic@users.sf.net>
|
2006-05-02 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps):
|
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps):
|
||||||
|
|
|
@ -181,6 +181,7 @@ gst_cairo_time_overlay_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int b_width;
|
int b_width;
|
||||||
|
int stride_y, stride_u, stride_v;
|
||||||
char *string;
|
char *string;
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned char *image;
|
unsigned char *image;
|
||||||
|
@ -238,16 +239,22 @@ gst_cairo_time_overlay_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
if (b_width > width)
|
if (b_width > width)
|
||||||
b_width = width;
|
b_width = width;
|
||||||
|
|
||||||
|
stride_y = GST_VIDEO_I420_Y_ROWSTRIDE (width);
|
||||||
|
stride_u = GST_VIDEO_I420_U_ROWSTRIDE (width);
|
||||||
|
stride_v = GST_VIDEO_I420_V_ROWSTRIDE (width);
|
||||||
|
|
||||||
memcpy (dest, src, GST_BUFFER_SIZE (in));
|
memcpy (dest, src, GST_BUFFER_SIZE (in));
|
||||||
for (i = 0; i < timeoverlay->text_height; i++) {
|
for (i = 0; i < timeoverlay->text_height; i++) {
|
||||||
for (j = 0; j < b_width; j++) {
|
for (j = 0; j < b_width; j++) {
|
||||||
((unsigned char *) dest)[i * width + j] = image[(i * width + j) * 4 + 0];
|
((unsigned char *) dest)[i * stride_y + j] =
|
||||||
|
image[(i * width + j) * 4 + 0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < timeoverlay->text_height / 2; i++) {
|
for (i = 0; i < timeoverlay->text_height / 2; i++) {
|
||||||
memset (dest + width * height + i * (width / 2), 128, b_width / 2);
|
memset (dest + GST_VIDEO_I420_U_OFFSET (width, height) + i * stride_u, 128,
|
||||||
memset (dest + width * height + (width / 2) * (height / 2) +
|
b_width / 2);
|
||||||
i * (width / 2), 128, b_width / 2);
|
memset (dest + GST_VIDEO_I420_V_OFFSET (width, height) + i * stride_v, 128,
|
||||||
|
b_width / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_destroy (text_cairo);
|
cairo_destroy (text_cairo);
|
||||||
|
|
Loading…
Reference in a new issue