summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/gst-plugins-base/files/gst-0.10.32-0018-textoverlay-add-stride-support.patch')
-rw-r--r--media-libs/gst-plugins-base/files/gst-0.10.32-0018-textoverlay-add-stride-support.patch132
1 files changed, 132 insertions, 0 deletions
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0018-textoverlay-add-stride-support.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0018-textoverlay-add-stride-support.patch
new file mode 100644
index 0000000..8c0c423
--- /dev/null
+++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0018-textoverlay-add-stride-support.patch
@@ -0,0 +1,132 @@
+From 8cd575c6c2f46464d7704e07102a648bba08a6c6 Mon Sep 17 00:00:00 2001
+From: Rob Clark <rob@ti.com>
+Date: Mon, 23 Aug 2010 14:01:14 -0500
+Subject: [PATCH 18/24] textoverlay: add stride support
+
+---
+ ext/pango/gsttextoverlay.c | 37 +++++++++++++++++++++++++------------
+ ext/pango/gsttextoverlay.h | 1 +
+ 2 files changed, 26 insertions(+), 12 deletions(-)
+
+diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c
+index 915a59c..1bf3638 100644
+--- a/ext/pango/gsttextoverlay.c
++++ b/ext/pango/gsttextoverlay.c
+@@ -187,7 +187,7 @@ static GstStaticPadTemplate src_template_factory =
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx ";"
+ GST_VIDEO_CAPS_xRGB ";"
+- GST_VIDEO_CAPS_YUV ("{AYUV, I420, UYVY, NV12, NV21}"))
++ GST_VIDEO_CAPS_YUV_STRIDED ("{AYUV, I420, UYVY, NV12, NV21}", "[0, max]"))
+ );
+
+ static GstStaticPadTemplate video_sink_template_factory =
+@@ -196,7 +196,7 @@ static GstStaticPadTemplate video_sink_template_factory =
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx ";"
+ GST_VIDEO_CAPS_xRGB ";"
+- GST_VIDEO_CAPS_YUV ("{AYUV, I420, UYVY, NV12, NV21}"))
++ GST_VIDEO_CAPS_YUV_STRIDED ("{AYUV, I420, UYVY, NV12, NV21}", "[0, max]"))
+ );
+
+ static GstStaticPadTemplate text_sink_template_factory =
+@@ -724,12 +724,13 @@ gst_text_overlay_setcaps (GstPad * pad, GstCaps * caps)
+
+ overlay->width = 0;
+ overlay->height = 0;
++ overlay->rowstride = 0;
+ structure = gst_caps_get_structure (caps, 0);
+ fps = gst_structure_get_value (structure, "framerate");
+
+ if (fps
+- && gst_video_format_parse_caps (caps, &overlay->format, &overlay->width,
+- &overlay->height)) {
++ && gst_video_format_parse_caps_strided (caps, &overlay->format, &overlay->width,
++ &overlay->height, &overlay->rowstride)) {
+ ret = gst_pad_set_caps (overlay->srcpad, caps);
+ }
+
+@@ -1364,14 +1365,21 @@ gst_text_overlay_render_pangocairo (GstTextOverlay * overlay,
+ #define BOX_XPAD 6
+ #define BOX_YPAD 6
+
++static gint
++gst_text_overlay_get_stride (GstTextOverlay * overlay, gint component)
++{
++ if (overlay->rowstride)
++ return overlay->rowstride;
++ return gst_video_format_get_row_stride (overlay->format, 0, overlay->width);
++}
++
+ static inline void
+ gst_text_overlay_shade_planar_Y (GstTextOverlay * overlay, guchar * dest,
+ gint x0, gint x1, gint y0, gint y1)
+ {
+ gint i, j, dest_stride;
+
+- dest_stride = gst_video_format_get_row_stride (overlay->format, 0,
+- overlay->width);
++ dest_stride = gst_text_overlay_get_stride (overlay, 0);
+
+ x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width);
+ x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width);
+@@ -1436,7 +1444,9 @@ static inline void
+ gst_text_overlay_shade_xRGB (GstTextOverlay * overlay, guchar * dest,
+ gint x0, gint x1, gint y0, gint y1)
+ {
+- gint i, j;
++ gint i, j, dest_stride;
++
++ dest_stride = gst_text_overlay_get_stride (overlay, 0);
+
+ x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width);
+ x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width);
+@@ -1448,7 +1458,7 @@ gst_text_overlay_shade_xRGB (GstTextOverlay * overlay, guchar * dest,
+ for (j = x0; j < x1; j++) {
+ gint y, y_pos, k;
+
+- y_pos = (i * 4 * overlay->width) + j * 4;
++ y_pos = (i * dest_stride) + j * 4;
+ for (k = 0; k < 4; k++) {
+ y = dest[y_pos + k] + overlay->shading_value;
+ dest[y_pos + k] = CLAMP (y, 0, 255);
+@@ -1480,10 +1490,10 @@ gst_text_overlay_blit_NV12_NV21 (GstTextOverlay * overlay,
+ w = overlay->width;
+ h = overlay->height;
+
+- y_stride = gst_video_format_get_row_stride (overlay->format, 0, w);
+- uv_stride = gst_video_format_get_row_stride (overlay->format, 1, w);
+- u_offset = gst_video_format_get_component_offset (overlay->format, 1, w, h);
+- v_offset = gst_video_format_get_component_offset (overlay->format, 2, w, h);
++ y_stride = gst_text_overlay_get_stride (overlay, 0);
++ uv_stride = gst_text_overlay_get_stride (overlay, 1);
++ u_offset = gst_video_format_get_component_offset (overlay->format, 1, y_stride, h);
++ v_offset = gst_video_format_get_component_offset (overlay->format, 2, y_stride, h);
+
+ gst_text_overlay_blit_1 (overlay, yuv_pixels, xpos, ypos, overlay->text_image,
+ y_stride);
+@@ -1509,6 +1519,9 @@ gst_text_overlay_blit_I420 (GstTextOverlay * overlay,
+ w = overlay->width;
+ h = overlay->height;
+
++ /* XXX this is not updated for rowstride.. but rowstride could be
++ * ambiguous for I420.. is the U and V plane rowstride or rowstride/2?
++ */
+ y_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 0, w);
+ u_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 1, w);
+ v_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 2, w);
+diff --git a/ext/pango/gsttextoverlay.h b/ext/pango/gsttextoverlay.h
+index 5fddf3a..bc2940b 100644
+--- a/ext/pango/gsttextoverlay.h
++++ b/ext/pango/gsttextoverlay.h
+@@ -112,6 +112,7 @@ struct _GstTextOverlay {
+
+ gint width;
+ gint height;
++ gint rowstride;
+ gint fps_n;
+ gint fps_d;
+ GstVideoFormat format;
+--
+1.7.1
+